1685 | | if ( $enqueue ) { |
1686 | | wp_enqueue_style( 'wp-pointer' ); |
1687 | | wp_enqueue_script( 'wp-pointer' ); |
1688 | | } |
| 1694 | // Pointers were already shown |
| 1695 | if ( empty( $pointers ) ) |
| 1696 | return; |
| 1697 | |
| 1698 | // Init pointers print functions |
| 1699 | foreach ( $pointers as $pointer ) |
| 1700 | add_action( 'admin_print_footer_scripts', '_wp_pointer_print_' . str_replace( '-', '_', $pointer ) ); |
| 1701 | |
| 1702 | // Add pointers script and style to queue |
| 1703 | wp_enqueue_style( 'wp-pointer' ); |
| 1704 | 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>'; |
| 1708 | /** |
| 1709 | * Print the pointer javascript data. |
| 1710 | * |
| 1711 | * @since 3.3.0 |
| 1712 | * |
| 1713 | * @param string $pointer_id The pointer ID |
| 1714 | * @param string $selector The HTML elements, on which the pointer should be attached |
| 1715 | * @param string $content The pointer content |
| 1716 | * @param array|string $position The pointer position, see wp-pointer.dev.js |
| 1717 | */ |
| 1718 | function _wp_pointer_print_js_data( $pointer_id, $selector, $content, $position ) { |
| 1719 | if ( empty( $pointer_id ) || empty( $selector ) || empty( $content ) ) |
| 1720 | return; |
| 1722 | // Set arrow and pointer position |
| 1723 | $_position = ''; |
| 1724 | if ( is_string( $position ) ) |
| 1725 | $_position = "position: '{$position}',"; |
| 1726 | elseif( is_array( $position ) ) { |
| 1727 | if ( ! empty( $position['edge'] ) && ! empty( $position['align'] ) ) { |
| 1728 | $_position = "position: { edge: '{$position['edge']}', align: '{$position['align']}' },"; |
| 1729 | } elseif ( ! empty( $position['edge'] ) ) { |
| 1730 | $_position = "position: { edge: '{$position['edge']}' },"; |
| 1731 | } elseif ( ! empty( $position['align'] ) ) { |
| 1732 | $_position = "position: { align: '{$position['align']}' },"; |
| 1733 | } |
| 1734 | } |
| 1754 | |
| 1755 | /** |
| 1756 | * Print 'New Feature: Toolbar' for 3.3.0. |
| 1757 | * |
| 1758 | * @since 3.3.0 |
| 1759 | */ |
| 1760 | function _wp_pointer_print_wp330_toolbar() { |
| 1761 | $content = '<h3>' . esc_js( __( 'New Feature: Toolbar' ) ). '</h3>'; |
| 1762 | $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>'; |
| 1763 | |
| 1764 | if ( is_multisite() && is_super_admin() ) |
| 1765 | $content .= '<p>' .esc_js( __( 'Network Admin is now located in the My Sites menu.' ) ) . '</p>'; |
| 1766 | |
| 1767 | $position['edge'] = 'top'; |
| 1768 | $position['align'] = 'right'; |
| 1769 | |
| 1770 | _wp_pointer_print_js_data( 'wp330-toolbar', '#wpadminbar', $content, $position ); |
| 1771 | } |
| 1772 | |
| 1773 | /** |
| 1774 | * Print 'New Feature: Flyout Menus' for 3.3.0. |
| 1775 | * |
| 1776 | * @since 3.3.0 |
| 1777 | */ |
| 1778 | function _wp_pointer_print_wp330_flyout_menus() { |
| 1779 | $content = '<h3>' . esc_js( __( 'New Feature: Flyout Menus' ) ) . '</h3>'; |
| 1780 | $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>'; |
| 1781 | |
| 1782 | $position['edge'] = 'left'; |
| 1783 | $position['align'] = 'center'; |
| 1784 | |
| 1785 | _wp_pointer_print_js_data( 'wp330-flyout-menus', '#menu-users', $content, $position ); |
| 1786 | } |
| 1787 | |
| 1788 | /** |
| 1789 | * Print 'Updated Media Uploader' for 3.3.0. |
| 1790 | * |
| 1791 | * @since 3.3.0 |
| 1792 | */ |
| 1793 | function _wp_pointer_print_wp330_media_uploader() { |
| 1794 | $content = '<h3>' . esc_js( __( 'Updated Media Uploader' ) ) . '</h3>'; |
| 1795 | $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>'; |
| 1796 | |
| 1797 | $position['edge'] = 'left'; |
| 1798 | $position['align'] = 'center'; |
| 1799 | |
| 1800 | _wp_pointer_print_js_data( 'wp330-media-uploader', '#content-add_media', $content, $position ); |
| 1801 | } |
| 1802 | |
| 1803 | /** |
| 1804 | * Print 'New Feature: Saving Widgets' for 3.3.0. |
| 1805 | * |
| 1806 | * @since 3.3.0 |
| 1807 | */ |
| 1808 | function _wp_pointer_print_wp330_saving_widgets() { |
| 1809 | $content = '<h3>' . esc_js( __( 'New Feature: Saving Widgets' ) ) . '</h3>'; |
| 1810 | $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>'; |
| 1811 | |
| 1812 | $position['edge'] = 'top'; |
| 1813 | $position['align'] = 'left'; |
| 1814 | |
| 1815 | _wp_pointer_print_js_data( 'wp330-saving-widgets', '#message2', $content, $position ); |
| 1816 | } |