* @subpackage Administration
*/
-
//
// Category Checklists
//
/**
- * {@internal Missing Short Description}}
+ * Walker to output an unordered list of category checkbox <input> elements.
*
+ * @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) {
+ function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent<ul class='children'>\n";
}
- function end_lvl(&$output, $depth, $args) {
+ function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul>\n";
}
- function start_el(&$output, $category, $depth, $args) {
+ function start_el( &$output, $category, $depth, $args, $id = 0 ) {
extract($args);
if ( empty($taxonomy) )
$taxonomy = 'category';
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
}
- function end_el(&$output, $category, $depth, $args) {
+ function end_el( &$output, $category, $depth = 0, $args = array() ) {
$output .= "</li>\n";
}
}
/**
- * {@internal Missing Short Description}}
+ * Output an unordered list of checkbox <input> elements labelled
+ * with category names.
*
+ * @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 <input> elements labelled
+ * with term names. Taxonomy independent version of wp_category_checklist().
*
* @since 3.0.0
*
'taxonomy' => 'category',
'checked_ontop' => true
);
+ $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') )
}
/**
- * {@internal Missing Short Description}}
+ * Retrieve a list of the most popular terms from the specified taxonomy.
+ *
+ * If the $echo argument is true then the elements for a list of checkbox
+ * <input> 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.
*
* @since 2.5.0
*
- * @param unknown_type $taxonomy
- * @param unknown_type $default
- * @param unknown_type $number
- * @param unknown_type $echo
- * @return unknown
+ * @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;
if ( $post->post_type == 'page' )
echo '<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>';
- if ( $post_type_object->hierarchical )
+ if ( post_type_supports( $post->post_type, 'page-attributes' ) )
echo '<div class="menu_order">' . $post->menu_order . '</div>';
$taxonomy_names = get_object_taxonomies( $post->post_type );
foreach ( $taxonomy_names as $taxonomy_name) {
$taxonomy = get_taxonomy( $taxonomy_name );
- if ( $taxonomy->hierarchical && $taxonomy->show_ui )
- echo '<div class="post_category" id="'.$taxonomy_name.'_'.$post->ID.'">' . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array('fields'=>'ids')) ) . '</div>';
- elseif ( $taxonomy->show_ui )
- echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">' . esc_html( str_replace( ',', ', ', get_terms_to_edit($post->ID, $taxonomy_name) ) ) . '</div>';
+ if ( $taxonomy->hierarchical && $taxonomy->show_ui ) {
+ echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">'
+ . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array( 'fields' => 'ids' ) ) ) . '</div>';
+ } elseif ( $taxonomy->show_ui ) {
+ echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">'
+ . esc_html( str_replace( ',', ', ', get_terms_to_edit( $post->ID, $taxonomy_name ) ) ) . '</div>';
+ }
}
if ( !$post_type_object->hierarchical )
<div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
<?php endif; ?>
<div id="replyhead" style="display:none;"><h5><?php _e( 'Reply to Comment' ); ?></h5></div>
-
+ <div id="addhead" style="display:none;"><h5><?php _e('Add new Comment'); ?></h5></div>
<div id="edithead" style="display:none;">
<div class="inside">
<label for="author"><?php _e('Name') ?></label>
<div id="replycontainer">
<?php
$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' );
- wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
+ wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings, 'tabindex' => 104 ) );
?>
</div>
<p id="replysubmit" class="submit">
<a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106"><?php _e('Cancel'); ?></a>
<a href="#comments-form" class="save button-primary alignright" tabindex="104">
+ <span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span>
<span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
<span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
<img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
$month .= "\t\t\t" . '<option value="' . $monthnum . '"';
if ( $i == $mm )
$month .= ' selected="selected"';
- $month .= '>' . $monthnum . '-' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) . "</option>\n";
+ /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
+ $month .= '>' . sprintf( __( '%1$s-%2$s' ), $monthnum, $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) ) . "</option>\n";
}
$month .= '</select>';
<?php
}
-
/**
* Print out <option> html elements for role selectors
*
* @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
* @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.
*/
-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['settings-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 ( ! is_array( $settings_errors ) )
+ return;
$output = '';
foreach ( $settings_errors as $key => $details ) {
if ( 'attachment' == $post->name )
continue;
?>
- <input type="radio" name="find-posts-what" id="find-posts-<?php echo esc_attr($post->name); ?>" value="<?php echo esc_attr($post->name); ?>" <?php checked($post->name, 'post'); ?> />
+ <input type="radio" name="find-posts-what" id="find-posts-<?php echo esc_attr($post->name); ?>" value="<?php echo esc_attr($post->name); ?>" <?php checked($post->name, 'post'); ?> />
<label for="find-posts-<?php echo esc_attr($post->name); ?>"><?php echo $post->label; ?></label>
<?php
} ?>
'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
'time':'<?php echo time() ?>'
},
- ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
+ ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
pagenow = '<?php echo $current_screen->id; ?>',
typenow = '<?php echo $current_screen->post_type; ?>',
adminpage = '<?php echo $admin_body_class; ?>',
do_action('admin_print_scripts');
do_action("admin_head-$hook_suffix");
do_action('admin_head');
+
+$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
?>
</head>
-<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin no-js iframe <?php echo apply_filters( 'admin_body_class', '' ) . ' ' . $admin_body_class; ?>">
+<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin no-js iframe <?php echo apply_filters( 'admin_body_class', '' ) . ' ' . $admin_body_class; ?>">
<script type="text/javascript">
//<![CDATA[
(function(){
* Defaults to no other attributes. Other attributes can also be provided as a
* string such as 'tabindex="1"', though the array format is typically cleaner.
*/
-function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
+function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
}
* Defaults to no other attributes. Other attributes can also be provided as a
* string such as 'tabindex="1"', though the array format is typically cleaner.
*/
-function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
+function get_submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
switch ( $type ) :
case 'primary' :
case 'secondary' :
default :
$class = $type; // Custom cases can just pass in the classes they want to be used
endswitch;
- $text = ( NULL == $text ) ? __( 'Save Changes' ) : $text;
+ $text = ( null == $text ) ? __( 'Save Changes' ) : $text;
// Default the id attribute to $name unless an id was specifically provided in $other_attributes
$id = $name;
}
function _wp_admin_html_begin() {
+ $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
?>
<!DOCTYPE html>
<!--[if IE 8]>
-<html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+<html xmlns="http://www.w3.org/1999/xhtml" class="ie8 <?php echo $admin_html_class; ?>" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 8) ]><!-->
-<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+<html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
'index.php' => 'wp330_toolbar',
'post-new.php' => 'wp330_media_uploader',
'post.php' => 'wp330_media_uploader',
- 'themes.php' => 'wp330_saving_widgets',
+ 'themes.php' => array( 'wp330_saving_widgets', 'wp340_customize_current_theme_link' ),
+ 'appearance_page_custom-header' => 'wp340_choose_image_from_library',
+ 'appearance_page_custom-background' => 'wp340_choose_image_from_library',
);
// Check if screen related pointer is registered
if ( empty( $registered_pointers[ $hook_suffix ] ) )
return;
- $pointer = $registered_pointers[ $hook_suffix ];
+ $pointers = (array) $registered_pointers[ $hook_suffix ];
$caps_required = array(
'wp330_media_uploader' => array( 'upload_files' ),
'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ),
+ 'wp340_customize_current_theme_link' => array( 'edit_theme_options' ),
+ 'wp340_choose_image_from_library' => array( 'edit_theme_options' ),
);
- if ( isset( $caps_required[ $pointer ] ) ) {
- foreach ( $caps_required[ $pointer ] as $cap ) {
- if ( ! current_user_can( $cap ) )
- return;
- }
- }
-
// Get dismissed pointers
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
- // Pointer has been dismissed
- if ( in_array( $pointer, $dismissed ) )
- return;
+ $got_pointers = false;
+ foreach ( array_diff( $pointers, $dismissed ) as $pointer ) {
+ if ( isset( $caps_required[ $pointer ] ) ) {
+ foreach ( $caps_required[ $pointer ] as $cap ) {
+ if ( ! current_user_can( $cap ) )
+ continue 2;
+ }
+ }
- // Bind pointer print function
- add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
+ // Bind pointer print function
+ add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
+ $got_pointers = true;
+ }
+
+ if ( ! $got_pointers )
+ return;
// Add pointers script and style to queue
wp_enqueue_style( 'wp-pointer' );
?>
<script type="text/javascript">
//<![CDATA[
- jQuery(document).ready( function($) {
- var options = <?php echo json_encode( $args ); ?>;
+ (function($){
+ var options = <?php echo json_encode( $args ); ?>, setup;
if ( ! options )
return;
}
});
- $('<?php echo $selector; ?>').pointer( options ).pointer('open');
- });
+ setup = function() {
+ $('<?php echo $selector; ?>').pointer( options ).pointer('open');
+ };
+
+ if ( options.position && options.position.defer_loading )
+ $(window).bind( 'load.wp-pointers', setup );
+ else
+ $(document).ready( setup );
+
+ })( jQuery );
//]]>
</script>
<?php
}
public static function pointer_wp330_toolbar() {
- $content = '<h3>' . esc_js( __( 'New Feature: Toolbar' ) ). '</h3>';
- $content .= '<p>' . esc_js( __( 'We’ve combined the admin bar and the old Dashboard header into one persistent toolbar. Hover over the toolbar items to see what’s new.' ) ) . '</p>';
+ $content = '<h3>' . __( 'New Feature: Toolbar' ) . '</h3>';
+ $content .= '<p>' . __( 'We’ve combined the admin bar and the old Dashboard header into one persistent toolbar. Hover over the toolbar items to see what’s new.' ) . '</p>';
if ( is_multisite() && is_super_admin() )
- $content .= '<p>' .esc_js( __( 'Network Admin is now located in the My Sites menu.' ) ) . '</p>';
+ $content .= '<p>' . __( 'Network Admin is now located in the My Sites menu.' ) . '</p>';
WP_Internal_Pointers::print_js( 'wp330_toolbar', '#wpadminbar', array(
'content' => $content,
* @since 3.3.0
*/
public static function pointer_wp330_media_uploader() {
- $content = '<h3>' . esc_js( __( 'Updated Media Uploader' ) ) . '</h3>';
- $content .= '<p>' . esc_js( __( 'The single media icon now launches the uploader for all file types, and the new drag and drop interface makes uploading a breeze.' ) ) . '</p>';
+ $content = '<h3>' . __( 'Updated Media Uploader' ) . '</h3>';
+ $content .= '<p>' . __( 'The single media icon now launches the uploader for all file types, and the new drag and drop interface makes uploading a breeze.' ) . '</p>';
WP_Internal_Pointers::print_js( 'wp330_media_uploader', '#content-add_media', array(
'content' => $content,
* @since 3.3.0
*/
public static function pointer_wp330_saving_widgets() {
- $content = '<h3>' . esc_js( __( 'New Feature: Saving Widgets' ) ) . '</h3>';
- $content .= '<p>' . esc_js( __( 'If you change your mind and revert to your previous theme, we’ll put the widgets back the way you had them.' ) ) . '</p>';
+ $content = '<h3>' . __( 'New Feature: Saving Widgets' ) . '</h3>';
+ $content .= '<p>' . __( 'If you change your mind and revert to your previous theme, we’ll put the widgets back the way you had them.' ) . '</p>';
WP_Internal_Pointers::print_js( 'wp330_saving_widgets', '#message2', array(
'content' => $content,
) );
}
+ /**
+ * Print 'New Feature: Current Theme Customize Link' for 3.4.0.
+ *
+ * @since 3.4.0
+ */
+ public static function pointer_wp340_customize_current_theme_link() {
+ $content = '<h3>' . __( 'New Feature: Customizer' ) . '</h3>';
+ $content .= '<p>' . __( 'Click Customize to change the header, background, title and menus of the current theme, all in one place.' ) . '</p>';
+ $content .= '<p>' . __( 'Click the Live Preview links in the Available Themes list below to customize and preview another theme before activating it.' ) . '</p>';
+
+ WP_Internal_Pointers::print_js( 'wp340_customize_current_theme_link', '#customize-current-theme-link', array(
+ 'content' => $content,
+ 'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left', 'offset' => is_rtl() ? '32 0' : '-32 0' ),
+ ) );
+ }
+
+ /**
+ * Print 'New Feature: Choose Image from Library' for 3.4.0.
+ *
+ * @since 3.4.0
+ */
+ public static function pointer_wp340_choose_image_from_library() {
+ $content = '<h3>' . __( 'New Feature: Choose Image from Library' ) . '</h3>';
+ $content .= '<p>' . __( 'Want to use an image you uploaded earlier? Select it from your media library instead of uploading it again.' ) . '</p>';
+
+ WP_Internal_Pointers::print_js( 'wp340_choose_image_from_library', '#choose-from-library-link', array(
+ 'content' => $content,
+ 'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left', 'defer_loading' => true ),
+ ) );
+ }
+
/**
* 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', 'wp330_toolbar,wp330_media_uploader,wp330_saving_widgets' );
+ add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp330_toolbar,wp330_media_uploader,wp330_saving_widgets,wp340_choose_image_from_library,wp340_customize_current_theme_link' );
}
}
}
return WP_Screen::get( $hook_name );
-}
\ No newline at end of file
+}