Make WordPress Core

Ticket #19691: 19691.diff

File 19691.diff, 8.9 KB (added by MikeSchinkel, 8 years ago)

Added unique admin message hooks for each use-case.

  • wp-admin/edit-comments.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    252252                        }
    253253                }
    254254
     255
     256                /**
     257                 * Filter the array of admin messages for editing comments before display.
     258                 *
     259                 * @since 4.4.0
     260                 *
     261                 * @param string[] $messages Array of messages to display, each containing HTML formatting.
     262                 */
     263                $messages = apply_filters( 'edit_comments_admin_messages', $messages );
     264
    255265                echo '<div id="moderated" class="updated notice is-dismissible"><p>' . implode( "<br/>\n", $messages ) . '</p></div>';
     266
    256267        }
    257268}
    258269?>
  • wp-admin/edit-tags.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    311311        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
    312312</h1>
    313313
    314 <?php if ( $message ) : ?>
     314<?php
     315/**
     316 * Filter the admin message for edit-tags.php before display.
     317 *
     318 * @since 4.4.0
     319 *
     320 * @param string $message Messages to display containing HTML formatting.
     321 */
     322$message = apply_filters( 'edit_tag_admin_message', $message );
     323
     324if ( $message ) : ?>
    315325<div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div>
    316326<?php $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] );
    317327endif; ?>
  • wp-admin/users.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    460460        </div>
    461461<?php endif;
    462462
     463/**
     464 * Filter the array of user admin messages before display.
     465 *
     466 * @since 4.4.0
     467 *
     468 * @param string[] $messages Array of messages to display, each containing HTML formatting.
     469 */
     470$messages = apply_filters( 'users_admin_messages', $messages );
     471
    463472if ( ! empty($messages) ) {
    464473        foreach ( $messages as $msg )
    465474                echo $msg;
  • wp-admin/network/site-settings.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    110110?>
    111111</h2>
    112112<?php
     113
     114/**
     115 * Filter the array of site settings admin messages before display.
     116 *
     117 * @since 4.4.0
     118 *
     119 * @param string[] $messages Array of messages to display, each containing HTML formatting.
     120 */
     121$messages = apply_filters( 'site_settings_admin_messages', $messages );
     122
    113123if ( ! empty( $messages ) ) {
    114124        foreach ( $messages as $msg )
    115125                echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
  • wp-admin/widgets.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    155155
    156156                /**
    157157                 * Fires immediately after a widget has been marked for deletion.
    158                  * 
     158                 *
    159159                 * @since 4.4.0
    160160                 *
    161161                 * @param string $widget_id  ID of the widget marked for deletion.
     
    341341?>
    342342</h1>
    343343
    344 <?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?>
    345 <div id="message" class="updated notice is-dismissible"><p><?php echo $messages[$_GET['message']]; ?></p></div>
    346 <?php } ?>
    347 <?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?>
    348 <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div>
    349 <?php } ?>
     344<?php
     345$message = isset( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ? $messages[ $_GET['message'] ] : '';
    350346
     347/**
     348 * Filter the admin message for Widgets before display.
     349 *
     350 * @since 4.4.0
     351 *
     352 * @param string $message Messages to display containing HTML formatting.
     353 */
     354$message = apply_filters( 'widget_admin_message', $message );
     355
     356if ( $message ):
     357?>
     358<div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
    351359<?php
     360endif; ?>
     361
     362<?php
     363$error = isset( $_GET['error'] ) && isset( $errors[ $_GET['error'] ] ) ? $errors[ $_GET['error'] ] : '';
     364
     365/**
     366 * Filter the admin error for Widgets before display.
     367 *
     368 * @since 4.4.0
     369 *
     370 * @param string $error Messages to display containing HTML formatting.
     371 */
     372$error = apply_filters( 'widget_admin_error', $error );
     373
     374if ( $error ):
     375?>
     376<div id="message" class="error"><p><?php echo $error; ?></p></div>
     377<?php
     378endif;
     379
    352380/**
    353381 * Fires before the Widgets administration page content loads.
    354382 *
  • wp-admin/network/site-new.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    160160<div class="wrap">
    161161<h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1>
    162162<?php
     163
     164/**
     165 * Filter the array of new site admin messages before display.
     166 *
     167 * @since 4.4.0
     168 *
     169 * @param string[] $messages Array of messages to display, each containing HTML formatting.
     170 */
     171$messages = apply_filters( 'new_site_admin_messages', $messages );
     172
    163173if ( ! empty( $messages ) ) {
    164174        foreach ( $messages as $msg )
    165175                echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
  • wp-admin/user-new.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    257257        echo _x( 'Add Existing User', 'user' );
    258258} ?>
    259259</h1>
     260<?php
    260261
    261 <?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
     262/**
     263 * Filter the array of error messages for new users before display.
     264 *
     265 * @since 4.4.0
     266 *
     267 * @param string[] $messages Array of messages to display, each containing HTML formatting.
     268 */
     269$errors = apply_filters( 'new_user_admin_errors', $errors );
     270
     271if ( isset($errors) && is_wp_error( $errors ) ) : ?>
    262272        <div class="error">
    263273                <ul>
    264274                <?php
     
    268278                </ul>
    269279        </div>
    270280<?php endif;
     281
     282/**
     283 * Filter the array of user admin messages for new users before display.
     284 *
     285 * @since 4.4.0
     286 *
     287 * @param string[] $messages Array of messages to display, each containing HTML formatting.
     288 */
     289$messages = apply_filters( 'new_user_admin_messages', $messages );
    271290
    272291if ( ! empty( $messages ) ) {
    273292        foreach ( $messages as $msg )
  • wp-admin/network/site-info.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    153153?>
    154154</h2>
    155155<?php
     156
     157/**
     158 * Filter the array of site info admin messages before display.
     159 *
     160 * @since 4.4.0
     161 *
     162 * @param string[] $messages Array of messages to display, each containing HTML formatting.
     163 */
     164$messages = apply_filters( 'site_info_admin_messages', $messages );
     165
    156166if ( ! empty( $messages ) ) {
    157167        foreach ( $messages as $msg ) {
    158168                echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
  • wp-admin/nav-menus.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    593593                ?>
    594594        </h2>
    595595        <?php
     596
     597        /**
     598         * Filter the array of admin messages for nav menus before display.
     599         *
     600         * @since 4.4.0
     601         *
     602         * @param string[] $messages Array of messages to display, each containing HTML formatting.
     603         */
     604        $messages = apply_filters( 'nav_menu_admin_messages', $messages );
     605
    596606        foreach ( $messages as $message ) :
    597607                echo $message . "\n";
    598608        endforeach;
  • wp-admin/upload.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    283283        $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
    284284}
    285285
     286/**
     287 * Filter the admin message for upload.php before display.
     288 *
     289 * @since 4.4.0
     290 *
     291 * @param string $message Messages to display containing HTML formatting.
     292 */
     293$message = apply_filters( 'upload_admin_message', $message );
     294
    286295if ( !empty($message) ) { ?>
    287296<div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
    288297<?php } ?>