Changeset 43502 for branches/4.9/src/wp-admin/includes/dashboard.php
- Timestamp:
- 07/18/2018 06:41:07 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9/src/wp-admin/includes/dashboard.php
r42883 r43502 1620 1620 <?php 1621 1621 } 1622 1623 /** 1624 * Displays a Try Gutenberg Panel, to introduce people to Gutenberg 1625 * 1626 * @since 4.9.8 1627 */ 1628 function wp_try_gutenberg_panel() { 1629 $plugins = get_plugins(); 1630 $action = $url = $classes = ''; 1631 $classic_action = $classic_url = $classic_classes = ''; 1632 1633 if ( current_user_can( 'install_plugins' ) ) { 1634 if ( empty( $plugins['gutenberg/gutenberg.php'] ) ) { 1635 $action = __( 'Install Gutenberg' ); 1636 $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' ); 1637 $classes = ' install-now'; 1638 } else if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) { 1639 $action = __( 'Activate Gutenberg' ); 1640 $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php&from=try-gutenberg' ), 'activate-plugin_gutenberg/gutenberg.php' ); 1641 $classes = ' activate-now'; 1642 } 1643 1644 if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) { 1645 $classic_action = __( 'Install the Classic Editor' ); 1646 $classic_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=classic-editor' ), 'install-plugin_classic-editor' ); 1647 $classic_classes = ' install-now'; 1648 } else if ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) { 1649 $classic_action = __( 'Activate the Classic Editor' ); 1650 $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' ); 1651 $classic_classes = ' activate-now'; 1652 } else { 1653 $classic_action = __( 'The Classic Editor is activated' ); 1654 $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' );; 1655 $classic_classes = ' button-disabled install-now updated-message'; 1656 } 1657 } 1658 1659 if ( current_user_can( 'edit_posts' ) && is_plugin_active( 'gutenberg/gutenberg.php' ) ) { 1660 $action = __( 'Try Gutenberg' ); 1661 $url = admin_url( 'admin.php?page=gutenberg' ); 1662 } 1663 1664 ?> 1665 <div class="try-gutenberg-panel-content"> 1666 <h2><?php _e( 'A new, modern publishing experience is coming soon.' ); ?></h2> 1667 1668 <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> 1669 1670 <hr /> 1671 1672 <div class="try-gutenberg-panel-column-container"> 1673 <div class="try-gutenberg-panel-column try-gutenberg-panel-image-column"> 1674 <picture> 1675 <source srcset="about:blank" media="(max-width: 1024px)"> 1676 <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' ); ?>" /> 1677 </picture> 1678 </div> 1679 <div class="try-gutenberg-panel-column plugin-card-gutenberg"> 1680 1681 <h3><?php _e( 'Test the new editor today.' ); ?></h3> 1682 1683 <p> 1684 <?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." ); ?> 1685 <?php 1686 printf( 1687 /* translators: 1: Gutenberg call for testing handbook link, 2: Gutenberg GitHub repository issues link, 3: Gutenberg GitHub repository CONTRIBUTING.md link */ 1688 __( '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>.' ), 1689 'https://make.wordpress.org/test/handbook/call-for-testing/gutenberg-testing/', 1690 'https://github.com/WordPress/gutenberg/issues', 1691 'https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md' 1692 ); 1693 ?> 1694 </p> 1695 1696 <?php if ( $action ) { ?> 1697 <div class="try-gutenberg-action"> 1698 <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> 1699 <p> 1700 <?php 1701 printf( 1702 /* translators: Link to https://wordpress.org/gutenberg/ */ 1703 __( '<a href="%s">Learn more about Gutenberg</a>' ), 1704 'https://wordpress.org/gutenberg/' 1705 ); 1706 ?> 1707 </p> 1708 </div> 1709 <?php } ?> 1710 </div> 1711 1712 <div class="try-gutenberg-panel-column plugin-card-classic-editor"> 1713 1714 <h3><?php _e( 'Not quite ready?' ); ?></h3> 1715 1716 <p> 1717 <?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.' ); ?> 1718 <?php 1719 printf( 1720 /* translators: Link to the Classic Editor plugin page */ 1721 __( 'Install the <a href="%s">Classic Editor plugin</a> to keep using the current editor until you’re ready to make the switch.' ), 1722 'http://wordpress.org/plugins/classic-editor' 1723 ); 1724 ?> 1725 </p> 1726 1727 <?php if ( $classic_action ) { ?> 1728 <div class="try-gutenberg-action"> 1729 <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> 1730 </div> 1731 <?php } ?> 1732 </div> 1733 </div> 1734 </div> 1735 <?php 1736 }
Note: See TracChangeset
for help on using the changeset viewer.