';
-
- return $output;
-}
-
//
// Category Checklists
//
/**
- * {@internal Missing Short Description}}
+ * Walker to output an unordered list of category checkbox elements.
*
- * @since unknown
+ * @see Walker
+ * @see wp_category_checklist()
+ * @see wp_terms_checklist()
+ * @since 2.5.1
*/
class Walker_Category_Checklist extends Walker {
var $tree_type = 'category';
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
- function start_lvl(&$output, $depth, $args) {
+ /**
+ * Starts the list before the elements are added.
+ *
+ * @see Walker:start_lvl()
+ *
+ * @since 2.5.1
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of category. Used for tab indentation.
+ * @param array $args An array of arguments. @see wp_terms_checklist()
+ */
+ function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
\n";
}
- function end_lvl(&$output, $depth, $args) {
+ /**
+ * Ends the list of after the elements are added.
+ *
+ * @see Walker::end_lvl()
+ *
+ * @since 2.5.1
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of category. Used for tab indentation.
+ * @param array $args An array of arguments. @see wp_terms_checklist()
+ */
+ function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
\n";
}
- function start_el(&$output, $category, $depth, $args) {
+ /**
+ * Start the element output.
+ *
+ * @see Walker::start_el()
+ *
+ * @since 2.5.1
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param object $category The current term object.
+ * @param int $depth Depth of the term in reference to parents. Default 0.
+ * @param array $args An array of arguments. @see wp_terms_checklist()
+ * @param int $id ID of the current term.
+ */
+ function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
extract($args);
if ( empty($taxonomy) )
$taxonomy = 'category';
@@ -206,38 +80,58 @@ class Walker_Category_Checklist extends Walker {
$name = 'tax_input['.$taxonomy.']';
$class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
- $output .= "\n
" . '';
- }
- function end_el(&$output, $category, $depth, $args) {
+ /** This filter is documented in wp-includes/category-template.php */
+ $output .= "\n
" . '';
+ }
+
+ /**
+ * Ends the element output, if needed.
+ *
+ * @see Walker::end_el()
+ *
+ * @since 2.5.1
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param object $category The current term object.
+ * @param int $depth Depth of the term in reference to parents. Default 0.
+ * @param array $args An array of arguments. @see wp_terms_checklist()
+ */
+ function end_el( &$output, $category, $depth = 0, $args = array() ) {
$output .= "
\n";
}
}
/**
- * {@internal Missing Short Description}}
+ * Output an unordered list of checkbox elements labelled
+ * with category names.
*
- * @since unknown
+ * @see wp_terms_checklist()
+ * @since 2.5.1
*
- * @param unknown_type $post_id
- * @param unknown_type $descendants_and_self
- * @param unknown_type $selected_cats
- * @param unknown_type $popular_cats
+ * @param int $post_id Mark categories associated with this post as checked. $selected_cats must not be an array.
+ * @param int $descendants_and_self ID of the category to output along with its descendents.
+ * @param bool|array $selected_cats List of categories to mark as checked.
+ * @param bool|array $popular_cats Override the list of categories that receive the "popular-category" class.
+ * @param object $walker Walker object to use to build the output.
+ * @param bool $checked_ontop Move checked items out of the hierarchy and to the top of the list.
*/
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
- wp_terms_checklist($post_id,
- array(
- 'taxonomy' => 'category',
- 'descendants_and_self' => $descendants_and_self,
- 'selected_cats' => $selected_cats,
- 'popular_cats' => $popular_cats,
- 'walker' => $walker,
- 'checked_ontop' => $checked_ontop
- ));
+ wp_terms_checklist( $post_id, array(
+ 'taxonomy' => 'category',
+ 'descendants_and_self' => $descendants_and_self,
+ 'selected_cats' => $selected_cats,
+ 'popular_cats' => $popular_cats,
+ 'walker' => $walker,
+ 'checked_ontop' => $checked_ontop
+ ) );
}
/**
- * Taxonomy independent version of wp_category_checklist
+ * Output an unordered list of checkbox elements labelled
+ * with term names. Taxonomy independent version of wp_category_checklist().
+ *
+ * @since 3.0.0
*
* @param int $post_id
* @param array $args
@@ -251,6 +145,19 @@ function wp_terms_checklist($post_id = 0, $args = array()) {
'taxonomy' => 'category',
'checked_ontop' => true
);
+
+ /**
+ * Filter the taxonomy terms checklist arguments.
+ *
+ * @since 3.4.0
+ *
+ * @see wp_terms_checklist()
+ *
+ * @param array $args An array of arguments.
+ * @param int $post_id The post ID.
+ */
+ $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
+
extract( wp_parse_args($args, $defaults), EXTR_SKIP );
if ( empty($walker) || !is_a($walker, 'Walker') )
@@ -303,31 +210,32 @@ function wp_terms_checklist($post_id = 0, $args = array()) {
}
/**
- * {@internal Missing Short Description}}
+ * Retrieve a list of the most popular terms from the specified taxonomy.
*
- * @since unknown
+ * If the $echo argument is true then the elements for a list of checkbox
+ * elements labelled with the names of the selected terms is output.
+ * If the $post_ID global isn't empty then the terms associated with that
+ * post will be marked as checked.
*
- * @param unknown_type $taxonomy
- * @param unknown_type $default
- * @param unknown_type $number
- * @param unknown_type $echo
- * @return unknown
+ * @since 2.5.0
+ *
+ * @param string $taxonomy Taxonomy to retrieve terms from.
+ * @param int $default Unused.
+ * @param int $number Number of terms to retrieve. Defaults to 10.
+ * @param bool $echo Optionally output the list as well. Defaults to true.
+ * @return array List of popular term IDs.
*/
function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
- global $post_ID;
+ $post = get_post();
- if ( $post_ID )
- $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids'));
+ if ( $post && $post->ID )
+ $checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
else
$checked_terms = array();
$terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
$tax = get_taxonomy($taxonomy);
- if ( ! current_user_can($tax->cap->assign_terms) )
- $disabled = 'disabled="disabled"';
- else
- $disabled = '';
$popular_ids = array();
foreach ( (array) $terms as $term ) {
@@ -340,8 +248,11 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
-
id;
+
if ( !isset($wp_meta_boxes) )
$wp_meta_boxes = array();
if ( !isset($wp_meta_boxes[$page]) )
@@ -2781,35 +889,35 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
$wp_meta_boxes[$page][$context] = array();
foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
- foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
- if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
- continue;
-
- // If a core box was previously added or removed by a plugin, don't add.
- if ( 'core' == $priority ) {
- // If core box previously deleted, don't add
- if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
+ foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
+ if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
+ continue;
+
+ // If a core box was previously added or removed by a plugin, don't add.
+ if ( 'core' == $priority ) {
+ // If core box previously deleted, don't add
+ if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
+ return;
+ // If box was added with default priority, give it core priority to maintain sort order
+ if ( 'default' == $a_priority ) {
+ $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
+ unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
+ }
return;
- // If box was added with default priority, give it core priority to maintain sort order
- if ( 'default' == $a_priority ) {
- $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
- unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
}
- return;
- }
- // 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.
- } 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'];
- $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
+ // 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 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'];
+ $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
+ }
+ // An id can be in only one priority and one context
+ if ( $priority != $a_priority || $context != $a_context )
+ unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
}
- // An id can be in only one priority and one context
- if ( $priority != $a_priority || $context != $a_context )
- unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
- }
}
if ( empty($priority) )
@@ -2826,16 +934,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));
@@ -2843,10 +958,12 @@ function do_meta_boxes($page, $context, $object) {
do {
// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
- foreach ( $sorted as $box_context => $ids )
- foreach ( explode(',', $ids) as $id )
- if ( $id )
- add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
+ foreach ( $sorted as $box_context => $ids ) {
+ foreach ( explode(',', $ids ) as $id ) {
+ if ( $id && 'dashboard_browser_nag' !== $id )
+ add_meta_box( $id, null, null, $screen, $box_context, 'sorted' );
+ }
+ }
}
$already_sorted = true;
@@ -2859,10 +976,10 @@ function do_meta_boxes($page, $context, $object) {
if ( false == $box || ! $box['title'] )
continue;
$i++;
- $style = '';
$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
echo '
' . "\n";
call_user_func($box['callback'], $object, $box);
@@ -2885,12 +1002,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]) )
@@ -2903,59 +1027,76 @@ function remove_meta_box($id, $page, $context) {
}
/**
- * {@internal Missing Short Description}}
+ * Meta Box Accordion Template Function
+ *
+ * Largely made up of abstracted code from {@link do_meta_boxes()}, this
+ * function serves to build meta boxes as list items for display as
+ * a collapsible accordion.
+ *
+ * @since 3.6.0
*
- * @since unknown
+ * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
*
- * @param unknown_type $screen
+ * @param string|object $screen The screen identifier.
+ * @param string $context The meta box context.
+ * @param mixed $object gets passed to the section callback function as first parameter.
+ * @return int number of meta boxes as accordion sections.
*/
-function meta_box_prefs($screen) {
+function do_accordion_sections( $screen, $context, $object ) {
global $wp_meta_boxes;
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
+ wp_enqueue_script( 'accordion' );
- 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
- *
- * @param string|object $screen Screen identifier
- * @return array Hidden Meta Boxes
- */
-function get_hidden_meta_boxes( $screen ) {
- if ( is_string( $screen ) )
+ if ( empty( $screen ) )
+ $screen = get_current_screen();
+ elseif ( is_string( $screen ) )
$screen = convert_to_screen( $screen );
- $hidden = get_user_option( "metaboxhidden_{$screen->id}" );
+ $page = $screen->id;
+
+ $hidden = get_hidden_meta_boxes( $screen );
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $id, 'title' => $title, 'callback' => $callback);
}
@@ -3004,7 +1143,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
@@ -3015,7 +1154,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()) {
@@ -3026,12 +1165,10 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default',
$page = 'general';
}
- if ( !isset($wp_settings_fields) )
- $wp_settings_fields = array();
- if ( !isset($wp_settings_fields[$page]) )
- $wp_settings_fields[$page] = array();
- if ( !isset($wp_settings_fields[$page][$section]) )
- $wp_settings_fields[$page][$section] = array();
+ if ( 'privacy' == $page ) {
+ _deprecated_argument( __FUNCTION__, '3.5', __( 'The privacy options group has been removed. Use another settings group.' ) );
+ $page = 'reading';
+ }
$wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
}
@@ -3045,23 +1182,27 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default',
*
* @global $wp_settings_sections Storage array of all settings sections added to admin pages
* @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
- * @since unknown
+ * @since 2.7.0
*
* @param string $page The slug name of the page whos settings sections you want to output
*/
-function do_settings_sections($page) {
+function do_settings_sections( $page ) {
global $wp_settings_sections, $wp_settings_fields;
- if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) )
+ if ( ! isset( $wp_settings_sections[$page] ) )
return;
foreach ( (array) $wp_settings_sections[$page] as $section ) {
- echo "
';
}
}
@@ -3075,7 +1216,7 @@ function do_settings_sections($page) {
*
* @global $wp_settings_fields Storage array of settings fields and their pages/sections
*
- * @since unknown
+ * @since 2.7.0
*
* @param string $page Slug title of the admin page who's settings fields you want to show.
* @param section $section Slug title of the settings section who's fields you want to show.
@@ -3083,13 +1224,13 @@ function do_settings_sections($page) {
function do_settings_fields($page, $section) {
global $wp_settings_fields;
- if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
+ if ( ! isset( $wp_settings_fields[$page][$section] ) )
return;
foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
- echo '
';
+ echo '
';
if ( !empty($field['args']['label_for']) )
- echo '
';
+ echo '
';
else
echo '
' . $field['title'] . '
';
echo '
';
@@ -3112,6 +1253,8 @@ function do_settings_fields($page, $section) {
* Additional calls to settings_errors() can be used to show errors even when the settings
* page is first accessed.
*
+ * @since 3.0.0
+ *
* @global array $wp_settings_errors Storage array of errors registered during this pageload
*
* @param string $setting Slug title of the setting to which this error applies
@@ -3122,9 +1265,6 @@ function do_settings_fields($page, $section) {
function add_settings_error( $setting, $code, $message, $type = 'error' ) {
global $wp_settings_errors;
- if ( !isset($wp_settings_errors) )
- $wp_settings_errors = array();
-
$new_error = array(
'setting' => $setting,
'code' => $code,
@@ -3140,7 +1280,7 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) {
* Checks the $wp_settings_errors array for any errors declared during the current
* pageload and returns them.
*
- * If changes were just submitted ($_GET['updated']) and settings errors were saved
+ * If changes were just submitted ($_GET['settings-updated']) and settings errors were saved
* to the 'settings_errors' transient then those errors will be returned instead. This
* is used to pass errors back across pageloads.
*
@@ -3148,40 +1288,44 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) {
* This is useful if you have errors or notices you want to show even when the user
* hasn't submitted data (i.e. when they first load an options page, or in admin_notices action hook)
*
+ * @since 3.0.0
+ *
* @global array $wp_settings_errors Storage array of errors registered during this pageload
*
* @param string $setting Optional slug title of a specific setting who's errors you want.
* @param boolean $sanitize Whether to re-sanitize the setting value before returning errors.
* @return array Array of settings errors
*/
-function get_settings_errors( $setting = '', $sanitize = FALSE ) {
+function get_settings_errors( $setting = '', $sanitize = false ) {
global $wp_settings_errors;
- // If $sanitize is true, manually re-run the sanitizisation for this option
+ // If $sanitize is true, manually re-run the sanitization for this option
// This allows the $sanitize_callback from register_setting() to run, adding
// any settings errors you want to show by default.
if ( $sanitize )
- sanitize_option( $setting, get_option($setting));
+ sanitize_option( $setting, get_option( $setting ) );
// If settings were passed back from options.php then use them
- // Ignore transients if $sanitize is true, we dont' want the old values anyway
- if ( isset($_GET['updated']) && $_GET['updated'] && get_transient('settings_errors') ) {
- $settings_errors = get_transient('settings_errors');
- delete_transient('settings_errors');
- // Otherwise check global in case validation has been run on this pageload
- } elseif ( count( $wp_settings_errors ) ) {
- $settings_errors = $wp_settings_errors;
- } else {
- return;
+ if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
+ $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) );
+ delete_transient( 'settings_errors' );
}
+ // Check global in case errors have been added on this pageload
+ if ( ! count( $wp_settings_errors ) )
+ return array();
+
// Filter the results to those of a specific setting if one was set
if ( $setting ) {
- foreach ( (array) $settings_errors as $key => $details )
- if ( $setting != $details['setting'] )
- unset( $settings_errors[$key] );
+ $setting_errors = array();
+ foreach ( (array) $wp_settings_errors as $key => $details ) {
+ if ( $setting == $details['setting'] )
+ $setting_errors[] = $wp_settings_errors[$key];
+ }
+ return $setting_errors;
}
- return $settings_errors;
+
+ return $wp_settings_errors;
}
/**
@@ -3200,18 +1344,21 @@ function get_settings_errors( $setting = '', $sanitize = FALSE ) {
* shown in the default error reporting after submission. This is useful to show general errors like missing
* settings when the user arrives at the settings page.
*
+ * @since 3.0.0
+ *
* @param string $setting Optional slug title of a specific setting who's errors you want.
* @param boolean $sanitize Whether to re-sanitize the setting value before returning errors.
* @param boolean $hide_on_update If set to true errors will not be shown if the settings page has already been submitted.
- * @return
*/
-function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = FALSE ) {
+function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {
- if ($hide_on_update AND $_GET['updated']) return;
+ if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) )
+ return;
$settings_errors = get_settings_errors( $setting, $sanitize );
- if ( !is_array($settings_errors) ) return;
+ if ( empty( $settings_errors ) )
+ return;
$output = '';
foreach ( $settings_errors as $key => $details ) {
@@ -3227,185 +1374,53 @@ function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = F
/**
* {@internal Missing Short Description}}
*
- * @since unknown
- *
- * @param unknown_type $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 ( in_array( $column, $special ) )
- continue;
- if ( empty( $title ) )
- continue;
-
- if ( 'comments' == $column )
- $title = __( 'Comments' );
- $id = "$column-hide";
- echo '\n";
- }
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $found_action
*/
function find_posts_div($found_action = '') {
?>
-
' . __('Most of the modules on this screen can be moved. If you hover your mouse over the title bar of a module you’ll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the module to a new location. As you drag the module, notice the dotted gray box that also moves. This box indicates where the module will be placed when you release the mouse button.') . '
-
' . __('The same modules can be expanded and collapsed by clicking once on their title bar and also completely hidden from the Screen Options tab.') . '
' . __('You may search based on 3 criteria:') . ' ' .
- __('Term: Searches theme names and descriptions for the specified term.') . ' ' .
- __('Tag: Searches for themes tagged as such.') . ' ' .
- __('Author: Searches for themes created by the Author, or which the Author contributed to.') . '
' . __( 'Add, edit, and play around with your widgets from the theme customizer.' ) . ' ' . __( 'Preview your changes in real-time and only save them when you’re ready.' ) . '
';
+
+ if ( 'themes' === get_current_screen()->id ) {
+ $selector = '.theme.active .customize';
+ $position = array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center', 'my' => is_rtl() ? 'right-13px' : '' );
+ } else {
+ $selector = 'a[href="customize.php"]';
+ if ( is_rtl() ) {
+ $position = array( 'edge' => 'right', 'align' => 'center', 'my' => 'right-5px' );
+ } else {
+ $position = array( 'edge' => 'left', 'align' => 'center', 'my' => 'left-5px' );
+ }
+ }
+
+ self::print_js( 'wp390_widgets', $selector, array(
+ 'content' => $content,
+ 'position' => $position,
+ ) );
+ }
+
+ /**
+ * Prevents new users from seeing existing 'new feature' pointers.
+ *
+ * @since 3.3.0
+ */
+ public static function dismiss_pointers_for_new_users( $user_id ) {
+ add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp350_media,wp360_revisions,wp360_locks,wp390_widgets' );
+ }
+}
+
+add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
+add_action( 'user_register', array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) );
+
+/**
+ * Convert a screen string to a screen object
+ *
+ * @since 3.0.0
+ *
+ * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
+ * @return WP_Screen Screen object.
+ */
+function convert_to_screen( $hook_name ) {
+ if ( ! class_exists( 'WP_Screen' ) ) {
+ _doing_it_wrong( 'convert_to_screen(), add_meta_box()', __( "Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead." ), '3.3' );
+ return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' );
+ }
+
+ return WP_Screen::get( $hook_name );
+}
+
+/**
+ * Output the HTML for restoring the post data from DOM storage
+ *
+ * @since 3.6.0
+ * @access private
+ */
+function _local_storage_notice() {
+ ?>
+
+
+
+
+
+
+
+
+
+
+ 0,
+ 'type' => 'rating',
+ 'number' => 0,
+ );
+ $r = wp_parse_args( $args, $defaults );
+ extract( $r, EXTR_SKIP );
+
+ // Non-english decimal places when the $rating is coming from a string
+ $rating = str_replace( ',', '.', $rating );
+
+ // Convert Percentage to star rating, 0..5 in .5 increments
+ if ( 'percent' == $type ) {
+ $rating = round( $rating / 10, 0 ) / 2;
+ }
+
+ // Calculate the number of each type of star needed
+ $full_stars = floor( $rating );
+ $half_stars = ceil( $rating - $full_stars );
+ $empty_stars = 5 - $full_stars - $half_stars;
+
+ if ( $number ) {
+ /* translators: 1: The rating, 2: The number of ratings */
+ $title = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $number );
+ $title = sprintf( $title, number_format_i18n( $rating, 1 ), number_format_i18n( $number ) );
+ } else {
+ /* translators: 1: The rating */
+ $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
+ }
+
+ echo '