Make WordPress Core

Ticket #31779: 31779.3.diff

File 31779.3.diff, 4.6 KB (added by helen, 7 years ago)

JS nonsense start for sharing

  • src/wp-admin/css/common.css

     
    31473147        line-height: 180%;
    31483148}
    31493149
     3150#file-editor-warning .file-editor-warning-content {
     3151        margin: 25px;
     3152}
     3153
    31503154/* @todo: can we use a common class for these? */
    31513155.nav-menus-php .item-edit:before,
    31523156.widget-top .widget-action .toggle-indicator:before,
  • src/wp-admin/js/theme-plugin-editor.js

     
    4646                component.form.on( 'submit', component.submit );
    4747                component.textarea = component.form.find( '#newcontent' );
    4848                component.textarea.on( 'change', component.onChange );
     49component.warning = $( '.file-editor-warning' );
    4950
     51if ( component.warning.length > 0 ) {
     52        $( 'body' ).addClass( 'modal-open' );
     53        component.warning.on( 'click', '.notice-dismiss', component.dismissWarning );
     54};
     55
     56
    5057                if ( false !== component.codeEditor ) {
    5158                        /*
    5259                         * Defer adding notices until after DOM ready as workaround for WP Admin injecting
     
    6673                } );
    6774        };
    6875
     76component.dismissWarning = function() {
     77// update user meta
     78// hide modal
     79component.warning.remove();
     80$( 'body' ).removeClass( 'modal-open' );
     81
     82// return focus
     83}
     84
    6985        /**
    7086         * Callback for when a change happens.
    7187         *
  • src/wp-admin/plugin-editor.php

     
    280280<br class="clear" />
    281281</div>
    282282<?php
     283$hide_notice = get_user_meta( get_current_user_id(), 'hide_plugin_editor_notice', true );
     284if ( empty( $hide_notice ) ) :
     285?>
     286<div id="file-editor-warning" class="notification-dialog-wrap file-editor-warning hide-if-no-js">
     287        <div class="notification-dialog-background"></div>
     288        <div class="notification-dialog" role="dialog" aria-labelledby="file-editor-warning-title" tabindex="0">
     289                <div class="file-editor-warning-content">
     290                        <h1 id="file-editor-warning-title"><?php _e( 'Heads up!' ); ?></h1>
     291                        <p><?php _e( 'You appear to be making direct edits to your plugin in the WordPress dashboard. We recommend that you don&#8217;t! Editing plugins directly may introduce incompatibilities that break your site or even leave you staring at the dreaded &#8220;White Screen of Death&#8221;. Your changes may also be overwritten by future updates.' ); ?></p>
     292                        <p><?php _e( 'If you absolutely must edit a plugin this way, WordPress will attempt to prevent you from being locked out from the dashboard entirely, but cannot guarantee results. Once dismissed, this notice will not appear again.' ); ?></p>
     293                </div>
     294                <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php _e( 'Dismiss' ); ?></span></button>
     295        </div>
     296</div>
     297<?php
     298endif; // editor warning notice
    283299
    284300include(ABSPATH . "wp-admin/admin-footer.php");
  • src/wp-admin/theme-editor.php

     
    309309<br class="clear" />
    310310</div>
    311311<?php
     312$hide_notice = get_user_meta( get_current_user_id(), 'hide_theme_editor_notice', true );
     313if ( empty( $hide_notice ) ) :
     314?>
     315<div id="file-editor-warning" class="notification-dialog-wrap file-editor-warning hide-if-no-js">
     316        <div class="notification-dialog-background"></div>
     317        <div class="notification-dialog" role="dialog" aria-labelledby="file-editor-warning-title" tabindex="0">
     318                <div class="file-editor-warning-content">
     319                        <h1 id="file-editor-warning-title"><?php _e( 'Heads up!' ); ?></h1>
     320                        <p><?php _e( 'You appear to be making direct edits to your plugin in the WordPress dashboard. We recommend that you don&#8217;t! Editing plugins directly may introduce incompatibilities that break your site or even leave you staring at the dreaded &#8220;White Screen of Death&#8221;. Your changes may also be overwritten by future updates.' ); ?></p>
     321                        <p><?php _e( 'If you absolutely must edit a plugin this way, WordPress will attempt to prevent you from being locked out from the dashboard entirely, but cannot guarantee results. Once dismissed, this notice will not appear again.' ); ?></p>
     322                </div>
     323                <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php _e( 'Dismiss' ); ?></span></button>
     324        </div>
     325</div>
     326<?php
     327endif; // editor warning notice
    312328
    313329include(ABSPATH . 'wp-admin/admin-footer.php' );