WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/03/2010 02:58:59 AM (10 years ago)
Author:
nacin
Message:

Move some post and taxonomy functions from admin/includes to wp-includes in preparation for QuickPress template tag. Moves get_tags_to_edit, get_terms_to_edit, get_default_post_to_edit, media_buttons, _media_button, get_upload_iframe_src. Also introduce get_media_buttons as a wrapper for media_buttons. props jorbin, see #14966.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r15654 r15688  
    28222822    return apply_filters('get_ancestors', $ancestors, $object_id, $object_type);
    28232823}
     2824
     2825
     2826/**
     2827 * {@internal Missing Short Description}}
     2828 *
     2829 * @since unknown
     2830 *
     2831 * @param unknown_type $post_id
     2832 * @return unknown
     2833 */
     2834function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
     2835    return get_terms_to_edit( $post_id, $taxonomy);
     2836}
     2837
     2838/**
     2839 * {@internal Missing Short Description}}
     2840 *
     2841 * @since unknown
     2842 *
     2843 * @param unknown_type $post_id
     2844 * @return unknown
     2845 */
     2846function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
     2847    $post_id = (int) $post_id;
     2848    if ( !$post_id )
     2849        return false;
     2850
     2851    $tags = wp_get_post_terms($post_id, $taxonomy, array());
     2852
     2853    if ( !$tags )
     2854        return false;
     2855
     2856    if ( is_wp_error($tags) )
     2857        return $tags;
     2858
     2859    foreach ( $tags as $tag )
     2860        $tag_names[] = $tag->name;
     2861    $tags_to_edit = join( ',', $tag_names );
     2862    $tags_to_edit = esc_attr( $tags_to_edit );
     2863    $tags_to_edit = apply_filters( 'terms_to_edit', $tags_to_edit, $taxonomy );
     2864
     2865    return $tags_to_edit;
     2866}
Note: See TracChangeset for help on using the changeset viewer.