mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Administration: Use wp_admin_notice()
in /wp-admin/includes
.
Add usages of `wp_admin_notice()` and `wp_get_admin_notice()` on `.notice-[type]` in the root level of `/wp-admin/includes`. Ongoing task to implement new function across core. Props costdev, joedolson. See #57791. Built from https://develop.svn.wordpress.org/trunk@56571 git-svn-id: http://core.svn.wordpress.org/trunk@56083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0f4010bd49
commit
008a32110f
@ -239,21 +239,24 @@ class Custom_Background {
|
||||
<div class="wrap" id="custom-background">
|
||||
<h1><?php _e( 'Custom Background' ); ?></h1>
|
||||
|
||||
<?php if ( current_user_can( 'customize' ) ) { ?>
|
||||
<div class="notice notice-info hide-if-no-customize">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
<?php
|
||||
if ( current_user_can( 'customize' ) ) {
|
||||
$message = sprintf(
|
||||
/* translators: %s: URL to background image configuration in Customizer. */
|
||||
__( 'You can now manage and live-preview Custom Backgrounds in the <a href="%s">Customizer</a>.' ),
|
||||
admin_url( 'customize.php?autofocus[control]=background_image' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
wp_admin_notice(
|
||||
$message,
|
||||
array(
|
||||
'type' => 'info',
|
||||
'additional_classes' => array( 'hide-if-no-customize' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
<?php if ( ! empty( $this->updated ) ) { ?>
|
||||
if ( ! empty( $this->updated ) ) {
|
||||
?>
|
||||
<div id="message" class="updated">
|
||||
<p>
|
||||
<?php
|
||||
|
@ -509,19 +509,22 @@ class Custom_Image_Header {
|
||||
<div class="wrap">
|
||||
<h1><?php _e( 'Custom Header' ); ?></h1>
|
||||
|
||||
<?php if ( current_user_can( 'customize' ) ) { ?>
|
||||
<div class="notice notice-info hide-if-no-customize">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
<?php
|
||||
if ( current_user_can( 'customize' ) ) {
|
||||
$message = sprintf(
|
||||
/* translators: %s: URL to header image configuration in Customizer. */
|
||||
__( 'You can now manage and live-preview Custom Header in the <a href="%s">Customizer</a>.' ),
|
||||
admin_url( 'customize.php?autofocus[control]=header_image' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
wp_admin_notice(
|
||||
$message,
|
||||
array(
|
||||
'type' => 'info',
|
||||
'additional_classes' => array( 'hide-if-no-customize' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ( ! empty( $this->updated ) ) { ?>
|
||||
<div id="message" class="updated">
|
||||
|
@ -686,52 +686,59 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
<div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>">
|
||||
<?php
|
||||
if ( ! $compatible_php || ! $compatible_wp ) {
|
||||
echo '<div class="notice inline notice-error notice-alt"><p>';
|
||||
$incompatible_notice_message = '';
|
||||
if ( ! $compatible_php && ! $compatible_wp ) {
|
||||
_e( 'This plugin does not work with your versions of WordPress and PHP.' );
|
||||
$incompatible_notice_message .= __( 'This plugin does not work with your versions of WordPress and PHP.' );
|
||||
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
$incompatible_notice_message .= sprintf(
|
||||
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
|
||||
self_admin_url( 'update-core.php' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
$incompatible_notice_message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
} elseif ( current_user_can( 'update_core' ) ) {
|
||||
printf(
|
||||
$incompatible_notice_message .= sprintf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||
self_admin_url( 'update-core.php' )
|
||||
);
|
||||
} elseif ( current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
$incompatible_notice_message .= sprintf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
$incompatible_notice_message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
}
|
||||
} elseif ( ! $compatible_wp ) {
|
||||
_e( 'This plugin does not work with your version of WordPress.' );
|
||||
$incompatible_notice_message .= __( 'This plugin does not work with your version of WordPress.' );
|
||||
if ( current_user_can( 'update_core' ) ) {
|
||||
printf(
|
||||
$incompatible_notice_message .= printf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||
self_admin_url( 'update-core.php' )
|
||||
);
|
||||
}
|
||||
} elseif ( ! $compatible_php ) {
|
||||
_e( 'This plugin does not work with your version of PHP.' );
|
||||
$incompatible_notice_message .= __( 'This plugin does not work with your version of PHP.' );
|
||||
if ( current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
$incompatible_notice_message .= sprintf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
$incompatible_notice_message .= wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
}
|
||||
}
|
||||
echo '</p></div>';
|
||||
|
||||
wp_admin_notice(
|
||||
$incompatible_notice_message,
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt', 'inline' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div class="plugin-card-top">
|
||||
|
@ -1243,7 +1243,14 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
*/
|
||||
echo apply_filters( 'plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data );
|
||||
|
||||
echo '<div class="notice notice-error notice-alt inline hidden"><p></p></div>';
|
||||
wp_admin_notice(
|
||||
'',
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
|
||||
)
|
||||
);
|
||||
|
||||
echo '</td>';
|
||||
|
||||
break;
|
||||
|
@ -2076,9 +2076,16 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="notice notice-error notice-alt inline hidden">
|
||||
<p class="error"></p>
|
||||
</div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
'<p class="error"></p>',
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
|
||||
'paragraph_wrap' => false,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div> <!-- end of .inline-edit-wrapper -->
|
||||
|
||||
|
@ -352,22 +352,20 @@ final class WP_Privacy_Policy_Content {
|
||||
'after'
|
||||
);
|
||||
} else {
|
||||
?>
|
||||
<div class="notice notice-warning inline wp-pp-notice">
|
||||
<p>
|
||||
<?php
|
||||
echo $message;
|
||||
printf(
|
||||
' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
|
||||
$url,
|
||||
$label,
|
||||
/* translators: Hidden accessibility text. */
|
||||
__( '(opens in a new tab)' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
$message .= sprintf(
|
||||
' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
|
||||
$url,
|
||||
$label,
|
||||
/* translators: Hidden accessibility text. */
|
||||
__( '(opens in a new tab)' )
|
||||
);
|
||||
wp_admin_notice(
|
||||
$message,
|
||||
array(
|
||||
'type' => 'warning',
|
||||
'additional_classes' => array( 'inline', 'wp-pp-notice' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -394,8 +392,14 @@ final class WP_Privacy_Policy_Content {
|
||||
$badge_title = sprintf( __( 'Removed %s.' ), $date );
|
||||
|
||||
/* translators: %s: Date of plugin deactivation. */
|
||||
$removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' );
|
||||
$removed = '<div class="notice notice-info inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
|
||||
$removed = sprintf( __( 'You deactivated this plugin on %s and may no longer need this policy.' ), $date );
|
||||
$removed = wp_get_admin_notice(
|
||||
$removed,
|
||||
array(
|
||||
'type' => 'info',
|
||||
'additional_classes' => array( 'inline' ),
|
||||
)
|
||||
);
|
||||
} elseif ( ! empty( $section['updated'] ) ) {
|
||||
$badge_class = ' blue';
|
||||
$date = date_i18n( $date_format, $section['updated'] );
|
||||
|
@ -711,9 +711,16 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" />
|
||||
<input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" />
|
||||
|
||||
<div class="notice notice-error notice-alt inline hidden">
|
||||
<p class="error"></p>
|
||||
</div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
'<p class="error"></p>',
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
|
||||
'paragraph_wrap' => false,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -311,25 +311,24 @@ function post_submit_meta_box( $post, $args = array() ) {
|
||||
endif;
|
||||
|
||||
if ( 'draft' === $post->post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) :
|
||||
?>
|
||||
<div class="notice notice-info notice-alt inline">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: URL to the Customizer. */
|
||||
__( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there is no need to publish now. It will be published automatically with those changes.' ),
|
||||
esc_url(
|
||||
add_query_arg(
|
||||
'changeset_uuid',
|
||||
rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
|
||||
admin_url( 'customize.php' )
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
$message = sprintf(
|
||||
/* translators: %s: URL to the Customizer. */
|
||||
__( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there is no need to publish now. It will be published automatically with those changes.' ),
|
||||
esc_url(
|
||||
add_query_arg(
|
||||
'changeset_uuid',
|
||||
rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
|
||||
admin_url( 'customize.php' )
|
||||
)
|
||||
)
|
||||
);
|
||||
wp_admin_notice(
|
||||
$message,
|
||||
array(
|
||||
'type' => 'info',
|
||||
'additional_classes' => array( 'notice-alt', 'inline' ),
|
||||
)
|
||||
);
|
||||
endif;
|
||||
|
||||
/**
|
||||
|
@ -817,37 +817,54 @@ function install_plugin_information() {
|
||||
$tested_wp = ( empty( $api->tested ) || version_compare( get_bloginfo( 'version' ), $api->tested, '<=' ) );
|
||||
|
||||
if ( ! $compatible_php ) {
|
||||
echo '<div class="notice notice-error notice-alt"><p>';
|
||||
_e( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>.' );
|
||||
$compatible_php_notice_message = '<p>';
|
||||
$compatible_php_notice_message .= __( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>.' );
|
||||
|
||||
if ( current_user_can( 'update_php' ) ) {
|
||||
printf(
|
||||
$compatible_php_notice_message .= sprintf(
|
||||
/* translators: %s: URL to Update PHP page. */
|
||||
' ' . __( '<a href="%s" target="_blank">Click here to learn more about updating PHP</a>.' ),
|
||||
esc_url( wp_get_update_php_url() )
|
||||
);
|
||||
|
||||
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||
) . wp_update_php_annotation( '</p><p><em>', '</em>', false );
|
||||
} else {
|
||||
echo '</p>';
|
||||
$compatible_php_notice_message .= '</p>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
wp_admin_notice(
|
||||
$compatible_php_notice_message,
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt' ),
|
||||
'paragraph_wrap' => false,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! $tested_wp ) {
|
||||
echo '<div class="notice notice-warning notice-alt"><p>';
|
||||
_e( '<strong>Warning:</strong> This plugin <strong>has not been tested</strong> with your current version of WordPress.' );
|
||||
echo '</p></div>';
|
||||
wp_admin_notice(
|
||||
__( '<strong>Warning:</strong> This plugin <strong>has not been tested</strong> with your current version of WordPress.' ),
|
||||
array(
|
||||
'type' => 'warning',
|
||||
'additional_classes' => array( 'notice-alt' ),
|
||||
)
|
||||
);
|
||||
} elseif ( ! $compatible_wp ) {
|
||||
echo '<div class="notice notice-error notice-alt"><p>';
|
||||
_e( '<strong>Error:</strong> This plugin <strong>requires a newer version of WordPress</strong>.' );
|
||||
$compatible_wp_notice_message = __( '<strong>Error:</strong> This plugin <strong>requires a newer version of WordPress</strong>.' );
|
||||
if ( current_user_can( 'update_core' ) ) {
|
||||
printf(
|
||||
$compatible_wp_notice_message .= sprintf(
|
||||
/* translators: %s: URL to WordPress Updates screen. */
|
||||
' ' . __( '<a href="%s" target="_parent">Click here to update WordPress</a>.' ),
|
||||
esc_url( self_admin_url( 'update-core.php' ) )
|
||||
);
|
||||
}
|
||||
echo '</p></div>';
|
||||
|
||||
wp_admin_notice(
|
||||
$compatible_wp_notice_message,
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( (array) $api->sections as $section_name => $content ) {
|
||||
|
@ -2497,13 +2497,17 @@ function paused_plugins_notice() {
|
||||
return;
|
||||
}
|
||||
|
||||
printf(
|
||||
'<div class="notice notice-error"><p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p></div>',
|
||||
$message = sprintf(
|
||||
'<strong>%s</strong><br>%s</p><p><a href="%s">%s</a>',
|
||||
__( 'One or more plugins failed to load properly.' ),
|
||||
__( 'You can find more details and make changes on the Plugins screen.' ),
|
||||
esc_url( admin_url( 'plugins.php?plugin_status=paused' ) ),
|
||||
__( 'Go to the Plugins screen' )
|
||||
);
|
||||
wp_admin_notice(
|
||||
$message,
|
||||
array( 'type' => 'error' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2571,8 +2575,8 @@ function deactivated_plugins_notice() {
|
||||
);
|
||||
}
|
||||
|
||||
printf(
|
||||
'<div class="notice notice-warning"><p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p></div>',
|
||||
$message = sprintf(
|
||||
'<strong>%s</strong><br>%s</p><p><a href="%s">%s</a>',
|
||||
sprintf(
|
||||
/* translators: %s: Name of deactivated plugin. */
|
||||
__( '%s plugin deactivated during WordPress upgrade.' ),
|
||||
@ -2582,6 +2586,7 @@ function deactivated_plugins_notice() {
|
||||
esc_url( admin_url( 'plugins.php?plugin_status=inactive' ) ),
|
||||
__( 'Go to the Plugins screen' )
|
||||
);
|
||||
wp_admin_notice( $message, array( 'type' => 'warning' ) );
|
||||
}
|
||||
|
||||
// Empty the options.
|
||||
|
@ -512,9 +512,16 @@ function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $
|
||||
<button type="button" class="cancel button"><?php _e( 'Cancel' ); ?></button>
|
||||
<span class="waiting spinner"></span>
|
||||
</p>
|
||||
<div class="notice notice-error notice-alt inline hidden">
|
||||
<p class="error"></p>
|
||||
</div>
|
||||
<?php
|
||||
wp_admin_notice(
|
||||
'<p class="error"></p>',
|
||||
array(
|
||||
'type' => 'error',
|
||||
'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
|
||||
'paragraph_wrap' => false,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="action" id="action" value="" />
|
||||
@ -2776,9 +2783,12 @@ function wp_star_rating( $args = array() ) {
|
||||
* @since 4.2.0
|
||||
*/
|
||||
function _wp_posts_page_notice() {
|
||||
printf(
|
||||
'<div class="notice notice-warning inline"><p>%s</p></div>',
|
||||
__( 'You are currently editing the page that shows your latest posts.' )
|
||||
wp_admin_notice(
|
||||
__( 'You are currently editing the page that shows your latest posts.' ),
|
||||
array(
|
||||
'type' => 'warning',
|
||||
'additional_classes' => array( 'inline' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1224,11 +1224,18 @@ function paused_themes_notice() {
|
||||
return;
|
||||
}
|
||||
|
||||
printf(
|
||||
'<div class="notice notice-error"><p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p></div>',
|
||||
$message = sprintf(
|
||||
'<p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p>',
|
||||
__( 'One or more themes failed to load properly.' ),
|
||||
__( 'You can find more details and make changes on the Themes screen.' ),
|
||||
esc_url( admin_url( 'themes.php' ) ),
|
||||
__( 'Go to the Themes screen' )
|
||||
);
|
||||
wp_admin_notice(
|
||||
$message,
|
||||
array(
|
||||
'type' => 'error',
|
||||
'paragraph_wrap' => false,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1049,19 +1049,12 @@ function wp_recovery_mode_nag() {
|
||||
$url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url );
|
||||
$url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION );
|
||||
|
||||
?>
|
||||
<div class="notice notice-info">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Recovery Mode exit link. */
|
||||
__( 'You are in recovery mode. This means there may be an error with a theme or plugin. To exit recovery mode, log out or use the Exit button. <a href="%s">Exit Recovery Mode</a>' ),
|
||||
esc_url( $url )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
$message = sprintf(
|
||||
/* translators: %s: Recovery Mode exit link. */
|
||||
__( 'You are in recovery mode. This means there may be an error with a theme or plugin. To exit recovery mode, log out or use the Exit button. <a href="%s">Exit Recovery Mode</a>' ),
|
||||
esc_url( $url )
|
||||
);
|
||||
wp_admin_notice( $message, array( 'type' => 'info' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-alpha-56570';
|
||||
$wp_version = '6.4-alpha-56571';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user