Make WordPress Core

Ticket #20554: 20554.3.diff

File 20554.3.diff, 3.8 KB (added by ryan, 13 years ago)

Refresh

  • wp-admin/includes/template.php

     
    17071707                        'index.php'    => 'wp330_toolbar',
    17081708                        'post-new.php' => 'wp330_media_uploader',
    17091709                        'post.php'     => 'wp330_media_uploader',
    1710                         'themes.php'   => 'wp330_saving_widgets',
     1710                        'themes.php'   => array( 'wp330_saving_widgets', 'wp340_customize_current_theme_link' ),
    17111711                );
    17121712
    17131713                // Check if screen related pointer is registered
    17141714                if ( empty( $registered_pointers[ $hook_suffix ] ) )
    17151715                        return;
    17161716
    1717                 $pointer = $registered_pointers[ $hook_suffix ];
     1717                $pointers = (array) $registered_pointers[ $hook_suffix ];
    17181718
    17191719                $caps_required = array(
    17201720                        'wp330_media_uploader' => array( 'upload_files' ),
    17211721                        'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ),
     1722                        'wp340_customize_current_theme_link' => array( 'edit_theme_options' ),
    17221723                );
    17231724
    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                                }
    17281735                        }
     1736
     1737                        // Bind pointer print function
     1738                        add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
     1739                        $got_pointers = true;
    17291740                }
    17301741
    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 )
    17361743                        return;
    17371744
    1738                 // Bind pointer print function
    1739                 add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
    1740 
    17411745                // Add pointers script and style to queue
    17421746                wp_enqueue_style( 'wp-pointer' );
    17431747                wp_enqueue_script( 'wp-pointer' );
     
    18251829        }
    18261830
    18271831        /**
     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        /**
    18281848         * Prevents new users from seeing existing 'new feature' pointers.
    18291849         *
    18301850         * @since 3.3.0
  • wp-admin/themes.php

     
    140140        </div>
    141141
    142142<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>
    144144        <span><?php _e( 'Options:' )?></span>
    145145        <?php
    146146        // Pretend you didn't see this.