Make WordPress Core

Ticket #21391: 21391.3.diff

File 21391.3.diff, 22.9 KB (added by SergeyBiryukov, 13 years ago)
  • wp-admin/css/wp-admin.css

     
    38943894        margin: 8px 0;
    38953895}
    38963896
    3897 .describe .imgedit-wrap table td {
     3897.describe .imgedit-wrap table td,
     3898.wp_attachment_holder .imgedit-wrap table td {
    38983899        vertical-align: top;
    38993900        padding-top: 0;
    39003901}
  • wp-admin/edit-form-advanced.php

     
    2323        wp_plupload_default_settings();
    2424        add_action( 'admin_footer', 'wp_print_media_templates' );
    2525}
     26if ( post_type_supports( $post_type, 'image_editor' ) ) {
     27        wp_enqueue_script('image-edit');
     28        wp_enqueue_style( 'imgareaselect' );
     29}
    2630
    2731/**
    2832 * Post ID global
     
    7781
    7882$notice = false;
    7983$form_extra = '';
    80 if ( 'auto-draft' == $post->post_status ) {
     84if ( 'auto-draft' == get_post_status( $post ) ) {
    8185        if ( 'edit' == $action )
    8286                $post->post_title = '';
    8387        $autosave = false;
     
    131135if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) )
    132136                add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
    133137
     138if ( 'attachment' == $post_type )
     139        add_meta_box( 'attachmentdata', __('Attachment Data'), 'attachment_data_meta_box', null, 'normal', 'core' );
     140
    134141if ( post_type_supports($post_type, 'excerpt') )
    135142        add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
    136143
     
    144151if ( post_type_supports($post_type, 'comments') )
    145152        add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
    146153
    147 if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') )
     154if ( ('publish' == get_post_status( $post ) || 'private' == get_post_status( $post )) && post_type_supports($post_type, 'comments') )
    148155        add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
    149156
    150 if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) )
     157if ( !( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) )
    151158        add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
    152159
    153160if ( post_type_supports($post_type, 'author') ) {
     
    158165if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) )
    159166        add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
    160167
     168if ( post_type_supports( $post_type, 'image_editor' ) )
     169        add_action( 'edit_form_advanced_before', 'edit_form_image_editor' );
     170
    161171do_action('add_meta_boxes', $post_type, $post);
    162172do_action('add_meta_boxes_' . $post_type, $post);
    163173
     
    263273<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" />
    264274<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
    265275<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" />
    266 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" />
     276<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ) ?>" />
    267277<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
    268278<?php if ( ! empty( $active_post_lock ) ) { ?>
    269279<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
    270280<?php
    271281}
    272 if ( 'draft' != $post->post_status )
     282if ( 'draft' != get_post_status( $post ) )
    273283        wp_original_referer_field(true, 'previous');
    274284
    275285echo $form_extra;
     
    283293
    284294<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
    285295<div id="post-body-content">
    286 <?php if ( post_type_supports($post_type, 'title') ) { ?>
     296<?php
     297do_action( 'edit_form_advanced_before');
     298
     299if ( post_type_supports($post_type, 'title') ) {
     300?>
    287301<div id="titlediv">
    288302<div id="titlewrap">
    289303        <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
     
    296310if ( !empty($shortlink) )
    297311    $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
    298312
    299 if ( $post_type_object->public && ! ( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?>
     313if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?>
    300314        <div id="edit-slug-box">
    301315        <?php
    302                 if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status )
     316                if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != get_post_status( $post ) )
    303317                        echo $sample_permalink_html;
    304318        ?>
    305319        </div>
     
    311325wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
    312326?>
    313327</div>
    314 <?php } ?>
    315328
     329<?php
     330        do_action( 'edit_form_after_title');
     331}
     332?>
     333
    316334<?php if ( post_type_supports($post_type, 'editor') ) { ?>
    317335<div id="postdivrich" class="postarea">
    318336
     
    323341        <td class="autosave-info">
    324342        <span class="autosave-message">&nbsp;</span>
    325343<?php
    326         if ( 'auto-draft' != $post->post_status ) {
     344        if ( 'auto-draft' != get_post_status( $post ) ) {
    327345                echo '<span id="last-edit">';
    328346                if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
    329347                        $last_user = get_userdata($last_id);
     
    337355</tr></tbody></table>
    338356
    339357</div>
    340 <?php } ?>
     358<?php
     359        do_action( 'edit_form_after_editor');
     360}
     361?>
    341362</div><!-- /post-body-content -->
    342363
    343364<div id="postbox-container-1" class="postbox-container">
  • wp-admin/includes/media.php

     
    858858
    859859/**
    860860 * Filters input from media_upload_form_handler() and assigns a default
    861  * post_title from the file name if none supplied. 
     861 * post_title from the file name if none supplied.
    862862 *
    863  * Illustrates the use of the attachment_fields_to_save filter 
     863 * Illustrates the use of the attachment_fields_to_save filter
    864864 * which can be used to add default values to any field before saving to DB.
    865865 *
    866866 * @since 2.5.0
     
    20952095        echo '<p>' . sprintf( __( 'Sorry, you have used all of your storage quota of %s MB.' ), get_space_allowed() ) . '</p>';
    20962096}
    20972097
     2098/**
     2099 * Displays the image and editor in the post editor
     2100 *
     2101 * @since 3.5.0
     2102 */
     2103function edit_form_image_editor() {
     2104        $post = get_post();
     2105
     2106        if ( ( $attachment_id = intval( $post->ID ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) )
     2107                $thumb_url = $thumb_url[0];
     2108        else
     2109                $thumb_url = false;
     2110
     2111        $filename = esc_html( basename( $post->guid ) );
     2112        $title = esc_attr( $post->post_title );
     2113
     2114
     2115        $post_mime_types = get_post_mime_types();
     2116        $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
     2117        $type = array_shift( $keys );
     2118        $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
     2119
     2120
     2121        $media_dims = '';
     2122        $meta = wp_get_attachment_metadata( $post->ID );
     2123        if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
     2124                $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
     2125        $media_dims = apply_filters( 'media_meta', $media_dims, $post );
     2126
     2127        $image_edit_button = '';
     2128        if ( gd_edit_image_support( $post->post_mime_type ) ) {
     2129                $nonce = wp_create_nonce( "image_editor-$post->ID" );
     2130                $image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <img src='" . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . "' class='imgedit-wait-spin' alt='' />";
     2131        }
     2132
     2133        ?>
     2134        <div class="wp_attachment_holder">
     2135                <div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
     2136
     2137                <div class="wp_attachment_image" id="media-head-<?php echo $attachment_id; ?>">
     2138                        <p><img class="thumbnail" src="<?php echo $thumb_url; ?>" alt="" /></p>
     2139                        <p><?php echo $image_edit_button; ?></p>
     2140                </div>
     2141                <div style="display:none" class="image-editor" id="image-editor-<?php echo $attachment_id; ?>"></div>
     2142
     2143                <div class="wp_attachment_details">
     2144                        <p><strong><?php _e( 'File name:' ); ?></strong> <?php echo $filename; ?></p>
     2145                        <p><strong><?php _e( 'File type:' ); ?></strong> <?php echo $post->post_mime_type; ?></p>
     2146                        <?php
     2147                                if ( !empty( $media_dims ) )
     2148                                        echo '<p><strong>' . __( 'Dimensions:' ) . "</strong> $media_dims</p>";
     2149                        ?>
     2150                </div>
     2151        </div>
     2152        <?php
     2153}
     2154
    20982155add_filter( 'async_upload_image', 'get_media_item', 10, 2 );
    20992156add_filter( 'async_upload_audio', 'get_media_item', 10, 2 );
    21002157add_filter( 'async_upload_video', 'get_media_item', 10, 2 );
  • wp-admin/includes/meta-boxes.php

     
    2626</div>
    2727
    2828<div id="minor-publishing-actions">
     29<?php if ( ! post_type_disables( $post->post_type, 'save' ) ) : ?>
    2930<div id="save-action">
    3031<?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
    3132<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button button-highlighted" />
     
    3435<?php } ?>
    3536<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading" id="draft-ajax-loading" alt="" />
    3637</div>
    37 <?php if ( $post_type_object->public ) : ?>
     38<?php endif; // doesn't disable save button ?>
     39<?php if ( ! post_type_disables( $post->post_type, 'preview' ) && $post_type_object->public ) : ?>
    3840<div id="preview-action">
    3941<?php
    4042if ( 'publish' == $post->post_status ) {
     
    5557
    5658<div id="misc-publishing-actions">
    5759
     60<?php if ( ! post_type_disables( $post->post_type, 'post_status' ) ) : ?>
    5861<div class="misc-pub-section"><label for="post_status"><?php _e('Status:') ?></label>
     62
    5963<span id="post-status-display">
    6064<?php
    6165switch ( $post->post_status ) {
     
    104108
    105109<?php } ?>
    106110</div><?php // /misc-pub-section ?>
     111<?php endif; // doesn't disable post_status ?>
    107112
     113<?php if ( ! post_type_disables( $post->post_type, 'visibility' ) ) : ?>
    108114<div class="misc-pub-section" id="visibility">
    109115<?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
    110116
     
    149155<?php } ?>
    150156
    151157</div><?php // /misc-pub-section ?>
     158<?php endif; // doesn't disable visibility ?>
    152159
    153160<?php
    154161// translators: Publish box date format, see http://php.net/date
    155162$datef = __( 'M j, Y @ G:i' );
    156163if ( 0 != $post->ID ) {
    157         if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
     164        if ( 'attachment' == get_post_type() ) { // attachments are uploaded on a date
     165                $stamp = __('Uploaded on: <b>%1$s</b>');
     166        } else if ( 'future' == get_post_status() ) { // scheduled for publishing at a future date
    158167                $stamp = __('Scheduled for: <b>%1$s</b>');
    159         } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
     168        } else if ( 'publish' == get_post_status() || 'private' == get_post_status() ) { // already published
    160169                $stamp = __('Published on: <b>%1$s</b>');
    161170        } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
    162171                $stamp = __('Publish <b>immediately</b>');
     
    171180        $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
    172181}
    173182
    174 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
     183if ( $can_publish && ! post_type_disables( $post->post_type, 'change_publish_date' ) ) : // Contributors don't get to choose the date of publish ?>
    175184<div class="misc-pub-section curtime">
    176185        <span id="timestamp">
    177186        <?php printf($stamp, $date); ?></span>
     
    202211<div id="publishing-action">
    203212<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading" id="ajax-loading" alt="" />
    204213<?php
    205 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
     214if ( !in_array( $post->post_status, array('publish', 'future', 'private', 'inherit') ) || 0 == $post->ID ) {
    206215        if ( $can_publish ) :
    207216                if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
    208217                <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
     
    914923        $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
    915924        echo _wp_post_thumbnail_html( $thumbnail_id );
    916925}
     926
     927/**
     928 * Display attachment/media-specific information
     929 *
     930 * @since 3.5.0
     931 *
     932 * @param object $post
     933 */
     934function attachment_data_meta_box( $post ) {
     935        $att_url = wp_get_attachment_url( $post->ID );
     936        $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
     937?>
     938        <label for="_wp_attachment_image_alt"><strong>Alternative text</strong></label><br />
     939        <input type="text" class="widefat" name="_wp_attachment_image_alt" value="<?php echo esc_attr( $alt_text ); ?>" />
     940</p>
     941
     942<p>
     943        <label for="excerpt"><strong>Excerpt</strong></label><br />
     944        <textarea class="widefat" name="excerpt"><?php echo $post->post_excerpt; ?></textarea>
     945</p>
     946
     947<p>
     948        <label for="attachment_url"><strong>File URL</strong></label><br />
     949        <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php echo esc_attr($att_url); ?>" /><br />
     950        <em><?php _e( 'Location of the uploaded file.' ); ?></em>
     951</p>
     952<?php
     953}
  • wp-admin/includes/post.php

     
    223223                }
    224224        }
    225225
     226        if ( isset( $post_data['_wp_attachment_image_alt'] ) ) {
     227                $image_alt = get_post_meta( $post_ID, '_wp_attachment_image_alt', true );
     228                if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) {
     229                        $image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true );
     230                        // update_meta expects slashed
     231                        update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) );
     232                }
     233        }
     234
    226235        add_meta( $post_ID );
    227236
    228237        update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID );
     
    10651074
    10661075        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    10671076
    1068         if ( 'publish' == $post->post_status ) {
     1077        if ( 'publish' == get_post_status( $post ) ) {
    10691078                $ptype = get_post_type_object($post->post_type);
    10701079                $view_post = $ptype->labels->view_item;
    10711080                $title = __('Click to edit this part of the permalink');
     
    10991108                }
    11001109        }
    11011110
    1102         $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
     1111        $post_name_html = '<span id="editable-post-name" title="' . __('Click to edit this part of the permalink') . '">' . $post_name_abridged . '</span>';
    11031112        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
    11041113        $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
    11051114        $return =  '<strong>' . __('Permalink:') . "</strong>\n";
  • wp-admin/includes/screen.php

     
    9898                if ( 'post' == $screen->base ) {
    9999                        if ( 'post' == $screen->post_type || 'page' == $screen->post_type )
    100100                                $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
     101                        elseif ( 'attachment' == $screen->post_type )
     102                                $hidden = array( 'slugdiv', 'trackbacksdiv', 'postcustom', 'authordiv', 'revisionsdiv' );
    101103                        else
    102104                                $hidden = array( 'slugdiv' );
    103105                }
  • wp-admin/post.php

     
    3131if ( $post ) {
    3232        $post_type = $post->post_type;
    3333        $post_type_object = get_post_type_object( $post_type );
     34        $parent_file = 'upload.php';
    3435}
    3536
    3637/**
     
    148149                $parent_file = "edit.php";
    149150                $submenu_file = "edit.php";
    150151                $post_new_file = "post-new.php";
     152        } elseif ( 'attachment' === $post_type ) {
     153                $parent_file = 'upload.php';
     154                $submenu_file = 'upload.php';
     155                $post_new_file = 'media-new.php';
    151156        } else {
    152157                if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
    153158                        $parent_file = $post_type_object->show_in_menu;
  • wp-includes/link-template.php

     
    106106        if ( $post->post_type == 'page' )
    107107                return get_page_link($post->ID, $leavename, $sample);
    108108        elseif ( $post->post_type == 'attachment' )
    109                 return get_attachment_link($post->ID);
     109                return get_attachment_link( $post->ID, $leavename );
    110110        elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
    111111                return get_post_permalink($post->ID, $leavename, $sample);
    112112
     
    292292 * @since 2.0.0
    293293 *
    294294 * @param mixed $post Optional. Post ID or object.
     295 * @param bool $leavename Optional. Leave name.
    295296 * @return string
    296297 */
    297 function get_attachment_link( $post = null ) {
     298function get_attachment_link( $post = null, $leavename = false ) {
    298299        global $wp_rewrite;
    299300
    300301        $link = false;
     
    314315                        $name = $post->post_name;
    315316
    316317                if ( strpos($parentlink, '?') === false )
    317                         $link = user_trailingslashit( trailingslashit($parentlink) . $name );
     318                        $link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
     319
     320                if ( ! $leavename )
     321                        $link = str_replace( '%postname%', $name, $link );
    318322        }
    319323
    320324        if ( ! $link )
  • wp-includes/post.php

     
    5353        register_post_type( 'attachment', array(
    5454                'labels' => array(
    5555                        'name' => __( 'Media' ),
     56                        'name' => _x('Media', 'post type general name'),
     57                        'singular_name' => _x( 'Media Item', 'post type singular name' ),
     58                        'add_new' => _x( 'Add New', 'media item'),
     59                        'add_new_item' => __( 'Add New Media' ),
    5660                        'edit_item' => __( 'Edit Media' ),
     61                        'new_item' => __( 'New Media Item' ),
     62                        'view_item' => __( 'View Attachment Page' ),
     63                        'search_items' => __( 'Search Media' ),
     64                        'not_found' => __( 'No media found.' ),
     65                        'not_found_in_trash' => __('No media found in Trash.'),
     66                        'parent_item_colon' => __('Parent:'),
     67                        'all_items' => __( 'All Media' ),
    5768                ),
    5869                'public' => true,
    59                 'show_ui' => false,
     70                'show_ui' => true,
    6071                '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
    61                 '_edit_link' => 'media.php?attachment_id=%d', /* internal use only. don't use this when registering your own post type. */
     72                '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */
    6273                'capability_type' => 'post',
    6374                'map_meta_cap' => true,
    6475                'hierarchical' => false,
     
    6677                'query_var' => false,
    6778                'show_in_nav_menus' => false,
    6879                'delete_with_user' => true,
    69                 'supports' => array( 'comments', 'author' ),
     80                'supports' => array( 'title', 'editor', 'author', 'comments', 'image_editor' ),
     81                'disables' => array( 'save', 'preview', 'post_status', 'visibility' )
    7082        ) );
    7183
    7284        register_post_type( 'revision', array(
     
    10991111                'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null,
    11001112                '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false,
    11011113                'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true,
    1102                 'supports' => array(), 'register_meta_box_cb' => null,
     1114                'supports' => array(), 'disables' => array(), 'register_meta_box_cb' => null,
    11031115                'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null,
    11041116                'can_export' => true,
    11051117                'show_in_nav_menus' => null, 'show_in_menu' => null, 'show_in_admin_bar' => null,
     
    11591171                add_post_type_support($post_type, array('title', 'editor'));
    11601172        }
    11611173
     1174        if ( ! empty($args->disables) ) {
     1175                disable_for_post_type($post_type, $args->disables);
     1176                unset($args->disables);
     1177        }
     1178
    11621179        if ( false !== $args->query_var && !empty($wp) ) {
    11631180                if ( true === $args->query_var )
    11641181                        $args->query_var = $post_type;
     
    15161533}
    15171534
    15181535/**
     1536 * Disable long-existing features for a post type
     1537 *
     1538 * Can't later add post type support for certain things
     1539 *
     1540 * @since 3.5.0
     1541 * @param string $post_type The post type for which to remove the feature
     1542 * @param string|array $feature the feature being removed, can be an array of feature strings or a single string
     1543 */
     1544function disable_for_post_type( $post_type, $feature ) {
     1545        global $_wp_post_type_disabled;
     1546
     1547        $features = (array) $feature;
     1548        foreach ($features as $feature) {
     1549                if ( func_num_args() == 2 )
     1550                        $_wp_post_type_disabled[$post_type][$feature] = true;
     1551                else
     1552                        $_wp_post_type_disabled[$post_type][$feature] = array_slice( func_get_args(), 2 );
     1553        }
     1554}
     1555
     1556/**
     1557 * Get all the disabled post type features
     1558 *
     1559 * @since 3.5.0
     1560 * @param string $post_type The post type
     1561 * @return array
     1562 */
     1563
     1564function get_all_disabled_for_post_type( $post_type ) {
     1565        global $_wp_post_type_disabled;
     1566
     1567        if ( isset( $_wp_post_type_disabled[$post_type] ) )
     1568                return $_wp_post_type_disabled[$post_type];
     1569
     1570        return array();
     1571}
     1572
     1573/**
     1574 * Checks whether a post type disables a given feature
     1575 *
     1576 * @since 3.5.0
     1577 * @param string $post_type The post type being checked
     1578 * @param string $feature the feature being checked
     1579 * @return boolean
     1580 */
     1581
     1582function post_type_disables( $post_type, $feature ) {
     1583        global $_wp_post_type_disabled;
     1584
     1585        if ( !isset( $_wp_post_type_disabled[$post_type][$feature] ) )
     1586                return false;
     1587
     1588        // If no args passed then no extra checks need be performed
     1589        if ( func_num_args() <= 2 )
     1590                return true;
     1591
     1592        return true;
     1593}
     1594
     1595/**
    15191596 * Updates the post type for the post ID.
    15201597 *
    15211598 * The page or post cache will be cleaned for the post ID.