Make WordPress Core

Changeset 30040


Ignore:
Timestamp:
10/27/2014 12:57:24 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Remove one-time loop and redundant isset() checks in do_meta_boxes().

See [30022] for do_accordion_sections().

props ipm-frommen.
fixes #30093.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r30022 r30040  
    10051005    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    10061006
    1007     $i = 0;
    1008     do {
    1009         // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    1010         if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
    1011             foreach ( $sorted as $box_context => $ids ) {
    1012                 foreach ( explode(',', $ids ) as $id ) {
    1013                     if ( $id && 'dashboard_browser_nag' !== $id )
    1014                         add_meta_box( $id, null, null, $screen, $box_context, 'sorted' );
     1007    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
     1008    if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
     1009        foreach ( $sorted as $box_context => $ids ) {
     1010            foreach ( explode( ',', $ids ) as $id ) {
     1011                if ( $id && 'dashboard_browser_nag' !== $id ) {
     1012                    add_meta_box( $id, null, null, $screen, $box_context, 'sorted' );
    10151013                }
    10161014            }
    10171015        }
    1018         $already_sorted = true;
    1019 
    1020         if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
    1021             break;
    1022 
    1023         foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) {
    1024             if ( isset($wp_meta_boxes[$page][$context][$priority]) ) {
    1025                 foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
     1016    }
     1017
     1018    $already_sorted = true;
     1019
     1020    $i = 0;
     1021
     1022    if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
     1023        foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
     1024            if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ]) ) {
     1025                foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
    10261026                    if ( false == $box || ! $box['title'] )
    10271027                        continue;
     
    10391039            }
    10401040        }
    1041     } while(0);
     1041    }
    10421042
    10431043    echo "</div>";
Note: See TracChangeset for help on using the changeset viewer.