Dashboard: Tweak the "Try Gutenberg" callout:

* Introduce `try_gutenberg_learn_more_link` filter that allows hosts or site owners to change the link, to provide extra information about Gutenberg, specific to their service.
* Only display the "Install" buttons if we're able to directly write to disk to install the plugins.
* Make sure the "Dismiss" link works correctly.

Props pento, andrew.taylor, leemon.
Fixes #41316.
Built from https://develop.svn.wordpress.org/branches/4.9@43537


git-svn-id: http://core.svn.wordpress.org/branches/4.9@43366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-07-26 15:06:26 +00:00
parent da5f52aae3
commit deee543f0d
3 changed files with 38 additions and 19 deletions

View File

@ -67,6 +67,7 @@ $core_actions_post = array(
'get-post-thumbnail-html', 'get-community-events', 'edit-theme-plugin-file',
'wp-privacy-export-personal-data',
'wp-privacy-erase-personal-data',
'update-try-gutenberg-panel',
);
// Deprecated

View File

@ -1632,9 +1632,11 @@ function wp_try_gutenberg_panel() {
if ( current_user_can( 'install_plugins' ) ) {
if ( empty( $plugins['gutenberg/gutenberg.php'] ) ) {
$action = __( 'Install Gutenberg' );
$url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' );
$classes = ' install-now';
if ( get_filesystem_method( array(), WP_PLUGIN_DIR ) === 'direct' ) {
$action = __( 'Install Gutenberg' );
$url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' );
$classes = ' install-now';
}
} else if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) {
$action = __( 'Activate Gutenberg' );
$url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php&from=try-gutenberg' ), 'activate-plugin_gutenberg/gutenberg.php' );
@ -1642,9 +1644,11 @@ function wp_try_gutenberg_panel() {
}
if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) {
$classic_action = __( 'Install the Classic Editor' );
$classic_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=classic-editor' ), 'install-plugin_classic-editor' );
$classic_classes = ' install-now';
if ( get_filesystem_method( array(), WP_PLUGIN_DIR ) === 'direct' ) {
$classic_action = __( 'Install the Classic Editor' );
$classic_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=classic-editor' ), 'install-plugin_classic-editor' );
$classic_classes = ' install-now';
}
} else if ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) {
$classic_action = __( 'Activate the Classic Editor' );
$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' );
@ -1695,20 +1699,34 @@ function wp_try_gutenberg_panel() {
</p>
</div>
<div class="try-gutenberg-action">
<?php if ( $action ) { ?>
<div class="try-gutenberg-action">
<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>
<p>
<?php
printf(
/* translators: Link to https://wordpress.org/gutenberg/ */
__( '<a href="%s">Learn more about Gutenberg</a>' ),
__( 'https://wordpress.org/gutenberg/' )
);
?>
</p>
</div>
<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>
<?php } ?>
<p>
<?php
$learnmore = sprintf(
/* translators: Link to https://wordpress.org/gutenberg/ */
__( '<a href="%s">Learn more about Gutenberg</a>' ),
__( 'https://wordpress.org/gutenberg/' )
);
/**
* Filters the "Learn more" link in the Try Gutenberg panel.
*
* It allows hosts or site owners to change the link, to provide extra
* information about Gutenberg, specific to their service.
*
* WARNING: This filter will only exist in the 4.9.x series, it will not be
* added to WordPress 5.0 and later.
*
* @since 4.9.8
*/
echo apply_filters( 'try_gutenberg_learn_more_link', $learnmore );
?>
</p>
</div>
</div>
<div class="try-gutenberg-panel-column plugin-card-classic-editor">

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9.8-RC1-43536';
$wp_version = '4.9.8-RC1-43537';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.