Ticket #20554: 20554.3.diff
File 20554.3.diff, 3.8 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/template.php
1707 1707 'index.php' => 'wp330_toolbar', 1708 1708 'post-new.php' => 'wp330_media_uploader', 1709 1709 'post.php' => 'wp330_media_uploader', 1710 'themes.php' => 'wp330_saving_widgets',1710 'themes.php' => array( 'wp330_saving_widgets', 'wp340_customize_current_theme_link' ), 1711 1711 ); 1712 1712 1713 1713 // Check if screen related pointer is registered 1714 1714 if ( empty( $registered_pointers[ $hook_suffix ] ) ) 1715 1715 return; 1716 1716 1717 $pointer =$registered_pointers[ $hook_suffix ];1717 $pointers = (array) $registered_pointers[ $hook_suffix ]; 1718 1718 1719 1719 $caps_required = array( 1720 1720 'wp330_media_uploader' => array( 'upload_files' ), 1721 1721 'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ), 1722 'wp340_customize_current_theme_link' => array( 'edit_theme_options' ), 1722 1723 ); 1723 1724 1724 if ( isset( $caps_required[ $pointer ] ) ) { 1725 foreach ( $caps_required[ $pointer ] as $cap ) { 1726 if ( ! current_user_can( $cap ) ) 1727 return; 1725 // Get dismissed pointers 1726 $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); 1727 1728 $got_pointers = false; 1729 foreach ( array_diff( $pointers, $dismissed ) as $pointer ) { 1730 if ( isset( $caps_required[ $pointer ] ) ) { 1731 foreach ( $caps_required[ $pointer ] as $cap ) { 1732 if ( ! current_user_can( $cap ) ) 1733 continue 2; 1734 } 1728 1735 } 1736 1737 // Bind pointer print function 1738 add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) ); 1739 $got_pointers = true; 1729 1740 } 1730 1741 1731 // Get dismissed pointers 1732 $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); 1733 1734 // Pointer has been dismissed 1735 if ( in_array( $pointer, $dismissed ) ) 1742 if ( ! $got_pointers ) 1736 1743 return; 1737 1744 1738 // Bind pointer print function1739 add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );1740 1741 1745 // Add pointers script and style to queue 1742 1746 wp_enqueue_style( 'wp-pointer' ); 1743 1747 wp_enqueue_script( 'wp-pointer' ); … … 1825 1829 } 1826 1830 1827 1831 /** 1832 * Print 'New Feature: Current Theme Customize Link' for 3.4.0. 1833 * 1834 * @since 3.4.0 1835 */ 1836 public static function pointer_wp340_customize_current_theme_link() { 1837 $content = '<h3>' . __( 'New Feature: Customizer' ) . '</h3>'; 1838 $content .= '<p>' . __( 'Click Customize to change the header, background, title and menus of the current theme, all in one place.' ) . '</p>'; 1839 $content .= '<p>' . __( 'Click the Customize links in the Available Themes list below to customize, preview, and optionally activate the selected theme.' ) . '</p>'; 1840 1841 WP_Internal_Pointers::print_js( 'wp340_customize_current_theme_link', '#customize-current-theme-link', array( 1842 'content' => $content, 1843 'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left' ), 1844 ) ); 1845 } 1846 1847 /** 1828 1848 * Prevents new users from seeing existing 'new feature' pointers. 1829 1849 * 1830 1850 * @since 3.3.0 -
wp-admin/themes.php
140 140 </div> 141 141 142 142 <div class="theme-options"> 143 <a href="<?php echo wp_customize_url( $ct->get_stylesheet() ); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"><?php _e( 'Customize' )?></a>143 <a id="customize-current-theme-link" href="<?php echo wp_customize_url( $ct->get_stylesheet() ); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"><?php _e( 'Customize' )?></a> 144 144 <span><?php _e( 'Options:' )?></span> 145 145 <?php 146 146 // Pretend you didn't see this.