@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes |
| 26 | 26 | * @author YIKES Inc. <[email protected]> |
| 27 | 27 | */ |
| 28 | -class Yikes_Inc_Easy_Mailchimp_Extender {
|
|
| 28 | +class Yikes_Inc_Easy_Mailchimp_Extender { |
|
| 29 | 29 | /** |
| 30 | 30 | * The loader that's responsible for maintaining and registering all hooks that power |
| 31 | 31 | * the plugin. |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @param Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface $form_interface |
| 72 | 72 | */ |
| 73 | - public function __construct( Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface $form_interface ) {
|
|
| 73 | + public function __construct( Yikes_Inc_Easy_Mailchimp_Extender_Form_Interface $form_interface ) { |
|
| 74 | 74 | $this->version = YIKES_MC_VERSION; |
| 75 | 75 | $this->form_interface = $form_interface; |
| 76 | 76 | $this->load_dependencies(); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @since 1.0.0 |
| 94 | 94 | * @access private |
| 95 | 95 | */ |
| 96 | - private function load_dependencies() {
|
|
| 96 | + private function load_dependencies() { |
|
| 97 | 97 | /** |
| 98 | 98 | * The class responsible for orchestrating the actions and filters of the |
| 99 | 99 | * core plugin. |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @since 1.0.0 |
| 122 | 122 | * @access private |
| 123 | 123 | */ |
| 124 | - private function define_admin_hooks() {
|
|
| 124 | + private function define_admin_hooks() { |
|
| 125 | 125 | $plugin_admin = new Yikes_Inc_Easy_Mailchimp_Forms_Admin( $this->get_yikes_inc_easy_mailchimp_extender(), $this->get_version(), $this->form_interface ); |
| 126 | 126 | $plugin_admin->hooks(); |
| 127 | 127 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @since 1.0.0 |
| 135 | 135 | * @access private |
| 136 | 136 | */ |
| 137 | - private function define_public_hooks() {
|
|
| 137 | + private function define_public_hooks() { |
|
| 138 | 138 | $plugin_public = new Yikes_Inc_Easy_Mailchimp_Extender_Public( $this->get_yikes_inc_easy_mailchimp_extender(), $this->get_version() ); |
| 139 | 139 | } |
| 140 | 140 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @since 1.0.0 |
| 144 | 144 | */ |
| 145 | - public function run() {
|
|
| 145 | + public function run() { |
|
| 146 | 146 | $this->loader->run(); |
| 147 | 147 | } |
| 148 | 148 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @since 1.0.0 |
| 153 | 153 | * @return string The name of the plugin. |
| 154 | 154 | */ |
| 155 | - public function get_yikes_inc_easy_mailchimp_extender() {
|
|
| 155 | + public function get_yikes_inc_easy_mailchimp_extender() { |
|
| 156 | 156 | return $this->yikes_inc_easy_mailchimp_extender; |
| 157 | 157 | } |
| 158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @since 1.0.0 |
| 162 | 162 | * @return Yikes_Inc_Easy_Mailchimp_Extender_Loader Orchestrates the hooks of the plugin. |
| 163 | 163 | */ |
| 164 | - public function get_loader() {
|
|
| 164 | + public function get_loader() { |
|
| 165 | 165 | return $this->loader; |
| 166 | 166 | } |
| 167 | 167 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @since 1.0.0 |
| 171 | 171 | * @return string The version number of the plugin. |
| 172 | 172 | */ |
| 173 | - public function get_version() {
|
|
| 173 | + public function get_version() { |
|
| 174 | 174 | return $this->version; |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $this->api_key = $api_key; |
| 74 | 74 | $parts = $this->get_api_key_parts(); |
| 75 | - $this->key = $parts['key']; |
|
| 76 | - $this->dc = $parts['dc']; |
|
| 75 | + $this->key = $parts[ 'key' ]; |
|
| 76 | + $this->dc = $parts[ 'dc' ]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | $parts = explode( '-', $this->api_key ); |
| 99 | 99 | |
| 100 | 100 | return array( |
| 101 | - 'key' => $parts[0], |
|
| 102 | - 'dc' => isset( $parts[1] ) ? $parts[1] : '', |
|
| 101 | + 'key' => $parts[ 0 ], |
|
| 102 | + 'dc' => isset( $parts[ 1 ] ) ? $parts[ 1 ] : '', |
|
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return Yikes_Inc_Easy_Mailchimp_API |
| 144 | 144 | */ |
| 145 | 145 | public function get_api( $version = '' ) { |
| 146 | - $version = $version ?: $this->get_default_api_version(); |
|
| 146 | + $version = $version ? : $this->get_default_api_version(); |
|
| 147 | 147 | |
| 148 | 148 | if ( ! array_key_exists( $version, $this->api ) || null === $this->api[ $version ] ) { |
| 149 | 149 | $this->api[ $version ] = new Yikes_Inc_Easy_Mailchimp_API( $this->get_datacenter(), $this->get_api_key(), $version ); |
@@ -5,18 +5,18 @@ discard block |
||
| 5 | 5 | * @since 6.0.3 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -class YIKES_Mailchimp_Visual_Composer_Extension {
|
|
| 8 | +class YIKES_Mailchimp_Visual_Composer_Extension { |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Constructor |
| 12 | 12 | * |
| 13 | 13 | * @since 6.0.3 |
| 14 | 14 | */ |
| 15 | - function __construct() {
|
|
| 15 | + function __construct() { |
|
| 16 | 16 | |
| 17 | 17 | add_action( 'admin_init', array( $this, 'extend_visual_composer' ) ); |
| 18 | 18 | |
| 19 | - if ( function_exists( 'vc_add_shortcode_param' ) ) {
|
|
| 19 | + if ( function_exists( 'vc_add_shortcode_param' ) ) { |
|
| 20 | 20 | vc_add_shortcode_param( 'yikes_mailchimp_logo', array( $this, 'yikes_mailchimp_logo_vc_section' ) ); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @since 6.0.3 |
| 28 | 28 | */ |
| 29 | - public function extend_visual_composer() {
|
|
| 29 | + public function extend_visual_composer() { |
|
| 30 | 30 | |
| 31 | - if ( ! function_exists( 'vc_map' ) ) {
|
|
| 31 | + if ( ! function_exists( 'vc_map' ) ) { |
|
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @since 6.0.3 |
| 100 | 100 | */ |
| 101 | - public function yikes_mailchimp_logo_vc_section() {
|
|
| 101 | + public function yikes_mailchimp_logo_vc_section() { |
|
| 102 | 102 | return '<img style="width:250px;display:block;margin:0 auto;" src="' . YIKES_MC_URL . 'includes/images/Mailchimp_Assets/mailchimp-logo.png" title="' . __( 'Easy Forms for Mailchimp', 'yikes-inc-easy-mailchimp-extender' ) . '" />'; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @since 6.0.3 |
| 109 | 109 | */ |
| 110 | - public function yikes_mailchimp_retreive_user_created_forms() {
|
|
| 110 | + public function yikes_mailchimp_retreive_user_created_forms() { |
|
| 111 | 111 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 112 | 112 | $all_forms = $interface->get_all_forms(); |
| 113 | 113 | |
| 114 | 114 | $lists = array(); |
| 115 | - if ( ! empty( $all_forms ) ) {
|
|
| 115 | + if ( ! empty( $all_forms ) ) { |
|
| 116 | 116 | // build an array to pass to our javascript |
| 117 | - foreach ( $all_forms as $id => $form ) {
|
|
| 117 | + foreach ( $all_forms as $id => $form ) { |
|
| 118 | 118 | $lists[ $form['form_name'] ] = $id; |
| 119 | 119 | } |
| 120 | - } else {
|
|
| 120 | + } else { |
|
| 121 | 121 | $lists[ __( 'Please Import Some Mailchimp Lists', 'yikes-inc-easy-mailchimp-extender' ) ] = '-'; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | // required..* |
| 18 | 18 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 19 | 19 | /* Visual Composer */ |
| 20 | - if( is_plugin_active( 'js_composer/js_composer.php' ) ) { |
|
| 20 | + if ( is_plugin_active( 'js_composer/js_composer.php' ) ) { |
|
| 21 | 21 | new YIKES_Mailchimp_Visual_Composer_Extension(); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -11,16 +11,16 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | public function __construct() { |
| 13 | 13 | // ajax process form submission |
| 14 | - add_action( 'wp_ajax_nopriv_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
| 15 | - add_action( 'wp_ajax_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
| 14 | + add_action( 'wp_ajax_nopriv_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
| 15 | + add_action( 'wp_ajax_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
| 16 | 16 | |
| 17 | 17 | // ajax send update emails |
| 18 | - add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
| 19 | - add_action( 'wp_ajax_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
| 18 | + add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
| 19 | + add_action( 'wp_ajax_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
| 20 | 20 | |
| 21 | 21 | // increase submission count for a given form on successful submit |
| 22 | - add_action( 'wp_ajax_nopriv_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
| 23 | - add_action( 'wp_ajax_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
| 22 | + add_action( 'wp_ajax_nopriv_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
| 23 | + add_action( 'wp_ajax_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /* |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * Increase the submission count for a given form. |
| 38 | 38 | */ |
| 39 | 39 | public function increase_submission_count() { |
| 40 | - $form_id = intval( $_POST['form_id'] ); |
|
| 40 | + $form_id = intval( $_POST[ 'form_id' ] ); |
|
| 41 | 41 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 42 | 42 | $form = $interface->get_form( $form_id ); |
| 43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Update the form. |
| 50 | - $submission_count = isset( $form['submissions'] ) ? $form['submissions'] + 1 : 1; |
|
| 50 | + $submission_count = isset( $form[ 'submissions' ] ) ? $form[ 'submissions' ] + 1 : 1; |
|
| 51 | 51 | $interface->update_form_field( $form_id, 'submissions', $submission_count ); |
| 52 | 52 | |
| 53 | 53 | exit(); |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | @since v6.0.4.1 |
| 59 | 59 | */ |
| 60 | 60 | public function sendUpdateProfileEmail() { |
| 61 | - $user_email = filter_var( $_POST['user_email'], FILTER_SANITIZE_STRING ); |
|
| 61 | + $user_email = filter_var( $_POST[ 'user_email' ], FILTER_SANITIZE_STRING ); |
|
| 62 | 62 | $user_id = md5( $user_email ); |
| 63 | - $list_id = filter_var( $_POST['list_id'], FILTER_SANITIZE_STRING ); |
|
| 64 | - $form_id = filter_var( $_POST['form_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 65 | - $page_id = filter_var( $_POST['page_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 63 | + $list_id = filter_var( $_POST[ 'list_id' ], FILTER_SANITIZE_STRING ); |
|
| 64 | + $form_id = filter_var( $_POST[ 'form_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 65 | + $page_id = filter_var( $_POST[ 'page_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 66 | 66 | $full_site_url = get_bloginfo( 'url' ); |
| 67 | 67 | $manager = yikes_get_mc_api_manager(); |
| 68 | 68 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | 'class.public_ajax.php' |
| 80 | 80 | ); |
| 81 | 81 | $is_error = true; |
| 82 | - $errors[] = $list_details->get_error_message(); |
|
| 82 | + $errors[ ] = $list_details->get_error_message(); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Subscriber details API call. |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 89 | 89 | $error_logging->maybe_write_to_log( $subscriber_account_details->get_error_code(), __( 'Send Update Profile Email - Get Member Info.', 'yikes-inc-easy-mailchimp-extender' ), 'class.public_ajax.php' ); |
| 90 | 90 | $is_error = true; |
| 91 | - $errors[] = $subscriber_account_details->get_error_message(); |
|
| 91 | + $errors[ ] = $subscriber_account_details->get_error_message(); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Form details API call. |
@@ -96,22 +96,22 @@ discard block |
||
| 96 | 96 | if ( ! empty( $interface ) && method_exists( $interface, 'get_form' ) && ! empty( $form_id ) ) { |
| 97 | 97 | $form_data = $interface->get_form( $form_id ); |
| 98 | 98 | if ( ! empty( $form_data ) ) { |
| 99 | - if ( isset( $form_data['error_messages'] ) ) { |
|
| 99 | + if ( isset( $form_data[ 'error_messages' ] ) ) { |
|
| 100 | 100 | |
| 101 | - if ( isset( $form_data['error_messages']['email-body'] ) && ! empty( $form_data['error_messages']['email-body'] ) ) { |
|
| 102 | - $email_body = apply_filters( 'the_content', $form_data['error_messages']['email-body'] ); |
|
| 101 | + if ( isset( $form_data[ 'error_messages' ][ 'email-body' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-body' ] ) ) { |
|
| 102 | + $email_body = apply_filters( 'the_content', $form_data[ 'error_messages' ][ 'email-body' ] ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( isset( $form_data['error_messages']['email-subject'] ) && ! empty( $form_data['error_messages']['email-subject'] ) ) { |
|
| 106 | - $email_subject = $form_data['error_messages']['email-subject']; |
|
| 105 | + if ( isset( $form_data[ 'error_messages' ][ 'email-subject' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-subject' ] ) ) { |
|
| 106 | + $email_subject = $form_data[ 'error_messages' ][ 'email-subject' ]; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ( isset( $form_data['error_messages']['update-email-success'] ) && ! empty( $form_data['error_messages']['update-email-success'] ) ) { |
|
| 110 | - $update_email_success_message = $form_data['error_messages']['update-email-success']; |
|
| 109 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-success' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-success' ] ) ) { |
|
| 110 | + $update_email_success_message = $form_data[ 'error_messages' ][ 'update-email-success' ]; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ( isset( $form_data['error_messages']['update-email-failure'] ) && ! empty( $form_data['error_messages']['update-email-failure'] ) ) { |
|
| 114 | - $update_email_failed_message = $form_data['error_messages']['update-email-failure']; |
|
| 113 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) ) { |
|
| 114 | + $update_email_failed_message = $form_data[ 'error_messages' ][ 'update-email-failure' ]; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // Construct the headers & email message content. |
| 135 | - $subscriber_id = $subscriber_account_details['unique_email_id']; |
|
| 136 | - $update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] ); |
|
| 135 | + $subscriber_id = $subscriber_account_details[ 'unique_email_id' ]; |
|
| 136 | + $update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] ); |
|
| 137 | 137 | $update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href ); |
| 138 | 138 | $update_link_tag = '<a href="' . $update_link_href . '">'; |
| 139 | - $headers = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n"; |
|
| 139 | + $headers = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n"; |
|
| 140 | 140 | $headers .= 'Content-type: text/html'; |
| 141 | 141 | |
| 142 | 142 | if ( ! isset( $email_subject ) ) { |
@@ -178,26 +178,26 @@ discard block |
||
| 178 | 178 | $email_body = str_replace( array( '[subscriber_id]', '[SUBSCRIBER_ID]' ), $subscriber_id, $email_body ); |
| 179 | 179 | |
| 180 | 180 | // We let the user use [form_name] for the form's name so replace [form_name] with the form's name. |
| 181 | - $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data['form_name'], $email_body ); |
|
| 181 | + $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data[ 'form_name' ], $email_body ); |
|
| 182 | 182 | |
| 183 | 183 | // We let the user use [fname] and [lname] so replace those. |
| 184 | - $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details['merge_fields']['FNAME'] ) ? $subscriber_account_details['merge_fields']['FNAME'] : '', $email_body ); |
|
| 185 | - $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details['merge_fields']['LNAME'] ) ? $subscriber_account_details['merge_fields']['LNAME'] : '', $email_body ); |
|
| 184 | + $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] : '', $email_body ); |
|
| 185 | + $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] : '', $email_body ); |
|
| 186 | 186 | |
| 187 | 187 | /* Confirm that the email was sent */ |
| 188 | 188 | if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $email_subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_body, $update_link_href ), $headers ) ) { |
| 189 | 189 | |
| 190 | 190 | $update_email_success_message = apply_filters( 'yikes-mailchimp-update-email-success-message', $update_email_success_message, $form_id, $user_email ); |
| 191 | - $submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
| 191 | + $submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
| 192 | 192 | $redirect_settings = Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler::handle_submission_response_success_redirect( $form_id, $submission_settings, $page_id ); |
| 193 | 193 | |
| 194 | 194 | wp_send_json_success( |
| 195 | 195 | array( |
| 196 | 196 | 'response_text' => '<div class="yikes-easy-mc-success-message">' . $update_email_success_message . '</div>', |
| 197 | - 'redirection' => $redirect_settings['redirection'], |
|
| 198 | - 'redirect' => $redirect_settings['redirect'], |
|
| 199 | - 'redirect_timer' => $redirect_settings['redirect_timer'], |
|
| 200 | - 'new_window' => $redirect_settings['new_window'], |
|
| 197 | + 'redirection' => $redirect_settings[ 'redirection' ], |
|
| 198 | + 'redirect' => $redirect_settings[ 'redirect' ], |
|
| 199 | + 'redirect_timer' => $redirect_settings[ 'redirect_timer' ], |
|
| 200 | + 'new_window' => $redirect_settings[ 'new_window' ], |
|
| 201 | 201 | ) |
| 202 | 202 | ); |
| 203 | 203 | } else { |
@@ -8,10 +8,10 @@ discard block |
||
| 8 | 8 | $submission_handler = new Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler( $is_ajax = true ); |
| 9 | 9 | |
| 10 | 10 | // parse our form data |
| 11 | -parse_str( $_POST['form_data'], $data ); |
|
| 11 | +parse_str( $_POST[ 'form_data' ], $data ); |
|
| 12 | 12 | |
| 13 | 13 | // Get the form_id |
| 14 | -$form_id = absint( $_POST['form_id'] ); |
|
| 14 | +$form_id = absint( $_POST[ 'form_id' ] ); |
|
| 15 | 15 | |
| 16 | 16 | // Send an error if for some reason we can't find the $form_id |
| 17 | 17 | $submission_handler->handle_empty_form_id( $form_id ); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $submission_handler->set_form_id( $form_id ); |
| 21 | 21 | |
| 22 | 22 | // Check our nonce |
| 23 | -$submission_handler->handle_nonce( $_POST['ajax_security_nonce'], 'yikes_mc_form_submission_security_nonce' ); |
|
| 23 | +$submission_handler->handle_nonce( $_POST[ 'ajax_security_nonce' ], 'yikes_mc_form_submission_security_nonce' ); |
|
| 24 | 24 | |
| 25 | 25 | // Get the form data |
| 26 | 26 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | $submission_handler->handle_empty_form( $form_data ); |
| 31 | 31 | |
| 32 | 32 | // Set up some variables from the form data -- these are required |
| 33 | -$list_id = isset( $form_data['list_id'] ) ? $form_data['list_id'] : null; |
|
| 34 | -$submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
| 35 | -$optin_settings = isset( $form_data['optin_settings'] ) ? $form_data['optin_settings'] : null; |
|
| 36 | -$form_fields = isset( $form_data['fields'] ) ? $form_data['fields'] : null; |
|
| 33 | +$list_id = isset( $form_data[ 'list_id' ] ) ? $form_data[ 'list_id' ] : null; |
|
| 34 | +$submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
| 35 | +$optin_settings = isset( $form_data[ 'optin_settings' ] ) ? $form_data[ 'optin_settings' ] : null; |
|
| 36 | +$form_fields = isset( $form_data[ 'fields' ] ) ? $form_data[ 'fields' ] : null; |
|
| 37 | 37 | |
| 38 | 38 | // Send an error if for some reason we can't find the required form data |
| 39 | 39 | $submission_handler->handle_empty_fields_generic( array( $list_id, $submission_settings, $optin_settings, $form_fields ) ); |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | $submission_handler->check_for_required_interest_groups( $data, $form_fields ); |
| 48 | 48 | |
| 49 | 49 | // Set up some variables from the form data -- these are not required |
| 50 | -$error_messages = isset( $form_data['error_messages'] ) ? $form_data['error_messages'] : array(); |
|
| 51 | -$notifications = isset( $form_data['custom_notifications'] ) ? $form_data['custom_notifications'] : array(); |
|
| 50 | +$error_messages = isset( $form_data[ 'error_messages' ] ) ? $form_data[ 'error_messages' ] : array(); |
|
| 51 | +$notifications = isset( $form_data[ 'custom_notifications' ] ) ? $form_data[ 'custom_notifications' ] : array(); |
|
| 52 | 52 | |
| 53 | 53 | // Set the error messages in our class |
| 54 | 54 | $submission_handler->set_error_messages( $error_messages ); |
| 55 | 55 | |
| 56 | 56 | // Some other variables we'll need. |
| 57 | -$page_data = isset( $_POST['page_data'] ) ? $_POST['page_data'] : ''; |
|
| 57 | +$page_data = isset( $_POST[ 'page_data' ] ) ? $_POST[ 'page_data' ] : ''; |
|
| 58 | 58 | $merge_variables = array(); |
| 59 | 59 | $error = 0; |
| 60 | 60 | $list_handler = yikes_get_mc_api_manager()->get_list_handler(); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | // As of 6.4 we no longer pass the post object, only the ID. |
| 63 | 63 | // For any users relying on the $post object for their `yikes-mailchimp-redirect-url` filter we'll grab the post object here. |
| 64 | 64 | // Eventually we should just pass the $post_id into the filter instead of the whole object. |
| 65 | -$page_data = ! empty( $page_data ) ? get_post( $page_data ) : ''; |
|
| 65 | +$page_data = ! empty( $page_data ) ? get_post( $page_data ) : ''; |
|
| 66 | 66 | |
| 67 | 67 | // Send an error if for some reason we can't find the list_handler |
| 68 | 68 | $submission_handler->handle_empty_list_handler( $list_handler ); |
| 69 | 69 | |
| 70 | 70 | // Get, sanitize and lowercasify the email |
| 71 | -$submitted_email = isset( $data['EMAIL'] ) ? $data['EMAIL'] : ''; |
|
| 71 | +$submitted_email = isset( $data[ 'EMAIL' ] ) ? $data[ 'EMAIL' ] : ''; |
|
| 72 | 72 | $sanitized_email = $submission_handler->get_sanitized_email( $submitted_email ); |
| 73 | 73 | $submission_handler->set_email( $sanitized_email ); |
| 74 | 74 | |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | $submission_handler->handle_empty_email( $sanitized_email ); |
| 77 | 77 | |
| 78 | 78 | // Check for Honeypot filled |
| 79 | -$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && '' !== $data['yikes-mailchimp-honeypot'] ) ? true : false; |
|
| 79 | +$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && '' !== $data[ 'yikes-mailchimp-honeypot' ] ) ? true : false; |
|
| 80 | 80 | |
| 81 | 81 | // Send an error if honey pot is not empty |
| 82 | 82 | $submission_handler->handle_non_empty_honeypot( $honey_pot_filled ); |
| 83 | 83 | |
| 84 | 84 | // Check if reCAPTCHA Response was submitted with the form data, and handle it if needed |
| 85 | -if ( isset( $data['g-recaptcha-response'] ) ) { |
|
| 86 | - $recaptcha_response = $data['g-recaptcha-response']; |
|
| 85 | +if ( isset( $data[ 'g-recaptcha-response' ] ) ) { |
|
| 86 | + $recaptcha_response = $data[ 'g-recaptcha-response' ]; |
|
| 87 | 87 | $submission_handler->handle_recaptcha( $recaptcha_response ); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $merge_variables = $submission_handler->get_submitted_merge_values( $data, $form_fields ); |
| 92 | 92 | |
| 93 | 93 | // Submission Setting: Replace interest groups or update interest groups |
| 94 | -$replace_interests = isset( $submission_settings['replace_interests'] ) ? (bool) $submission_settings['replace_interests'] : true; |
|
| 94 | +$replace_interests = isset( $submission_settings[ 'replace_interests' ] ) ? (bool) $submission_settings[ 'replace_interests' ] : true; |
|
| 95 | 95 | |
| 96 | 96 | // Get the default groups |
| 97 | 97 | $groups = $submission_handler->get_default_interest_groups( $replace_interests, $list_handler ); |
@@ -106,15 +106,15 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @param $merge_variables array Array of merge variable to use |
| 108 | 108 | */ |
| 109 | -do_action( 'yikes-mailchimp-before-submission', $merge_variables ); |
|
| 109 | +do_action( 'yikes-mailchimp-before-submission', $merge_variables ); |
|
| 110 | 110 | do_action( "yikes-mailchimp-before-submission-{$form_id}", $merge_variables ); |
| 111 | 111 | |
| 112 | 112 | // Allow users to check for form values (using the `yikes-mailchimp-filter-before-submission` filter hook in function `get_submitted_merge_values`) |
| 113 | 113 | // and pass back an error and message to the user |
| 114 | 114 | // If error is set and no message, default to our class variable's default error message |
| 115 | -if ( isset( $merge_variables['error'] ) ) { |
|
| 116 | - $merge_error_message = isset( $merge_variables['message'] ) ? $merge_variables['message'] : $submission_handler->default_error_response_message; |
|
| 117 | - $submission_handler->handle_merge_variables_error( $merge_variables['error'], $merge_error_message ); |
|
| 115 | +if ( isset( $merge_variables[ 'error' ] ) ) { |
|
| 116 | + $merge_error_message = isset( $merge_variables[ 'message' ] ) ? $merge_variables[ 'message' ] : $submission_handler->default_error_response_message; |
|
| 117 | + $submission_handler->handle_merge_variables_error( $merge_variables[ 'error' ], $merge_error_message ); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // This is the array we're going to pass through to the Mailchimp API |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // Only add groups if they exist |
| 128 | 128 | if ( ! empty( $groups ) ) { |
| 129 | - $member_data['interests'] = $groups; |
|
| 129 | + $member_data[ 'interests' ] = $groups; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // Check if this member already exists |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | // Likewise, if this member exists but their status is 'pending' it means we're dealing with a double opt-in list and they never confirmed |
| 137 | 137 | // Or, if this member but their status is 'unsubscribed' it means we're dealing with someone who unsubscribed and they need to re-subscribe |
| 138 | 138 | // Continue as if they're a new member to force another double opt-in email |
| 139 | -$double_optin_resubscribe = is_array( $member_exists ) && isset( $member_exists['status'] ) && ( $member_exists['status'] === 'pending' || $member_exists['status'] === 'unsubscribed' ); |
|
| 139 | +$double_optin_resubscribe = is_array( $member_exists ) && isset( $member_exists[ 'status' ] ) && ( $member_exists[ 'status' ] === 'pending' || $member_exists[ 'status' ] === 'unsubscribed' ); |
|
| 140 | 140 | |
| 141 | 141 | if ( is_wp_error( $member_exists ) || $double_optin_resubscribe === true ) { |
| 142 | 142 | |
@@ -144,23 +144,23 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | // Check the opt-in value - is it double or single? |
| 146 | 146 | // Double opt-in means 'status_if_new' => 'pending' |
| 147 | - $double_optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
| 147 | + $double_optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
| 148 | 148 | |
| 149 | 149 | // If the user was unsubscribed and is re-subscribing, we set the status to 'pending', which |
| 150 | 150 | // causes Mailchimp to send them a confirmation email. This is the only way Mailchimp will |
| 151 | 151 | // allow us to re-subscribe the user. |
| 152 | - $was_unsubscribed = is_array( $member_exists ) && isset( $member_exists['status'] ) && $member_exists['status'] === 'unsubscribed'; |
|
| 152 | + $was_unsubscribed = is_array( $member_exists ) && isset( $member_exists[ 'status' ] ) && $member_exists[ 'status' ] === 'unsubscribed'; |
|
| 153 | 153 | |
| 154 | 154 | if ( $double_optin === 1 || $was_unsubscribed === true ) { |
| 155 | 155 | |
| 156 | 156 | // Double opt-in |
| 157 | - $member_data['status_if_new'] = 'pending'; |
|
| 158 | - $member_data['status'] = 'pending'; |
|
| 157 | + $member_data[ 'status_if_new' ] = 'pending'; |
|
| 158 | + $member_data[ 'status' ] = 'pending'; |
|
| 159 | 159 | } else { |
| 160 | 160 | |
| 161 | 161 | // Single opt-in |
| 162 | - $member_data['status_if_new'] = 'subscribed'; |
|
| 163 | - $member_data['status'] = 'subscribed'; |
|
| 162 | + $member_data[ 'status_if_new' ] = 'subscribed'; |
|
| 163 | + $member_data[ 'status' ] = 'subscribed'; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | } else { |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | // But first let's set our flag, and set the Mailchimp status flag |
| 171 | 171 | $new_subscriber = false; |
| 172 | - $member_data['status'] = 'subscribed'; |
|
| 172 | + $member_data[ 'status' ] = 'subscribed'; |
|
| 173 | 173 | |
| 174 | 174 | // Check our update_existing_user optin setting |
| 175 | - $update_existing_user = ( $optin_settings['update_existing_user'] === '1' ) ? true : false; |
|
| 175 | + $update_existing_user = ( $optin_settings[ 'update_existing_user' ] === '1' ) ? true : false; |
|
| 176 | 176 | |
| 177 | 177 | // If update_existing_user is false (not allowed) then simply fail and return a response message |
| 178 | 178 | if ( $update_existing_user === false ) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // If update_existing_user is true, we need to check our 'send_update_email' option |
| 183 | - $send_update_email = ( $optin_settings['send_update_email'] === '1' ) ? true : false; |
|
| 183 | + $send_update_email = ( $optin_settings[ 'send_update_email' ] === '1' ) ? true : false; |
|
| 184 | 184 | |
| 185 | 185 | // If $send_update_email is true (we send the email) then we need to fire off the 'send update email' logic |
| 186 | 186 | if ( $send_update_email === true ) { |
@@ -3,234 +3,234 @@ discard block |
||
| 3 | 3 | class Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler { |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
| 7 | - * |
|
| 8 | - * @since 6.3.0 |
|
| 9 | - * @access protected |
|
| 10 | - * @var bool | $is_ajax |
|
| 11 | - */ |
|
| 6 | + * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
| 7 | + * |
|
| 8 | + * @since 6.3.0 |
|
| 9 | + * @access protected |
|
| 10 | + * @var bool | $is_ajax |
|
| 11 | + */ |
|
| 12 | 12 | protected $is_ajax; |
| 13 | 13 | |
| 14 | 14 | /**** Hardcoded Internal Variables ****/ |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * An array of form fields we don't process |
|
| 18 | - * |
|
| 19 | - * @since 6.3.0 |
|
| 20 | - * @access protected |
|
| 21 | - * @var array | $skipped_form_fields |
|
| 22 | - */ |
|
| 17 | + * An array of form fields we don't process |
|
| 18 | + * |
|
| 19 | + * @since 6.3.0 |
|
| 20 | + * @access protected |
|
| 21 | + * @var array | $skipped_form_fields |
|
| 22 | + */ |
|
| 23 | 23 | protected $skipped_form_fields; |
| 24 | 24 | |
| 25 | 25 | /**** Form Variables ****/ |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * The ID of the corresponding YIKES Mailchimp form |
|
| 29 | - * |
|
| 30 | - * @since 6.3.0 |
|
| 31 | - * @access public |
|
| 32 | - * @var int | $form_id |
|
| 33 | - */ |
|
| 28 | + * The ID of the corresponding YIKES Mailchimp form |
|
| 29 | + * |
|
| 30 | + * @since 6.3.0 |
|
| 31 | + * @access public |
|
| 32 | + * @var int | $form_id |
|
| 33 | + */ |
|
| 34 | 34 | public $form_id; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * The ID of the corresponding Mailchimp list |
|
| 38 | - * |
|
| 39 | - * @since 6.3.0 |
|
| 40 | - * @access public |
|
| 41 | - * @var int | $list_id |
|
| 42 | - */ |
|
| 37 | + * The ID of the corresponding Mailchimp list |
|
| 38 | + * |
|
| 39 | + * @since 6.3.0 |
|
| 40 | + * @access public |
|
| 41 | + * @var int | $list_id |
|
| 42 | + */ |
|
| 43 | 43 | public $list_id; |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * The submitted email |
|
| 47 | - * |
|
| 48 | - * @since 6.3.0 |
|
| 49 | - * @access public |
|
| 50 | - * @var string | $email |
|
| 51 | - */ |
|
| 46 | + * The submitted email |
|
| 47 | + * |
|
| 48 | + * @since 6.3.0 |
|
| 49 | + * @access public |
|
| 50 | + * @var string | $email |
|
| 51 | + */ |
|
| 52 | 52 | public $email; |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * The array of error messages defined by the user and attached to this form |
|
| 56 | - * |
|
| 57 | - * @since 6.3.0 |
|
| 58 | - * @access public |
|
| 59 | - * @var array | $error_messages |
|
| 60 | - */ |
|
| 55 | + * The array of error messages defined by the user and attached to this form |
|
| 56 | + * |
|
| 57 | + * @since 6.3.0 |
|
| 58 | + * @access public |
|
| 59 | + * @var array | $error_messages |
|
| 60 | + */ |
|
| 61 | 61 | public $error_messages; |
| 62 | 62 | |
| 63 | 63 | /**** Default Error Messages ****/ |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * The error message for no form ID |
|
| 67 | - * |
|
| 68 | - * @since 6.3.0 |
|
| 69 | - * @access public |
|
| 70 | - * @var string | $handle_empty_form_id_message |
|
| 71 | - */ |
|
| 66 | + * The error message for no form ID |
|
| 67 | + * |
|
| 68 | + * @since 6.3.0 |
|
| 69 | + * @access public |
|
| 70 | + * @var string | $handle_empty_form_id_message |
|
| 71 | + */ |
|
| 72 | 72 | public $handle_empty_form_id_message; |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * The error message for no form found |
|
| 76 | - * |
|
| 77 | - * @since 6.3.0 |
|
| 78 | - * @access public |
|
| 79 | - * @var string | $handle_empty_form_message |
|
| 80 | - */ |
|
| 75 | + * The error message for no form found |
|
| 76 | + * |
|
| 77 | + * @since 6.3.0 |
|
| 78 | + * @access public |
|
| 79 | + * @var string | $handle_empty_form_message |
|
| 80 | + */ |
|
| 81 | 81 | public $handle_empty_form_message; |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * The error message for missing form fields |
|
| 85 | - * |
|
| 86 | - * @since 6.3.0 |
|
| 87 | - * @access public |
|
| 88 | - * @var string | $handle_empty_fields_generic_message |
|
| 89 | - */ |
|
| 84 | + * The error message for missing form fields |
|
| 85 | + * |
|
| 86 | + * @since 6.3.0 |
|
| 87 | + * @access public |
|
| 88 | + * @var string | $handle_empty_fields_generic_message |
|
| 89 | + */ |
|
| 90 | 90 | public $handle_empty_fields_generic_message; |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * The error message for missing $list_handler class |
|
| 94 | - * |
|
| 95 | - * @since 6.3.0 |
|
| 96 | - * @access public |
|
| 97 | - * @var string | $handle_empty_list_handler_message |
|
| 98 | - */ |
|
| 93 | + * The error message for missing $list_handler class |
|
| 94 | + * |
|
| 95 | + * @since 6.3.0 |
|
| 96 | + * @access public |
|
| 97 | + * @var string | $handle_empty_list_handler_message |
|
| 98 | + */ |
|
| 99 | 99 | public $handle_empty_list_handler_message; |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * The error message for no email |
|
| 103 | - * |
|
| 104 | - * @since 6.3.0 |
|
| 105 | - * @access public |
|
| 106 | - * @var string | $handle_empty_email_message |
|
| 107 | - */ |
|
| 102 | + * The error message for no email |
|
| 103 | + * |
|
| 104 | + * @since 6.3.0 |
|
| 105 | + * @access public |
|
| 106 | + * @var string | $handle_empty_email_message |
|
| 107 | + */ |
|
| 108 | 108 | public $handle_empty_email_message; |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * The error message for a filled in honeypot |
|
| 112 | - * |
|
| 113 | - * @since 6.3.0 |
|
| 114 | - * @access public |
|
| 115 | - * @var string | $handle_non_empty_honeypot_message |
|
| 116 | - */ |
|
| 111 | + * The error message for a filled in honeypot |
|
| 112 | + * |
|
| 113 | + * @since 6.3.0 |
|
| 114 | + * @access public |
|
| 115 | + * @var string | $handle_non_empty_honeypot_message |
|
| 116 | + */ |
|
| 117 | 117 | public $handle_non_empty_honeypot_message; |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * The error message for existing users trying to update when it's disallowed |
|
| 121 | - * |
|
| 122 | - * @since 6.3.0 |
|
| 123 | - * @access public |
|
| 124 | - * @var string | $handle_disallowed_existing_user_update_message |
|
| 125 | - */ |
|
| 120 | + * The error message for existing users trying to update when it's disallowed |
|
| 121 | + * |
|
| 122 | + * @since 6.3.0 |
|
| 123 | + * @access public |
|
| 124 | + * @var string | $handle_disallowed_existing_user_update_message |
|
| 125 | + */ |
|
| 126 | 126 | public $handle_disallowed_existing_user_update_message; |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | - * The first half of the error message for updating an existing user when it's done via a profile link |
|
| 130 | - * |
|
| 131 | - * @since 6.3.0 |
|
| 132 | - * @access public |
|
| 133 | - * @var string | $handle_updating_existing_user_message |
|
| 134 | - */ |
|
| 129 | + * The first half of the error message for updating an existing user when it's done via a profile link |
|
| 130 | + * |
|
| 131 | + * @since 6.3.0 |
|
| 132 | + * @access public |
|
| 133 | + * @var string | $handle_updating_existing_user_message |
|
| 134 | + */ |
|
| 135 | 135 | public $handle_updating_existing_user_message; |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
| 139 | - * |
|
| 140 | - * @since 6.3.0 |
|
| 141 | - * @access public |
|
| 142 | - * @var string | $handle_updating_existing_user_link_message |
|
| 143 | - */ |
|
| 138 | + * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
| 139 | + * |
|
| 140 | + * @since 6.3.0 |
|
| 141 | + * @access public |
|
| 142 | + * @var string | $handle_updating_existing_user_link_message |
|
| 143 | + */ |
|
| 144 | 144 | public $handle_updating_existing_user_link_message; |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * A default, generic error message |
|
| 148 | - * |
|
| 149 | - * @since 6.3.0 |
|
| 150 | - * @access public |
|
| 151 | - * @var string | $default_error_response_message |
|
| 152 | - */ |
|
| 147 | + * A default, generic error message |
|
| 148 | + * |
|
| 149 | + * @since 6.3.0 |
|
| 150 | + * @access public |
|
| 151 | + * @var string | $default_error_response_message |
|
| 152 | + */ |
|
| 153 | 153 | public $default_error_response_message; |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * The error message for not filling out a required form field |
|
| 157 | - * |
|
| 158 | - * @since 6.3.0 |
|
| 159 | - * @access public |
|
| 160 | - * @var string | $handle_empty_required_field_message |
|
| 161 | - */ |
|
| 156 | + * The error message for not filling out a required form field |
|
| 157 | + * |
|
| 158 | + * @since 6.3.0 |
|
| 159 | + * @access public |
|
| 160 | + * @var string | $handle_empty_required_field_message |
|
| 161 | + */ |
|
| 162 | 162 | public $handle_empty_required_field_message; |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | - * The error message for not filling out a required interest group |
|
| 166 | - * |
|
| 167 | - * @since 6.3.0 |
|
| 168 | - * @access public |
|
| 169 | - * @var string | $handle_empty_required_interest_group_message |
|
| 170 | - */ |
|
| 165 | + * The error message for not filling out a required interest group |
|
| 166 | + * |
|
| 167 | + * @since 6.3.0 |
|
| 168 | + * @access public |
|
| 169 | + * @var string | $handle_empty_required_interest_group_message |
|
| 170 | + */ |
|
| 171 | 171 | public $handle_empty_required_interest_group_message; |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * The error message for nonce failures |
|
| 175 | - * |
|
| 176 | - * @since 6.3.0 |
|
| 177 | - * @access public |
|
| 178 | - * @var string | $handle_nonce_message |
|
| 179 | - */ |
|
| 174 | + * The error message for nonce failures |
|
| 175 | + * |
|
| 176 | + * @since 6.3.0 |
|
| 177 | + * @access public |
|
| 178 | + * @var string | $handle_nonce_message |
|
| 179 | + */ |
|
| 180 | 180 | public $handle_nonce_message; |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * The error message for a recaptcha that is not checked/filled out |
|
| 184 | - * |
|
| 185 | - * @since 6.3.0 |
|
| 186 | - * @access public |
|
| 187 | - * @var string | $handle_nonce_message |
|
| 188 | - */ |
|
| 183 | + * The error message for a recaptcha that is not checked/filled out |
|
| 184 | + * |
|
| 185 | + * @since 6.3.0 |
|
| 186 | + * @access public |
|
| 187 | + * @var string | $handle_nonce_message |
|
| 188 | + */ |
|
| 189 | 189 | public $handle_non_filled_recaptcha_message_message; |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * The error message for recaptcha errors that we're not sure of |
|
| 193 | - * |
|
| 194 | - * @since 6.3.0 |
|
| 195 | - * @access public |
|
| 196 | - * @var string | $handle_nonce_message |
|
| 197 | - */ |
|
| 192 | + * The error message for recaptcha errors that we're not sure of |
|
| 193 | + * |
|
| 194 | + * @since 6.3.0 |
|
| 195 | + * @access public |
|
| 196 | + * @var string | $handle_nonce_message |
|
| 197 | + */ |
|
| 198 | 198 | public $generic_recaptcha_error_message; |
| 199 | 199 | |
| 200 | 200 | /**** Default Success Messages ****/ |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | - * The success message for single-optin forms |
|
| 204 | - * |
|
| 205 | - * @since 6.3.0 |
|
| 206 | - * @access public |
|
| 207 | - * @var string | $default_response_single_optin_success_message |
|
| 208 | - */ |
|
| 203 | + * The success message for single-optin forms |
|
| 204 | + * |
|
| 205 | + * @since 6.3.0 |
|
| 206 | + * @access public |
|
| 207 | + * @var string | $default_response_single_optin_success_message |
|
| 208 | + */ |
|
| 209 | 209 | public $default_response_single_optin_success_message; |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | - * The default success message for double-optin forms |
|
| 213 | - * |
|
| 214 | - * @since 6.3.0 |
|
| 215 | - * @access public |
|
| 216 | - * @var string | $default_response_double_optin_success_message |
|
| 217 | - */ |
|
| 212 | + * The default success message for double-optin forms |
|
| 213 | + * |
|
| 214 | + * @since 6.3.0 |
|
| 215 | + * @access public |
|
| 216 | + * @var string | $default_response_double_optin_success_message |
|
| 217 | + */ |
|
| 218 | 218 | public $default_response_double_optin_success_message; |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * The default success message for already subscribed users re-subscribing |
|
| 222 | - * |
|
| 223 | - * @since 6.3.0 |
|
| 224 | - * @access public |
|
| 225 | - * @var string | $existing_subscriber_profile_update_message |
|
| 226 | - */ |
|
| 221 | + * The default success message for already subscribed users re-subscribing |
|
| 222 | + * |
|
| 223 | + * @since 6.3.0 |
|
| 224 | + * @access public |
|
| 225 | + * @var string | $existing_subscriber_profile_update_message |
|
| 226 | + */ |
|
| 227 | 227 | public $existing_subscriber_profile_update_message; |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * The construct function - sets all of our hardcoded variables |
|
| 231 | - * |
|
| 232 | - * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
| 233 | - */ |
|
| 230 | + * The construct function - sets all of our hardcoded variables |
|
| 231 | + * |
|
| 232 | + * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
| 233 | + */ |
|
| 234 | 234 | public function __construct( $is_ajax ) { |
| 235 | 235 | |
| 236 | 236 | // Set up our variables |
@@ -268,45 +268,45 @@ discard block |
||
| 268 | 268 | /**** Setters for our Form Variables ****/ |
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | - * Set the form ID class property |
|
| 272 | - * |
|
| 273 | - * @since 6.3.0 |
|
| 274 | - * |
|
| 275 | - * @param int | $form_id | ID of the corresponding YIKES Mailchimp form |
|
| 276 | - */ |
|
| 271 | + * Set the form ID class property |
|
| 272 | + * |
|
| 273 | + * @since 6.3.0 |
|
| 274 | + * |
|
| 275 | + * @param int | $form_id | ID of the corresponding YIKES Mailchimp form |
|
| 276 | + */ |
|
| 277 | 277 | public function set_form_id( $form_id ) { |
| 278 | 278 | $this->form_id = $form_id; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | - * Set the list ID class property |
|
| 283 | - * |
|
| 284 | - * @since 6.3.0 |
|
| 285 | - * |
|
| 286 | - * @param int | $list_id | ID of the corresponding Mailchimp list |
|
| 287 | - */ |
|
| 282 | + * Set the list ID class property |
|
| 283 | + * |
|
| 284 | + * @since 6.3.0 |
|
| 285 | + * |
|
| 286 | + * @param int | $list_id | ID of the corresponding Mailchimp list |
|
| 287 | + */ |
|
| 288 | 288 | public function set_list_id( $list_id ) { |
| 289 | 289 | $this->list_id = $list_id; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
| 293 | - * Set the email class property |
|
| 294 | - * |
|
| 295 | - * @since 6.3.0 |
|
| 296 | - * |
|
| 297 | - * @param string | $sanitized_email | The sanitized email |
|
| 298 | - */ |
|
| 293 | + * Set the email class property |
|
| 294 | + * |
|
| 295 | + * @since 6.3.0 |
|
| 296 | + * |
|
| 297 | + * @param string | $sanitized_email | The sanitized email |
|
| 298 | + */ |
|
| 299 | 299 | public function set_email( $sanitized_email ) { |
| 300 | 300 | $this->email = $sanitized_email; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
| 304 | - * Set the $error_messages class property |
|
| 305 | - * |
|
| 306 | - * @since 6.3.0 |
|
| 307 | - * |
|
| 308 | - * @param array | $error_messages | The array of user-defined error messages for this form |
|
| 309 | - */ |
|
| 304 | + * Set the $error_messages class property |
|
| 305 | + * |
|
| 306 | + * @since 6.3.0 |
|
| 307 | + * |
|
| 308 | + * @param array | $error_messages | The array of user-defined error messages for this form |
|
| 309 | + */ |
|
| 310 | 310 | public function set_error_messages( $error_messages ) { |
| 311 | 311 | $this->error_messages = $error_messages; |
| 312 | 312 | } |
@@ -315,24 +315,24 @@ discard block |
||
| 315 | 315 | /**** Simple Return Functions ****/ |
| 316 | 316 | |
| 317 | 317 | /** |
| 318 | - * Return a sanitized email |
|
| 319 | - * |
|
| 320 | - * @since 6.3.0 |
|
| 321 | - * |
|
| 322 | - * @param string | $email | The user's email |
|
| 323 | - * @return string| $email | The user's email, lowercased and sanitized |
|
| 324 | - */ |
|
| 318 | + * Return a sanitized email |
|
| 319 | + * |
|
| 320 | + * @since 6.3.0 |
|
| 321 | + * |
|
| 322 | + * @param string | $email | The user's email |
|
| 323 | + * @return string| $email | The user's email, lowercased and sanitized |
|
| 324 | + */ |
|
| 325 | 325 | public function get_sanitized_email( $email ) { |
| 326 | 326 | return sanitize_email( strtolower( $email ) ); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | - * Return the class property $skipped_form_fields |
|
| 331 | - * |
|
| 332 | - * @since 6.3.0 |
|
| 333 | - * |
|
| 334 | - * @return array | $skipped_form_fields |
|
| 335 | - */ |
|
| 330 | + * Return the class property $skipped_form_fields |
|
| 331 | + * |
|
| 332 | + * @since 6.3.0 |
|
| 333 | + * |
|
| 334 | + * @return array | $skipped_form_fields |
|
| 335 | + */ |
|
| 336 | 336 | protected function get_skipped_merge_tags() { |
| 337 | 337 | return $this->skipped_form_fields; |
| 338 | 338 | } |
@@ -341,14 +341,14 @@ discard block |
||
| 341 | 341 | /**** Collection of functions handling the incoming form and interest group data ****/ |
| 342 | 342 | |
| 343 | 343 | /** |
| 344 | - * Loop through form data to sanitize, format, filter, and return. |
|
| 345 | - * |
|
| 346 | - * @since 6.3.0 |
|
| 347 | - * |
|
| 348 | - * @param array | $data | The array of user-submitted form values |
|
| 349 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 350 | - * @return array| $merge_variables| The array of sanitized and formatted form values |
|
| 351 | - */ |
|
| 344 | + * Loop through form data to sanitize, format, filter, and return. |
|
| 345 | + * |
|
| 346 | + * @since 6.3.0 |
|
| 347 | + * |
|
| 348 | + * @param array | $data | The array of user-submitted form values |
|
| 349 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 350 | + * @return array| $merge_variables| The array of sanitized and formatted form values |
|
| 351 | + */ |
|
| 352 | 352 | public function get_submitted_merge_values( $data, $form_fields ) { |
| 353 | 353 | |
| 354 | 354 | // Array to return |
@@ -400,14 +400,14 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
| 403 | - * Sanitize form values and return them |
|
| 404 | - * |
|
| 405 | - * @since 6.3.0 |
|
| 406 | - * |
|
| 407 | - * @param string | $key | The MERGE/Field-name for this value |
|
| 408 | - * @param mixed | $value | The form value - this could be an array or a string |
|
| 409 | - * @return mixed | $sanitized | The $value sanitized |
|
| 410 | - */ |
|
| 403 | + * Sanitize form values and return them |
|
| 404 | + * |
|
| 405 | + * @since 6.3.0 |
|
| 406 | + * |
|
| 407 | + * @param string | $key | The MERGE/Field-name for this value |
|
| 408 | + * @param mixed | $value | The form value - this could be an array or a string |
|
| 409 | + * @return mixed | $sanitized | The $value sanitized |
|
| 410 | + */ |
|
| 411 | 411 | protected function sanitize_form_values( $key, $value ) { |
| 412 | 412 | if ( is_scalar( $value ) ) { |
| 413 | 413 | $sanitized = sanitize_text_field( $value ); |
@@ -421,14 +421,14 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
| 424 | - * Check a date field's date format and pass it along to the appropriate function |
|
| 425 | - * |
|
| 426 | - * @since 6.3.0 |
|
| 427 | - * |
|
| 428 | - * @param string | $date | The unformatted date value |
|
| 429 | - * @param string | $date_format | The date format |
|
| 430 | - * @return string| $date | The date formatted according to the $date_format |
|
| 431 | - */ |
|
| 424 | + * Check a date field's date format and pass it along to the appropriate function |
|
| 425 | + * |
|
| 426 | + * @since 6.3.0 |
|
| 427 | + * |
|
| 428 | + * @param string | $date | The unformatted date value |
|
| 429 | + * @param string | $date_format | The date format |
|
| 430 | + * @return string| $date | The date formatted according to the $date_format |
|
| 431 | + */ |
|
| 432 | 432 | protected function handle_date_format_merge_values( $date, $date_format ) { |
| 433 | 433 | // Check if EU date format (for dates: 'DD/MM/YYYY', for birthdays: 'DD/MM') |
| 434 | 434 | if ( 'DD/MM/YYYY' === $date_format ) { |
@@ -441,13 +441,13 @@ discard block |
||
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | /** |
| 444 | - * Format a date field whose date format is dd/mm/yyyy |
|
| 445 | - * |
|
| 446 | - * @since 6.3.0 |
|
| 447 | - * |
|
| 448 | - * @param string | $date | A date in the format dd/mm/yyyy |
|
| 449 | - * @return string| $date | A date in the format mm/dd/yyyy |
|
| 450 | - */ |
|
| 444 | + * Format a date field whose date format is dd/mm/yyyy |
|
| 445 | + * |
|
| 446 | + * @since 6.3.0 |
|
| 447 | + * |
|
| 448 | + * @param string | $date | A date in the format dd/mm/yyyy |
|
| 449 | + * @return string| $date | A date in the format mm/dd/yyyy |
|
| 450 | + */ |
|
| 451 | 451 | protected function handle_dd_mm_yyyy_date( $date ) { |
| 452 | 452 | |
| 453 | 453 | // Mailchimp wants the dates as 'MM/DD/YYYY' regardless of user-specified format, so convert |
@@ -466,13 +466,13 @@ discard block |
||
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | - * Format a birthday field whose date format is dd/mm |
|
| 470 | - * |
|
| 471 | - * @since 6.3.0 |
|
| 472 | - * |
|
| 473 | - * @param string | $birthday | A date in the format dd/mm |
|
| 474 | - * @return string| $birthday | A date in the format mm/dd |
|
| 475 | - */ |
|
| 469 | + * Format a birthday field whose date format is dd/mm |
|
| 470 | + * |
|
| 471 | + * @since 6.3.0 |
|
| 472 | + * |
|
| 473 | + * @param string | $birthday | A date in the format dd/mm |
|
| 474 | + * @return string| $birthday | A date in the format mm/dd |
|
| 475 | + */ |
|
| 476 | 476 | protected function handle_dd_mm_birthday( $birthday ) { |
| 477 | 477 | |
| 478 | 478 | // Mailchimp wants the birthdays as 'MM/DD' regardless of user-specified format, so convert |
@@ -492,14 +492,14 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | |
| 494 | 494 | /** |
| 495 | - * Create an array of available interest groups based on the $replace_interests flag |
|
| 496 | - * |
|
| 497 | - * @since 6.3.0 |
|
| 498 | - * |
|
| 499 | - * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
| 500 | - * @param class | $list_class | Class for interacting with the current list |
|
| 501 | - * @return array | $groups | Array of interest groups |
|
| 502 | - */ |
|
| 495 | + * Create an array of available interest groups based on the $replace_interests flag |
|
| 496 | + * |
|
| 497 | + * @since 6.3.0 |
|
| 498 | + * |
|
| 499 | + * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
| 500 | + * @param class | $list_class | Class for interacting with the current list |
|
| 501 | + * @return array | $groups | Array of interest groups |
|
| 502 | + */ |
|
| 503 | 503 | public function get_default_interest_groups( $replace_interests, $list_class ) { |
| 504 | 504 | |
| 505 | 505 | // If $replace_interests flag is true then loop through interest groups and set them all to false to start. |
@@ -537,15 +537,15 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | |
| 539 | 539 | /** |
| 540 | - * Loop through the interest group form data to sanitize, format, filter, and return. |
|
| 541 | - * |
|
| 542 | - * @since 6.3.0 |
|
| 543 | - * |
|
| 544 | - * @param array | $data | The array of user-submitted form values |
|
| 545 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 546 | - * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
| 547 | - * @return array| $groups | The array of sanitized and formatted form values |
|
| 548 | - */ |
|
| 540 | + * Loop through the interest group form data to sanitize, format, filter, and return. |
|
| 541 | + * |
|
| 542 | + * @since 6.3.0 |
|
| 543 | + * |
|
| 544 | + * @param array | $data | The array of user-submitted form values |
|
| 545 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 546 | + * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
| 547 | + * @return array| $groups | The array of sanitized and formatted form values |
|
| 548 | + */ |
|
| 549 | 549 | public function get_submitted_interest_groups( $data, $form_fields, $groups ) { |
| 550 | 550 | |
| 551 | 551 | // loop to push variables to our array |
@@ -574,13 +574,13 @@ discard block |
||
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /** |
| 577 | - * yikes-mailchimp-filter-groups-before-submission |
|
| 578 | - * |
|
| 579 | - * Catch the interest groups before they get sent over to Mailchimp |
|
| 580 | - * @param array | $groups | User submitted interest group data |
|
| 581 | - * @optional int| $form_id| the ID of the form to filter |
|
| 582 | - * @since 6.3.0 |
|
| 583 | - */ |
|
| 577 | + * yikes-mailchimp-filter-groups-before-submission |
|
| 578 | + * |
|
| 579 | + * Catch the interest groups before they get sent over to Mailchimp |
|
| 580 | + * @param array | $groups | User submitted interest group data |
|
| 581 | + * @optional int| $form_id| the ID of the form to filter |
|
| 582 | + * @since 6.3.0 |
|
| 583 | + */ |
|
| 584 | 584 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission', $groups, $this->form_id ); |
| 585 | 585 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission-{$this->form_id}', $groups, $this->form_id ); |
| 586 | 586 | |
@@ -591,17 +591,17 @@ discard block |
||
| 591 | 591 | /**** Functions to Handle Subscribe API Response ****/ |
| 592 | 592 | |
| 593 | 593 | /** |
| 594 | - * Handle the response to a successful subscribe request |
|
| 595 | - * |
|
| 596 | - * @since 6.3.0 |
|
| 597 | - * |
|
| 598 | - * @param array | $submission_settings | Array of the form's submission settings |
|
| 599 | - * @param array | $page_data | Array of the page data |
|
| 600 | - * @param array | $merge_variables | Array of the submitted form variables |
|
| 601 | - * @param array | $notifications | Literally don't know what this is yet. |
|
| 602 | - * @param array | $optin_settings | Array of the form's optin settings |
|
| 603 | - * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
| 604 | - */ |
|
| 594 | + * Handle the response to a successful subscribe request |
|
| 595 | + * |
|
| 596 | + * @since 6.3.0 |
|
| 597 | + * |
|
| 598 | + * @param array | $submission_settings | Array of the form's submission settings |
|
| 599 | + * @param array | $page_data | Array of the page data |
|
| 600 | + * @param array | $merge_variables | Array of the submitted form variables |
|
| 601 | + * @param array | $notifications | Literally don't know what this is yet. |
|
| 602 | + * @param array | $optin_settings | Array of the form's optin settings |
|
| 603 | + * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
| 604 | + */ |
|
| 605 | 605 | public function handle_submission_response_success( $submission_settings, $page_data, $merge_variables, $notifications, $optin_settings, $new_subscriber ) { |
| 606 | 606 | |
| 607 | 607 | // Check if we should redirect, and collect the redirect info in an array |
@@ -610,27 +610,27 @@ discard block |
||
| 610 | 610 | // Fire off our actions |
| 611 | 611 | |
| 612 | 612 | /** |
| 613 | - * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
| 614 | - * |
|
| 615 | - * Catch the merge variables after they've been sent over to Mailchimp |
|
| 616 | - * @since 6.0.0 |
|
| 617 | - * |
|
| 618 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 619 | - */ |
|
| 613 | + * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
| 614 | + * |
|
| 615 | + * Catch the merge variables after they've been sent over to Mailchimp |
|
| 616 | + * @since 6.0.0 |
|
| 617 | + * |
|
| 618 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 619 | + */ |
|
| 620 | 620 | do_action( 'yikes-mailchimp-after-submission', $merge_variables, $this->form_id ); |
| 621 | 621 | do_action( "yikes-mailchimp-after-submission-{$this->form_id}", $merge_variables, $this->form_id ); |
| 622 | 622 | |
| 623 | 623 | /** |
| 624 | - * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
| 625 | - * |
|
| 626 | - * Catch our notifications and other form data |
|
| 627 | - * |
|
| 628 | - * @param string | $email | The user's email |
|
| 629 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 630 | - * @param string | $form_id | The form ID |
|
| 631 | - * @param array | $notifications | Array of notification messages |
|
| 632 | - * |
|
| 633 | - */ |
|
| 624 | + * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
| 625 | + * |
|
| 626 | + * Catch our notifications and other form data |
|
| 627 | + * |
|
| 628 | + * @param string | $email | The user's email |
|
| 629 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 630 | + * @param string | $form_id | The form ID |
|
| 631 | + * @param array | $notifications | Array of notification messages |
|
| 632 | + * |
|
| 633 | + */ |
|
| 634 | 634 | do_action( 'yikes-mailchimp-form-submission', $this->email, $merge_variables, $this->form_id, $notifications ); |
| 635 | 635 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
| 636 | 636 | |
@@ -652,15 +652,15 @@ discard block |
||
| 652 | 652 | $default_response = ( $new_subscriber === false ) ? $this->check_for_user_defined_response_message( 'success-resubscribed', $this->existing_subscriber_profile_update_message ) : $default_response; |
| 653 | 653 | |
| 654 | 654 | /** |
| 655 | - * yikes-mailchimp-success-response |
|
| 656 | - * |
|
| 657 | - * Filter the success message displayed to the user |
|
| 658 | - * |
|
| 659 | - * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
| 660 | - * @param string | $form_id | The form ID |
|
| 661 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 662 | - * |
|
| 663 | - */ |
|
| 655 | + * yikes-mailchimp-success-response |
|
| 656 | + * |
|
| 657 | + * Filter the success message displayed to the user |
|
| 658 | + * |
|
| 659 | + * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
| 660 | + * @param string | $form_id | The form ID |
|
| 661 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 662 | + * |
|
| 663 | + */ |
|
| 664 | 664 | $response_message = apply_filters( 'yikes-mailchimp-success-response', $default_response, $this->form_id, $merge_variables ); |
| 665 | 665 | |
| 666 | 666 | // Construct our success array variables |
@@ -679,13 +679,13 @@ discard block |
||
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | /** |
| 682 | - * Handle an unsuccessful/error subscribe request |
|
| 683 | - * |
|
| 684 | - * @since 6.3.0 |
|
| 685 | - * |
|
| 686 | - * @param object | $subscribe_response | The response from the API |
|
| 687 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 688 | - */ |
|
| 682 | + * Handle an unsuccessful/error subscribe request |
|
| 683 | + * |
|
| 684 | + * @since 6.3.0 |
|
| 685 | + * |
|
| 686 | + * @param object | $subscribe_response | The response from the API |
|
| 687 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 688 | + */ |
|
| 689 | 689 | public function handle_submission_response_error( $subscribe_response, $form_fields ) { |
| 690 | 690 | |
| 691 | 691 | // Get the error data |
@@ -727,13 +727,13 @@ discard block |
||
| 727 | 727 | // Note: All of these functions return `return $this->yikes_fail()`. Check function for more info. |
| 728 | 728 | |
| 729 | 729 | /** |
| 730 | - * Check if the submitted form data is missing any required fields |
|
| 731 | - * |
|
| 732 | - * @since 6.3.0 |
|
| 733 | - * |
|
| 734 | - * @param array | $data | The array of user-submitted form values |
|
| 735 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 736 | - */ |
|
| 730 | + * Check if the submitted form data is missing any required fields |
|
| 731 | + * |
|
| 732 | + * @since 6.3.0 |
|
| 733 | + * |
|
| 734 | + * @param array | $data | The array of user-submitted form values |
|
| 735 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 736 | + */ |
|
| 737 | 737 | public function check_for_required_form_fields( $data, $form_fields ) { |
| 738 | 738 | |
| 739 | 739 | // Set up our defaults |
@@ -758,15 +758,15 @@ discard block |
||
| 758 | 758 | foreach( $value as $field => $val ) { |
| 759 | 759 | |
| 760 | 760 | /** |
| 761 | - * 'yikes-mailchimp-ignore-required-array-field' |
|
| 762 | - * |
|
| 763 | - * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
| 764 | - * |
|
| 765 | - * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
| 766 | - * @param int | $form_id |
|
| 767 | - * |
|
| 768 | - * @return Array of fields to ignore. |
|
| 769 | - */ |
|
| 761 | + * 'yikes-mailchimp-ignore-required-array-field' |
|
| 762 | + * |
|
| 763 | + * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
| 764 | + * |
|
| 765 | + * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
| 766 | + * @param int | $form_id |
|
| 767 | + * |
|
| 768 | + * @return Array of fields to ignore. |
|
| 769 | + */ |
|
| 770 | 770 | $ignored_fields = apply_filters( 'yikes-mailchimp-ignore-required-array-field', array( 'addr2' => true ), $this->form_id ); |
| 771 | 771 | |
| 772 | 772 | if ( empty( $val ) && ! isset( $ignored_fields[ $field ] ) ) { |
@@ -797,14 +797,14 @@ discard block |
||
| 797 | 797 | ); |
| 798 | 798 | |
| 799 | 799 | /** |
| 800 | - * yikes-mailchimp-required-form-field-missing |
|
| 801 | - * |
|
| 802 | - * Alter the response message shown to the user for missing required form fields |
|
| 803 | - * |
|
| 804 | - * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
| 805 | - * @param int | $form_id | The ID of the form |
|
| 806 | - * @param array | $missing_fields | Array of the missing required fields |
|
| 807 | - */ |
|
| 800 | + * yikes-mailchimp-required-form-field-missing |
|
| 801 | + * |
|
| 802 | + * Alter the response message shown to the user for missing required form fields |
|
| 803 | + * |
|
| 804 | + * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
| 805 | + * @param int | $form_id | The ID of the form |
|
| 806 | + * @param array | $missing_fields | Array of the missing required fields |
|
| 807 | + */ |
|
| 808 | 808 | $default_response = apply_filters( 'yikes-mailchimp-required-form-field-missing', $this->handle_empty_required_field_message, $this->form_id, $missing_fields ); |
| 809 | 809 | |
| 810 | 810 | // If we've found a missing field, return the array of field data |
@@ -813,13 +813,13 @@ discard block |
||
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | /** |
| 816 | - * Check if the submitted form interest group data is missing any required fields |
|
| 817 | - * |
|
| 818 | - * @since 6.3.0 |
|
| 819 | - * |
|
| 820 | - * @param array | $data | The array of user-submitted form values |
|
| 821 | - * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 822 | - */ |
|
| 816 | + * Check if the submitted form interest group data is missing any required fields |
|
| 817 | + * |
|
| 818 | + * @since 6.3.0 |
|
| 819 | + * |
|
| 820 | + * @param array | $data | The array of user-submitted form values |
|
| 821 | + * @param array | $form_fields | The array of form field definitions for this YIKES Mailchimp form |
|
| 822 | + */ |
|
| 823 | 823 | public function check_for_required_interest_groups( $data, $form_fields ) { |
| 824 | 824 | |
| 825 | 825 | // Set up our defaults |
@@ -853,14 +853,14 @@ discard block |
||
| 853 | 853 | ); |
| 854 | 854 | |
| 855 | 855 | /** |
| 856 | - * yikes-mailchimp-required-interest-group-missing |
|
| 857 | - * |
|
| 858 | - * Alter the response message shown to the user for missing required form fields |
|
| 859 | - * |
|
| 860 | - * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
| 861 | - * @param int | $form_id | The ID of the form |
|
| 862 | - * @param array | $missing_fields | Array of the missing required fields |
|
| 863 | - */ |
|
| 856 | + * yikes-mailchimp-required-interest-group-missing |
|
| 857 | + * |
|
| 858 | + * Alter the response message shown to the user for missing required form fields |
|
| 859 | + * |
|
| 860 | + * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
| 861 | + * @param int | $form_id | The ID of the form |
|
| 862 | + * @param array | $missing_fields | Array of the missing required fields |
|
| 863 | + */ |
|
| 864 | 864 | $default_response = apply_filters( 'yikes-mailchimp-required-interest-group-missing', $this->handle_empty_required_interest_group_message, $this->form_id, $missing_fields ); |
| 865 | 865 | |
| 866 | 866 | // If we find a required interest group with an empty value, send an error |
@@ -869,12 +869,12 @@ discard block |
||
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | /** |
| 872 | - * Handle the reCAPTCHA |
|
| 873 | - * |
|
| 874 | - * @since 6.3.0 |
|
| 875 | - * |
|
| 876 | - * @param string | $recaptcha_response | The form value of the recaptcha field |
|
| 877 | - */ |
|
| 872 | + * Handle the reCAPTCHA |
|
| 873 | + * |
|
| 874 | + * @since 6.3.0 |
|
| 875 | + * |
|
| 876 | + * @param string | $recaptcha_response | The form value of the recaptcha field |
|
| 877 | + */ |
|
| 878 | 878 | public function handle_recaptcha( $recaptcha_response ) { |
| 879 | 879 | |
| 880 | 880 | // Before we the hit the API, let's check that we actually got a response. |
@@ -882,11 +882,11 @@ discard block |
||
| 882 | 882 | if ( empty( $recaptcha_response ) ) { |
| 883 | 883 | |
| 884 | 884 | /** |
| 885 | - * yikes-mailchimp-recaptcha-required-error |
|
| 886 | - * |
|
| 887 | - * Catch the recaptcha errors before they're returned to the user |
|
| 888 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 889 | - */ |
|
| 885 | + * yikes-mailchimp-recaptcha-required-error |
|
| 886 | + * |
|
| 887 | + * Catch the recaptcha errors before they're returned to the user |
|
| 888 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 889 | + */ |
|
| 890 | 890 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', $this->handle_non_filled_recaptcha_message_message, $this->form_id ); |
| 891 | 891 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
| 892 | 892 | } |
@@ -919,40 +919,40 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | /** |
| 922 | - * yikes-mailchimp-recaptcha-required-error |
|
| 923 | - * |
|
| 924 | - * Catch the recaptcha errors before they're returned to the user |
|
| 925 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 926 | - */ |
|
| 922 | + * yikes-mailchimp-recaptcha-required-error |
|
| 923 | + * |
|
| 924 | + * Catch the recaptcha errors before they're returned to the user |
|
| 925 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 926 | + */ |
|
| 927 | 927 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $recaptcha_errors ), $this->form_id ); |
| 928 | 928 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
| 929 | 929 | } |
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | /** |
| 933 | - * Handle the nonce field |
|
| 934 | - * |
|
| 935 | - * @since 6.3.0 |
|
| 936 | - * |
|
| 937 | - * @param string | $nonce_value | The form value of the nonce |
|
| 938 | - * @param string | $nonce_name | The name of the nonce |
|
| 939 | - */ |
|
| 933 | + * Handle the nonce field |
|
| 934 | + * |
|
| 935 | + * @since 6.3.0 |
|
| 936 | + * |
|
| 937 | + * @param string | $nonce_value | The form value of the nonce |
|
| 938 | + * @param string | $nonce_name | The name of the nonce |
|
| 939 | + */ |
|
| 940 | 940 | public function handle_nonce( $nonce_value, $nonce_name ) { |
| 941 | 941 | |
| 942 | 942 | // First, check our option - this is set in the general settings page |
| 943 | 943 | if ( get_option( 'yikes-mailchimp-use-nonce' ) === '1' ) { |
| 944 | 944 | |
| 945 | 945 | /** |
| 946 | - * yikes-mailchimp-use-nonce-verification |
|
| 947 | - * |
|
| 948 | - * Decide if we're going to check the nonce value. |
|
| 949 | - * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
| 950 | - * The default will always be to use the nonce. |
|
| 951 | - * |
|
| 952 | - * @param int | $form_id | The form id |
|
| 953 | - * |
|
| 954 | - * @return bool | True if we should check the nonce |
|
| 955 | - */ |
|
| 946 | + * yikes-mailchimp-use-nonce-verification |
|
| 947 | + * |
|
| 948 | + * Decide if we're going to check the nonce value. |
|
| 949 | + * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
| 950 | + * The default will always be to use the nonce. |
|
| 951 | + * |
|
| 952 | + * @param int | $form_id | The form id |
|
| 953 | + * |
|
| 954 | + * @return bool | True if we should check the nonce |
|
| 955 | + */ |
|
| 956 | 956 | $use_nonce = apply_filters( 'yikes-mailchimp-use-nonce-verification', true, $this->form_id ); |
| 957 | 957 | |
| 958 | 958 | // We let the filter override the option because the filter is on a per-form basis |
@@ -965,24 +965,24 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /** |
| 968 | - * Handle a merge_variables error |
|
| 969 | - * |
|
| 970 | - * @since 6.3.0 |
|
| 971 | - * |
|
| 972 | - * @param int | $error | Int $error = 1 if an error |
|
| 973 | - * @param string | $message | The message shown to the user |
|
| 974 | - */ |
|
| 968 | + * Handle a merge_variables error |
|
| 969 | + * |
|
| 970 | + * @since 6.3.0 |
|
| 971 | + * |
|
| 972 | + * @param int | $error | Int $error = 1 if an error |
|
| 973 | + * @param string | $message | The message shown to the user |
|
| 974 | + */ |
|
| 975 | 975 | public function handle_merge_variables_error( $error, $message ) { |
| 976 | 976 | return $this->yikes_fail( $hide = 0, $error, $message, array(), $return_response_non_ajax = true ); |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | /** |
| 980 | - * Handle an empty email field and return the corresponding error message |
|
| 981 | - * |
|
| 982 | - * @since 6.3.0 |
|
| 983 | - * |
|
| 984 | - * @param string | $email |
|
| 985 | - */ |
|
| 980 | + * Handle an empty email field and return the corresponding error message |
|
| 981 | + * |
|
| 982 | + * @since 6.3.0 |
|
| 983 | + * |
|
| 984 | + * @param string | $email |
|
| 985 | + */ |
|
| 986 | 986 | public function handle_empty_email( $email ) { |
| 987 | 987 | if ( empty( $email ) ) { |
| 988 | 988 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_email_message ); |
@@ -990,12 +990,12 @@ discard block |
||
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | /** |
| 993 | - * Check if the form is empty and return the corresponding error message |
|
| 994 | - * |
|
| 995 | - * @since 6.3.0 |
|
| 996 | - * |
|
| 997 | - * @param array | $form_data |
|
| 998 | - */ |
|
| 993 | + * Check if the form is empty and return the corresponding error message |
|
| 994 | + * |
|
| 995 | + * @since 6.3.0 |
|
| 996 | + * |
|
| 997 | + * @param array | $form_data |
|
| 998 | + */ |
|
| 999 | 999 | public function handle_empty_form( $form_data ) { |
| 1000 | 1000 | if ( empty( $form_data ) ) { |
| 1001 | 1001 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_message ); |
@@ -1003,12 +1003,12 @@ discard block |
||
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | 1005 | /** |
| 1006 | - * Check if the honeypot is NOT empty and return the corresponding error message |
|
| 1007 | - * |
|
| 1008 | - * @since 6.3.0 |
|
| 1009 | - * |
|
| 1010 | - * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
| 1011 | - */ |
|
| 1006 | + * Check if the honeypot is NOT empty and return the corresponding error message |
|
| 1007 | + * |
|
| 1008 | + * @since 6.3.0 |
|
| 1009 | + * |
|
| 1010 | + * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
| 1011 | + */ |
|
| 1012 | 1012 | public function handle_non_empty_honeypot( $honey_pot_filled ) { |
| 1013 | 1013 | if ( $honey_pot_filled === true ) { |
| 1014 | 1014 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_non_empty_honeypot_message ); |
@@ -1016,12 +1016,12 @@ discard block |
||
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | /** |
| 1019 | - * Loop through fields looking for null and return the corresponding error message |
|
| 1020 | - * |
|
| 1021 | - * @since 6.3.0 |
|
| 1022 | - * |
|
| 1023 | - * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
| 1024 | - */ |
|
| 1019 | + * Loop through fields looking for null and return the corresponding error message |
|
| 1020 | + * |
|
| 1021 | + * @since 6.3.0 |
|
| 1022 | + * |
|
| 1023 | + * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
| 1024 | + */ |
|
| 1025 | 1025 | public function handle_empty_fields_generic( $fields_array ) { |
| 1026 | 1026 | foreach( $fields_array as $field ) { |
| 1027 | 1027 | if ( $field === null ) { |
@@ -1031,12 +1031,12 @@ discard block |
||
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | 1033 | /** |
| 1034 | - * Check if the list handler is empty and return the corresponding error message |
|
| 1035 | - * |
|
| 1036 | - * @since 6.3.0 |
|
| 1037 | - * |
|
| 1038 | - * @param class | $list_handler | A class that handles list functions |
|
| 1039 | - */ |
|
| 1034 | + * Check if the list handler is empty and return the corresponding error message |
|
| 1035 | + * |
|
| 1036 | + * @since 6.3.0 |
|
| 1037 | + * |
|
| 1038 | + * @param class | $list_handler | A class that handles list functions |
|
| 1039 | + */ |
|
| 1040 | 1040 | public function handle_empty_list_handler( $list_handler ) { |
| 1041 | 1041 | if ( empty( $list_handler ) ) { |
| 1042 | 1042 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_list_handler_message ); |
@@ -1044,12 +1044,12 @@ discard block |
||
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | 1046 | /** |
| 1047 | - * Check if the form id is empty and return the corresponding error message |
|
| 1048 | - * |
|
| 1049 | - * @since 6.3.0 |
|
| 1050 | - * |
|
| 1051 | - * @param int | $form_id | The form ID |
|
| 1052 | - */ |
|
| 1047 | + * Check if the form id is empty and return the corresponding error message |
|
| 1048 | + * |
|
| 1049 | + * @since 6.3.0 |
|
| 1050 | + * |
|
| 1051 | + * @param int | $form_id | The form ID |
|
| 1052 | + */ |
|
| 1053 | 1053 | public function handle_empty_form_id( $form_id ) { |
| 1054 | 1054 | if ( empty( $form_id ) ) { |
| 1055 | 1055 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_id_message ); |
@@ -1057,10 +1057,10 @@ discard block |
||
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | /** |
| 1060 | - * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
| 1061 | - * |
|
| 1062 | - * @since 6.3.0 |
|
| 1063 | - */ |
|
| 1060 | + * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
| 1061 | + * |
|
| 1062 | + * @since 6.3.0 |
|
| 1063 | + */ |
|
| 1064 | 1064 | public function handle_disallowed_existing_user_update() { |
| 1065 | 1065 | |
| 1066 | 1066 | // Get the default response |
@@ -1073,10 +1073,10 @@ discard block |
||
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | /** |
| 1076 | - * Construct and filter the error message related to the profile link to update user's profile |
|
| 1077 | - * |
|
| 1078 | - * @since 6.3.0 |
|
| 1079 | - */ |
|
| 1076 | + * Construct and filter the error message related to the profile link to update user's profile |
|
| 1077 | + * |
|
| 1078 | + * @since 6.3.0 |
|
| 1079 | + */ |
|
| 1080 | 1080 | public function handle_updating_existing_user() { |
| 1081 | 1081 | |
| 1082 | 1082 | // Get the first half of the message |
@@ -1101,15 +1101,15 @@ discard block |
||
| 1101 | 1101 | /**** Helper Functions ****/ |
| 1102 | 1102 | |
| 1103 | 1103 | /** |
| 1104 | - * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
| 1105 | - * |
|
| 1106 | - * @since 6.3.0 |
|
| 1107 | - * |
|
| 1108 | - * @param string | $slug | The type of message we're looking for |
|
| 1109 | - * @param string | $response_text| The default response message |
|
| 1110 | - * @param array | $data | An array of data that may be needed to construct the user's error message |
|
| 1111 | - * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
| 1112 | - */ |
|
| 1104 | + * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
| 1105 | + * |
|
| 1106 | + * @since 6.3.0 |
|
| 1107 | + * |
|
| 1108 | + * @param string | $slug | The type of message we're looking for |
|
| 1109 | + * @param string | $response_text| The default response message |
|
| 1110 | + * @param array | $data | An array of data that may be needed to construct the user's error message |
|
| 1111 | + * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
| 1112 | + */ |
|
| 1113 | 1113 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
| 1114 | 1114 | |
| 1115 | 1115 | switch( $slug ) { |
@@ -1123,13 +1123,13 @@ discard block |
||
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | /** |
| 1126 | - * yikes-easy-mailchimp-user-already-subscribed-text |
|
| 1127 | - * |
|
| 1128 | - * Catch the message for user's already subscrbed before we show it to the user |
|
| 1129 | - * @param string | $message | The response message |
|
| 1130 | - * @param int | $form_id | The form id |
|
| 1131 | - * @param string | $email | The user's email |
|
| 1132 | - */ |
|
| 1126 | + * yikes-easy-mailchimp-user-already-subscribed-text |
|
| 1127 | + * |
|
| 1128 | + * Catch the message for user's already subscrbed before we show it to the user |
|
| 1129 | + * @param string | $message | The response message |
|
| 1130 | + * @param int | $form_id | The form id |
|
| 1131 | + * @param string | $email | The user's email |
|
| 1132 | + */ |
|
| 1133 | 1133 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-text', $response_text, $this->form_id, $this->email ); |
| 1134 | 1134 | |
| 1135 | 1135 | return $response_text; |
@@ -1148,13 +1148,13 @@ discard block |
||
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | /** |
| 1151 | - * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
| 1152 | - * |
|
| 1153 | - * Catch the message for user's already subscrbed link text before we show it to the user |
|
| 1154 | - * |
|
| 1155 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1156 | - * @param string | $form_id | The form ID |
|
| 1157 | - */ |
|
| 1151 | + * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
| 1152 | + * |
|
| 1153 | + * Catch the message for user's already subscrbed link text before we show it to the user |
|
| 1154 | + * |
|
| 1155 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1156 | + * @param string | $form_id | The form ID |
|
| 1157 | + */ |
|
| 1158 | 1158 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-link-text', $response_text, $this->form_id ); |
| 1159 | 1159 | |
| 1160 | 1160 | return $response_text; |
@@ -1168,14 +1168,14 @@ discard block |
||
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | /** |
| 1171 | - * yikes-mailchimp-success-double-optin-response |
|
| 1172 | - * |
|
| 1173 | - * Filter the success message displayed to the user |
|
| 1174 | - * |
|
| 1175 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1176 | - * @param string | $form_id | The form ID |
|
| 1177 | - * |
|
| 1178 | - */ |
|
| 1171 | + * yikes-mailchimp-success-double-optin-response |
|
| 1172 | + * |
|
| 1173 | + * Filter the success message displayed to the user |
|
| 1174 | + * |
|
| 1175 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1176 | + * @param string | $form_id | The form ID |
|
| 1177 | + * |
|
| 1178 | + */ |
|
| 1179 | 1179 | $response_text = apply_filters( 'yikes-mailchimp-success-double-optin-response', $response_text, $this->form_id ); |
| 1180 | 1180 | |
| 1181 | 1181 | return $response_text; |
@@ -1188,14 +1188,14 @@ discard block |
||
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | /** |
| 1191 | - * yikes-mailchimp-success-single-optin-response |
|
| 1192 | - * |
|
| 1193 | - * Filter the success message displayed to the user |
|
| 1194 | - * |
|
| 1195 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1196 | - * @param string | $form_id | The form ID |
|
| 1197 | - * |
|
| 1198 | - */ |
|
| 1191 | + * yikes-mailchimp-success-single-optin-response |
|
| 1192 | + * |
|
| 1193 | + * Filter the success message displayed to the user |
|
| 1194 | + * |
|
| 1195 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1196 | + * @param string | $form_id | The form ID |
|
| 1197 | + * |
|
| 1198 | + */ |
|
| 1199 | 1199 | $response_text = apply_filters( 'yikes-mailchimp-success-single-optin-response', $response_text, $this->form_id ); |
| 1200 | 1200 | |
| 1201 | 1201 | return $response_text; |
@@ -1208,14 +1208,14 @@ discard block |
||
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /** |
| 1211 | - * yikes-mailchimp-success-resubscribed-response |
|
| 1212 | - * |
|
| 1213 | - * Filter the success message displayed to the user |
|
| 1214 | - * |
|
| 1215 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1216 | - * @param string | $form_id | The form ID |
|
| 1217 | - * |
|
| 1218 | - */ |
|
| 1211 | + * yikes-mailchimp-success-resubscribed-response |
|
| 1212 | + * |
|
| 1213 | + * Filter the success message displayed to the user |
|
| 1214 | + * |
|
| 1215 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1216 | + * @param string | $form_id | The form ID |
|
| 1217 | + * |
|
| 1218 | + */ |
|
| 1219 | 1219 | $response_text = apply_filters( 'yikes-mailchimp-success-resubscribed-response', $response_text, $this->form_id ); |
| 1220 | 1220 | |
| 1221 | 1221 | return $response_text; |
@@ -1231,16 +1231,16 @@ discard block |
||
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | /** |
| 1234 | - * yikes-mailchimp-general-error-response |
|
| 1235 | - * |
|
| 1236 | - * Filter the error message displayed to the user |
|
| 1237 | - * |
|
| 1238 | - * @param string | $original_response_text | The original response message returned from the API |
|
| 1239 | - * @param string | $user_defined_response_text | The response message defined by the user |
|
| 1240 | - * @param string | $form_id | The form ID |
|
| 1241 | - * |
|
| 1242 | - * @return string | $response_text | The message that will be shown to the user |
|
| 1243 | - */ |
|
| 1234 | + * yikes-mailchimp-general-error-response |
|
| 1235 | + * |
|
| 1236 | + * Filter the error message displayed to the user |
|
| 1237 | + * |
|
| 1238 | + * @param string | $original_response_text | The original response message returned from the API |
|
| 1239 | + * @param string | $user_defined_response_text | The response message defined by the user |
|
| 1240 | + * @param string | $form_id | The form ID |
|
| 1241 | + * |
|
| 1242 | + * @return string | $response_text | The message that will be shown to the user |
|
| 1243 | + */ |
|
| 1244 | 1244 | $response_text = apply_filters( 'yikes-mailchimp-general-error-response', $original_response_text, $user_defined_response_text, $this->form_id ); |
| 1245 | 1245 | |
| 1246 | 1246 | return $response_text; |
@@ -1254,14 +1254,14 @@ discard block |
||
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | /** |
| 1257 | - * Wrap the response message in HTML for Non-AJAX form submissions |
|
| 1258 | - * |
|
| 1259 | - * @since 6.3.0 |
|
| 1260 | - * |
|
| 1261 | - * @param string | $message | The response message |
|
| 1262 | - * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
| 1263 | - * @return string| The $message wrapping in HTML |
|
| 1264 | - */ |
|
| 1257 | + * Wrap the response message in HTML for Non-AJAX form submissions |
|
| 1258 | + * |
|
| 1259 | + * @since 6.3.0 |
|
| 1260 | + * |
|
| 1261 | + * @param string | $message | The response message |
|
| 1262 | + * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
| 1263 | + * @return string| The $message wrapping in HTML |
|
| 1264 | + */ |
|
| 1265 | 1265 | public function wrap_form_submission_response( $message, $is_success ) { |
| 1266 | 1266 | |
| 1267 | 1267 | // If we're successful, we wrap the $message differently |
@@ -1275,14 +1275,14 @@ discard block |
||
| 1275 | 1275 | /**** Returning Success / Failure Functions ****/ |
| 1276 | 1276 | |
| 1277 | 1277 | /** |
| 1278 | - * Return success. Method of returning success based on the $is_ajax flag |
|
| 1279 | - * |
|
| 1280 | - * @since 6.3.0 |
|
| 1281 | - * |
|
| 1282 | - * @param array | $success_array | Array of success values to return |
|
| 1283 | - * |
|
| 1284 | - * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
| 1285 | - */ |
|
| 1278 | + * Return success. Method of returning success based on the $is_ajax flag |
|
| 1279 | + * |
|
| 1280 | + * @since 6.3.0 |
|
| 1281 | + * |
|
| 1282 | + * @param array | $success_array | Array of success values to return |
|
| 1283 | + * |
|
| 1284 | + * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
| 1285 | + */ |
|
| 1286 | 1286 | protected function yikes_success( $success_array ) { |
| 1287 | 1287 | if ( $this->is_ajax === true ) { |
| 1288 | 1288 | wp_send_json_success( $success_array ); |
@@ -1295,18 +1295,18 @@ discard block |
||
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | /** |
| 1298 | - * Return failure. Method of returning failure based on the $is_ajax flag |
|
| 1299 | - * |
|
| 1300 | - * @since 6.3.0 |
|
| 1301 | - * |
|
| 1302 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1303 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1304 | - * @param string | $response | The response message to display to the user |
|
| 1305 | - * @param array | $additional_fields | An array of additional fields to return |
|
| 1306 | - * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
| 1307 | - * |
|
| 1308 | - * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
| 1309 | - */ |
|
| 1298 | + * Return failure. Method of returning failure based on the $is_ajax flag |
|
| 1299 | + * |
|
| 1300 | + * @since 6.3.0 |
|
| 1301 | + * |
|
| 1302 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1303 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1304 | + * @param string | $response | The response message to display to the user |
|
| 1305 | + * @param array | $additional_fields | An array of additional fields to return |
|
| 1306 | + * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
| 1307 | + * |
|
| 1308 | + * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
| 1309 | + */ |
|
| 1310 | 1310 | protected function yikes_fail( $hide, $error, $response, $additional_fields = array(), $return_response_non_ajax = false ) { |
| 1311 | 1311 | if ( $this->is_ajax === true ) { |
| 1312 | 1312 | $this->yikes_send_json_error( $hide, $error, $response, $additional_fields ); |
@@ -1319,17 +1319,17 @@ discard block |
||
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | /** |
| 1322 | - * Wrapper function for wp_send_json_error() |
|
| 1323 | - * |
|
| 1324 | - * @since 6.3.0 |
|
| 1325 | - * |
|
| 1326 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1327 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1328 | - * @param string | $translated_string | The response message to display to the user |
|
| 1329 | - * @param array | $additional_fields | An array of additional fields to return |
|
| 1330 | - * |
|
| 1331 | - * @return func | wp_send_json_error() |
|
| 1332 | - */ |
|
| 1322 | + * Wrapper function for wp_send_json_error() |
|
| 1323 | + * |
|
| 1324 | + * @since 6.3.0 |
|
| 1325 | + * |
|
| 1326 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1327 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1328 | + * @param string | $translated_string | The response message to display to the user |
|
| 1329 | + * @param array | $additional_fields | An array of additional fields to return |
|
| 1330 | + * |
|
| 1331 | + * @return func | wp_send_json_error() |
|
| 1332 | + */ |
|
| 1333 | 1333 | protected function yikes_send_json_error( $hide, $error, $translated_string, $additional_fields = array() ) { |
| 1334 | 1334 | |
| 1335 | 1335 | // Default response array |
@@ -1353,14 +1353,14 @@ discard block |
||
| 1353 | 1353 | /** Static functions used in other places **/ |
| 1354 | 1354 | |
| 1355 | 1355 | /** |
| 1356 | - * Handle the redirect logic for successful submissions |
|
| 1357 | - * |
|
| 1358 | - * @since 6.3.0 |
|
| 1359 | - * |
|
| 1360 | - * @param array | $submission_settings | Array of the form's submission settings |
|
| 1361 | - * @param array | $page_data | Page ID |
|
| 1362 | - * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
| 1363 | - */ |
|
| 1356 | + * Handle the redirect logic for successful submissions |
|
| 1357 | + * |
|
| 1358 | + * @since 6.3.0 |
|
| 1359 | + * |
|
| 1360 | + * @param array | $submission_settings | Array of the form's submission settings |
|
| 1361 | + * @param array | $page_data | Page ID |
|
| 1362 | + * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
| 1363 | + */ |
|
| 1364 | 1364 | public static function handle_submission_response_success_redirect( $form_id, $submission_settings, $page_data ) { |
| 1365 | 1365 | |
| 1366 | 1366 | $default_redirect_time_ms = 1500; |
@@ -1393,23 +1393,23 @@ discard block |
||
| 1393 | 1393 | $redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
| 1394 | 1394 | |
| 1395 | 1395 | /** |
| 1396 | - * yikes-mailchimp-redirect-url |
|
| 1397 | - * |
|
| 1398 | - * Catch the redirect URL before it's shown to the user |
|
| 1399 | - * |
|
| 1400 | - * @param string | $redirect_url | The URL that we will redirect to |
|
| 1401 | - * @param string | $form_id | The ID of the current form being subscribed to |
|
| 1402 | - * @param array | $page_data | An array of data related to the page the form is on |
|
| 1403 | - */ |
|
| 1396 | + * yikes-mailchimp-redirect-url |
|
| 1397 | + * |
|
| 1398 | + * Catch the redirect URL before it's shown to the user |
|
| 1399 | + * |
|
| 1400 | + * @param string | $redirect_url | The URL that we will redirect to |
|
| 1401 | + * @param string | $form_id | The ID of the current form being subscribed to |
|
| 1402 | + * @param array | $page_data | An array of data related to the page the form is on |
|
| 1403 | + */ |
|
| 1404 | 1404 | $redirect_url = apply_filters( 'yikes-mailchimp-redirect-url', $redirect_url, $form_id, $page_data ); |
| 1405 | 1405 | |
| 1406 | 1406 | /** |
| 1407 | - * yikes-mailchimp-redirect-timer |
|
| 1408 | - * |
|
| 1409 | - * Catch the redirect timer before it's sent to the JavaScript file |
|
| 1410 | - * |
|
| 1411 | - * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
| 1412 | - */ |
|
| 1407 | + * yikes-mailchimp-redirect-timer |
|
| 1408 | + * |
|
| 1409 | + * Catch the redirect timer before it's sent to the JavaScript file |
|
| 1410 | + * |
|
| 1411 | + * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
| 1412 | + */ |
|
| 1413 | 1413 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data ); |
| 1414 | 1414 | |
| 1415 | 1415 | $redirect_array['redirect_timer'] = $redirect_timer; |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | new YIKES_Inc_Easy_Mailchimp_Public_Ajax(); |
| 58 | 58 | |
| 59 | 59 | // Include our error logging class |
| 60 | - add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 ); |
|
| 60 | + add_action( 'init', array( $this, 'load_error_logging_class' ), 1 ); |
|
| 61 | 61 | // load our checkbox classes |
| 62 | - add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 ); |
|
| 62 | + add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 ); |
|
| 63 | 63 | // custom front end filter |
| 64 | 64 | add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) ); |
| 65 | 65 | // Process non-ajax forms in the header |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | **/ |
| 95 | 95 | public function load_checkbox_integration_classes() { |
| 96 | 96 | // store our options |
| 97 | - $integrations = get_option( 'optin-checkbox-init' , array() ); |
|
| 98 | - if( ! empty( $integrations ) && is_array( $integrations ) ) { |
|
| 97 | + $integrations = get_option( 'optin-checkbox-init', array() ); |
|
| 98 | + if ( ! empty( $integrations ) && is_array( $integrations ) ) { |
|
| 99 | 99 | // load our mail integrations class |
| 100 | 100 | require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php'; |
| 101 | 101 | // loop over selected classes and load them up! |
| 102 | - foreach( $integrations as $integration => $value ) { |
|
| 103 | - if( isset( $value['value'] ) && $value['value'] == 'on' ) { |
|
| 102 | + foreach ( $integrations as $integration => $value ) { |
|
| 103 | + if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) { |
|
| 104 | 104 | // load our class extensions |
| 105 | - require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php'; |
|
| 105 | + require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php'; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @since 6.0.0 |
| 117 | 117 | */ |
| 118 | 118 | public function load_error_logging_class() { |
| 119 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 119 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 120 | 120 | // if error logging is enabled we should include our error logging class |
| 121 | 121 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 122 | 122 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging; |
@@ -129,19 +129,19 @@ discard block |
||
| 129 | 129 | * @since 6.0.3.4 |
| 130 | 130 | */ |
| 131 | 131 | public function yikes_process_non_ajax_forms( $form_submitted ) { |
| 132 | - global $wpdb,$post; |
|
| 133 | - $form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id |
|
| 134 | - if( $form_id ) { |
|
| 132 | + global $wpdb, $post; |
|
| 133 | + $form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id |
|
| 134 | + if ( $form_id ) { |
|
| 135 | 135 | $form_settings = self::yikes_retrieve_form_settings( $form_id ); |
| 136 | - if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) { |
|
| 137 | - if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted |
|
| 136 | + if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) { |
|
| 137 | + if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted |
|
| 138 | 138 | |
| 139 | 139 | // Lets include our form processing file |
| 140 | 140 | include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' ); |
| 141 | - if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) { |
|
| 142 | - if( $form_submitted == 1 ) { |
|
| 141 | + if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) { |
|
| 142 | + if ( $form_submitted == 1 ) { |
|
| 143 | 143 | // decode our settings |
| 144 | - $redirect_page = ( 'custom_url' != $form_settings['submission_settings']['redirect_page'] ) ? get_permalink( (int) $form_settings['submission_settings']['redirect_page'] ) : $form_settings['submission_settings']['custom_redirect_url']; |
|
| 144 | + $redirect_page = ( 'custom_url' != $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) ? get_permalink( (int) $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) : $form_settings[ 'submission_settings' ][ 'custom_redirect_url' ]; |
|
| 145 | 145 | wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) ); |
| 146 | 146 | exit; |
| 147 | 147 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public static function yikes_retrieve_form_settings( $form_id ) { |
| 171 | 171 | // if no form id, abort |
| 172 | - if( ! $form_id ) { |
|
| 172 | + if ( ! $form_id ) { |
|
| 173 | 173 | return array(); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | return; |
| 199 | 199 | } |
| 200 | 200 | // trim trailing period |
| 201 | - if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) { |
|
| 202 | - $response_text = $form_settings['error_messages']['update-link']; |
|
| 201 | + if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) { |
|
| 202 | + $response_text = $form_settings[ 'error_messages' ][ 'update-link' ]; |
|
| 203 | 203 | // extract the link text |
| 204 | 204 | preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text ); |
| 205 | 205 | if ( $link_text && ! empty( $link_text ) ) { |
| 206 | 206 | // Extract the custom link text ([link]*[/link]) |
| 207 | - $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) ); |
|
| 207 | + $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) ); |
|
| 208 | 208 | // Replace the link text, with our custom link text |
| 209 | 209 | $response_text = str_replace( $link_text, $custom_link_text, $response_text ); |
| 210 | 210 | } |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // trim trailing period |
| 236 | - if ( isset( $form_settings['error_messages']['already-subscribed'] ) && ! empty( $form_settings['error_messages']['already-subscribed'] ) ) { |
|
| 237 | - $response_text = str_replace( '[email]', $email, $form_settings['error_messages']['already-subscribed'] ); |
|
| 236 | + if ( isset( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) { |
|
| 237 | + $response_text = str_replace( '[email]', $email, $form_settings[ 'error_messages' ][ 'already-subscribed' ] ); |
|
| 238 | 238 | } |
| 239 | 239 | // Return our new string |
| 240 | 240 | return $response_text; |