diff --git a/includes/admin/admin-notices.php b/includes/admin/admin-notices.php new file mode 100644 index 0000000..6307c52 --- /dev/null +++ b/includes/admin/admin-notices.php @@ -0,0 +1,80 @@ + +
+ array( + 'href' => array(), + 'title' => array(), + 'target' => array(), + ), + 'strong' => array(), + 'em' => array(), + ) + ); + ?> +
++ array( + 'href' => array(), + 'title' => array(), + 'target' => array(), + ), + 'strong' => array(), + 'em' => array(), + ) + ); + ?> +
+' . esc_html__( 'Fancy Javascript submission turned On!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Fancy Javascript submission turned On!', 'mailchimp' ); + admin_notice_success( $msg ); } elseif ( get_option( 'mc_use_javascript' ) !== 'off' ) { update_option( 'mc_use_javascript', 'off' ); - $msg = '' . esc_html__( 'Fancy Javascript submission turned Off!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Fancy Javascript submission turned Off!', 'mailchimp' ); + admin_notice_success( $msg ); } if ( isset( $_POST['mc_use_datepicker'] ) ) { update_option( 'mc_use_datepicker', 'on' ); - $msg = '' . esc_html__( 'Datepicker turned On!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Datepicker turned On!', 'mailchimp' ); + admin_notice_success( $msg ); } elseif ( get_option( 'mc_use_datepicker' ) !== 'off' ) { update_option( 'mc_use_datepicker', 'off' ); - $msg = '' . esc_html__( 'Datepicker turned Off!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Datepicker turned Off!', 'mailchimp' ); + admin_notice_success( $msg ); } /*Enable double optin toggle*/ if ( isset( $_POST['mc_double_optin'] ) ) { update_option( 'mc_double_optin', true ); - $msg = '' . esc_html__( 'Double opt-in turned On!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Double opt-in turned On!', 'mailchimp' ); + admin_notice_success( $msg ); } elseif ( get_option( 'mc_double_optin' ) !== false ) { update_option( 'mc_double_optin', false ); - $msg = '' . esc_html__( 'Double opt-in turned Off!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Double opt-in turned Off!', 'mailchimp' ); + admin_notice_success( $msg ); } /* NUKE the CSS! */ if ( isset( $_POST['mc_nuke_all_styles'] ) ) { update_option( 'mc_nuke_all_styles', true ); - $msg = '' . esc_html__( 'Mailchimp CSS turned Off!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Mailchimp CSS turned Off!', 'mailchimp' ); + admin_notice_success( $msg ); } elseif ( get_option( 'mc_nuke_all_styles' ) !== false ) { update_option( 'mc_nuke_all_styles', false ); - $msg = '' . esc_html__( 'Mailchimp CSS turned On!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Mailchimp CSS turned On!', 'mailchimp' ); + admin_notice_success( $msg ); } /* Update existing */ if ( isset( $_POST['mc_update_existing'] ) ) { update_option( 'mc_update_existing', true ); - $msg = '' . esc_html__( 'Update existing subscribers turned On!' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Update existing subscribers turned On!' ); + admin_notice_success( $msg ); } elseif ( get_option( 'mc_update_existing' ) !== false ) { update_option( 'mc_update_existing', false ); - $msg = '' . esc_html__( 'Update existing subscribers turned Off!' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Update existing subscribers turned Off!' ); + admin_notice_success( $msg ); } if ( isset( $_POST['mc_use_unsub_link'] ) ) { update_option( 'mc_use_unsub_link', 'on' ); - $msg = '' . esc_html__( 'Unsubscribe link turned On!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Unsubscribe link turned On!', 'mailchimp' ); + admin_notice_success( $msg ); } elseif ( get_option( 'mc_use_unsub_link' ) !== 'off' ) { update_option( 'mc_use_unsub_link', 'off' ); - $msg = '' . esc_html__( 'Unsubscribe link turned Off!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Unsubscribe link turned Off!', 'mailchimp' ); + admin_notice_success( $msg ); } $content = isset( $_POST['mc_header_content'] ) ? wp_kses_post( wp_unslash( $_POST['mc_header_content'] ) ) : ''; @@ -601,8 +608,8 @@ function mailchimp_sf_save_general_form_settings() { } } - $msg = '' . esc_html__( 'Successfully Updated your List Subscribe Form Settings!', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Successfully Updated your List Subscribe Form Settings!', 'mailchimp' ); + admin_notice_success( $msg ); } /** @@ -614,8 +621,8 @@ function mailchimp_sf_change_list_if_necessary() { } if ( empty( $_POST['mc_list_id'] ) ) { - $msg = '' . esc_html__( 'Please choose a valid list', 'mailchimp' ) . '
'; - mailchimp_sf_global_msg( $msg ); + $msg = esc_html__( 'Please choose a valid list', 'mailchimp' ); + admin_notice_error( $msg ); return; } @@ -673,16 +680,15 @@ function mailchimp_sf_change_list_if_necessary() { $igs_text .= sprintf( esc_html__( 'and %s Sets of Interest Groups', 'mailchimp' ), count( $igs ) ); } - $msg = '' .
- sprintf(
- /* translators: %s: count (number) */
- __( 'Success! Loaded and saved the info for %d Merge Variables', 'mailchimp' ) . $igs_text,
- count( $mv )
- ) . ' ' .
- esc_html__( 'from your list' ) . ' "' . $list_name . '"
' .
- esc_html__( 'Now you should either Turn On the Mailchimp Widget or change your options below, then turn it on.', 'mailchimp' ) . '
:@@ -54,29 +48,19 @@ // we *could* support paging, but few users have that many lists (and shouldn't) $lists = $api->get( 'lists', 100, array( 'fields' => 'lists.id,lists.name,lists.email_type_option' ) ); if ( is_wp_error( $lists ) ) { - ?> -
- get_error_message() )
- );
- ?>
-
- get_error_message() )
+ );
+ admin_notice_error( $msg );
} elseif ( isset( $lists['lists'] ) && count( $lists['lists'] ) === 0 ) {
- ?>
-
- Mailchimp"
- );
- ?>
-
- Mailchimp"
+ );
+ admin_notice_error( $msg );
} else {
$lists = $lists['lists'];
$option = get_option( 'mc_list_id' );
|