function _nxt_ajax_add_hierarchical_term() { $action = $_POST['action']; $taxonomy = get_taxonomy(substr($action, 4)); check_ajax_referer($action, '_ajax_nonce-add-' . $taxonomy->name); if (!current_user_can($taxonomy->cap->edit_terms)) { die('-1'); } $names = explode(',', $_POST['new' . $taxonomy->name]); $parent = isset($_POST['new' . $taxonomy->name . '_parent']) ? (int) $_POST['new' . $taxonomy->name . '_parent'] : 0; if (0 > $parent) { $parent = 0; } if ($taxonomy->name == 'category') { $post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array(); } else { $post_category = isset($_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name]) ? (array) $_POST['tax_input'][$taxonomy->name] : array(); } $checked_categories = array_map('absint', (array) $post_category); $popular_ids = nxt_popular_terms_checklist($taxonomy->name, 0, 10, false); foreach ($names as $cat_name) { $cat_name = trim($cat_name); $category_nicename = sanitize_title($cat_name); if ('' === $category_nicename) { continue; } if (!($cat_id = term_exists($cat_name, $taxonomy->name, $parent))) { $new_term = nxt_insert_term($cat_name, $taxonomy->name, array('parent' => $parent)); $cat_id = $new_term['term_id']; } $checked_categories[] = $cat_id; if ($parent) { // Do these all at once in a second continue; } $category = get_term($cat_id, $taxonomy->name); ob_start(); nxt_terms_checklist(0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids)); $data = ob_get_contents(); ob_end_clean(); $add = array('what' => $taxonomy->name, 'id' => $cat_id, 'data' => str_replace(array("\n", "\t"), '', $data), 'position' => -1); } if ($parent) { // Foncy - replace the parent and all its children $parent = get_term($parent, $taxonomy->name); $term_id = $parent->term_id; while ($parent->parent) { // get the top parent $parent =& get_term($parent->parent, $taxonomy->name); if (is_nxt_error($parent)) { break; } $term_id = $parent->term_id; } ob_start(); nxt_terms_checklist(0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids)); $data = ob_get_contents(); ob_end_clean(); $add = array('what' => $taxonomy->name, 'id' => $term_id, 'data' => str_replace(array("\n", "\t"), '', $data), 'position' => -1); } ob_start(); nxt_dropdown_categories(array('taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —')); $sup = ob_get_contents(); ob_end_clean(); $add['supplemental'] = array('newcat_parent' => $sup); $x = new nxt_Ajax_Response($add); $x->send(); }
/** * Outputs the hidden row displayed when inline editing * * @since 3.1.0 */ function inline_edit() { global $mode; $screen = get_current_screen(); $post = get_default_post_to_edit($screen->post_type); $post_type_object = get_post_type_object($screen->post_type); $taxonomy_names = get_object_taxonomies($screen->post_type); $hierarchical_taxonomies = array(); $flat_taxonomies = array(); foreach ($taxonomy_names as $taxonomy_name) { $taxonomy = get_taxonomy($taxonomy_name); if (!$taxonomy->show_ui) { continue; } if ($taxonomy->hierarchical) { $hierarchical_taxonomies[] = $taxonomy; } else { $flat_taxonomies[] = $taxonomy; } } $m = isset($mode) && 'excerpt' == $mode ? 'excerpt' : 'list'; $can_publish = current_user_can($post_type_object->cap->publish_posts); $core_columns = array('cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true); ?> <form method="get" action=""><table style="display: none"><tbody id="inlineedit"> <?php $hclass = count($hierarchical_taxonomies) ? 'post' : 'page'; $bulk = 0; while ($bulk < 2) { ?> <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?> " class="inline-edit-row inline-edit-row-<?php echo "{$hclass} inline-edit-{$screen->post_type} "; echo $bulk ? "bulk-edit-row bulk-edit-row-{$hclass} bulk-edit-{$screen->post_type}" : "quick-edit-row quick-edit-row-{$hclass} inline-edit-{$screen->post_type}"; ?> " style="display: none"><td colspan="<?php echo $this->get_column_count(); ?> " class="colspanchange"> <fieldset class="inline-edit-col-left"><div class="inline-edit-col"> <h4><?php echo $bulk ? __('Bulk Edit') : __('Quick Edit'); ?> </h4> <?php if (post_type_supports($screen->post_type, 'title')) { if ($bulk) { ?> <div id="bulk-title-div"> <div id="bulk-titles"></div> </div> <?php } else { // $bulk ?> <label> <span class="title"><?php _e('Title'); ?> </span> <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span> </label> <label> <span class="title"><?php _e('Slug'); ?> </span> <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span> </label> <?php } // $bulk } // post_type_supports title ?> <?php if (!$bulk) { ?> <label><span class="title"><?php _e('Date'); ?> </span></label> <div class="inline-edit-date"> <?php touch_time(1, 1, 4, 1); ?> </div> <br class="clear" /> <?php } // $bulk if (post_type_supports($screen->post_type, 'author')) { $authors_dropdown = ''; if (is_super_admin() || current_user_can($post_type_object->cap->edit_others_posts)) { $users_opt = array('hide_if_only_one_author' => false, 'who' => 'authors', 'name' => 'post_author', 'class' => 'authors', 'multi' => 1, 'echo' => 0); if ($bulk) { $users_opt['show_option_none'] = __('— No Change —'); } if ($authors = nxt_dropdown_users($users_opt)) { $authors_dropdown = '<label class="inline-edit-author">'; $authors_dropdown .= '<span class="title">' . __('Author') . '</span>'; $authors_dropdown .= $authors; $authors_dropdown .= '</label>'; } } // authors ?> <?php if (!$bulk) { echo $authors_dropdown; } } // post_type_supports author if (!$bulk) { ?> <div class="inline-edit-group"> <label class="alignleft"> <span class="title"><?php _e('Password'); ?> </span> <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span> </label> <em style="margin:5px 10px 0 0" class="alignleft"> <?php /* translators: Between password field and private checkbox on post quick edit interface */ echo __('–OR–'); ?> </em> <label class="alignleft inline-edit-private"> <input type="checkbox" name="keep_private" value="private" /> <span class="checkbox-title"><?php echo __('Private'); ?> </span> </label> </div> <?php } ?> </div></fieldset> <?php if (count($hierarchical_taxonomies) && !$bulk) { ?> <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> <?php foreach ($hierarchical_taxonomies as $taxonomy) { ?> <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name); ?> <span class="catshow"><?php _e('[more]'); ?> </span> <span class="cathide" style="display:none;"><?php _e('[less]'); ?> </span> </span> <input type="hidden" name="<?php echo $taxonomy->name == 'category' ? 'post_category[]' : 'tax_input[' . esc_attr($taxonomy->name) . '][]'; ?> " value="0" /> <ul class="cat-checklist <?php echo esc_attr($taxonomy->name); ?> -checklist"> <?php nxt_terms_checklist(null, array('taxonomy' => $taxonomy->name)); ?> </ul> <?php } //$hierarchical_taxonomies as $taxonomy ?> </div></fieldset> <?php } // count( $hierarchical_taxonomies ) && !$bulk ?> <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> <?php if (post_type_supports($screen->post_type, 'author') && $bulk) { echo $authors_dropdown; } if (post_type_supports($screen->post_type, 'page-attributes')) { if ($post_type_object->hierarchical) { ?> <label> <span class="title"><?php _e('Parent'); ?> </span> <?php $dropdown_args = array('post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column' => 'menu_order, post_title'); if ($bulk) { $dropdown_args['show_option_no_change'] = __('— No Change —'); } $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args); nxt_dropdown_pages($dropdown_args); ?> </label> <?php } // hierarchical if (!$bulk) { ?> <label> <span class="title"><?php _e('Order'); ?> </span> <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?> " /></span> </label> <?php } // !$bulk if ('page' == $screen->post_type) { ?> <label> <span class="title"><?php _e('Template'); ?> </span> <select name="page_template"> <?php if ($bulk) { ?> <option value="-1"><?php _e('— No Change —'); ?> </option> <?php } // $bulk ?> <option value="default"><?php _e('Default Template'); ?> </option> <?php page_template_dropdown(); ?> </select> </label> <?php } // page post_type } // page-attributes ?> <?php if (count($flat_taxonomies) && !$bulk) { ?> <?php foreach ($flat_taxonomies as $taxonomy) { ?> <?php if (current_user_can($taxonomy->cap->assign_terms)) { ?> <label class="inline-edit-tags"> <span class="title"><?php echo esc_html($taxonomy->labels->name); ?> </span> <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name); ?> ]" class="tax_input_<?php echo esc_attr($taxonomy->name); ?> "></textarea> </label> <?php } ?> <?php } //$flat_taxonomies as $taxonomy ?> <?php } // count( $flat_taxonomies ) && !$bulk ?> <?php if (post_type_supports($screen->post_type, 'comments') || post_type_supports($screen->post_type, 'trackbacks')) { if ($bulk) { ?> <div class="inline-edit-group"> <?php if (post_type_supports($screen->post_type, 'comments')) { ?> <label class="alignleft"> <span class="title"><?php _e('Comments'); ?> </span> <select name="comment_status"> <option value=""><?php _e('— No Change —'); ?> </option> <option value="open"><?php _e('Allow'); ?> </option> <option value="closed"><?php _e('Do not allow'); ?> </option> </select> </label> <?php } if (post_type_supports($screen->post_type, 'trackbacks')) { ?> <label class="alignright"> <span class="title"><?php _e('Pings'); ?> </span> <select name="ping_status"> <option value=""><?php _e('— No Change —'); ?> </option> <option value="open"><?php _e('Allow'); ?> </option> <option value="closed"><?php _e('Do not allow'); ?> </option> </select> </label> <?php } ?> </div> <?php } else { // $bulk ?> <div class="inline-edit-group"> <?php if (post_type_supports($screen->post_type, 'comments')) { ?> <label class="alignleft"> <input type="checkbox" name="comment_status" value="open" /> <span class="checkbox-title"><?php _e('Allow Comments'); ?> </span> </label> <?php } if (post_type_supports($screen->post_type, 'trackbacks')) { ?> <label class="alignleft"> <input type="checkbox" name="ping_status" value="open" /> <span class="checkbox-title"><?php _e('Allow Pings'); ?> </span> </label> <?php } ?> </div> <?php } // $bulk } // post_type_supports comments or pings ?> <div class="inline-edit-group"> <label class="inline-edit-status alignleft"> <span class="title"><?php _e('Status'); ?> </span> <select name="_status"> <?php if ($bulk) { ?> <option value="-1"><?php _e('— No Change —'); ?> </option> <?php } // $bulk ?> <?php if ($can_publish) { // Contributors only get "Unpublished" and "Pending Review" ?> <option value="publish"><?php _e('Published'); ?> </option> <option value="future"><?php _e('Scheduled'); ?> </option> <?php if ($bulk) { ?> <option value="private"><?php _e('Private'); ?> </option> <?php } // $bulk ?> <?php } ?> <option value="pending"><?php _e('Pending Review'); ?> </option> <option value="draft"><?php _e('Draft'); ?> </option> </select> </label> <?php if ('post' == $screen->post_type && $can_publish && current_user_can($post_type_object->cap->edit_others_posts)) { ?> <?php if ($bulk) { ?> <label class="alignright"> <span class="title"><?php _e('Sticky'); ?> </span> <select name="sticky"> <option value="-1"><?php _e('— No Change —'); ?> </option> <option value="sticky"><?php _e('Sticky'); ?> </option> <option value="unsticky"><?php _e('Not Sticky'); ?> </option> </select> </label> <?php } else { // $bulk ?> <label class="alignleft"> <input type="checkbox" name="sticky" value="sticky" /> <span class="checkbox-title"><?php _e('Make this post sticky'); ?> </span> </label> <?php } // $bulk ?> <?php } // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?> </div> <?php if (post_type_supports($screen->post_type, 'post-formats') && current_theme_supports('post-formats')) { $post_formats = get_theme_support('post-formats'); if (isset($post_formats[0]) && is_array($post_formats[0])) { $all_post_formats = get_post_format_strings(); ?> <div class="inline-edit-group"> <label class="alignleft" for="post_format"> <span class="title"><?php _e('Post Format'); ?> </span> <select name="post_format"> <?php if ($bulk) { ?> <option value="-1"><?php _e('— No Change —'); ?> </option> <?php } ?> <option value="0"><?php _ex('Standard', 'Post format'); ?> </option> <?php foreach ($all_post_formats as $slug => $format) { if ($slug != 'standard') { ?> <option value="<?php echo esc_attr($slug); ?> "<?php if (!in_array($slug, $post_formats[0])) { echo ' class="unsupported"'; } ?> ><?php echo esc_html($format); ?> </option> <?php } } ?> </select></label> </div> <?php } ?> <?php } // post-formats ?> </div></fieldset> <?php list($columns) = $this->get_column_info(); foreach ($columns as $column_name => $column_display_name) { if (isset($core_columns[$column_name])) { continue; } do_action($bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type); } ?> <p class="submit inline-edit-save"> <a accesskey="c" href="#inline-edit" title="<?php esc_attr_e('Cancel'); ?> " class="button-secondary cancel alignleft"><?php _e('Cancel'); ?> </a> <?php if (!$bulk) { nxt_nonce_field('inlineeditnonce', '_inline_edit', false); $update_text = __('Update'); ?> <a accesskey="s" href="#inline-edit" title="<?php esc_attr_e('Update'); ?> " class="button-primary save alignright"><?php echo esc_attr($update_text); ?> </a> <img class="waiting" style="display:none;" src="<?php echo esc_url(admin_url('images/nxtspin_light.gif')); ?> " alt="" /> <?php } else { submit_button(__('Update'), 'button-primary alignright', 'bulk_edit', false, array('accesskey' => 's')); } ?> <input type="hidden" name="post_view" value="<?php echo esc_attr($m); ?> " /> <input type="hidden" name="screen" value="<?php echo esc_attr($screen->id); ?> " /> <span class="error" style="display:none"></span> <br class="clear" /> </p> </td></tr> <?php $bulk++; } ?> </tbody></table></form> <?php }
/** * {@internal Missing Short Description}} * * @since 2.5.1 * * @param unknown_type $post_id * @param unknown_type $descendants_and_self * @param unknown_type $selected_cats * @param unknown_type $popular_cats */ function nxt_category_checklist($post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true) { nxt_terms_checklist($post_id, array('taxonomy' => 'category', 'descendants_and_self' => $descendants_and_self, 'selected_cats' => $selected_cats, 'popular_cats' => $popular_cats, 'walker' => $walker, 'checked_ontop' => $checked_ontop)); }
function woo_tumblog_dashboard_widget_output() { //security check if (current_user_can('publish_posts')) { $tumblog_items = array('articles' => get_option('woo_articles_term_id'), 'images' => get_option('woo_images_term_id'), 'audio' => get_option('woo_audio_term_id'), 'video' => get_option('woo_video_term_id'), 'quotes' => get_option('woo_quotes_term_id'), 'links' => get_option('woo_links_term_id')); ?> <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?> /functions/js/ajaxupload.js"></script> <script type="text/javascript"> //No Conflict Mode jQuery.noConflict(); //AJAX Functions jQuery(document).ready(function(){ //JQUERY DATEPICKER jQuery( '.date-picker').each(function (){ jQuery( '#' + jQuery(this).attr( 'id')).datepicker({showOn: 'button', buttonImage: '<?php echo get_template_directory_uri(); ?> /functions/images/calendar.gif', buttonImageOnly: true}); }); jQuery( '#advanced-options-toggle').click(function () { jQuery( '#meta-fields').toggle(); if ( jQuery(this).text() == 'View Advanced Options' ) { jQuery(this).text( 'Hide Advanced Options' ); } else { jQuery(this).text( 'View Advanced Options' ); } }); //MENU BUTTON CLICK EVENTS jQuery( '#articles-menu-button').click(function () { jQuery( '#article-fields').removeAttr( 'class' ); jQuery( '#image-fields').removeAttr( 'class' ); jQuery( '#image-fields').attr( 'class','hide-fields' ); jQuery( '#link-fields').removeAttr( 'class' ); jQuery( '#link-fields').attr( 'class','hide-fields' ); jQuery( '#audio-fields').removeAttr( 'class' ); jQuery( '#audio-fields').attr( 'class','hide-fields' ); jQuery( '#video-fields').removeAttr( 'class' ); jQuery( '#video-fields').attr( 'class','hide-fields' ); jQuery( '#quote-fields').removeAttr( 'class' ); jQuery( '#quote-fields').attr( 'class','hide-fields' ); jQuery( '#tumblog-submit-fields').removeAttr( 'class' ); jQuery( '#tumblog-type').attr( 'value','article' ); jQuery( '#content-fields').removeAttr( 'class' ); jQuery( '#tag-fields').removeAttr( 'class' ); <?php if (get_option('woo_tumblog_content_method') != 'post_format') { ?> //Additional Tumblogs Checks jQuery( '#additional-tumblogs input').each(function(){ var elementid = jQuery(this).val(); <?php $term_array =& get_term($tumblog_items['articles'], 'tumblog'); ?> var catid = <?php echo $tumblog_items['articles']; ?> ; if (elementid == catid) { //make invisible jQuery(this).addClass( 'hide-cat' ); jQuery(this).attr( 'checked', false); } else { //make visible jQuery(this).removeAttr( 'class' ); jQuery(this).attr( 'checked', false); } }); jQuery( '#additional-tumblogs li').each(function(){ var elementname = jQuery(this).text(); var catname = '<?php echo $term_array->name; ?> '; var elementnamesub = elementname.substring(1); if (elementnamesub == catname) { //make invisible jQuery(this).addClass( 'hide-cat' ); } else { //make visible jQuery(this).removeAttr( 'class' ); } }); <?php } ?> if (nicEditors.findEditor( 'test-content') == undefined) { myNicEditor = new nicEditor({ buttonList : ['bold','italic','underline','ol','ul','left','center','right','justify','link','unlink','strikeThrough','xhtml','image'], iconsPath : '<?php echo get_template_directory_uri(); ?> /functions/images/nicEditorIcons.gif'}).panelInstance( 'test-content' ); } else { myNicEditor = nicEditors.findEditor( 'test-content' ); } jQuery( '#note-title').focus(); nicEditors.findEditor( 'test-content').setContent( '' ); jQuery( '#content-fields > div').addClass( 'editorwidth' ); }); jQuery( '#images-menu-button').click(function () { jQuery( '#image-fields').removeAttr( 'class' ); jQuery( '#article-fields').removeAttr( 'class' ); jQuery( '#article-fields').attr( 'class','hide-fields' ); jQuery( '#link-fields').removeAttr( 'class' ); jQuery( '#link-fields').attr( 'class','hide-fields' ); jQuery( '#audio-fields').removeAttr( 'class' ); jQuery( '#audio-fields').attr( 'class','hide-fields' ); jQuery( '#video-fields').removeAttr( 'class' ); jQuery( '#video-fields').attr( 'class','hide-fields' ); jQuery( '#quote-fields').removeAttr( 'class' ); jQuery( '#quote-fields').attr( 'class','hide-fields' ); jQuery( '#tumblog-submit-fields').removeAttr( 'class' ); jQuery( '#tumblog-type').attr( 'value','image' ); jQuery( '#content-fields').removeAttr( 'class' ); jQuery( '#tag-fields').removeAttr( 'class' ); <?php if (get_option('woo_tumblog_content_method') != 'post_format') { ?> //Additional Tumblogs Checks jQuery( '#additional-tumblogs input').each(function(){ var elementid = jQuery(this).val(); <?php $term_array =& get_term($tumblog_items['images'], 'tumblog'); ?> var catid = <?php echo $tumblog_items['images']; ?> ; if (elementid == catid) { //make invisible jQuery(this).addClass( 'hide-cat' ); jQuery(this).attr( 'checked', false); } else { //make visible jQuery(this).removeAttr( 'class' ); jQuery(this).attr( 'checked', false); } }); jQuery( '#additional-tumblogs li').each(function(){ var elementname = jQuery(this).text(); var catname = '<?php echo $term_array->name; ?> '; var elementnamesub = elementname.substring(1); if (elementnamesub == catname) { //make invisible jQuery(this).addClass( 'hide-cat' ); } else { //make visible jQuery(this).removeAttr( 'class' ); } }); <?php } ?> if (nicEditors.findEditor( 'test-content') == undefined) { myNicEditor = new nicEditor({ buttonList : ['bold','italic','underline','ol','ul','left','center','right','justify','link','unlink','strikeThrough','xhtml','image'], iconsPath : '<?php echo get_template_directory_uri(); ?> /functions/images/nicEditorIcons.gif'}).panelInstance( 'test-content' ); } else { myNicEditor = nicEditors.findEditor( 'test-content' ); } jQuery( '#image-title').focus(); nicEditors.findEditor( 'test-content').setContent( '' ); jQuery( '#content-fields > div').addClass( 'editorwidth' ); }); jQuery( '#links-menu-button').click(function () { jQuery( '#link-fields').removeAttr( 'class' ); jQuery( '#image-fields').removeAttr( 'class' ); jQuery( '#image-fields').attr( 'class','hide-fields' ); jQuery( '#article-fields').removeAttr( 'class' ); jQuery( '#article-fields').attr( 'class','hide-fields' ); jQuery( '#audio-fields').removeAttr( 'class' ); jQuery( '#audio-fields').attr( 'class','hide-fields' ); jQuery( '#video-fields').removeAttr( 'class' ); jQuery( '#video-fields').attr( 'class','hide-fields' ); jQuery( '#quote-fields').removeAttr( 'class' ); jQuery( '#quote-fields').attr( 'class','hide-fields' ); jQuery( '#tumblog-submit-fields').removeAttr( 'class' ); jQuery( '#tumblog-type').attr( 'value','link' ); jQuery( '#content-fields').removeAttr( 'class' ); jQuery( '#tag-fields').removeAttr( 'class' ); <?php if (get_option('woo_tumblog_content_method') != 'post_format') { ?> //Additional Tumblogs Checks jQuery( '#additional-tumblogs input').each(function(){ var elementid = jQuery(this).val(); <?php $term_array =& get_term($tumblog_items['links'], 'tumblog'); ?> var catid = <?php echo $tumblog_items['links']; ?> ; if (elementid == catid) { //make invisible jQuery(this).addClass( 'hide-cat' ); jQuery(this).attr( 'checked', false); } else { //make visible jQuery(this).removeAttr( 'class' ); jQuery(this).attr( 'checked', false); } }); jQuery( '#additional-tumblogs li').each(function(){ var elementname = jQuery(this).text(); var catname = '<?php echo $term_array->name; ?> '; var elementnamesub = elementname.substring(1); if (elementnamesub == catname) { //make invisible jQuery(this).addClass( 'hide-cat' ); } else { //make visible jQuery(this).removeAttr( 'class' ); } }); <?php } ?> if (nicEditors.findEditor( 'test-content') == undefined) { myNicEditor = new nicEditor({ buttonList : ['bold','italic','underline','ol','ul','left','center','right','justify','link','unlink','strikeThrough','xhtml','image'], iconsPath : '<?php echo get_template_directory_uri(); ?> /functions/images/nicEditorIcons.gif'}).panelInstance( 'test-content' ); } else { myNicEditor = nicEditors.findEditor( 'test-content' ); } jQuery( '#link-title').focus(); nicEditors.findEditor( 'test-content').setContent( '' ); jQuery( '#content-fields > div').addClass( 'editorwidth' ); }); jQuery( '#audio-menu-button').click(function () { jQuery( '#audio-fields').removeAttr( 'class' ); jQuery( '#image-fields').removeAttr( 'class' ); jQuery( '#image-fields').attr( 'class','hide-fields' ); jQuery( '#link-fields').removeAttr( 'class' ); jQuery( '#link-fields').attr( 'class','hide-fields' ); jQuery( '#article-fields').removeAttr( 'class' ); jQuery( '#article-fields').attr( 'class','hide-fields' ); jQuery( '#video-fields').removeAttr( 'class' ); jQuery( '#video-fields').attr( 'class','hide-fields' ); jQuery( '#quote-fields').removeAttr( 'class' ); jQuery( '#quote-fields').attr( 'class','hide-fields' ); jQuery( '#tumblog-submit-fields').removeAttr( 'class' ); jQuery( '#tumblog-type').attr( 'value','audio' ); jQuery( '#content-fields').removeAttr( 'class' ); jQuery( '#tag-fields').removeAttr( 'class' ); <?php if (get_option('woo_tumblog_content_method') != 'post_format') { ?> //Additional Tumblogs Checks jQuery( '#additional-tumblogs input').each(function(){ var elementid = jQuery(this).val(); <?php $term_array =& get_term($tumblog_items['audio'], 'tumblog'); ?> var catid = <?php echo $tumblog_items['audio']; ?> ; if (elementid == catid) { //make invisible jQuery(this).addClass( 'hide-cat' ); jQuery(this).attr( 'checked', false); } else { //make visible jQuery(this).removeAttr( 'class' ); jQuery(this).attr( 'checked', false); } }); jQuery( '#additional-tumblogs li').each(function(){ var elementname = jQuery(this).text(); var catname = '<?php echo $term_array->name; ?> '; var elementnamesub = elementname.substring(1); if (elementnamesub == catname) { //make invisible jQuery(this).addClass( 'hide-cat' ); } else { //make visible jQuery(this).removeAttr( 'class' ); } }); <?php } ?> if (nicEditors.findEditor( 'test-content') == undefined) { myNicEditor = new nicEditor({ buttonList : ['bold','italic','underline','ol','ul','left','center','right','justify','link','unlink','strikeThrough','xhtml','image'], iconsPath : '<?php echo get_template_directory_uri(); ?> /functions/images/nicEditorIcons.gif'}).panelInstance( 'test-content' ); } else { myNicEditor = nicEditors.findEditor( 'test-content' ); } jQuery( '#audio-title').focus(); nicEditors.findEditor( 'test-content').setContent( '' ); jQuery( '#content-fields > div').addClass( 'editorwidth' ); }); jQuery( '#videos-menu-button').click(function () { jQuery( '#video-fields').removeAttr( 'class' ); jQuery( '#image-fields').removeAttr( 'class' ); jQuery( '#image-fields').attr( 'class','hide-fields' ); jQuery( '#link-fields').removeAttr( 'class' ); jQuery( '#link-fields').attr( 'class','hide-fields' ); jQuery( '#audio-fields').removeAttr( 'class' ); jQuery( '#audio-fields').attr( 'class','hide-fields' ); jQuery( '#article-fields').removeAttr( 'class' ); jQuery( '#article-fields').attr( 'class','hide-fields' ); jQuery( '#quote-fields').removeAttr( 'class' ); jQuery( '#quote-fields').attr( 'class','hide-fields' ); jQuery( '#tumblog-submit-fields').removeAttr( 'class' ); jQuery( '#tumblog-type').attr( 'value','video' ); jQuery( '#content-fields').removeAttr( 'class' ); jQuery( '#tag-fields').removeAttr( 'class' ); <?php if (get_option('woo_tumblog_content_method') != 'post_format') { ?> //Additional Tumblogs Checks jQuery( '#additional-tumblogs input').each(function(){ var elementid = jQuery(this).val(); <?php $term_array =& get_term($tumblog_items['video'], 'tumblog'); ?> var catid = <?php echo $tumblog_items['video']; ?> ; if (elementid == catid) { //make invisible jQuery(this).addClass( 'hide-cat' ); jQuery(this).attr( 'checked', false); } else { //make visible jQuery(this).removeAttr( 'class' ); jQuery(this).attr( 'checked', false); } }); jQuery( '#additional-tumblogs li').each(function(){ var elementname = jQuery(this).text(); var catname = '<?php echo $term_array->name; ?> '; var elementnamesub = elementname.substring(1); if (elementnamesub == catname) { //make invisible jQuery(this).addClass( 'hide-cat' ); } else { //make visible jQuery(this).removeAttr( 'class' ); } }); <?php } ?> if (nicEditors.findEditor( 'test-content') == undefined) { myNicEditor = new nicEditor({ buttonList : ['bold','italic','underline','ol','ul','left','center','right','justify','link','unlink','strikeThrough','xhtml','image'], iconsPath : '<?php echo get_template_directory_uri(); ?> /functions/images/nicEditorIcons.gif'}).panelInstance( 'test-content' ); } else { myNicEditor = nicEditors.findEditor( 'test-content' ); } jQuery( '#video-title').focus(); nicEditors.findEditor( 'test-content').setContent( '' ); jQuery( '#content-fields > div').addClass( 'editorwidth' ); }); jQuery( '#quotes-menu-button').click(function () { jQuery( '#quote-fields').removeAttr( 'class' ); jQuery( '#image-fields').removeAttr( 'class' ); jQuery( '#image-fields').attr( 'class','hide-fields' ); jQuery( '#link-fields').removeAttr( 'class' ); jQuery( '#link-fields').attr( 'class','hide-fields' ); jQuery( '#audio-fields').removeAttr( 'class' ); jQuery( '#audio-fields').attr( 'class','hide-fields' ); jQuery( '#video-fields').removeAttr( 'class' ); jQuery( '#video-fields').attr( 'class','hide-fields' ); jQuery( '#article-fields').removeAttr( 'class' ); jQuery( '#article-fields').attr( 'class','hide-fields' ); jQuery( '#tumblog-submit-fields').removeAttr( 'class' ); jQuery( '#tumblog-type').attr( 'value','quote' ); jQuery( '#content-fields').removeAttr( 'class' ); jQuery( '#tag-fields').removeAttr( 'class' ); <?php if (get_option('woo_tumblog_content_method') != 'post_format') { ?> //Additional Tumblogs Checks jQuery( '#additional-tumblogs input').each(function(){ var elementid = jQuery(this).val(); <?php $term_array =& get_term($tumblog_items['quotes'], 'tumblog'); ?> var catid = <?php echo $tumblog_items['quotes']; ?> ; if (elementid == catid) { //make invisible jQuery(this).addClass( 'hide-cat' ); jQuery(this).attr( 'checked', false); } else { //make visible jQuery(this).removeAttr( 'class' ); jQuery(this).attr( 'checked', false); } }); jQuery( '#additional-tumblogs li').each(function(){ var elementname = jQuery(this).text(); var catname = '<?php echo $term_array->name; ?> '; var elementnamesub = elementname.substring(1); if (elementnamesub == catname) { //make invisible jQuery(this).addClass( 'hide-cat' ); } else { //make visible jQuery(this).removeAttr( 'class' ); } }); <?php } ?> if (nicEditors.findEditor( 'test-content') == undefined) { myNicEditor = new nicEditor({ buttonList : ['bold','italic','underline','ol','ul','left','center','right','justify','link','unlink','strikeThrough','xhtml','image'], iconsPath : '<?php echo get_template_directory_uri(); ?> /functions/images/nicEditorIcons.gif'}).panelInstance( 'test-content' ); } else { myNicEditor = nicEditors.findEditor( 'test-content' ); } jQuery( '#quote-title').focus(); nicEditors.findEditor( 'test-content').setContent( '' ); jQuery( '#content-fields > div').addClass( 'editorwidth' ); }); //AJAX FORM POST jQuery( '#tumblog-form').ajaxForm( { name: 'formpost', data: { // Additional data to send action: 'woo_tumblog_post', type: 'upload', data: 'formpost' }, // handler function for success event success: function(responseText, statusText) { jQuery( '#test-response').html( '<span class="success">'+'Published!'+'</span>').fadeIn( '3000').animate({ opacity: 1.0 },2000).fadeOut(); jQuery( '#ajax-loader').hide(); resetTumblogQuickPress(); }, // handler function for errors error: function(request) { // parse it for NXTClass error if (request.responseText.search(/<title>NXTClass › Error<\/title>/) != -1) { var data = request.responseText.match(/<p>(.*)<\/p>/); jQuery( '#test-response').html( '<span class="error">'+ data[1] +'</span>' ); } else { jQuery( '#test-response').html( '<span class="error">An error occurred, please notify the administrator.</span>' ); } }, beforeSubmit: function(formData, jqForm, options) { jQuery( '#ajax-loader').show(); } }); //AJAX IMAGE UPLOAD new AjaxUpload( '#image_upload_button', { action: '<?php echo admin_url("admin-ajax.php"); ?> ', name: 'userfile', data: { // Additional data to send action: 'woo_tumblog_media_upload', type: 'upload', data: 'userfile' }, onSubmit : function(file , ext){ if (! (ext && /^(jpg|png|jpeg|gif|bmp|tiff|tif|ico|jpe)$/.test(ext))){ // extension is not allowed alert( 'Error: invalid file extension' ); // cancel upload return false; } else { jQuery( '#test-response').html( '<span class="success">'+'Image Uploading...'+'</span>').fadeIn( '3000').animate({ opacity: 1.0 },2000); } }, onComplete: function(file, response) { jQuery( '#test-response').html( '<span class="success">'+'Image Uploaded!'+'</span>').fadeIn( '3000').animate({ opacity: 1.0 },2000).fadeOut(); var splitResults = response.split( '|' ); jQuery( '#image-upload').attr( 'value',splitResults[0]); jQuery( '#image-id').attr( 'value',splitResults[1]); } }); //AJAX AUDIO UPLOAD new AjaxUpload( '#audio_upload_button', { action: '<?php echo admin_url("admin-ajax.php"); ?> ', name: 'userfile', data: { // Additional data to send action: 'woo_tumblog_media_upload', type: 'upload', data: 'userfile' }, onSubmit : function(file , ext){ if (! (ext && /^(mp3|mp4|ogg|wma|midi|mid|wav|wmx|wmv|avi|mov|qt|mpeg|mpg|asx|asf)$/.test(ext))){ // extension is not allowed alert( 'Error: invalid file extension' ); // cancel upload return false; } else { jQuery( '#test-response').html( '<span class="success">'+'Audio Uploading...'+'</span>').fadeIn( '3000').animate({ opacity: 1.0 },2000); } }, onComplete: function(file, response) { jQuery( '#test-response').html( '<span class="success">'+'Audio Uploaded!'+'</span>').fadeIn( '3000').animate({ opacity: 1.0 },2000).fadeOut(); var splitResults = response.split( '|' ); jQuery( '#audio-upload').attr( 'value',splitResults[0]); jQuery( '#audio-id').attr( 'value',splitResults[1]); } }); }); </script> <div id="tumblog-post"> <form name="tumblog-form" onsubmit="updateContent();" id="tumblog-form" method="post" action="<?php echo admin_url("admin-ajax.php"); ?> "> <img id="ajax-loader" src="<?php echo get_template_directory_uri(); ?> /functions/images/ajax-loader.gif" /> <div id="test-response"></div> <div id="tumblog-menu"> <a id="articles-menu-button" href="#" title="#">Article</a> <a id="images-menu-button" href="#" title="#">Image</a> <a id="links-menu-button" href="#" title="#">Link</a> <a id="audio-menu-button" href="#" title="#">Audio</a> <a id="videos-menu-button" href="#" title="#">Video</a> <a id="quotes-menu-button" href="#" title="#">Quote</a> </div> <div id="article-fields" class="hide-fields"> <h4 id="quick-post-title"><label for="note-title">Title</label></h4> <div> <input name="note-title" id="note-title" tabindex="1" autocomplete="off" value="" type="text" class="tumblog-title"> </div> </div> <div id="video-fields" class="hide-fields"> <h4 id="quick-post-title"><label for="video-title">Title</label></h4> <div> <input name="video-title" id="video-title" tabindex="1" autocomplete="off" value="" type="text" class="tumblog-title"> </div> <h4 id="quick-post-title"><label for="video-embed">Embed Video Code</label></h4> <textarea style="width:100%" id="video-embed" name="video-embed" tabindex="2"></textarea> </div> <div id="image-fields" class="hide-fields"> <h4 id="quick-post-title"><label for="image-title">Title</label></h4> <div> <input name="image-title" id="image-title" tabindex="1" autocomplete="off" value="" type="text" class="tumblog-title"> </div> <div id="image-option-upload" style="display:none;"> <h4 id="quick-post-title"><label for="image-upload">Upload Image</label> | <label id="image-url-button">Image URL instead</label></h4> <div> <input name="image-upload" id="image-upload" tabindex="2" autocomplete="off" value="" type="text"> </div> <input name="image_upload_button" type="button" id="image_upload_button" class="button" value="Upload Image" /> </div> <div id="image-option-url"> <h4 id="quick-post-title"><label for="image-url">Image URL</label> | <label id="image-upload-button">Upload Image instead</label></h4> <div> <input name="image-url" id="image-url" tabindex="2" autocomplete="off" value="" type="text"> </div> </div> <input type="hidden" id="image-id" name="image-id" value="" /> </div> <div id="link-fields" class="hide-fields"> <h4 id="quick-post-title"><label for="link-title">Title</label></h4> <div> <input name="link-title" id="link-title" tabindex="1" autocomplete="off" value="" type="text" class="tumblog-title"> </div> <h4 id="quick-post-title"><label for="link-url">Link URL</label></h4> <div> <input name="link-url" id="link-url" tabindex="2" autocomplete="off" value="" type="text"> </div> </div> <div id="quote-fields" class="hide-fields"> <h4 id="quick-post-title"><label for="quote-title">Title</label></h4> <div> <input name="quote-title" id="quote-title" tabindex="1" autocomplete="off" value="" type="text" class="tumblog-title"> </div> <h4 id="quick-post-title"><label for="quote-copy">Quote</label></h4> <textarea style="width:100%" id="quote-copy" name="quote-copy" tabindex="2"></textarea> <h4 id="quick-post-title"><label for="quote-url">Quote URL</label></h4> <div> <input name="quote-url" id="quote-url" tabindex="3" autocomplete="off" value="" type="text"> </div> <h4 id="quick-post-title"><label for="quote-quote">Quote Author</label></h4> <div> <input name="quote-author" id="quote-author" tabindex="4" autocomplete="off" value="" type="text"> </div> </div> <div id="audio-fields" class="hide-fields"> <h4 id="quick-post-title"><label for="audio-title">Title</label></h4> <div> <input name="audio-title" id="audio-title" tabindex="1" autocomplete="off" value="" type="text" class="tumblog-title"> </div> <div id="audio-option-upload" style="display:none;"> <h4 id="quick-post-title"><label for="audio-upload">Upload Audio</label> | <label id="audio-url-button">Audio URL instead</label></h4> <div> <input name="audio-upload" id="audio-upload" tabindex="2" autocomplete="off" value="" type="text"> </div> <input name="audio_upload_button" type="button" id="audio_upload_button" class="button" value="Upload Audio" /> </div> <div id="audio-option-url"> <h4 id="quick-post-title"><label for="audio-url">Audio URL</label> | <label id="audio-upload-button">Upload Audio instead</label></h4> <div> <input name="audio-url" id="audio-url" tabindex="2" autocomplete="off" value="" type="text"> </div> </div> <input type="hidden" id="audio-id" name="audio-id" value="" /> </div> <div id="content-fields" class="hide-fields"> <?php if (current_user_can('upload_files')) { ?> <?php //the_editor( '', $id = 'content', $prev_id = 'title', $media_buttons = false, $tab_index = 5); ?> <textarea tabindex="5" id="test-content" style="width:100%;height:100px;"></textarea> <?php } ?> <input type="hidden" id="tumblog-content" name="tumblog-content" value="" /> <input type="hidden" id="tumblog-type" name="tumblog-type" value="article" /> <p><a id="advanced-options-toggle" onclick="">View Advanced Options</a></p> </div> <div id="meta-fields" class="hide-fields"> <p> <?php // START - POST STATUS AND DATE TIME ?> <strong><label for="tumblog-status">Post Status : </label></strong> <select style="margin-left:10px;" id="tumblog-status" name="tumblog-status" tabindex="6"> <option value="publish">Published</option> <option value="draft">Draft</option> </select> </p> <p> <?php $date_formatted = date_i18n("m/d/Y"); ?> <?php $time_now_hours = date_i18n("H"); ?> <?php $time_now_mins = date_i18n("i"); ?> <?php $post_id = 0; ?> <strong><label for="tumblog-date">Post Date : </label></strong> <input name="tumblog-date" id="tumblog-date" tabindex="7" value="<?php echo esc_attr($date_formatted); ?> " type="text" class="date-picker" style="width:100px;margin-left:20px;"> @ <input class="tumblog-time" name="tumblog-hours" id="tumblog-hours" maxlength="2" size="2" value="<?php echo esc_attr($time_now_hours); ?> " type="text">:<input class="tumblog-time" name="tumblog-mins" id="tumblog-mins" maxlength="2" size="2" value="<?php echo esc_attr($time_now_mins); ?> " type="text"> <?php // END - POST STATUS AND DATE TIME ?> </p> <br /> <div id="additional-categories" style="width:<?php if (get_option('woo_tumblog_content_method') != 'post_format') { ?> 47%;float:left;<?php } else { ?> 94%;<?php } ?> "> <strong><label for="post_category[]">Additional Categories : </label></strong> <?php // START - MULTI CATEGORY DROP DOWN ?> <?php $taxonomy = 'category'; ?> <div id="<?php echo $taxonomy; ?> -all" class="tabs-panel" style="height:100px;overflow:auto;border: 1px solid #CCCCCC;margin-top:6px;margin-bottom:6px;"> <?php $name = $taxonomy == 'category' ? 'post_category' : 'tax_input[' . $taxonomy . ']'; ?> <ul id="<?php echo $taxonomy; ?> checklist" class="list:<?php echo $taxonomy; ?> categorychecklist form-no-clear"> <?php if (function_exists('nxt_terms_checklist')) { nxt_terms_checklist($post_id, array('taxonomy' => $taxonomy)); ?> <?php } else { nxt_category_checklist(); } ?> </ul> <?php // END - MULTI CATEGORY DROP DOWN ?> </div> </div> <?php if (get_option('woo_tumblog_content_method') != 'post_format') { ?> <div id="additional-tumblogs" style="width:47%;float:right;"> <strong><label for="post_tumblog[]">Additional Tumblogs : </label></strong> <?php // START - MULTI TUMBLOG DROP DOWN ?> <?php $taxonomy = 'tumblog'; ?> <div id="<?php echo $taxonomy; ?> -all" class="tabs-panel" style="height:100px;overflow:auto;border: 1px solid #CCCCCC;margin-top:6px;margin-bottom:6px;"> <?php $name = $taxonomy == 'tumblog' ? 'post_tumblog' : 'tax_input[' . $taxonomy . ']'; ?> <ul id="<?php echo $taxonomy; ?> checklist" class="list:<?php echo $taxonomy; ?> categorychecklist form-no-clear"> <?php if (function_exists('nxt_terms_checklist')) { nxt_terms_checklist($post_id, array('taxonomy' => $taxonomy)); ?> <?php } else { nxt_category_checklist(); } ?> </ul> <?php // END - MULTI TUMBLOG DROP DOWN ?> </div> </div> <?php } ?> </div> <div id="tag-fields" class="hide-fields" style="clear:both;padding-top:10px;"> <h4 id="tumblog-tags-title"><label for="tumblog-tags">Tags</label></h4> <div> <input name="tumblog-tags" id="tumblog-tags" tabindex="6" autocomplete="off" value="" type="text"> </div> </div> <div id="tumblog-submit-fields" class="hide-fields"> <input name="tumblogsubmit" type="submit" id="tumblogsubmit" class="button-primary" tabindex="7" value="Submit" onclick="return validateInput();" /> <input name="tumblogreset" type="reset" id="tumblogreset" class="button" tabindex="8" value="Reset" /> </div> </form> </div><div id="debug-tumblog"></div> <?php } }
/** * Display post categories form fields. * * @since 2.6.0 * * @param object $post */ function post_categories_meta_box($post, $box) { $defaults = array('taxonomy' => 'category'); if (!isset($box['args']) || !is_array($box['args'])) { $args = array(); } else { $args = $box['args']; } extract(nxt_parse_args($args, $defaults), EXTR_SKIP); $tax = get_taxonomy($taxonomy); ?> <div id="taxonomy-<?php echo $taxonomy; ?> " class="categorydiv"> <ul id="<?php echo $taxonomy; ?> -tabs" class="category-tabs"> <li class="tabs"><a href="#<?php echo $taxonomy; ?> -all" tabindex="3"><?php echo $tax->labels->all_items; ?> </a></li> <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?> -pop" tabindex="3"><?php _e('Most Used'); ?> </a></li> </ul> <div id="<?php echo $taxonomy; ?> -pop" class="tabs-panel" style="display: none;"> <ul id="<?php echo $taxonomy; ?> checklist-pop" class="categorychecklist form-no-clear" > <?php $popular_ids = nxt_popular_terms_checklist($taxonomy); ?> </ul> </div> <div id="<?php echo $taxonomy; ?> -all" class="tabs-panel"> <?php $name = $taxonomy == 'category' ? 'post_category' : 'tax_input[' . $taxonomy . ']'; echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. ?> <ul id="<?php echo $taxonomy; ?> checklist" class="list:<?php echo $taxonomy; ?> categorychecklist form-no-clear"> <?php nxt_terms_checklist($post->ID, array('taxonomy' => $taxonomy, 'popular_cats' => $popular_ids)); ?> </ul> </div> <?php if (current_user_can($tax->cap->edit_terms)) { ?> <div id="<?php echo $taxonomy; ?> -adder" class="nxt-hidden-children"> <h4> <a id="<?php echo $taxonomy; ?> -add-toggle" href="#<?php echo $taxonomy; ?> -add" class="hide-if-no-js" tabindex="3"> <?php /* translators: %s: add new taxonomy label */ printf(__('+ %s'), $tax->labels->add_new_item); ?> </a> </h4> <p id="<?php echo $taxonomy; ?> -add" class="category-add nxt-hidden-child"> <label class="screen-reader-text" for="new<?php echo $taxonomy; ?> "><?php echo $tax->labels->add_new_item; ?> </label> <input type="text" name="new<?php echo $taxonomy; ?> " id="new<?php echo $taxonomy; ?> " class="form-required form-input-tip" value="<?php echo esc_attr($tax->labels->new_item_name); ?> " tabindex="3" aria-required="true"/> <label class="screen-reader-text" for="new<?php echo $taxonomy; ?> _parent"> <?php echo $tax->labels->parent_item_colon; ?> </label> <?php nxt_dropdown_categories(array('taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new' . $taxonomy . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3)); ?> <input type="button" id="<?php echo $taxonomy; ?> -add-submit" class="add:<?php echo $taxonomy; ?> checklist:<?php echo $taxonomy; ?> -add button category-add-sumbit" value="<?php echo esc_attr($tax->labels->add_new_item); ?> " tabindex="3" /> <?php nxt_nonce_field('add-' . $taxonomy, '_ajax_nonce-add-' . $taxonomy, false); ?> <span id="<?php echo $taxonomy; ?> -ajax-response"></span> </p> </div> <?php } ?> </div> <?php }