| 1685 | | if ( $enqueue ) { |
| 1686 | | wp_enqueue_style( 'wp-pointer' ); |
| 1687 | | wp_enqueue_script( 'wp-pointer' ); |
| 1688 | | } |
| | 1699 | // Pointers were already shown |
| | 1700 | if ( empty( $pointers ) ) |
| | 1701 | return; |
| | 1702 | |
| | 1703 | // Init pointers print functions |
| | 1704 | foreach ( $pointers as $pointer ) |
| | 1705 | add_action( 'admin_print_footer_scripts', '_wp_pointer_print_' . str_replace( '-', '_', $pointer ) ); |
| | 1706 | |
| | 1707 | // Add pointers script and style to queue |
| | 1708 | wp_enqueue_style( 'wp-pointer' ); |
| | 1709 | wp_enqueue_script( 'wp-pointer' ); |
| 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>'; |
| | 1713 | /** |
| | 1714 | * Print the pointer javascript data. |
| | 1715 | * |
| | 1716 | * @since 3.3.0 |
| | 1717 | * |
| | 1718 | * @param string $pointer_id The pointer ID. |
| | 1719 | * @param string $selector The HTML elements, on which the pointer should be attached. |
| | 1720 | * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.dev.js). |
| | 1721 | */ |
| | 1722 | function _wp_pointer_print_js_data( $pointer_id, $selector, $args ) { |
| | 1723 | if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) |
| | 1724 | return; |
| | 1750 | |
| | 1751 | /** |
| | 1752 | * Print 'New Feature: Toolbar' for 3.3.0. |
| | 1753 | * |
| | 1754 | * @since 3.3.0 |
| | 1755 | */ |
| | 1756 | function _wp_pointer_print_wp330_toolbar() { |
| | 1757 | $content = '<h3>' . esc_js( __( 'New Feature: Toolbar' ) ). '</h3>'; |
| | 1758 | $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>'; |
| | 1759 | |
| | 1760 | if ( is_multisite() && is_super_admin() ) |
| | 1761 | $content .= '<p>' .esc_js( __( 'Network Admin is now located in the My Sites menu.' ) ) . '</p>'; |
| | 1762 | |
| | 1763 | _wp_pointer_print_js_data( 'wp330-toolbar', '#wpadminbar', array( |
| | 1764 | 'content' => $content, |
| | 1765 | 'position' => array( 'edge' => 'top', 'align' => 'right' ), |
| | 1766 | ) ); |
| | 1767 | } |
| | 1768 | |
| | 1769 | /** |
| | 1770 | * Print 'New Feature: Flyout Menus' for 3.3.0. |
| | 1771 | * |
| | 1772 | * @since 3.3.0 |
| | 1773 | */ |
| | 1774 | function _wp_pointer_print_wp330_flyout_menus() { |
| | 1775 | $content = '<h3>' . esc_js( __( 'New Feature: Flyout Menus' ) ) . '</h3>'; |
| | 1776 | $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>'; |
| | 1777 | |
| | 1778 | _wp_pointer_print_js_data( 'wp330-flyout-menus', '#menu-users', array( |
| | 1779 | 'content' => $content, |
| | 1780 | 'position' => array( 'edge' => 'left', 'align' => 'center' ), |
| | 1781 | ) ); |
| | 1782 | } |
| | 1783 | |
| | 1784 | /** |
| | 1785 | * Print 'Updated Media Uploader' for 3.3.0. |
| | 1786 | * |
| | 1787 | * @since 3.3.0 |
| | 1788 | */ |
| | 1789 | function _wp_pointer_print_wp330_media_uploader() { |
| | 1790 | $content = '<h3>' . esc_js( __( 'Updated Media Uploader' ) ) . '</h3>'; |
| | 1791 | $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>'; |
| | 1792 | |
| | 1793 | _wp_pointer_print_js_data( 'wp330-media-uploader', '#content-add_media', array( |
| | 1794 | 'content' => $content, |
| | 1795 | 'position' => array( 'edge' => 'left', 'align' => 'center' ), |
| | 1796 | ) ); |
| | 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 | _wp_pointer_print_js_data( 'wp330-saving-widgets', '#message2', array( |
| | 1809 | 'content' => $content, |
| | 1810 | 'position' => array( 'edge' => 'top', 'align' => 'left' ), |
| | 1811 | ) ); |
| | 1812 | |
| | 1813 | } |