Make WordPress Core

Changeset 56599


Ignore:
Timestamp:
09/17/2023 03:21:07 PM (3 years ago)
Author:
costdev
Message:

Administration: Use wp_admin_notice() more in /wp-admin/includes/.

Adds further usages of wp_admin_notice() in /wp-admin/includes/ on .notice-error, .notice-warning, .error, and .updated.

Ongoing task to implement new function across core.

Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597].

Props joedolson, mukesh27, costdev.
See #57791.

Location:
trunk/src/wp-admin/includes
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-bulk-upgrader-skin.php

    r56027 r56599  
    144144                if ( $this->error || ! $this->result ) {
    145145                        if ( $this->error ) {
    146                                 echo '<div class="error"><p>' . sprintf( $this->upgrader->strings['skin_update_failed_error'], $title, '<strong>' . $this->error . '</strong>' ) . '</p></div>';
     146                                $after_error_message = sprintf( $this->upgrader->strings['skin_update_failed_error'], $title, '<strong>' . $this->error . '</strong>' );
    147147                        } else {
    148                                 echo '<div class="error"><p>' . sprintf( $this->upgrader->strings['skin_update_failed'], $title ) . '</p></div>';
     148                                $after_error_message = sprintf( $this->upgrader->strings['skin_update_failed'], $title );
    149149                        }
     150                        wp_admin_notice(
     151                                $after_error_message,
     152                                array(
     153                                        'additional_classes' => array( 'error' ),
     154                                )
     155                        );
    150156
    151157                        echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js( $this->upgrader->update_current ) . '\').show();</script>';
  • trunk/src/wp-admin/includes/class-custom-background.php

    r56571 r56599  
    257257
    258258                if ( ! empty( $this->updated ) ) {
    259                         ?>
    260 <div id="message" class="updated">
    261         <p>
    262                         <?php
    263                         /* translators: %s: Home URL. */
    264                         printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), esc_url( home_url( '/' ) ) );
    265                         ?>
    266         </p>
    267 </div>
    268                 <?php } ?>
     259                        $updated_message = sprintf(
     260                                /* translators: %s: Home URL. */
     261                                __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ),
     262                                esc_url( home_url( '/' ) )
     263                        );
     264                        wp_admin_notice(
     265                                $updated_message,
     266                                array(
     267                                        'id'                 => 'message',
     268                                        'additional_classes' => array( 'updated' ),
     269                                )
     270                        );
     271                }
     272                ?>
    269273
    270274<h2><?php _e( 'Background Image' ); ?></h2>
  • trunk/src/wp-admin/includes/class-custom-image-header.php

    r56571 r56599  
    525525                        );
    526526                }
     527
     528                if ( ! empty( $this->updated ) ) {
     529                        $updated_message = sprintf(
     530                                /* translators: %s: Home URL. */
     531                                __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ),
     532                                esc_url( home_url( '/' ) )
     533                        );
     534                        wp_admin_notice(
     535                                $updated_message,
     536                                array(
     537                                        'id'                 => 'message',
     538                                        'additional_classes' => array( 'updated' ),
     539                                )
     540                        );
     541                }
    527542                ?>
    528 
    529                 <?php if ( ! empty( $this->updated ) ) { ?>
    530 <div id="message" class="updated">
    531         <p>
    532                         <?php
    533                         /* translators: %s: Home URL. */
    534                         printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), esc_url( home_url( '/' ) ) );
    535                         ?>
    536         </p>
    537 </div>
    538                 <?php } ?>
    539543
    540544<h2><?php _e( 'Header Image' ); ?></h2>
  • trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php

    r56571 r56599  
    291291         */
    292292        public function no_items() {
    293                 if ( isset( $this->error ) ) { ?>
    294                         <div class="inline error"><p><?php echo $this->error->get_error_message(); ?></p>
    295                                 <p class="hide-if-no-js"><button class="button try-again"><?php _e( 'Try Again' ); ?></button></p>
    296                         </div>
     293                if ( isset( $this->error ) ) {
     294                        $error_message  = '<p>' . $this->error->get_error_message() . '</p>';
     295                        $error_message .= '<p class="hide-if-no-js"><button class="button try-again">' . __( 'Try Again' ) . '</button></p>';
     296                        wp_admin_notice(
     297                                $error_message,
     298                                array(
     299                                        'additional_classes' => array( 'inline', 'error' ),
     300                                        'paragraph_wrap'     => false,
     301                                )
     302                        );
     303                        ?>
    297304                <?php } else { ?>
    298305                        <div class="no-plugin-results"><?php _e( 'No plugins found. Try a different search.' ); ?></div>
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r56571 r56599  
    12831283                                '<tr class="plugin-update-tr">' .
    12841284                                '<td colspan="%s" class="plugin-update colspanchange">' .
    1285                                 '<div class="update-message notice inline notice-error notice-alt"><p>',
    12861285                                esc_attr( $this->get_column_count() )
    12871286                        );
    12881287
     1288                        $incompatible_message = '';
    12891289                        if ( ! $compatible_php && ! $compatible_wp ) {
    1290                                 _e( 'This plugin does not work with your versions of WordPress and PHP.' );
     1290                                $incompatible_message .= __( 'This plugin does not work with your versions of WordPress and PHP.' );
    12911291                                if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
    1292                                         printf(
     1292                                        $incompatible_message .= sprintf(
    12931293                                                /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
    12941294                                                ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     
    12961296                                                esc_url( wp_get_update_php_url() )
    12971297                                        );
    1298                                         wp_update_php_annotation( '</p><p><em>', '</em>' );
     1298                                        $incompatible_message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
    12991299                                } elseif ( current_user_can( 'update_core' ) ) {
    1300                                         printf(
     1300                                        $incompatible_message .= sprintf(
    13011301                                                /* translators: %s: URL to WordPress Updates screen. */
    13021302                                                ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     
    13041304                                        );
    13051305                                } elseif ( current_user_can( 'update_php' ) ) {
    1306                                         printf(
     1306                                        $incompatible_message .= sprintf(
    13071307                                                /* translators: %s: URL to Update PHP page. */
    13081308                                                ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
    13091309                                                esc_url( wp_get_update_php_url() )
    13101310                                        );
    1311                                         wp_update_php_annotation( '</p><p><em>', '</em>' );
     1311                                        $incompatible_message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
    13121312                                }
    13131313                        } elseif ( ! $compatible_wp ) {
    1314                                 _e( 'This plugin does not work with your version of WordPress.' );
     1314                                $incompatible_message .= __( 'This plugin does not work with your version of WordPress.' );
    13151315                                if ( current_user_can( 'update_core' ) ) {
    1316                                         printf(
     1316                                        $incompatible_message .= sprintf(
    13171317                                                /* translators: %s: URL to WordPress Updates screen. */
    13181318                                                ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     
    13211321                                }
    13221322                        } elseif ( ! $compatible_php ) {
    1323                                 _e( 'This plugin does not work with your version of PHP.' );
     1323                                $incompatible_message .= __( 'This plugin does not work with your version of PHP.' );
    13241324                                if ( current_user_can( 'update_php' ) ) {
    1325                                         printf(
     1325                                        $incompatible_message .= sprintf(
    13261326                                                /* translators: %s: URL to Update PHP page. */
    13271327                                                ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
    13281328                                                esc_url( wp_get_update_php_url() )
    13291329                                        );
    1330                                         wp_update_php_annotation( '</p><p><em>', '</em>' );
     1330                                        $incompatible_message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
    13311331                                }
    13321332                        }
    13331333
    1334                         echo '</p></div></td></tr>';
     1334                        wp_admin_notice(
     1335                                $incompatible_message,
     1336                                array(
     1337                                        'type'               => 'error',
     1338                                        'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
     1339                                )
     1340                        );
     1341
     1342                        echo '</td></tr>';
    13351343                }
    13361344
  • trunk/src/wp-admin/includes/class-wp-privacy-policy-content.php

    r56571 r56599  
    139139                }
    140140
    141                 ?>
    142                 <div class="policy-text-updated notice notice-warning is-dismissible">
    143                         <p>
    144                         <?php
    145                                 printf(
    146                                         /* translators: %s: Privacy Policy Guide URL. */
    147                                         __( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
    148                                         esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) )
    149                                 );
    150                         ?>
    151                         </p>
    152                 </div>
    153                 <?php
     141                $privacy_message = sprintf(
     142                        /* translators: %s: Privacy Policy Guide URL. */
     143                        __( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
     144                        esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) )
     145                );
     146
     147                wp_admin_notice(
     148                        $privacy_message,
     149                        array(
     150                                'type'               => 'warning',
     151                                'additional_classes' => array( 'policy-text-updated' ),
     152                                'dismissible'        => true,
     153                        )
     154                );
    154155        }
    155156
  • trunk/src/wp-admin/includes/dashboard.php

    r56548 r56599  
    574574        <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
    575575
    576                 <?php if ( $error_msg ) : ?>
    577                 <div class="error"><?php echo $error_msg; ?></div>
    578                 <?php endif; ?>
     576                <?php
     577                if ( $error_msg ) {
     578                        wp_admin_notice(
     579                                $error_msg,
     580                                array(
     581                                        'additional_classes' => array( 'error' ),
     582                                )
     583                        );
     584                }
     585                ?>
    579586
    580587                <div class="input-text-wrap" id="title-wrap">
     
    11581165 */
    11591166function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) {
    1160         $loading    = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&hellip;' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>';
    11611167        $doing_ajax = wp_doing_ajax();
     1168        $loading    = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&hellip;' ) . '</p>';
     1169        $loading   .= wp_get_admin_notice(
     1170                __( 'This widget requires JavaScript.' ),
     1171                array(
     1172                        'type'               => 'error',
     1173                        'additional_classes' => array( 'inline', 'hide-if-js' ),
     1174                )
     1175        );
    11621176
    11631177        if ( empty( $check_urls ) ) {
     
    13411355 */
    13421356function wp_print_community_events_markup() {
    1343         ?>
    1344 
    1345         <div class="community-events-errors notice notice-error inline hide-if-js">
    1346                 <p class="hide-if-js">
    1347                         <?php _e( 'This widget requires JavaScript.' ); ?>
    1348                 </p>
    1349 
    1350                 <p class="community-events-error-occurred" aria-hidden="true">
    1351                         <?php _e( 'An error occurred. Please try again.' ); ?>
    1352                 </p>
    1353 
    1354                 <p class="community-events-could-not-locate" aria-hidden="true"></p>
    1355         </div>
    1356 
    1357         <div class="community-events-loading hide-if-no-js">
    1358                 <?php _e( 'Loading&hellip;' ); ?>
    1359         </div>
    1360 
    1361         <?php
     1357        $community_events_notice  = '<p class="hide-if-js">' . ( 'This widget requires JavaScript.' ) . '</p>';
     1358        $community_events_notice .= '<p class="community-events-error-occurred" aria-hidden="true">' . __( 'An error occurred. Please try again.' ) . '</p>';
     1359        $community_events_notice .= '<p class="community-events-could-not-locate" aria-hidden="true"></p>';
     1360
     1361        wp_admin_notice(
     1362                $community_events_notice,
     1363                array(
     1364                        'type'               => 'error',
     1365                        'additional_classes' => array( 'community-events-errors', 'inline', 'hide-if-js' ),
     1366                        'paragraph_wrap'     => false,
     1367                )
     1368        );
     1369
    13621370        /*
    13631371         * Hide the main element when the page first loads, because the content
  • trunk/src/wp-admin/includes/file.php

    r56559 r56599  
    24272427                        $error_string = esc_html( $error->get_error_message() );
    24282428                }
    2429                 echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
     2429                wp_admin_notice(
     2430                        $error_string,
     2431                        array(
     2432                                'id'                 => 'message',
     2433                                'additional_classes' => array( 'error' ),
     2434                        )
     2435                );
    24302436        }
    24312437
  • trunk/src/wp-admin/includes/ms.php

    r56549 r56599  
    693693
    694694        if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $wp_db_version ) {
    695                 echo "<div class='update-nag notice notice-warning inline'>" . sprintf(
     695                $upgrade_network_message = sprintf(
    696696                        /* translators: %s: URL to Upgrade Network screen. */
    697697                        __( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ),
    698698                        esc_url( network_admin_url( 'upgrade.php' ) )
    699                 ) . '</div>';
     699                );
     700
     701                wp_admin_notice(
     702                        $upgrade_network_message,
     703                        array(
     704                                'type'               => 'warning',
     705                                'additional_classes' => array( 'update-nag', 'inline' ),
     706                                'paragraph_wrap'     => false,
     707                        )
     708                );
    700709        }
    701710}
  • trunk/src/wp-admin/includes/nav-menu.php

    r56548 r56599  
    14381438
    14391439                        if ( is_wp_error( $menu_item_db_id ) ) {
    1440                                 $messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>';
     1440                                $messages[] = wp_get_admin_notice(
     1441                                        $menu_item_db_id->get_error_message(),
     1442                                        array(
     1443                                                'id'                 => 'message',
     1444                                                'additional_classes' => array( 'error' ),
     1445                                        )
     1446                                );
    14411447                        } else {
    14421448                                unset( $menu_items[ $menu_item_db_id ] );
  • trunk/src/wp-admin/includes/network.php

    r56410 r56599  
    114114
    115115        if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
    116                 echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf(
     116                $cannot_define_constant_message  = '<strong>' . __( 'Error:' ) . '</strong> ';
     117                $cannot_define_constant_message .= sprintf(
    117118                        /* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
    118119                        __( 'The constant %s cannot be defined when creating a network.' ),
    119120                        '<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
    120                 ) . '</p></div>';
     121                );
     122
     123                wp_admin_notice(
     124                        $cannot_define_constant_message,
     125                        array(
     126                                'additional_classes' => array( 'error' ),
     127                        )
     128                );
     129
    121130                echo '</div>';
    122131                require_once ABSPATH . 'wp-admin/admin-footer.php';
     
    143152        $has_ports = strstr( $hostname, ':' );
    144153        if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
    145                 echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
     154                wp_admin_notice(
     155                        '<strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ),
     156                        array(
     157                                'additional_classes' => array( 'error' ),
     158                        )
     159                );
     160
    146161                echo '<p>' . sprintf(
    147162                        /* translators: %s: Port number. */
     
    161176        $error_codes = array();
    162177        if ( is_wp_error( $errors ) ) {
    163                 echo '<div class="error"><p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>';
     178                $network_created_error_message = '<p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>';
    164179                foreach ( $errors->get_error_messages() as $error ) {
    165                         echo "<p>$error</p>";
    166                 }
    167                 echo '</div>';
     180                        $network_created_error_message .= "<p>$error</p>";
     181                }
     182                wp_admin_notice(
     183                        $network_created_error_message,
     184                        array(
     185                                'additional_classes' => array( 'error' ),
     186                                'paragraph_wrap'     => false,
     187                        )
     188                );
    168189                $error_codes = $errors->get_error_codes();
    169190        }
     
    196217                $got_mod_rewrite   = got_mod_rewrite();
    197218                if ( $got_mod_rewrite ) { // Dangerous assumptions.
    198                         echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
    199                         printf(
     219                        $message_class = 'updated';
     220                        $message       = '<p><strong>' . __( 'Warning:' ) . '</strong> ';
     221                        $message      .= '<p>' . sprintf(
    200222                                /* translators: %s: mod_rewrite */
    201223                                __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
    202224                                '<code>mod_rewrite</code>'
    203                         );
    204                         echo '</p>';
     225                        ) . '</p>';
    205226                } elseif ( $is_apache ) {
    206                         echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ';
    207                         printf(
     227                        $message_class = 'error';
     228                        $message       = '<p><strong>' . __( 'Warning:' ) . '</strong> ';
     229                        $message      .= sprintf(
    208230                                /* translators: %s: mod_rewrite */
    209231                                __( 'It looks like the Apache %s module is not installed.' ),
    210232                                '<code>mod_rewrite</code>'
    211                         );
    212                         echo '</p>';
     233                        ) . '</p>';
    213234                }
    214235
    215236                if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache).
    216                         echo '<p>';
    217                         printf(
     237                        $message .= '<p>' . sprintf(
    218238                                /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */
    219239                                __( 'If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.' ),
     
    221241                                'https://httpd.apache.org/docs/mod/mod_rewrite.html',
    222242                                'https://www.google.com/search?q=apache+mod_rewrite'
     243                        ) . '</p>';
     244
     245                        wp_admin_notice(
     246                                $message,
     247                                array(
     248                                        'additional_classes' => array( $message_class, 'inline' ),
     249                                        'paragraph_wrap'     => false,
     250                                )
    223251                        );
    224                         echo '</p></div>';
    225252                }
    226253        }
     
    264291
    265292        if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) {
    266                 echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
     293                $subdirectory_warning_message  = '<strong>' . __( 'Warning:' ) . '</strong> ';
     294                $subdirectory_warning_message .= __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' );
     295                wp_admin_notice(
     296                        $subdirectory_warning_message,
     297                        array(
     298                                'additional_classes' => array( 'error', 'inline' ),
     299                        )
     300                );
    267301        }
    268302
     
    410444        // Wildcard DNS message.
    411445        if ( is_wp_error( $errors ) ) {
    412                 echo '<div class="error">' . $errors->get_error_message() . '</div>';
     446                wp_admin_notice(
     447                        $errors->get_error_message(),
     448                        array(
     449                                'additional_classes' => array( 'error' ),
     450                        )
     451                );
    413452        }
    414453
     
    427466                } else {
    428467                        $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
     468
     469                        wp_admin_notice(
     470                                '<strong>' . __( 'Warning:' ) . '</strong> ' . __( 'An existing WordPress network was detected.' ),
     471                                array(
     472                                        'additional_classes' => array( 'error' ),
     473                                )
     474                        );
    429475                        ?>
    430         <div class="error"><p><strong><?php _e( 'Warning:' ); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
    431476        <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>
    432477                        <?php
  • trunk/src/wp-admin/includes/template.php

    r56571 r56599  
    10141014        $upload_dir = wp_upload_dir();
    10151015        if ( ! empty( $upload_dir['error'] ) ) :
    1016                 ?>
    1017                 <div class="error"><p><?php _e( 'Before you can upload your import file, you will need to fix the following error:' ); ?></p>
    1018                 <p><strong><?php echo $upload_dir['error']; ?></strong></p></div>
    1019                 <?php
     1016                $upload_directory_error  = '<p>' . __( 'Before you can upload your import file, you will need to fix the following error:' ) . '</p>';
     1017                $upload_directory_error .= '<p><strong>' . $upload_dir['error'] . '</strong></p>';
     1018                wp_admin_notice(
     1019                        $upload_directory_error,
     1020                        array(
     1021                                'additonal_classes' => array( 'error' ),
     1022                                'paragraph_wrap'    => false,
     1023                        )
     1024                );
    10201025        else :
    10211026                ?>
     
    14351440                                                $plugin = _get_plugin_from_callback( $box['callback'] );
    14361441                                                if ( $plugin ) {
    1437                                                         ?>
    1438                                                         <div class="error inline">
    1439                                                                 <p>
    1440                                                                         <?php
    1441                                                                                 /* translators: %s: The name of the plugin that generated this meta box. */
    1442                                                                                 printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "<strong>{$plugin['Name']}</strong>" );
    1443                                                                         ?>
    1444                                                                 </p>
    1445                                                         </div>
    1446                                                         <?php
     1442                                                        $meta_box_not_compatible_message = sprintf(
     1443                                                                /* translators: %s: The name of the plugin that generated this meta box. */
     1444                                                                __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ),
     1445                                                                "<strong>{$plugin['Name']}</strong>"
     1446                                                        );
     1447                                                        wp_admin_notice(
     1448                                                                $meta_box_not_compatible_message,
     1449                                                                array(
     1450                                                                        'additional_classes' => array( 'error', 'inline' ),
     1451                                                                )
     1452                                                        );
    14471453                                                }
    14481454                                        }
     
    26962702 */
    26972703function _local_storage_notice() {
    2698         ?>
    2699         <div id="local-storage-notice" class="hidden notice is-dismissible">
    2700         <p class="local-restore">
    2701                 <?php _e( 'The backup of this post in your browser is different from the version below.' ); ?>
    2702                 <button type="button" class="button restore-backup"><?php _e( 'Restore the backup' ); ?></button>
    2703         </p>
    2704         <p class="help">
    2705                 <?php _e( 'This will replace the current editor content with the last backup version. You can use undo and redo in the editor to get the old content back or to return to the restored version.' ); ?>
    2706         </p>
    2707         </div>
    2708         <?php
     2704        $local_storage_message  = '<p class="local-restore">';
     2705        $local_storage_message .= __( 'The backup of this post in your browser is different from the version below.' );
     2706        $local_storage_message .= '<button type="button" class="button restore-backup">' . __( 'Restore the backup' ) . '</button></p>';
     2707        $local_storage_message .= '<p class="help">';
     2708        $local_storage_message .= __( 'This will replace the current editor content with the last backup version. You can use undo and redo in the editor to get the old content back or to return to the restored version.' );
     2709        $local_storage_message .= '</p>';
     2710
     2711        wp_admin_notice(
     2712                $local_storage_message,
     2713                array(
     2714                        'id'                 => 'local-storage-notice',
     2715                        'additional_classes' => array( 'hidden' ),
     2716                        'dismissible'        => true,
     2717                        'paragraph_wrap'     => false,
     2718                )
     2719        );
    27092720}
    27102721
  • trunk/src/wp-admin/includes/update.php

    r56571 r56599  
    343343        }
    344344
    345         echo "<div class='update-nag notice notice-warning inline'>$msg</div>";
     345        wp_admin_notice(
     346                $msg,
     347                array(
     348                        'type'              => 'warning',
     349                        'additonal_classes' => array( 'update-nag', 'inline' ),
     350                        'paragraph_wrap'    => false,
     351                )
     352        );
    346353}
    347354
     
    885892        }
    886893
    887         echo "<div class='update-nag notice notice-warning inline'>$msg</div>";
     894        wp_admin_notice(
     895                $msg,
     896                array(
     897                        'type'               => 'warning',
     898                        'additional_classes' => array( 'update-nag', 'inline' ),
     899                        'paragraph_wrap'     => false,
     900                )
     901        );
    888902}
    889903
  • trunk/src/wp-admin/includes/user.php

    r55988 r56599  
    536536                return;
    537537        }
    538         ?>
    539         <div class="error default-password-nag">
    540                 <p>
    541                         <strong><?php _e( 'Notice:' ); ?></strong>
    542                         <?php _e( 'You are using the auto-generated password for your account. Would you like to change it?' ); ?>
    543                 </p>
    544                 <p>
    545                 <?php
    546                 printf(
    547                         '<a href="%1$s">%2$s</a> | ',
    548                         esc_url( get_edit_profile_url() . '#password' ),
    549                         __( 'Yes, take me to my profile page' )
    550                 );
    551                 printf(
    552                         '<a href="%1$s" id="default-password-nag-no">%2$s</a>',
    553                         '?default_password_nag=0',
    554                         __( 'No thanks, do not remind me again' )
    555                 );
    556                 ?>
    557                 </p>
    558         </div>
    559         <?php
     538
     539        $default_password_nag_message  = sprintf(
     540                '<p><strong>%1$s</strong> %2$s</p>',
     541                __( 'Notice:' ),
     542                __( 'You are using the auto-generated password for your account. Would you like to change it?' )
     543        );
     544        $default_password_nag_message .= sprintf(
     545                '<p><a href="%1$s">%2$s</a> | ',
     546                esc_url( get_edit_profile_url() . '#password' ),
     547                __( 'Yes, take me to my profile page' )
     548        );
     549        $default_password_nag_message .= sprintf(
     550                '<a href="%1$s" id="default-password-nag-no">%2$s</a></p>',
     551                '?default_password_nag=0',
     552                __( 'No thanks, do not remind me again' )
     553        );
     554
     555        wp_admin_notice(
     556                $default_password_nag_message,
     557                array(
     558                        'additional_classes' => array( 'error', 'default-password-nag' ),
     559                        'paragraph_wrap'     => false,
     560                )
     561        );
    560562}
    561563
Note: See TracChangeset for help on using the changeset viewer.