WordPress.org

Make WordPress Core

Changeset 14752


Ignore:
Timestamp:
05/19/10 19:11:33 (4 years ago)
Author:
ryan
Message:

Meta box and screen option phpdoc and cleanup. Props hakre. fixes #13017

File:
1 edited

Legend:

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

    r14724 r14752  
    28382838 
    28392839/** 
    2840  * {@internal Missing Short Description}} 
    2841  * 
    2842  * @since unknown 
    2843  * 
    2844  * @param unknown_type $page 
    2845  * @param unknown_type $context 
    2846  * @param unknown_type $object 
     2840 * Meta-Box template function 
     2841 * 
     2842 * @since 2.5.0 
     2843 * 
     2844 * @param string $page page identifier, also known as screen identifier 
     2845 * @param string $context box context 
     2846 * @param mixed $object gets passed to the box callback function as first parameter 
    28472847 * @return int number of meta_boxes 
    28482848 */ 
     
    28512851    static $already_sorted = false; 
    28522852 
    2853     //do_action('do_meta_boxes', $page, $context, $object); 
    2854  
    28552853    $hidden = get_hidden_meta_boxes($page); 
    28562854 
    2857     echo "<div id='$context-sortables' class='meta-box-sortables'>\n"; 
     2855    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));  
    28582856 
    28592857    $i = 0; 
     
    29552953} 
    29562954 
    2957 function get_hidden_meta_boxes($screen) { 
    2958     if ( is_string($screen) ) 
    2959         $screen = convert_to_screen($screen); 
    2960  
    2961     $hidden = get_user_option( "metaboxhidden_$screen->id" ); 
     2955/** 
     2956 * Get Hidden Meta Boxes 
     2957 * 
     2958 * @since 2.7 
     2959 * 
     2960 * @param string|object $screen Screen identifier 
     2961 * @return array Hidden Meta Boxes 
     2962 */ 
     2963function get_hidden_meta_boxes( $screen ) { 
     2964    if ( is_string( $screen ) ) 
     2965        $screen = convert_to_screen( $screen ); 
     2966 
     2967    $hidden = get_user_option( "metaboxhidden_{$screen->id}" ); 
    29622968 
    29632969    // Hide slug boxes by default 
    2964     if ( !is_array($hidden) ) 
     2970    if ( !is_array( $hidden ) ) 
    29652971        $hidden = array('slugdiv'); 
    29662972 
     
    32413247 * @param unknown_type $page 
    32423248 */ 
    3243 function manage_columns_prefs($page) { 
    3244     $columns = get_column_headers($page); 
    3245  
    3246     $hidden = get_hidden_columns($page); 
     3249function manage_columns_prefs( $page ) { 
     3250    $columns = get_column_headers( $page ); 
     3251    $hidden  = get_hidden_columns( $page );  
     3252    $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username'); 
    32473253 
    32483254    foreach ( $columns as $column => $title ) { 
    32493255        // Can't hide these or they are special 
    3250         if ( '_title' == $column || 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column ) 
     3256        if ( in_array( $column, $special ) ) 
    32513257            continue; 
    3252         if ( empty($title) ) 
     3258        if ( empty( $title ) ) 
    32533259            continue; 
    32543260 
    32553261        if ( 'comments' == $column ) 
    3256             $title = __('Comments'); 
     3262            $title = __( 'Comments' ); 
    32573263        $id = "$column-hide"; 
    32583264        echo '<label for="' . $id . '">'; 
     
    35503556 * Convert a screen string to a screen object 
    35513557 *  
     3558 * @since 3.0.0 
     3559 *  
    35523560 * @param string $screen The name of the screen 
    35533561 * @return object An object containing the safe screen name and id 
    35543562 */ 
    35553563function convert_to_screen( $screen ) { 
    3556     $screen = str_replace('.php', '', $screen); 
    3557     $screen = str_replace('-new', '', $screen); 
    3558     $screen = str_replace('-add', '', $screen); 
    3559     $screen = apply_filters('screen_meta_screen', $screen); 
    3560  
    3561     $screen = array('id' => $screen, 'base' => $screen); 
    3562     return (object) $screen; 
     3564    $screen = str_replace( array('.php', '-new', '-add' ), '', $screen); 
     3565    $screen = (string) apply_filters( 'screen_meta_screen', $screen ); 
     3566    $screen = (object) array('id' => $screen, 'base' => $screen); 
     3567    return $screen; 
    35633568} 
    35643569 
     
    35963601            break; 
    35973602    } 
    3598     if( !empty($settings) ) 
     3603    if( ! empty( $settings ) ) 
    35993604        $show_screen = true; 
    36003605?> 
Note: See TracChangeset for help on using the changeset viewer.