mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
File editor warning: Add a "Go back" button.
see #42100, #31779. git-svn-id: https://develop.svn.wordpress.org/trunk@41859 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -290,6 +290,15 @@ endif; // $error
|
||||
<?php
|
||||
$dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
|
||||
if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) :
|
||||
// Get a back URL
|
||||
$referer = wp_get_referer();
|
||||
$excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' );
|
||||
|
||||
if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
|
||||
$return_url = $referer;
|
||||
} else {
|
||||
$return_url = admin_url( '/' );
|
||||
}
|
||||
?>
|
||||
<div id="file-editor-warning" class="notification-dialog-wrap file-editor-warning hide-if-no-js">
|
||||
<div class="notification-dialog-background"></div>
|
||||
@@ -300,13 +309,16 @@ if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) :
|
||||
<?php
|
||||
echo sprintf(
|
||||
/* translators: %s is a link to Custom CSS section in the Customizer. */
|
||||
__( 'You appear to be making direct edits to your theme in the WordPress Dashboard. We recommend that you don’t! Editing this code directly is dangerous, and can leave you unable to log back in to WordPress and undo changes. There’s no need to change your CSS here — you can edit and live preview CSS changes in WordPress’s <a href="%s">built in CSS editor</a>.' ),
|
||||
__( 'You appear to be making direct edits to your theme in the WordPress dashboard. We recommend that you don’t! Editing this code directly is dangerous, and can leave you unable to log back in to WordPress and undo changes. There’s no need to change your CSS here — you can edit and live preview CSS changes in WordPress’s <a href="%s">built in CSS editor</a>.' ),
|
||||
esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p><?php _e( 'If you decide to go ahead with direct edits anyway, make sure to back up all your site’s files before making changes so you can restore a functional version if something goes wrong.' ); ?></p>
|
||||
<p><button type="button" class="file-editor-warning-dismiss button-primary"><?php _e( 'I understand' ); ?></button></p>
|
||||
<p>
|
||||
<a class="button file-editor-warning-go-back" href="<?php echo esc_url( $return_url ); ?>"><?php _e( 'Go back' ); ?></a>
|
||||
<button type="button" class="file-editor-warning-dismiss button button-primary"><?php _e( 'I understand' ); ?></button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user