Plugin Directory

Changeset 3139337


Ignore:
Timestamp:
08/22/2024 12:48:39 AM (19 months ago)
Author:
mdawaffe
Message:

Switch to add_settings_error()

Props mmtr86

File:
1 edited

Legend:

Unmodified
Added
Removed
  • email-post-changes/trunk/class.email-post-changes.php

    r3139330 r3139337  
    372372
    373373    function admin_page_head() {
     374        $options = $this->get_options();
     375        if ( ! empty( $options['invalid_emails'] ) && ! empty( $_REQUEST['settings-updated'] ) ) {
     376            add_settings_error(
     377                'email_post_changes',
     378                'email_post_changes',
     379                /* Translators: Comma-separated list of invalid email addresses. */
     380                sprintf(
     381                    _n( 'Invalid Email: %s', 'Invalid Emails: %s', is_countable( $options['invalid_emails'] ) ? count( $options['invalid_emails'] ) : 0 ),
     382                    '<kbd>' . implode( '</kbd>, <kbd>', array_map( 'esc_html', $options['invalid_emails'] ) )
     383                )
     384            );
     385        }
     386
    374387?>
    375388<style>
     
    400413<div class="wrap">
    401414    <h1><?php _e( 'Email Post Changes' ); ?></h1>
    402 <?php   if ( !empty( $options['invalid_emails'] ) && $_GET['settings-updated'] ) : ?>
    403     <div class="error">
    404         <p><?php printf( _n( 'Invalid Email: %s', 'Invalid Emails: %s', is_countable( $options['invalid_emails'] ) ? count( $options['invalid_emails'] ) : 0 ), '<kbd>' . implode( '</kbd>, <kbd>', array_map( 'esc_html', $options['invalid_emails'] ) ) ); ?></p>
    405     </div>
    406 <?php   endif; ?>
    407415
    408416    <form action="options.php" method="post">
Note: See TracChangeset for help on using the changeset viewer.