Make WordPress Core

Changeset 20774


Ignore:
Timestamp:
05/11/2012 08:29:08 PM (13 years ago)
Author:
ryan
Message:

First pass at 3.4 pointers. Add pointer to the customize link for the current theme on themes.php. Support multiple pointers per page. Props scribu. see #20554

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r20710 r20774  
    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
     
    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        );
    1723 
    1724         if ( isset( $caps_required[ $pointer ] ) ) {
    1725             foreach ( $caps_required[ $pointer ] as $cap ) {
    1726                 if ( ! current_user_can( $cap ) )
    1727                     return;
    1728             }
    1729         }
    17301724
    17311725        // Get dismissed pointers
    17321726        $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
    17331727
    1734         // Pointer has been dismissed
    1735         if ( in_array( $pointer, $dismissed ) )
     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                }
     1735            }
     1736
     1737            // Bind pointer print function
     1738            add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
     1739            $got_pointers = true;
     1740        }
     1741
     1742        if ( ! $got_pointers )
    17361743            return;
    1737 
    1738         // Bind pointer print function
    1739         add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
    17401744
    17411745        // Add pointers script and style to queue
     
    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     *
  • trunk/wp-admin/themes.php

    r20747 r20774  
    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
Note: See TracChangeset for help on using the changeset viewer.