Changeset 44106
- Timestamp:
- 12/13/2018 09:06:20 AM (6 years ago)
- Location:
- branches/4.9
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
- Property svn:mergeinfo changed
/branches/5.0 merged: 43807
- Property svn:mergeinfo changed
-
branches/4.9/src/wp-admin/admin-ajax.php
r43537 r44106 68 68 'wp-privacy-export-personal-data', 69 69 'wp-privacy-erase-personal-data', 70 'update-try-gutenberg-panel',71 70 ); 72 71 -
branches/4.9/src/wp-admin/css/common.css
r43502 r44106 765 765 /* @todo can we combine these into a class or use an existing dashicon one? */ 766 766 .welcome-panel .welcome-panel-close:before, 767 .try-gutenberg-panel .try-gutenberg-panel-close:before,768 767 .tagchecklist .ntdelbutton .remove-tag-icon:before, 769 768 #bulk-titles div a:before, -
branches/4.9/src/wp-admin/css/dashboard.css
r43674 r44106 99 99 100 100 /* Welcome Panel */ 101 .welcome-panel, 102 .try-gutenberg-panel { 101 .welcome-panel { 103 102 position: relative; 104 103 overflow: auto; … … 112 111 } 113 112 114 .welcome-panel h2, 115 .try-gutenberg-panel h2 { 113 .welcome-panel h2 { 116 114 margin: 0; 117 115 font-size: 21px; … … 125 123 } 126 124 127 .try-gutenberg-panel h3 { 128 margin: 17px 0 0; 125 .welcome-panel li { 126 font-size: 14px; 127 } 128 129 .welcome-panel p { 130 color: #72777c; 131 } 132 133 .welcome-panel a { 134 text-decoration: none; 135 } 136 137 .welcome-panel .about-description { 129 138 font-size: 16px; 130 line-height: 1.4; 131 } 132 133 .welcome-panel li, 134 .try-gutenberg-panel li { 135 font-size: 14px; 136 } 137 138 .welcome-panel p, 139 .try-gutenberg-panel p { 140 color: #72777c; 141 } 142 143 .welcome-panel a, 144 .try-gutenberg-action a { 145 text-decoration: none; 146 } 147 148 .welcome-panel .about-description, 149 .try-gutenberg-panel .about-description { 150 font-size: 16px; 151 margin: 0; 152 } 153 154 .try-gutenberg-panel-content hr { 155 margin: 20px -23px 0 -23px; 156 border-top: 1px solid #f3f4f5; 157 border-bottom: none; 158 } 159 160 .welcome-panel .welcome-panel-close, 161 .try-gutenberg-panel .try-gutenberg-panel-close { 139 margin: 0; 140 } 141 142 .welcome-panel .welcome-panel-close { 162 143 position: absolute; 163 144 z-index: 10; … … 170 151 } 171 152 172 .welcome-panel .welcome-panel-close:before, 173 .try-gutenberg-panel .try-gutenberg-panel-close:before { 153 .welcome-panel .welcome-panel-close:before { 174 154 position: absolute; 175 155 top: 8px; … … 186 166 } 187 167 188 .welcome-panel-content, 189 .try-gutenberg-panel-content { 168 .welcome-panel-content { 190 169 margin: 0 13px; 191 170 max-width: 1500px; 192 }193 194 .try-gutenberg-panel img {195 margin-top: 23px;196 width: calc( 100% - 40px );197 border: 1px solid #f3f4f5;198 }199 200 .try-gutenberg-panel .install-now.updating-message:before,201 .try-gutenberg-panel .install-now.updated-message:before {202 margin-top: 11px;203 171 } 204 172 … … 214 182 } 215 183 216 .try-gutenberg-panel .try-gutenberg-panel-column > * {217 padding-right: 40px;218 }219 220 184 .ie8 .welcome-panel .welcome-panel-column { 221 185 min-width: 230px; … … 226 190 } 227 191 228 .try-gutenberg-panel .try-gutenberg-panel-column-container {229 display: flex;230 margin-bottom: 13px;231 }232 233 @supports (display: grid) {234 .try-gutenberg-panel .try-gutenberg-panel-column-container {235 display: -ms-grid;236 display: grid;237 -ms-grid-columns: 36% 32% 32%;238 grid-template-columns: 36% 32% 32%;239 }240 }241 242 .try-gutenberg-panel .try-gutenberg-panel-image-column {243 width: 36%;244 }245 246 @supports (display: grid) {247 .try-gutenberg-panel .try-gutenberg-panel-image-column {248 width: auto;249 }250 }251 252 .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {253 display: flex;254 flex-direction: column;255 justify-content: space-between;256 width: 32%;257 }258 259 @supports (display: grid) {260 .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {261 display: -ms-grid;262 display: grid;263 -ms-grid-rows: auto 100px;264 grid-template-rows: auto 100px;265 width: auto;266 }267 }268 269 .try-gutenberg-panel .try-gutenberg-action {270 height: 100px;271 }272 273 @supports (display: grid) {274 .try-gutenberg-panel .try-gutenberg-action {275 height: auto;276 }277 }278 279 192 .welcome-panel-column p.hide-if-no-customize { 280 193 margin-top: 10px; 281 194 } 282 195 283 .welcome-panel-column p, 284 .try-gutenberg-panel-column p { 196 .welcome-panel-column p { 285 197 margin-top: 7px; 286 198 color: #444; … … 1297 1209 } 1298 1210 1299 @media screen and (max-width: 1024px) {1300 .try-gutenberg-panel .try-gutenberg-panel-column-container {1301 -ms-grid-columns: 50% 50%;1302 grid-template-columns: 50% 50%;1303 }1304 1305 .try-gutenberg-panel .try-gutenberg-panel-image-column {1306 display: none;1307 }1308 1309 .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {1310 width: 50%;1311 }1312 1313 @supports (display: grid) {1314 .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {1315 width: auto;1316 }1317 }1318 }1319 1320 1211 @media screen and (max-width: 870px) { 1321 1212 .welcome-panel .welcome-panel-column, … … 1323 1214 display: block; 1324 1215 float: none; 1325 width: 100%;1326 }1327 1328 .try-gutenberg-panel .try-gutenberg-panel-column-container {1329 flex-wrap: wrap;1330 }1331 1332 @supports (display: grid) {1333 .try-gutenberg-panel .try-gutenberg-panel-column-container {1334 -ms-grid-columns: 100%;1335 grid-template-columns: 100%;1336 }1337 }1338 1339 .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {1340 1216 width: 100%; 1341 1217 } … … 1391 1267 @media screen and (max-width: 600px) { 1392 1268 /* Keep the close icon from overlapping the Welcome text. */ 1393 .welcome-panel .welcome-panel-close, 1394 .try-gutenberg-panel .try-gutenberg-panel-close { 1269 .welcome-panel .welcome-panel-close { 1395 1270 overflow: hidden; 1396 1271 text-indent: 40px; … … 1404 1279 1405 1280 /* Make the close icon larger for tappability. */ 1406 .welcome-panel .welcome-panel-close:before, 1407 .try-gutenberg-panel .try-gutenberg-panel-close:before { 1281 .welcome-panel .welcome-panel-close:before { 1408 1282 font-size: 20px; 1409 1283 top: 5px; -
branches/4.9/src/wp-admin/includes/ajax-actions.php
r44053 r44106 1486 1486 1487 1487 /** 1488 * Ajax handler for updating whether to display the Try Gutenberg panel.1489 *1490 * @since 4.9.81491 */1492 function wp_ajax_update_try_gutenberg_panel() {1493 check_ajax_referer( 'try-gutenberg-panel-nonce', 'trygutenbergpanelnonce' );1494 1495 update_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', empty( $_POST['visible'] ) ? 0 : 1 );1496 1497 wp_die( 1 );1498 }1499 1500 /**1501 1488 * Ajax handler for retrieving menu meta boxes. 1502 1489 * -
branches/4.9/src/wp-admin/includes/class-wp-screen.php
r44051 r44106 1035 1035 } 1036 1036 1037 if ( 'dashboard' === $this->id && has_action( 'try_gutenberg_panel' ) ) {1038 if ( isset( $_GET['try_gutenberg'] ) ) {1039 $try_gutenberg_checked = empty( $_GET['try_gutenberg'] ) ? 0 : 1;1040 update_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', $try_gutenberg_checked );1041 } else {1042 $try_gutenberg_checked = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );1043 if ( '' === $try_gutenberg_checked ) {1044 $try_gutenberg_checked = '1';1045 }1046 if ( '2' === $try_gutenberg_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {1047 $try_gutenberg_checked = false;1048 }1049 }1050 echo '<label for="wp_try_gutenberg_panel-hide">';1051 echo '<input type="checkbox" id="wp_try_gutenberg_panel-hide"' . checked( (bool) $try_gutenberg_checked, true, false ) . ' />';1052 echo __( 'New Editor' ) . "</label>\n";1053 }1054 1037 ?> 1055 1038 </fieldset> -
branches/4.9/src/wp-admin/includes/dashboard.php
r43544 r44106 24 24 25 25 /* Register Widgets and Controls */ 26 27 // Try Gutenberg28 29 // If Gutenberg isn't activated, only show the panel to users who can install and activate it.30 $plugins = get_plugins();31 if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'install_plugins' ) ) {32 remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );33 }34 // If Gutenberg is activated, only show it to users who can use it.35 if ( is_plugin_active( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'edit_posts' ) ) {36 remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );37 }38 26 39 27 $response = wp_check_browser_version(); … … 1632 1620 <?php 1633 1621 } 1634 1635 /**1636 * Displays a Try Gutenberg Panel, to introduce people to Gutenberg1637 *1638 * @since 4.9.81639 */1640 function wp_try_gutenberg_panel() {1641 $plugins = get_plugins();1642 $action = $url = $classes = '';1643 $classic_action = $classic_url = $classic_classes = '';1644 1645 if ( current_user_can( 'install_plugins' ) ) {1646 if ( empty( $plugins['gutenberg/gutenberg.php'] ) ) {1647 if ( get_filesystem_method( array(), WP_PLUGIN_DIR ) === 'direct' ) {1648 $action = __( 'Install Gutenberg' );1649 $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' );1650 $classes = ' install-now';1651 }1652 } else if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) {1653 $action = __( 'Activate Gutenberg' );1654 $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php&from=try-gutenberg' ), 'activate-plugin_gutenberg/gutenberg.php' );1655 $classes = ' activate-now';1656 }1657 1658 if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) {1659 if ( get_filesystem_method( array(), WP_PLUGIN_DIR ) === 'direct' ) {1660 $classic_action = __( 'Install the Classic Editor' );1661 $classic_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=classic-editor' ), 'install-plugin_classic-editor' );1662 $classic_classes = ' install-now';1663 }1664 } else if ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) {1665 $classic_action = __( 'Activate the Classic Editor' );1666 $classic_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php&from=try-gutenberg' ), 'activate-plugin_classic-editor/classic-editor.php' );1667 $classic_classes = ' activate-now';1668 } else {1669 $classic_action = __( 'The Classic Editor is activated' );1670 $classic_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php&from=try-gutenberg' ), 'activate-plugin_classic-editor/classic-editor.php' );;1671 $classic_classes = ' button-disabled install-now updated-message';1672 }1673 }1674 1675 if ( current_user_can( 'edit_posts' ) && is_plugin_active( 'gutenberg/gutenberg.php' ) ) {1676 $action = __( 'Try Gutenberg' );1677 $url = admin_url( 'admin.php?page=gutenberg' );1678 }1679 1680 ?>1681 <div class="try-gutenberg-panel-content">1682 <h2><?php _e( 'A new, modern publishing experience is coming soon.' ); ?></h2>1683 1684 <p class="about-description"><?php _e( "Take your words, media, and layout in new directions with Gutenberg, the WordPress editor we're currently building." ); ?></p>1685 1686 <hr />1687 1688 <div class="try-gutenberg-panel-column-container">1689 <div class="try-gutenberg-panel-column try-gutenberg-panel-image-column">1690 <picture>1691 <source srcset="about:blank" media="(max-width: 1024px)">1692 <img src="https://s.w.org/images/core/gutenberg-screenshot.png?<?php echo date( 'Ymd' ); ?>" alt="<?php esc_attr_e( 'Screenshot from the Gutenberg interface' ); ?>" />1693 </picture>1694 </div>1695 <div class="try-gutenberg-panel-column plugin-card-gutenberg">1696 1697 <div>1698 <h3><?php _e( 'Test the new editor today.' ); ?></h3>1699 1700 <p>1701 <?php _e( "You can take Gutenberg for a spin (and share your feedback, if you’d like) before we officially release it, by installing it as a plugin." ); ?>1702 <?php1703 printf(1704 /* translators: 1: Gutenberg call for testing handbook link, 2: Gutenberg GitHub repository issues link, 3: Gutenberg GitHub repository CONTRIBUTING.md link */1705 __( 'You can help by <a href="%1$s">testing</a>, <a href="%2$s">filing bugs</a>, or contributing on the <a href="%3$s">GitHub repository</a>.' ),1706 'https://make.wordpress.org/test/handbook/call-for-testing/gutenberg-testing/',1707 'https://github.com/WordPress/gutenberg/issues',1708 'https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md'1709 );1710 ?>1711 </p>1712 </div>1713 1714 <div class="try-gutenberg-action">1715 <?php if ( $action ) { ?>1716 <p><a class="button button-primary button-hero<?php echo $classes; ?>" href="<?php echo esc_url( $url ); ?>" data-name="<?php esc_attr_e( 'Gutenberg' ); ?>" data-slug="gutenberg"><?php echo $action; ?></a></p>1717 <?php } ?>1718 1719 <p>1720 <?php1721 $learnmore = sprintf(1722 /* translators: Link to https://wordpress.org/gutenberg/ */1723 __( '<a href="%s">Learn more about Gutenberg</a>' ),1724 __( 'https://wordpress.org/gutenberg/' )1725 );1726 1727 /**1728 * Filters the "Learn more" link in the Try Gutenberg panel.1729 *1730 * It allows hosts or site owners to change the link, to provide extra1731 * information about Gutenberg, specific to their service.1732 *1733 * WARNING: This filter will only exist in the 4.9.x series, it will not be1734 * added to WordPress 5.0 and later.1735 *1736 * @since 4.9.81737 */1738 echo apply_filters( 'try_gutenberg_learn_more_link', $learnmore );1739 ?>1740 </p>1741 </div>1742 </div>1743 1744 <div class="try-gutenberg-panel-column plugin-card-classic-editor">1745 1746 <div>1747 <h3><?php _e( 'Not quite ready?' ); ?></h3>1748 1749 <p>1750 <?php _e( 'The new editor will be enabled by default in the next major release of WordPress. If you’re not sure how compatible your current themes and plugins are, we’ve got you covered.' ); ?>1751 <?php1752 printf(1753 /* translators: Link to the Classic Editor plugin page */1754 __( 'Install the <a href="%s">Classic Editor plugin</a> to keep using the current editor until you’re ready to make the switch.' ),1755 __( 'https://wordpress.org/plugins/classic-editor' )1756 );1757 ?>1758 </p>1759 </div>1760 1761 <?php if ( $classic_action ) { ?>1762 <div class="try-gutenberg-action">1763 <p><a class="button button-secondary button-hero<?php echo $classic_classes; ?>" href="<?php echo esc_url( $classic_url ); ?>" data-name="<?php esc_attr_e( 'Classic Editor' ); ?>" data-slug="classic-editor"><?php echo $classic_action; ?></a></p>1764 </div>1765 <?php } ?>1766 </div>1767 </div>1768 </div>1769 <?php1770 } -
branches/4.9/src/wp-admin/index.php
r43502 r44106 104 104 <h1><?php echo esc_html( $title ); ?></h1> 105 105 106 <?php if ( has_action( 'try_gutenberg_panel' ) ) :107 $classes = 'try-gutenberg-panel';108 109 $option = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );110 // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner111 $hide = '0' === $option || ( '2' === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) );112 if ( $hide )113 $classes .= ' hidden'; ?>114 115 <div id="try-gutenberg-panel" class="<?php echo esc_attr( $classes ); ?>">116 <?php wp_nonce_field( 'try-gutenberg-panel-nonce', 'trygutenbergpanelnonce', false ); ?>117 <a class="try-gutenberg-panel-close" href="<?php echo esc_url( admin_url( '?try_gutenberg=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the Try Gutenberg panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>118 <?php119 /**120 * Add content to the Try Gutenberg panel on the admin dashboard.121 *122 * To remove the Try Gutenberg panel, use remove_action():123 *124 * remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );125 *126 * @since 4.9.8127 */128 do_action( 'try_gutenberg_panel' );129 ?>130 </div>131 <?php endif; ?>132 106 <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) : 133 107 $classes = 'welcome-panel'; -
branches/4.9/src/wp-admin/js/dashboard.js
r43502 r44106 31 31 updateWelcomePanel( this.checked ? 1 : 0 ); 32 32 }); 33 34 var tryGutenbergPanel = $( '#try-gutenberg-panel' ),35 tryGutenbergPanelHide = $('#wp_try_gutenberg_panel-hide'),36 updateTryGutenbergPanel, installGutenbergSuccess;37 38 updateTryGutenbergPanel = function( visible ) {39 $.post( ajaxurl, {40 action: 'update-try-gutenberg-panel',41 visible: visible,42 trygutenbergpanelnonce: $( '#trygutenbergpanelnonce' ).val()43 });44 };45 46 installGutenbergSuccess = function( response ) {47 response.activateUrl += '&from=try-gutenberg';48 response.activateLabel = wp.updates.l10n.activatePluginLabel.replace( '%s', response.pluginName );49 wp.updates.installPluginSuccess( response );50 };51 52 if ( tryGutenbergPanel.hasClass( 'hidden' ) && tryGutenbergPanelHide.prop( 'checked' ) ) {53 tryGutenbergPanel.removeClass( 'hidden' );54 }55 56 $( '.try-gutenberg-panel-close, .try-gutenberg-panel-dismiss a', tryGutenbergPanel ).click( function( e ) {57 e.preventDefault();58 tryGutenbergPanel.addClass( 'hidden' );59 updateTryGutenbergPanel( 0 );60 $('#wp_try_gutenberg_panel-hide').prop( 'checked', false );61 });62 63 tryGutenbergPanelHide.click( function() {64 tryGutenbergPanel.toggleClass( 'hidden', ! this.checked );65 updateTryGutenbergPanel( this.checked ? 1 : 0 );66 });67 68 tryGutenbergPanel.on( 'click', '.install-now', function( e ) {69 e.preventDefault();70 var args = {71 slug: $( e.target ).data( 'slug' ),72 success: installGutenbergSuccess73 };74 wp.updates.installPlugin( args );75 } );76 33 77 34 // These widgets are sometimes populated via ajax -
branches/4.9/src/wp-admin/plugins.php
r43502 r44106 66 66 } else if ( isset($_GET['from']) && 'press-this' == $_GET['from'] ) { 67 67 wp_redirect( self_admin_url( "press-this.php") ); 68 } else if ( isset( $_GET['from'] ) && 'try-gutenberg' == $_GET['from'] ) {69 if ( 'gutenberg/gutenberg.php' === $plugin ) {70 wp_redirect( self_admin_url( "admin.php?page=gutenberg" ) );71 } else {72 wp_redirect( self_admin_url() );73 }74 68 } else { 75 69 wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above -
branches/4.9/src/wp-includes/default-filters.php
r43502 r44106 319 319 add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); 320 320 add_action( 'admin_init', 'send_frame_options_header', 10, 0 ); 321 add_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );322 321 add_action( 'welcome_panel', 'wp_welcome_panel' ); 323 322
Note: See TracChangeset
for help on using the changeset viewer.