| 1676 | // Pointers to show, saved in format array( pointer_id => hook_suffix ) |
| 1677 | $pointers = apply_filters( 'wp_pointers', array( |
| 1678 | 'wp330-toolbar' => 'index.php', |
| 1679 | 'wp330-flyout-menus' => 'index.php', |
| 1680 | 'wp330-media-uploader' => 'post-new.php', |
| 1681 | 'wp330-saving-widgets' => 'themes.php' |
| 1682 | ) ); |
| 1683 | |
| 1684 | // Pointers which are dismissed |
1680 | | if ( ! in_array( 'wp330-admin-bar', $dismissed ) ) { |
1681 | | $enqueue = true; |
1682 | | add_action( 'admin_print_footer_scripts', '_wp_pointer_print_admin_bar' ); |
| 1687 | // Sort dismissed pointers out |
| 1688 | $pointer_ids = array_diff( array_keys($pointers), $dismissed ); |
| 1689 | |
| 1690 | // No pointers |
| 1691 | if ( empty( $pointers ) ) |
| 1692 | return; |
| 1693 | |
| 1694 | // Print pointers |
| 1695 | foreach ( $pointer_ids as $id ) { |
| 1696 | if ( $hook_suffix == $pointers[$id] ) { |
| 1697 | add_action( 'admin_print_footer_scripts', '_wp_pointer_print_' . str_replace( '-', '_', $id ) ); |
| 1698 | $enqueue = true; |
| 1699 | } |
1692 | | function _wp_pointer_print_admin_bar() { |
1693 | | $pointer_content = '<h3>' . 'The admin bar has been updated in WordPress 3.3.' . '</h3>'; |
1694 | | $pointer_content .= '<p>' . sprintf( 'Have some feedback? Visit the <a href="%s">forum</a>.', 'http://wordpress.org/support/forum/alphabeta' ) . '</p>'; |
1695 | | $pointer_content .= '<p>' . 'P.S. You are looking at a new admin pointer.' . '</p>'; |
| 1710 | /** |
| 1711 | * Print the pointer javascript data. |
| 1712 | * |
| 1713 | * @since 3.3.0 |
| 1714 | * |
| 1715 | * @param string $pointer_id The pointer ID |
| 1716 | * @param string $selector The HTML elements, on which the pointer should be attached. |
| 1717 | * @param string $content The pointer content |
| 1718 | * @param array $position The pointer position. Defaults to edge = top and align = center |
| 1719 | */ |
| 1720 | function _wp_pointer_javascript( $pointer_id, $selector, $content, $position = array() ) { |
| 1721 | if ( empty( $pointer_id ) || empty( $selector ) || empty( $content ) ) |
| 1722 | return; |
| 1751 | |
| 1752 | |
| 1753 | /** |
| 1754 | * Print 'New Feature: Toolbar' for 3.3.0. |
| 1755 | * |
| 1756 | * @since 3.3.0 |
| 1757 | */ |
| 1758 | function _wp_pointer_print_wp330_toolbar() { |
| 1759 | $content = '<h3>' . esc_js( __( 'New Feature: Toolbar' ) ). '</h3>'; |
| 1760 | $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>'; |
| 1761 | |
| 1762 | if ( is_multisite() && is_super_admin() ) |
| 1763 | $content .= '<p>' .esc_js( __( 'Network Admin is now located in the My Sites menu.' ) ) . '</p>'; |
| 1764 | |
| 1765 | $position['align'] = 'right'; |
| 1766 | |
| 1767 | _wp_pointer_javascript( 'wp330-toolbar', '#wpadminbar', $content, $position ); |
| 1768 | } |
| 1769 | |
| 1770 | /** |
| 1771 | * Print 'New Feature: Flyout Menus' for 3.3.0. |
| 1772 | * |
| 1773 | * @since 3.3.0 |
| 1774 | */ |
| 1775 | function _wp_pointer_print_wp330_flyout_menus() { |
| 1776 | $content = '<h3>' . esc_js( __( 'New Feature: Flyout Menus' ) ) . '</h3>'; |
| 1777 | $content .= '<p>' . 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.' ) ) . '</p>'; |
| 1778 | |
| 1779 | $position['edge'] = 'left'; |
| 1780 | $position['align'] = 'bottom'; |
| 1781 | |
| 1782 | _wp_pointer_javascript( 'wp330-flyout-menus', '#adminmenu', $content, $position ); |
| 1783 | } |
| 1784 | |
| 1785 | /** |
| 1786 | * Print 'Updated Media Uploader' for 3.3.0. |
| 1787 | * |
| 1788 | * @since 3.3.0 |
| 1789 | */ |
| 1790 | function _wp_pointer_print_wp330_media_uploader() { |
| 1791 | $content = '<h3>' . esc_js( __( 'Updated Media Uploader' ) ) . '</h3>'; |
| 1792 | $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>'; |
| 1793 | |
| 1794 | $position['align'] = 'right'; |
| 1795 | |
| 1796 | _wp_pointer_javascript( 'wp330-media-uploader', '#content-add_media', $content, $position ); |
| 1797 | } |
| 1798 | |
| 1799 | /** |
| 1800 | * Print 'New Feature: Saving Widgets' for 3.3.0. |
| 1801 | * |
| 1802 | * @since 3.3.0 |
| 1803 | */ |
| 1804 | function _wp_pointer_print_wp330_saving_widgets() { |
| 1805 | $content = '<h3>' . esc_js( __( 'New Feature: Saving Widgets' ) ) . '</h3>'; |
| 1806 | $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>'; |
| 1807 | |
| 1808 | $position['align'] = 'left'; |
| 1809 | |
| 1810 | _wp_pointer_javascript( 'wp330-saving-widgets', '#message2', $content, $position ); |
| 1811 | } |