Make WordPress Core


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.