Index: wp-admin/includes/template.php =================================================================== --- wp-admin/includes/template.php (revision 19363) +++ wp-admin/includes/template.php (working copy) @@ -1669,19 +1669,37 @@ * * @since 3.3.0 * - * Pointer user settings: - * p0 - Admin bar pointer, added 3.3. */ function wp_pointer_enqueue( $hook_suffix ) { $enqueue = false; + // Pointers to show, saved in format array( pointer_id => hook_suffix ) + $pointers = apply_filters( 'wp_pointers', array( + 'wp330-toolbar' => 'index.php', + 'wp330-flyout-menus' => 'index.php', + 'wp330-media-uploader' => 'post-new.php', + 'wp330-saving-widgets' => 'themes.php' + ) ); + + // Pointers which are dismissed $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); - if ( ! in_array( 'wp330-admin-bar', $dismissed ) ) { - $enqueue = true; - add_action( 'admin_print_footer_scripts', '_wp_pointer_print_admin_bar' ); + // Sort dismissed pointers out + $pointer_ids = array_diff( array_keys($pointers), $dismissed ); + + // No pointers + if ( empty( $pointers ) ) + return; + + // Print pointers + foreach ( $pointer_ids as $id ) { + if ( $hook_suffix == $pointers[$id] ) { + add_action( 'admin_print_footer_scripts', '_wp_pointer_print_' . str_replace( '-', '_', $id ) ); + $enqueue = true; + } } + // Load pointers script and style if ( $enqueue ) { wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); @@ -1689,25 +1707,38 @@ } add_action( 'admin_enqueue_scripts', 'wp_pointer_enqueue' ); -function _wp_pointer_print_admin_bar() { - $pointer_content = '
' . sprintf( 'Have some feedback? Visit the forum.', 'http://wordpress.org/support/forum/alphabeta' ) . '
'; - $pointer_content .= '' . 'P.S. You are looking at a new admin pointer.' . '
'; +/** + * Print the pointer javascript data. + * + * @since 3.3.0 + * + * @param string $pointer_id The pointer ID + * @param string $selector The HTML elements, on which the pointer should be attached. + * @param string $content The pointer content + * @param array $position The pointer position. Defaults to edge = top and align = center + */ +function _wp_pointer_javascript( $pointer_id, $selector, $content, $position = array() ) { + if ( empty( $pointer_id ) || empty( $selector ) || empty( $content ) ) + return; + $position = wp_parse_args( $position, array( + 'edge' => 'top', + 'align' => 'center' + ) ); + ?> ' . esc_js( __( 'New Feature: Toolbar' ) ). ''; + $content .= '' . 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." ) ) . '
'; + + if ( is_multisite() && is_super_admin() ) + $content .= '' .esc_js( __( 'Network Admin is now located in the My Sites menu.' ) ) . '
'; + + $position['align'] = 'right'; + + _wp_pointer_javascript( 'wp330-toolbar', '#wpadminbar', $content, $position ); +} + +/** + * Print 'New Feature: Flyout Menus' for 3.3.0. + * + * @since 3.3.0 + */ +function _wp_pointer_print_wp330_flyout_menus() { + $content = '' . esc_js( __( 'Instead of clicking to open and close navigation sections, just hover over a menu item and the submenu will "fly out" to the side, allowing single-click access to any screen.' ) ) . '
'; + + $position['edge'] = 'left'; + $position['align'] = 'bottom'; + + _wp_pointer_javascript( 'wp330-flyout-menus', '#adminmenu', $content, $position ); +} + +/** + * Print 'Updated Media Uploader' for 3.3.0. + * + * @since 3.3.0 + */ +function _wp_pointer_print_wp330_media_uploader() { + $content = '' . 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.' ) ) . '
'; + + $position['align'] = 'right'; + + _wp_pointer_javascript( 'wp330-media-uploader', '#content-add_media', $content, $position ); +} + +/** + * Print 'New Feature: Saving Widgets' for 3.3.0. + * + * @since 3.3.0 + */ +function _wp_pointer_print_wp330_saving_widgets() { + $content = '' . esc_js( __( "If you change your mind and revert to your previous theme, we'll put the widgets back the way you had them." ) ) . '
'; + + $position['align'] = 'left'; + + _wp_pointer_javascript( 'wp330-saving-widgets', '#message2', $content, $position ); +}