Make WordPress Core

Changeset 16509


Ignore:
Timestamp:
11/20/2010 07:20:32 PM (16 years ago)
Author:
nacin
Message:

Indent a foreach.

File:
1 edited

Legend:

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

    r16438 r16509  
    871871
    872872        foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
    873         foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
    874                 if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
    875                         continue;
    876 
    877                 // If a core box was previously added or removed by a plugin, don't add.
    878                 if ( 'core' == $priority ) {
    879                         // If core box previously deleted, don't add
    880                         if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
     873                foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
     874                        if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
     875                                continue;
     876       
     877                        // If a core box was previously added or removed by a plugin, don't add.
     878                        if ( 'core' == $priority ) {
     879                                // If core box previously deleted, don't add
     880                                if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
     881                                        return;
     882                                // If box was added with default priority, give it core priority to maintain sort order
     883                                if ( 'default' == $a_priority ) {
     884                                        $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
     885                                        unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
     886                                }
    881887                                return;
    882                         // If box was added with default priority, give it core priority to maintain sort order
    883                         if ( 'default' == $a_priority ) {
    884                                 $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
    885                                 unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
    886888                        }
    887                         return;
     889                        // If no priority given and id already present, use existing priority
     890                        if ( empty($priority) ) {
     891                                $priority = $a_priority;
     892                        // else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
     893                        } elseif ( 'sorted' == $priority ) {
     894                                $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
     895                                $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
     896                                $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
     897                        }
     898                        // An id can be in only one priority and one context
     899                        if ( $priority != $a_priority || $context != $a_context )
     900                                unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
    888901                }
    889                 // If no priority given and id already present, use existing priority
    890                 if ( empty($priority) ) {
    891                         $priority = $a_priority;
    892                 // else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
    893                 } elseif ( 'sorted' == $priority ) {
    894                         $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
    895                         $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
    896                         $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
    897                 }
    898                 // An id can be in only one priority and one context
    899                 if ( $priority != $a_priority || $context != $a_context )
    900                         unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
    901         }
    902902        }
    903903
Note: See TracChangeset for help on using the changeset viewer.