Make WordPress Core

Changeset 28090


Ignore:
Timestamp:
04/12/2014 08:47:12 PM (11 years ago)
Author:
nacin
Message:

Add a feature pointer for widgets in the customizer in 3.9. Remove older pointers from 3.3 and 3.4.

see #27777.

File:
1 edited

Legend:

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

    r27776 r28090  
    18301830     *     remove_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
    18311831     *
    1832      * Individual pointers (e.g. wp330_toolbar) can be disabled using the following:
    1833      *     remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp330_toolbar' ) );
     1832     * Individual pointers (e.g. wp390_widgets) can be disabled using the following:
     1833     *     remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp390_widgets' ) );
    18341834     */
    18351835    public static function enqueue_scripts( $hook_suffix ) {
     
    18401840
    18411841        $registered_pointers = array(
    1842             'index.php'    => 'wp330_toolbar',
    18431842            'post-new.php' => 'wp350_media',
    18441843            'post.php'     => array( 'wp350_media', 'wp360_revisions' ),
    18451844            'edit.php'     => 'wp360_locks',
    1846             'themes.php'   => array( 'wp330_saving_widgets', 'wp340_customize_current_theme_link' ),
    1847             'appearance_page_custom-header' => 'wp340_choose_image_from_library',
    1848             'appearance_page_custom-background' => 'wp340_choose_image_from_library',
     1845            'widgets.php'  => 'wp390_widgets',
     1846            'themes.php'   => 'wp390_widgets',
    18491847        );
    18501848
     
    18561854
    18571855        $caps_required = array(
    1858             'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ),
    1859             'wp340_customize_current_theme_link' => array( 'edit_theme_options' ),
    1860             'wp340_choose_image_from_library' => array( 'edit_theme_options' ),
    18611856            'wp350_media' => array( 'upload_files' ),
    18621857        );
     
    19331928    }
    19341929
    1935     public static function pointer_wp330_toolbar() {
    1936         $content  = '<h3>' . __( 'New Feature: Toolbar' ) . '</h3>';
    1937         $content .= '<p>' .  __( 'We&#8217;ve combined the admin bar and the old Dashboard header into one persistent toolbar. Hover over the toolbar items to see what&#8217;s new.' ) . '</p>';
    1938 
    1939         if ( is_multisite() && is_super_admin() )
    1940             $content .= '<p>' . __( 'Network Admin is now located in the My Sites menu.' ) . '</p>';
    1941 
    1942         WP_Internal_Pointers::print_js( 'wp330_toolbar', '#wpadminbar', array(
    1943             'content'  => $content,
    1944             'position' => array( 'edge' => 'top', 'align' => 'center' ),
    1945         ) );
    1946     }
    1947 
    1948     /**
    1949      * Print 'Updated Media Uploader' for 3.3.0.
    1950      *
    1951      * @since 3.3.0
    1952      */
     1930    public static function pointer_wp330_toolbar() {}
    19531931    public static function pointer_wp330_media_uploader() {}
    1954 
    1955     /**
    1956      * Print 'New Feature: Saving Widgets' for 3.3.0.
    1957      *
    1958      * @since 3.3.0
    1959      */
    1960     public static function pointer_wp330_saving_widgets() {
    1961         $content  = '<h3>' . __( 'New Feature: Saving Widgets' ) . '</h3>';
    1962         $content .= '<p>' . __( 'If you change your mind and revert to your previous theme, we&#8217;ll put the widgets back the way you had them.' ) . '</p>';
    1963 
    1964         WP_Internal_Pointers::print_js( 'wp330_saving_widgets', '#message2', array(
    1965             'content'  => $content,
    1966             'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left' ),
    1967         ) );
    1968     }
    1969 
    1970     /**
    1971      * Print 'New Feature: Current Theme Customize Link' for 3.4.0.
    1972      *
    1973      * @since 3.4.0
    1974      */
    1975     public static function pointer_wp340_customize_current_theme_link() {
    1976         $content  = '<h3>' . __( 'New Feature: Customizer' ) . '</h3>';
    1977         $content .= '<p>' . __( 'Click Customize to change the header, background, title and menus of the current theme, all in one place.' ) . '</p>';
    1978         $content .= '<p>' . __( 'Click the Live Preview links in the Available Themes list below to customize and preview another theme before activating it.' ) . '</p>';
    1979 
    1980         WP_Internal_Pointers::print_js( 'wp340_customize_current_theme_link', '#customize-current-theme-link', array(
    1981             'content'  => $content,
    1982             'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left', 'offset' => is_rtl() ? '32 0' : '-32 0' ),
    1983         ) );
    1984     }
    1985 
    1986     /**
    1987      * Print 'New Feature: Choose Image from Library' for 3.4.0.
    1988      *
    1989      * @since 3.4.0
    1990      */
    1991     public static function pointer_wp340_choose_image_from_library() {
    1992         $content  = '<h3>' . __( 'New Feature: Choose Image from Library' ) . '</h3>';
    1993         $content .= '<p>' . __( 'Want to use an image you uploaded earlier? Select it from your media library instead of uploading it again.' ) . '</p>';
    1994 
    1995         WP_Internal_Pointers::print_js( 'wp340_choose_image_from_library', '#choose-from-library-link', array(
    1996             'content'  => $content,
    1997             'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left', 'defer_loading' => true ),
    1998         ) );
    1999     }
     1932    public static function pointer_wp330_saving_widgets() {}
     1933    public static function pointer_wp340_customize_current_theme_link() {}
     1934    public static function pointer_wp340_choose_image_from_library() {}
    20001935
    20011936    public static function pointer_wp350_media() {
     
    20201955
    20211956    public static function pointer_wp360_locks() {
     1957        if ( ! is_multi_author() ) {
     1958            return;
     1959        }
     1960
    20221961        $content  = '<h3>' . __( 'Edit Lock' ) . '</h3>';
    20231962        $content .= '<p>' . __( 'Someone else is editing this. No need to refresh; the lock will disappear when they&#8217;re done.' ) . '</p>';
    2024 
    2025         if ( ! is_multi_author() )
    2026             return;
    20271963
    20281964        self::print_js( 'wp360_locks', 'tr.wp-locked .locked-indicator', array(
     
    20321968    }
    20331969
     1970    public static function pointer_wp390_widgets() {
     1971        if ( ! current_theme_supports( 'widgets' ) ) {
     1972            return;
     1973        }
     1974
     1975        $content  = '<h3>' . __( 'New Feature: Live Widget Previews' ) . '</h3>';
     1976        $content .= '<p>' . __( 'Add, edit, and play around with your widgets from the theme customizer.' ) . ' ' . __( 'Preview your changes in real-time and only save them when you&#8217;re ready.' ) . '</p>';
     1977
     1978        if ( 'themes' === get_current_screen()->id ) {
     1979            $selector = '.theme.active .customize';
     1980            $position = array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' );
     1981        } else {
     1982            $selector = 'a[href="customize.php"]';
     1983            if ( is_rtl() ) {
     1984                $position = array( 'edge' => 'right', 'align' => 'center-8px', 'my' => 'right-5px' );
     1985            } else {
     1986                $position = array( 'edge' => 'left', 'align' => 'center-8px', 'my' => 'left-5px' );
     1987            }
     1988        }
     1989
     1990        self::print_js( 'wp390_widgets', $selector, array(
     1991            'content' => $content,
     1992            'position' => $position,
     1993        ) );
     1994    }
     1995
    20341996    /**
    20351997     * Prevents new users from seeing existing 'new feature' pointers.
     
    20382000     */
    20392001    public static function dismiss_pointers_for_new_users( $user_id ) {
    2040         add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp330_toolbar,wp330_saving_widgets,wp340_choose_image_from_library,wp340_customize_current_theme_link,wp350_media,wp360_revisions,wp360_locks' );
     2002        add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp350_media,wp360_revisions,wp360_locks,wp390_widgets' );
    20412003    }
    20422004}
Note: See TracChangeset for help on using the changeset viewer.