From 9fef68880df8ad8c7c706ea4d33924bd1019cdc0 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 19 May 2010 19:11:33 +0000 Subject: [PATCH] Meta box and screen option phpdoc and cleanup. Props hakre. fixes #13017 git-svn-id: https://develop.svn.wordpress.org/trunk@14752 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/template.php | 61 ++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 9a9b8f0179..35e6d6fd8c 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -2837,24 +2837,22 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri } /** - * {@internal Missing Short Description}} + * Meta-Box template function * - * @since unknown + * @since 2.5.0 * - * @param unknown_type $page - * @param unknown_type $context - * @param unknown_type $object + * @param string $page page identifier, also known as screen identifier + * @param string $context box context + * @param mixed $object gets passed to the box callback function as first parameter * @return int number of meta_boxes */ function do_meta_boxes($page, $context, $object) { global $wp_meta_boxes; static $already_sorted = false; - //do_action('do_meta_boxes', $page, $context, $object); - $hidden = get_hidden_meta_boxes($page); - echo "
\n"; + printf('
', htmlspecialchars($context)); $i = 0; do { @@ -2954,14 +2952,22 @@ function meta_box_prefs($screen) { } } -function get_hidden_meta_boxes($screen) { - if ( is_string($screen) ) - $screen = convert_to_screen($screen); +/** + * Get Hidden Meta Boxes + * + * @since 2.7 + * + * @param string|object $screen Screen identifier + * @return array Hidden Meta Boxes + */ +function get_hidden_meta_boxes( $screen ) { + if ( is_string( $screen ) ) + $screen = convert_to_screen( $screen ); - $hidden = get_user_option( "metaboxhidden_$screen->id" ); + $hidden = get_user_option( "metaboxhidden_{$screen->id}" ); // Hide slug boxes by default - if ( !is_array($hidden) ) + if ( !is_array( $hidden ) ) $hidden = array('slugdiv'); return $hidden; @@ -3240,20 +3246,20 @@ function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = F * * @param unknown_type $page */ -function manage_columns_prefs($page) { - $columns = get_column_headers($page); - - $hidden = get_hidden_columns($page); +function manage_columns_prefs( $page ) { + $columns = get_column_headers( $page ); + $hidden = get_hidden_columns( $page ); + $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username'); foreach ( $columns as $column => $title ) { // Can't hide these or they are special - if ( '_title' == $column || 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column ) + if ( in_array( $column, $special ) ) continue; - if ( empty($title) ) + if ( empty( $title ) ) continue; if ( 'comments' == $column ) - $title = __('Comments'); + $title = __( 'Comments' ); $id = "$column-hide"; echo '