<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[28090] trunk/src/wp-admin/includes/template.php: Add a feature pointer for widgets in the customizer in 3.9.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/28090">28090</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2014-04-12 20:47:12 +0000 (Sat, 12 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add a feature pointer for widgets in the customizer in 3.9. Remove older pointers from 3.3 and 3.4.
see <a href="http://core.trac.wordpress.org/ticket/27777">#27777</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludestemplatephp">trunk/src/wp-admin/includes/template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/template.php (28089 => 28090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/template.php 2014-04-12 20:00:52 UTC (rev 28089)
+++ trunk/src/wp-admin/includes/template.php 2014-04-12 20:47:12 UTC (rev 28090)
</span><span class="lines">@@ -1829,8 +1829,8 @@
</span><span class="cx"> * All pointers can be disabled using the following:
</span><span class="cx"> * remove_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
</span><span class="cx"> *
</span><del>- * Individual pointers (e.g. wp330_toolbar) can be disabled using the following:
- * remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp330_toolbar' ) );
</del><ins>+ * Individual pointers (e.g. wp390_widgets) can be disabled using the following:
+ * remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp390_widgets' ) );
</ins><span class="cx"> */
</span><span class="cx"> public static function enqueue_scripts( $hook_suffix ) {
</span><span class="cx"> /*
</span><span class="lines">@@ -1839,13 +1839,11 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> $registered_pointers = array(
</span><del>- 'index.php' => 'wp330_toolbar',
</del><span class="cx"> 'post-new.php' => 'wp350_media',
</span><span class="cx"> 'post.php' => array( 'wp350_media', 'wp360_revisions' ),
</span><span class="cx"> 'edit.php' => 'wp360_locks',
</span><del>- 'themes.php' => array( 'wp330_saving_widgets', 'wp340_customize_current_theme_link' ),
- 'appearance_page_custom-header' => 'wp340_choose_image_from_library',
- 'appearance_page_custom-background' => 'wp340_choose_image_from_library',
</del><ins>+ 'widgets.php' => 'wp390_widgets',
+ 'themes.php' => 'wp390_widgets',
</ins><span class="cx"> );
</span><span class="cx">
</span><span class="cx"> // Check if screen related pointer is registered
</span><span class="lines">@@ -1855,9 +1853,6 @@
</span><span class="cx"> $pointers = (array) $registered_pointers[ $hook_suffix ];
</span><span class="cx">
</span><span class="cx"> $caps_required = array(
</span><del>- 'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ),
- 'wp340_customize_current_theme_link' => array( 'edit_theme_options' ),
- 'wp340_choose_image_from_library' => array( 'edit_theme_options' ),
</del><span class="cx"> 'wp350_media' => array( 'upload_files' ),
</span><span class="cx"> );
</span><span class="cx">
</span><span class="lines">@@ -1932,72 +1927,12 @@
</span><span class="cx"> <?php
</span><span class="cx"> }
</span><span class="cx">
</span><del>- public static function pointer_wp330_toolbar() {
- $content = '<h3>' . __( 'New Feature: Toolbar' ) . '</h3>';
- $content .= '<p>' . __( 'We’ve combined the admin bar and the old Dashboard header into one persistent toolbar. Hover over the toolbar items to see what’s new.' ) . '</p>';
-
- if ( is_multisite() && is_super_admin() )
- $content .= '<p>' . __( 'Network Admin is now located in the My Sites menu.' ) . '</p>';
-
- WP_Internal_Pointers::print_js( 'wp330_toolbar', '#wpadminbar', array(
- 'content' => $content,
- 'position' => array( 'edge' => 'top', 'align' => 'center' ),
- ) );
- }
-
- /**
- * Print 'Updated Media Uploader' for 3.3.0.
- *
- * @since 3.3.0
- */
</del><ins>+ public static function pointer_wp330_toolbar() {}
</ins><span class="cx"> public static function pointer_wp330_media_uploader() {}
</span><ins>+ public static function pointer_wp330_saving_widgets() {}
+ public static function pointer_wp340_customize_current_theme_link() {}
+ public static function pointer_wp340_choose_image_from_library() {}
</ins><span class="cx">
</span><del>- /**
- * Print 'New Feature: Saving Widgets' for 3.3.0.
- *
- * @since 3.3.0
- */
- public static function pointer_wp330_saving_widgets() {
- $content = '<h3>' . __( 'New Feature: Saving Widgets' ) . '</h3>';
- $content .= '<p>' . __( 'If you change your mind and revert to your previous theme, we’ll put the widgets back the way you had them.' ) . '</p>';
-
- WP_Internal_Pointers::print_js( 'wp330_saving_widgets', '#message2', array(
- 'content' => $content,
- 'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left' ),
- ) );
- }
-
- /**
- * 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 Live Preview links in the Available Themes list below to customize and preview another theme before activating it.' ) . '</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', 'offset' => is_rtl() ? '32 0' : '-32 0' ),
- ) );
- }
-
- /**
- * Print 'New Feature: Choose Image from Library' for 3.4.0.
- *
- * @since 3.4.0
- */
- public static function pointer_wp340_choose_image_from_library() {
- $content = '<h3>' . __( 'New Feature: Choose Image from Library' ) . '</h3>';
- $content .= '<p>' . __( 'Want to use an image you uploaded earlier? Select it from your media library instead of uploading it again.' ) . '</p>';
-
- WP_Internal_Pointers::print_js( 'wp340_choose_image_from_library', '#choose-from-library-link', array(
- 'content' => $content,
- 'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left', 'defer_loading' => true ),
- ) );
- }
-
</del><span class="cx"> public static function pointer_wp350_media() {
</span><span class="cx"> $content = '<h3>' . __( 'New Media Manager' ) . '</h3>';
</span><span class="cx"> $content .= '<p>' . __( 'Uploading files and creating image galleries has a whole new look. Check it out!' ) . '</p>';
</span><span class="lines">@@ -2019,25 +1954,52 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> public static function pointer_wp360_locks() {
</span><ins>+ if ( ! is_multi_author() ) {
+ return;
+ }
+
</ins><span class="cx"> $content = '<h3>' . __( 'Edit Lock' ) . '</h3>';
</span><span class="cx"> $content .= '<p>' . __( 'Someone else is editing this. No need to refresh; the lock will disappear when they’re done.' ) . '</p>';
</span><span class="cx">
</span><del>- if ( ! is_multi_author() )
- return;
-
</del><span class="cx"> self::print_js( 'wp360_locks', 'tr.wp-locked .locked-indicator', array(
</span><span class="cx"> 'content' => $content,
</span><span class="cx"> 'position' => array( 'edge' => 'left', 'align' => 'left' ),
</span><span class="cx"> ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ public static function pointer_wp390_widgets() {
+ if ( ! current_theme_supports( 'widgets' ) ) {
+ return;
+ }
+
+ $content = '<h3>' . __( 'New Feature: Live Widget Previews' ) . '</h3>';
+ $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’re ready.' ) . '</p>';
+
+ if ( 'themes' === get_current_screen()->id ) {
+ $selector = '.theme.active .customize';
+ $position = array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' );
+ } else {
+ $selector = 'a[href="customize.php"]';
+ if ( is_rtl() ) {
+ $position = array( 'edge' => 'right', 'align' => 'center-8px', 'my' => 'right-5px' );
+ } else {
+ $position = array( 'edge' => 'left', 'align' => 'center-8px', 'my' => 'left-5px' );
+ }
+ }
+
+ self::print_js( 'wp390_widgets', $selector, array(
+ 'content' => $content,
+ 'position' => $position,
+ ) );
+ }
+
</ins><span class="cx"> /**
</span><span class="cx"> * Prevents new users from seeing existing 'new feature' pointers.
</span><span class="cx"> *
</span><span class="cx"> * @since 3.3.0
</span><span class="cx"> */
</span><span class="cx"> public static function dismiss_pointers_for_new_users( $user_id ) {
</span><del>- 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' );
</del><ins>+ add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp350_media,wp360_revisions,wp360_locks,wp390_widgets' );
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>