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
git-svn-id: http://core.svn.wordpress.org/trunk@20774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eefdd33f6c
commit
e44a0c3930
|
@ -1707,36 +1707,40 @@ final class WP_Internal_Pointers {
|
|||
'index.php' => 'wp330_toolbar',
|
||||
'post-new.php' => 'wp330_media_uploader',
|
||||
'post.php' => 'wp330_media_uploader',
|
||||
'themes.php' => 'wp330_saving_widgets',
|
||||
'themes.php' => array( 'wp330_saving_widgets', 'wp340_customize_current_theme_link' ),
|
||||
);
|
||||
|
||||
// Check if screen related pointer is registered
|
||||
if ( empty( $registered_pointers[ $hook_suffix ] ) )
|
||||
return;
|
||||
|
||||
$pointer = $registered_pointers[ $hook_suffix ];
|
||||
$pointers = (array) $registered_pointers[ $hook_suffix ];
|
||||
|
||||
$caps_required = array(
|
||||
'wp330_media_uploader' => array( 'upload_files' ),
|
||||
'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ),
|
||||
'wp340_customize_current_theme_link' => array( 'edit_theme_options' ),
|
||||
);
|
||||
|
||||
if ( isset( $caps_required[ $pointer ] ) ) {
|
||||
foreach ( $caps_required[ $pointer ] as $cap ) {
|
||||
if ( ! current_user_can( $cap ) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Get dismissed pointers
|
||||
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
|
||||
|
||||
// Pointer has been dismissed
|
||||
if ( in_array( $pointer, $dismissed ) )
|
||||
return;
|
||||
$got_pointers = false;
|
||||
foreach ( array_diff( $pointers, $dismissed ) as $pointer ) {
|
||||
if ( isset( $caps_required[ $pointer ] ) ) {
|
||||
foreach ( $caps_required[ $pointer ] as $cap ) {
|
||||
if ( ! current_user_can( $cap ) )
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Bind pointer print function
|
||||
add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
|
||||
// Bind pointer print function
|
||||
add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
|
||||
$got_pointers = true;
|
||||
}
|
||||
|
||||
if ( ! $got_pointers )
|
||||
return;
|
||||
|
||||
// Add pointers script and style to queue
|
||||
wp_enqueue_style( 'wp-pointer' );
|
||||
|
@ -1824,6 +1828,22 @@ final class WP_Internal_Pointers {
|
|||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Print 'New Feature: Current Theme Customize Link' for 3.4.0.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public static function pointer_wp340_customize_current_theme_link() {
|
||||
$content = '<h3>' . __( 'New Feature: Customizer' ) . '</h3>';
|
||||
$content .= '<p>' . __( 'Click Customize to change the header, background, title and menus of the current theme, all in one place.' ) . '</p>';
|
||||
$content .= '<p>' . __( 'Click the Customize links in the Available Themes list below to customize, preview, and optionally activate the selected theme.' ) . '</p>';
|
||||
|
||||
WP_Internal_Pointers::print_js( 'wp340_customize_current_theme_link', '#customize-current-theme-link', array(
|
||||
'content' => $content,
|
||||
'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left' ),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents new users from seeing existing 'new feature' pointers.
|
||||
*
|
||||
|
|
|
@ -140,7 +140,7 @@ $customize_title = sprintf( __( 'Customize “%s”' ), $ct->display('Na
|
|||
</div>
|
||||
|
||||
<div class="theme-options">
|
||||
<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>
|
||||
<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>
|
||||
<span><?php _e( 'Options:' )?></span>
|
||||
<?php
|
||||
// Pretend you didn't see this.
|
||||
|
|
Loading…
Reference in New Issue