Changeset 43807
- Timestamp:
- 10/23/2018 11:03:20 AM (6 years ago)
- Location:
- branches/5.0/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-admin/admin-ajax.php
r43537 r43807 68 68 'wp-privacy-export-personal-data', 69 69 'wp-privacy-erase-personal-data', 70 'update-try-gutenberg-panel',71 70 ); 72 71 -
branches/5.0/src/wp-admin/css/common.css
r43784 r43807 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/5.0/src/wp-admin/css/dashboard.css
r43536 r43807 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: -ms-grid;230 display: grid;231 -ms-grid-columns: 36% 32% 32%;232 grid-template-columns: 36% 32% 32%;233 margin-bottom: 13px;234 }235 236 .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {237 display: -ms-grid;238 display: grid;239 -ms-grid-rows: auto 100px;240 grid-template-rows: auto 100px;241 }242 243 192 .welcome-panel-column p.hide-if-no-customize { 244 193 margin-top: 10px; 245 194 } 246 195 247 .welcome-panel-column p, 248 .try-gutenberg-panel-column p { 196 .welcome-panel-column p { 249 197 margin-top: 7px; 250 198 color: #444; … … 1261 1209 } 1262 1210 1263 @media screen and (max-width: 1024px) {1264 .try-gutenberg-panel .try-gutenberg-panel-column-container {1265 -ms-grid-columns: 50% 50%;1266 grid-template-columns: 50% 50%;1267 }1268 1269 .try-gutenberg-panel .try-gutenberg-panel-image-column {1270 display: none;1271 }1272 }1273 1274 1211 @media screen and (max-width: 870px) { 1275 1212 .welcome-panel .welcome-panel-column, … … 1278 1215 float: none; 1279 1216 width: 100%; 1280 }1281 1282 .try-gutenberg-panel .try-gutenberg-panel-column-container {1283 -ms-grid-columns: 100%;1284 grid-template-columns: 100%;1285 1217 } 1286 1218 … … 1335 1267 @media screen and (max-width: 600px) { 1336 1268 /* Keep the close icon from overlapping the Welcome text. */ 1337 .welcome-panel .welcome-panel-close, 1338 .try-gutenberg-panel .try-gutenberg-panel-close { 1269 .welcome-panel .welcome-panel-close { 1339 1270 overflow: hidden; 1340 1271 text-indent: 40px; … … 1348 1279 1349 1280 /* Make the close icon larger for tappability. */ 1350 .welcome-panel .welcome-panel-close:before, 1351 .try-gutenberg-panel .try-gutenberg-panel-close:before { 1281 .welcome-panel .welcome-panel-close:before { 1352 1282 font-size: 20px; 1353 1283 top: 5px; -
branches/5.0/src/wp-admin/includes/ajax-actions.php
r43502 r43807 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/5.0/src/wp-admin/includes/class-wp-screen.php
r43777 r43807 1057 1057 } 1058 1058 1059 if ( 'dashboard' === $this->id && has_action( 'try_gutenberg_panel' ) ) {1060 if ( isset( $_GET['try_gutenberg'] ) ) {1061 $try_gutenberg_checked = empty( $_GET['try_gutenberg'] ) ? 0 : 1;1062 update_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', $try_gutenberg_checked );1063 } else {1064 $try_gutenberg_checked = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );1065 if ( '' === $try_gutenberg_checked ) {1066 $try_gutenberg_checked = '1';1067 }1068 if ( '2' === $try_gutenberg_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {1069 $try_gutenberg_checked = false;1070 }1071 }1072 echo '<label for="wp_try_gutenberg_panel-hide">';1073 echo '<input type="checkbox" id="wp_try_gutenberg_panel-hide"' . checked( (bool) $try_gutenberg_checked, true, false ) . ' />';1074 echo __( 'New Editor' ) . "</label>\n";1075 }1076 1059 ?> 1077 1060 </fieldset> -
branches/5.0/src/wp-admin/includes/dashboard.php
r43544 r43807 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/5.0/src/wp-admin/index.php
r43502 r43807 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/5.0/src/wp-admin/js/dashboard.js
r43502 r43807 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/5.0/src/wp-admin/plugins.php
r43502 r43807 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/5.0/src/wp-includes/default-filters.php
r43752 r43807 358 358 add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); 359 359 add_action( 'admin_init', 'send_frame_options_header', 10, 0 ); 360 add_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );361 360 add_action( 'welcome_panel', 'wp_welcome_panel' ); 362 361
Note: See TracChangeset
for help on using the changeset viewer.