@@ -384,8 +356,11 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
-
-
+
@@ -466,7 +441,7 @@ function list_meta( $meta ) {
function _list_meta_row( $entry, &$count ) {
static $update_nonce = false;
- if ( is_protected_meta( $entry['meta_key'] ) )
+ if ( is_protected_meta( $entry['meta_key'], 'post' ) )
return;
if ( !$update_nonce )
@@ -478,8 +453,6 @@ function _list_meta_row( $entry, &$count ) {
$style = 'alternate';
else
$style = '';
- if ('_' == $entry['meta_key'] { 0 } )
- $style .= ' hidden';
if ( is_serialized( $entry['meta_value'] ) ) {
if ( is_serialized_string( $entry['meta_value'] ) ) {
@@ -613,10 +586,11 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
$month = "';
@@ -865,13 +839,20 @@ function wp_import_upload_form( $action ) {
* @param string $id String for use in the 'id' attribute of tags.
* @param string $title Title of the meta box.
* @param string $callback Function that fills the box with the desired content. The function should echo its output.
- * @param string $page The type of edit page on which to show the box (post, page, link).
- * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
- * @param string $priority The priority within the context where the boxes should show ('high', 'low').
+ * @param string|object $screen Optional. The screen on which to show the box (post, page, link). Defaults to current screen.
+ * @param string $context Optional. The context within the page where the boxes should show ('normal', 'advanced').
+ * @param string $priority Optional. The priority within the context where the boxes should show ('high', 'low').
*/
-function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args=null) {
+function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
global $wp_meta_boxes;
+ if ( empty( $screen ) )
+ $screen = get_current_screen();
+ elseif ( is_string( $screen ) )
+ $screen = convert_to_screen( $screen );
+
+ $page = $screen->id;
+
if ( !isset($wp_meta_boxes) )
$wp_meta_boxes = array();
if ( !isset($wp_meta_boxes[$page]) )
@@ -899,7 +880,7 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
// If no priority given and id already present, use existing priority
if ( empty($priority) ) {
$priority = $a_priority;
- // 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.
+ // else if we're adding to the sorted priority, we don't know the title or callback. Grab them from the previously added context/priority.
} elseif ( 'sorted' == $priority ) {
$title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
$callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
@@ -925,16 +906,23 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
*
* @since 2.5.0
*
- * @param string $page page identifier, also known as screen identifier
+ * @param string|object $screen 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) {
+function do_meta_boxes( $screen, $context, $object ) {
global $wp_meta_boxes;
static $already_sorted = false;
- $hidden = get_hidden_meta_boxes($page);
+ if ( empty( $screen ) )
+ $screen = get_current_screen();
+ elseif ( is_string( $screen ) )
+ $screen = convert_to_screen( $screen );
+
+ $page = $screen->id;
+
+ $hidden = get_hidden_meta_boxes( $screen );
printf('
', htmlspecialchars($context));
@@ -945,7 +933,7 @@ function do_meta_boxes($page, $context, $object) {
foreach ( $sorted as $box_context => $ids ) {
foreach ( explode(',', $ids ) as $id ) {
if ( $id && 'dashboard_browser_nag' !== $id )
- add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
+ add_meta_box( $id, null, null, $screen, $box_context, 'sorted' );
}
}
}
@@ -987,12 +975,19 @@ function do_meta_boxes($page, $context, $object) {
* @since 2.6.0
*
* @param string $id String for use in the 'id' attribute of tags.
- * @param string $page The type of edit page on which to show the box (post, page, link).
+ * @param string|object $screen The screen on which to show the box (post, page, link).
* @param string $context The context within the page where the boxes should show ('normal', 'advanced').
*/
-function remove_meta_box($id, $page, $context) {
+function remove_meta_box($id, $screen, $context) {
global $wp_meta_boxes;
+ if ( empty( $screen ) )
+ $screen = get_current_screen();
+ elseif ( is_string( $screen ) )
+ $screen = convert_to_screen( $screen );
+
+ $page = $screen->id;
+
if ( !isset($wp_meta_boxes) )
$wp_meta_boxes = array();
if ( !isset($wp_meta_boxes[$page]) )
@@ -1004,67 +999,6 @@ function remove_meta_box($id, $page, $context) {
$wp_meta_boxes[$page][$context][$priority][$id] = false;
}
-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.7.0
- *
- * @param unknown_type $screen
- */
-function meta_box_prefs($screen) {
- global $wp_meta_boxes;
-
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
-
- if ( empty($wp_meta_boxes[$screen->id]) )
- return;
-
- $hidden = get_hidden_meta_boxes($screen);
-
- foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) {
- foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) {
- foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) {
- if ( false == $box || ! $box['title'] )
- continue;
- // Submit box cannot be hidden
- if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
- continue;
- $box_id = $box['id'];
- echo '\n";
- }
- }
- }
-}
-
-/**
- * Get Hidden Meta Boxes
- *
- * @since 2.7.0
- *
- * @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}" );
-
- // Hide slug boxes by default
- if ( !is_array( $hidden ) ) {
- if ( 'post' == $screen->base || 'page' == $screen->base )
- $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
- else
- $hidden = array( 'slugdiv' );
- $hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen);
- }
-
- return $hidden;
-}
-
/**
* Add a new section to a settings page.
*
@@ -1111,7 +1045,7 @@ function add_settings_section($id, $title, $callback, $page) {
* do_settings_fields() in do_settings-sections()
*
* The $callback argument should be the name of a function that echoes out the
- * html input tags for this setting field. Use get_option() to retrive existing
+ * html input tags for this setting field. Use get_option() to retrieve existing
* values to show.
*
* @since 2.7.0
@@ -1122,7 +1056,7 @@ function add_settings_section($id, $title, $callback, $page) {
* @param string $title Formatted title of the field. Shown as the label for the field during output.
* @param string $callback Function that fills the field with the desired form inputs. The function should echo its output.
* @param string $page The slug-name of the settings page on which to show the section (general, reading, writing, ...).
- * @param string $section The slug-name of the section of the settingss page in which to show the box (default, ...).
+ * @param string $section The slug-name of the section of the settings page in which to show the box (default, ...).
* @param array $args Additional arguments
*/
function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
@@ -1163,7 +1097,8 @@ function do_settings_sections($page) {
return;
foreach ( (array) $wp_settings_sections[$page] as $section ) {
- echo "