Make WordPress Core


Ignore:
Timestamp:
12/13/2018 09:06:20 AM (6 years ago)
Author:
pento
Message:

Dashboard: Remove the Try Gutenberg callout.

Merge of [43807] from the 5.0 branch.

Props mukesh27.
Fixes #45063.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/includes/dashboard.php

    r43544 r44106  
    2424
    2525    /* Register Widgets and Controls */
    26 
    27     // Try Gutenberg
    28 
    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     }
    3826
    3927    $response = wp_check_browser_version();
     
    16321620    <?php
    16331621}
    1634 
    1635 /**
    1636  * Displays a Try Gutenberg Panel, to introduce people to Gutenberg
    1637  *
    1638  * @since 4.9.8
    1639  */
    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                         <?php
    1703                             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                         <?php
    1721                             $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 extra
    1731                              * information about Gutenberg, specific to their service.
    1732                              *
    1733                              * WARNING: This filter will only exist in the 4.9.x series, it will not be
    1734                              * added to WordPress 5.0 and later.
    1735                              *
    1736                              * @since 4.9.8
    1737                              */
    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                         <?php
    1752                             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     <?php
    1770 }
Note: See TracChangeset for help on using the changeset viewer.