Skip to content

Commit

Permalink
Merge pull request #1548 from IanDelMar/wp_admin_notice
Browse files Browse the repository at this point in the history
Fix wp_admin_notice argument type
  • Loading branch information
takayukister authored Feb 14, 2025
2 parents 4d8952b + 30539c8 commit 2254d53
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,14 @@ function wpcf7_admin_updated_message( $page, $action, $object ) {
}

if ( ! empty( $message ) ) {
wp_admin_notice( esc_html( $message ), 'type=success' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'success' ) );
}

if ( 'failed' === $_REQUEST['message'] ) {
$message =
__( "There was an error saving the contact form.", 'contact-form-7' );

wp_admin_notice( esc_html( $message ), 'type=error' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'error' ) );
}

if ( 'validated' === $_REQUEST['message'] ) {
Expand All @@ -592,11 +592,11 @@ function wpcf7_admin_updated_message( $page, $action, $object ) {
number_format_i18n( $count_invalid )
);

wp_admin_notice( esc_html( $message ), 'type=warning' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
} else {
$message = __( "Configuration validation completed. No invalid contact form was found.", 'contact-form-7' );

wp_admin_notice( esc_html( $message ), 'type=success' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'success' ) );
}
}
}
Expand Down Expand Up @@ -638,7 +638,7 @@ function wpcf7_old_wp_version_error( $page, $action, $object ) {
admin_url( 'update-core.php' )
);

wp_admin_notice( $message, 'type=warning' );
wp_admin_notice( $message, array( 'type' => 'warning' ) );
}
}

Expand All @@ -655,7 +655,7 @@ function wpcf7_not_allowed_to_edit( $page, $action, $object ) {
if ( ! current_user_can( 'wpcf7_edit_contact_form', $contact_form->id() ) ) {
$message = __( "You are not allowed to edit this contact form.", 'contact-form-7' );

wp_admin_notice( esc_html( $message ), 'type=warning' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
}
}

Expand All @@ -666,7 +666,7 @@ function wpcf7_outdated_php_warning( $page, $action, $object ) {
if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
$message = __( "The next major release of Contact Form 7 will discontinue support for outdated PHP versions. If you don't upgrade PHP, you will not be able to upgrade the plugin.", 'contact-form-7' );

wp_admin_notice( esc_html( $message ), 'type=warning' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
}
}

Expand All @@ -686,6 +686,6 @@ function wpcf7_ctct_deprecated_warning( $page, $action, $object ) {
array( 'http', 'https' )
);

wp_admin_notice( $message, 'type=warning' );
wp_admin_notice( $message, array( 'type' => 'warning' ) );
}
}
2 changes: 1 addition & 1 deletion admin/includes/config-validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function wpcf7_admin_warnings_bulk_cv( $page, $action, $object ) {
esc_html( $message ),
$link
),
'type=warning'
array( 'type' => 'warning' )
);
}

Expand Down
2 changes: 1 addition & 1 deletion includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,6 @@ function wpcf7_file_display_warning_message( $page, $action, $object ) {
$uploads_dir
);

wp_admin_notice( esc_html( $message ), 'type=warning' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
}
}
6 changes: 3 additions & 3 deletions modules/constant-contact/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public function admin_notice( $message = '' ) {
case 'success':
wp_admin_notice(
esc_html( __( "Connection established.", 'contact-form-7' ) ),
'type=success'
array( 'type' => 'success' )
);

break;
Expand All @@ -354,14 +354,14 @@ public function admin_notice( $message = '' ) {
esc_html( __( "Error", 'contact-form-7' ) ),
esc_html( __( "Failed to establish connection. Please double-check your configuration.", 'contact-form-7' ) )
),
'type=error'
array( 'type' => 'error' )
);

break;
case 'updated':
wp_admin_notice(
esc_html( __( "Configuration updated.", 'contact-form-7' ) ),
'type=success'
array( 'type' => 'success' )
);

break;
Expand Down
4 changes: 2 additions & 2 deletions modules/really-simple-captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function wpcf7_captcha_display_warning_message( $page, $action, $object ) {
$uploads_dir
);

wp_admin_notice( esc_html( $message ), 'type=warning' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
}

if (
Expand All @@ -286,7 +286,7 @@ function wpcf7_captcha_display_warning_message( $page, $action, $object ) {
) {
$message = __( "This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server.", 'contact-form-7' );

wp_admin_notice( esc_html( $message ), 'type=warning' );
wp_admin_notice( esc_html( $message ), array( 'type' => 'warning' ) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/recaptcha/recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,5 @@ function wpcf7_admin_warnings_recaptcha_v2_v3( $page, $action, $object ) {
)
);

wp_admin_notice( $message, 'type=warning' );
wp_admin_notice( $message, array( 'type' => 'warning' ) );
}
4 changes: 2 additions & 2 deletions modules/recaptcha/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,14 @@ public function admin_notice( $message = '' ) {
esc_html( __( "Error", 'contact-form-7' ) ),
esc_html( __( "Invalid key values.", 'contact-form-7' ) )
),
'type=error'
array( 'type' => 'error' )
);
}

if ( 'success' === $message ) {
wp_admin_notice(
esc_html( __( "Settings saved.", 'contact-form-7' ) ),
'type=success'
array( 'type' => 'success' )
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions modules/sendinblue/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function admin_notice( $message = '' ) {
esc_html( __( "Error", 'contact-form-7' ) ),
esc_html( __( "You have not been authenticated. Make sure the provided API key is correct.", 'contact-form-7' ) )
),
'type=error'
array( 'type' => 'error' )
);
}

Expand All @@ -135,14 +135,14 @@ public function admin_notice( $message = '' ) {
esc_html( __( "Error", 'contact-form-7' ) ),
esc_html( __( "Invalid key values.", 'contact-form-7' ) )
),
'type=error'
array( 'type' => 'error' )
);
}

if ( 'success' === $message ) {
wp_admin_notice(
esc_html( __( "Settings saved.", 'contact-form-7' ) ),
'type=success'
array( 'type' => 'success' )
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/stripe/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ public function admin_notice( $message = '' ) {
esc_html( __( "Error", 'contact-form-7' ) ),
esc_html( __( "Invalid key values.", 'contact-form-7' ) )
),
'type=error'
array( 'type' => 'error' )
);
}

if ( 'success' === $message ) {
wp_admin_notice(
esc_html( __( "Settings saved.", 'contact-form-7' ) ),
'type=success'
array( 'type' => 'success' )
);
}
}
Expand Down

0 comments on commit 2254d53

Please sign in to comment.