Make WordPress Core

Ticket #15000: 15000.6-refresh.diff

File 15000.6-refresh.diff, 3.1 KB (added by meloniq, 10 years ago)

Refreshed last one patch (6) to current version of WP (34082). Also moved the Screen ID check out of the loop.

  • wp-admin/includes/template.php

     
    966966 * @param string           $title         Title of the meta box.
    967967 * @param callback         $callback      Function that fills the box with the desired content.
    968968 *                                        The function should echo its output.
    969  * @param string|WP_Screen $screen        Optional. The screen on which to show the box (like a post
     969 * @param string|array|WP_Screen $screen  Optional. The screen on which to show the box (like a post
    970970 *                                        type, 'link', or 'comment'). Default is the current screen.
     971 *                                        Also accepts an array of post type slugs.
    971972 * @param string           $context       Optional. The context within the screen where the boxes
    972973 *                                        should display. Available contexts vary from screen to
    973974 *                                        screen. Post edit screen contexts include 'normal', 'side',
     
    983984function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
    984985        global $wp_meta_boxes;
    985986
    986         if ( empty( $screen ) )
     987        if ( empty( $screen ) ) {
    987988                $screen = get_current_screen();
    988         elseif ( is_string( $screen ) )
     989        } elseif ( is_string( $screen ) ) {
    989990                $screen = convert_to_screen( $screen );
     991        } elseif ( is_array( $screen ) ) {
     992                foreach ( $screen as $single_screen ) {
     993                        add_meta_box( $id, $title, $callback, $single_screen, $context, $priority, $callback_args );
     994                }
     995        }
    990996
     997        if ( ! isset( $screen->id ) ) {
     998                return;
     999        }
     1000
    9911001        $page = $screen->id;
    9921002
    9931003        if ( !isset($wp_meta_boxes) )
     
    11251135 *
    11261136 * @global array $wp_meta_boxes
    11271137 *
    1128  * @param string        $id      String for use in the 'id' attribute of tags.
    1129  * @param string|object $screen  The screen on which to show the box (post, page, link).
    1130  * @param string        $context The context within the page where the boxes should show ('normal', 'advanced').
     1138 * @param string              $id      String for use in the 'id' attribute of tags.
     1139 * @param string|array|object $screen  The screen on which to show the box (post, page, link). Also accepts an
     1140 *                                     array of post type slugs from which to remove the box from.
     1141 * @param string              $context The context within the page where the boxes should show ('normal', 'advanced').
    11311142 */
    1132 function remove_meta_box($id, $screen, $context) {
     1143function remove_meta_box( $id, $screen, $context ) {
    11331144        global $wp_meta_boxes;
    11341145
    1135         if ( empty( $screen ) )
     1146        if ( empty( $screen ) ) {
    11361147                $screen = get_current_screen();
    1137         elseif ( is_string( $screen ) )
     1148        } elseif ( is_string( $screen ) ) {
    11381149                $screen = convert_to_screen( $screen );
     1150        } elseif ( is_array( $screen ) ) {
     1151                foreach ( $screen as $single_screen ) {
     1152                        remove_meta_box( $id, $single_screen, $context );
     1153                }
     1154        }
    11391155
     1156        if ( ! isset( $screen->id ) ) {
     1157                return;
     1158        }
     1159
    11401160        $page = $screen->id;
    11411161
    11421162        if ( !isset($wp_meta_boxes) )