@@ -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,12 +58,12 @@ discard block |
||
| 58 | 58 | @since v6.0.4.1 |
| 59 | 59 | */ |
| 60 | 60 | public function sendUpdateProfileEmail() { |
| 61 | - $user_email = $_POST['user_email']; |
|
| 61 | + $user_email = $_POST[ 'user_email' ]; |
|
| 62 | 62 | $user_id = md5( $user_email ); |
| 63 | - $list_id = $_POST['list_id']; |
|
| 64 | - $form_id = $_POST['form_id']; |
|
| 65 | - $page_id = $_POST['page_id']; |
|
| 66 | - $full_site_url = get_bloginfo( 'url' ); |
|
| 63 | + $list_id = $_POST[ 'list_id' ]; |
|
| 64 | + $form_id = $_POST[ 'form_id' ]; |
|
| 65 | + $page_id = $_POST[ 'page_id' ]; |
|
| 66 | + $full_site_url = get_bloginfo( 'url' ); |
|
| 67 | 67 | $manager = yikes_get_mc_api_manager(); |
| 68 | 68 | |
| 69 | 69 | // Possibly handle errors. |
@@ -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' ) && isset( $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 | } |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // Construct the headers & email message content |
| 134 | - $subscriber_id = $subscriber_account_details['unique_email_id']; |
|
| 135 | - $update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] ); |
|
| 134 | + $subscriber_id = $subscriber_account_details[ 'unique_email_id' ]; |
|
| 135 | + $update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] ); |
|
| 136 | 136 | $update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href ); |
| 137 | 137 | $update_link_tag = '<a href="' . $update_link_href . '">'; |
| 138 | - $headers = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n"; |
|
| 139 | - $headers .= 'Content-type: text/html'; |
|
| 138 | + $headers = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n"; |
|
| 139 | + $headers .= 'Content-type: text/html'; |
|
| 140 | 140 | |
| 141 | 141 | if ( ! isset( $email_subject ) ) { |
| 142 | 142 | $email_subject = __( 'MailChimp Profile Update', 'yikes-inc-easy-mailchimp-extender' ); |
@@ -174,16 +174,16 @@ discard block |
||
| 174 | 174 | 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 ) ) { |
| 175 | 175 | |
| 176 | 176 | $update_email_success_message = apply_filters( 'yikes-mailchimp-update-email-success-message', $update_email_success_message, $form_id, $user_email ); |
| 177 | - $submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
| 177 | + $submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
| 178 | 178 | $redirect_settings = Yikes_Inc_Easy_MailChimp_Extender_Process_Submission_Handler::handle_submission_response_success_redirect( $form_id, $submission_settings, $page_id ); |
| 179 | 179 | |
| 180 | 180 | wp_send_json_success( |
| 181 | 181 | array( |
| 182 | 182 | 'response_text' => '<div class="yikes-easy-mc-success-message">' . $update_email_success_message . '</div>', |
| 183 | - 'redirection' => $redirect_settings['redirection'], |
|
| 184 | - 'redirect' => $redirect_settings['redirect'], |
|
| 185 | - 'redirect_timer' => $redirect_settings['redirect_timer'], |
|
| 186 | - 'new_window' => $redirect_settings['new_window'], |
|
| 183 | + 'redirection' => $redirect_settings[ 'redirection' ], |
|
| 184 | + 'redirect' => $redirect_settings[ 'redirect' ], |
|
| 185 | + 'redirect_timer' => $redirect_settings[ 'redirect_timer' ], |
|
| 186 | + 'new_window' => $redirect_settings[ 'new_window' ], |
|
| 187 | 187 | ) |
| 188 | 188 | ); |
| 189 | 189 | } else { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $data = $_POST; |
| 15 | 15 | |
| 16 | 16 | // Confirm we have a form id to work with |
| 17 | -$form_id = ( isset( $data['yikes-mailchimp-submitted-form'] ) ) ? absint( $data['yikes-mailchimp-submitted-form'] ) : false; |
|
| 17 | +$form_id = ( isset( $data[ 'yikes-mailchimp-submitted-form' ] ) ) ? absint( $data[ 'yikes-mailchimp-submitted-form' ] ) : false; |
|
| 18 | 18 | |
| 19 | 19 | // Set the form id in our class |
| 20 | 20 | $submission_handler->set_form_id( $form_id ); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // Check our nonce |
| 31 | -if ( $submission_handler->handle_nonce( $_POST['yikes_easy_mc_new_subscriber'], 'yikes_easy_mc_form_submit' ) === false ) { |
|
| 31 | +if ( $submission_handler->handle_nonce( $_POST[ 'yikes_easy_mc_new_subscriber' ], 'yikes_easy_mc_form_submit' ) === false ) { |
|
| 32 | 32 | $process_submission_response = $submission_handler->wrap_form_submission_response( $submission_handler->handle_nonce_message, $is_success = false ); |
| 33 | 33 | return; |
| 34 | 34 | } |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Set up some variables from the form data -- these are required |
| 47 | -$list_id = isset( $form_data['list_id'] ) ? $form_data['list_id'] : null; |
|
| 48 | -$submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
| 49 | -$optin_settings = isset( $form_data['optin_settings'] ) ? $form_data['optin_settings'] : null; |
|
| 50 | -$form_fields = isset( $form_data['fields'] ) ? $form_data['fields'] : null; |
|
| 47 | +$list_id = isset( $form_data[ 'list_id' ] ) ? $form_data[ 'list_id' ] : null; |
|
| 48 | +$submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
| 49 | +$optin_settings = isset( $form_data[ 'optin_settings' ] ) ? $form_data[ 'optin_settings' ] : null; |
|
| 50 | +$form_fields = isset( $form_data[ 'fields' ] ) ? $form_data[ 'fields' ] : null; |
|
| 51 | 51 | |
| 52 | 52 | // Send an error if for some reason we can't find the required form data |
| 53 | 53 | if ( $submission_handler->handle_empty_fields_generic( array( $list_id, $submission_settings, $optin_settings, $form_fields ) ) === false ) { |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | $submission_handler->set_list_id( $list_id ); |
| 71 | 71 | |
| 72 | 72 | // Set up some variables from the form data -- these are not required |
| 73 | -$error_messages = isset( $form_data['error_messages'] ) ? $form_data['error_messages'] : array(); |
|
| 74 | -$notifications = isset( $form_data['custom_notifications'] ) ? $form_data['custom_notifications'] : array(); // Do we need this? |
|
| 73 | +$error_messages = isset( $form_data[ 'error_messages' ] ) ? $form_data[ 'error_messages' ] : array(); |
|
| 74 | +$notifications = isset( $form_data[ 'custom_notifications' ] ) ? $form_data[ 'custom_notifications' ] : array(); // Do we need this? |
|
| 75 | 75 | |
| 76 | 76 | // Set the error messages in our class |
| 77 | 77 | $submission_handler->set_error_messages( $error_messages ); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // Get, sanitize, and lowercasify the email |
| 90 | -$submitted_email = isset( $data['EMAIL'] ) ? $data['EMAIL'] : ''; |
|
| 90 | +$submitted_email = isset( $data[ 'EMAIL' ] ) ? $data[ 'EMAIL' ] : ''; |
|
| 91 | 91 | $sanitized_email = $submission_handler->get_sanitized_email( $submitted_email ); |
| 92 | 92 | $submission_handler->set_email( $sanitized_email ); |
| 93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Check for Honeypot filled |
| 101 | -$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && '' !== $data['yikes-mailchimp-honeypot'] ) ? true : false; |
|
| 101 | +$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && '' !== $data[ 'yikes-mailchimp-honeypot' ] ) ? true : false; |
|
| 102 | 102 | |
| 103 | 103 | // Send an error if honey pot is not empty |
| 104 | 104 | if ( $submission_handler->handle_non_empty_honeypot( $honey_pot_filled ) === false ) { |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // Check if reCAPTCHA Response was submitted with the form data, and handle it if needed |
| 110 | -if ( isset( $data['g-recaptcha-response'] ) ) { |
|
| 111 | - $recaptcha_response = $data['g-recaptcha-response']; |
|
| 110 | +if ( isset( $data[ 'g-recaptcha-response' ] ) ) { |
|
| 111 | + $recaptcha_response = $data[ 'g-recaptcha-response' ]; |
|
| 112 | 112 | $recaptcha_handle = $submission_handler->handle_recaptcha( $recaptcha_response ); |
| 113 | - if ( isset( $recaptcha_handle['success'] ) && $recaptcha_handle['success'] === false ) { |
|
| 114 | - $process_submission_response = $submission_handler->wrap_form_submission_response( $recaptcha_handle['message'], $is_success = false ); |
|
| 113 | + if ( isset( $recaptcha_handle[ 'success' ] ) && $recaptcha_handle[ 'success' ] === false ) { |
|
| 114 | + $process_submission_response = $submission_handler->wrap_form_submission_response( $recaptcha_handle[ 'message' ], $is_success = false ); |
|
| 115 | 115 | return; |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $merge_variables = $submission_handler->get_submitted_merge_values( $data, $form_fields ); |
| 121 | 121 | |
| 122 | 122 | // Submission Setting: Replace interest groups or update interest groups |
| 123 | -$replace_interests = isset( $submission_settings['replace_interests'] ) ? (bool) $submission_settings['replace_interests'] : true; |
|
| 123 | +$replace_interests = isset( $submission_settings[ 'replace_interests' ] ) ? (bool) $submission_settings[ 'replace_interests' ] : true; |
|
| 124 | 124 | |
| 125 | 125 | // Get the default groups |
| 126 | 126 | $groups = $submission_handler->get_default_interest_groups( $replace_interests, $list_handler ); |
@@ -135,17 +135,17 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @param $merge_variables array Array of merge variable to use |
| 137 | 137 | */ |
| 138 | -do_action( 'yikes-mailchimp-before-submission', $merge_variables ); |
|
| 138 | +do_action( 'yikes-mailchimp-before-submission', $merge_variables ); |
|
| 139 | 139 | do_action( "yikes-mailchimp-before-submission-{$form_id}", $merge_variables ); |
| 140 | 140 | |
| 141 | 141 | // Allow users to check for form values (using the `yikes-mailchimp-filter-before-submission` filter hook in function `get_submitted_merge_values`) |
| 142 | 142 | // and pass back an error and message to the user |
| 143 | 143 | // If error is set and no message, default to our class variable's default error message |
| 144 | -if ( isset( $merge_variables['error'] ) ) { |
|
| 145 | - $merge_error_message = isset( $merge_variables['message'] ) ? $merge_variables['message'] : $submission_handler->default_error_response_message; |
|
| 146 | - $merge_vars_error_array = $submission_handler->handle_merge_variables_error( $merge_variables['error'], $merge_error_message ); |
|
| 147 | - if ( $merge_vars_error_array['success'] === false ) { |
|
| 148 | - $process_submission_response = $submission_handler->wrap_form_submission_response( $merge_vars_error_array['message'], $is_success = false ); |
|
| 144 | +if ( isset( $merge_variables[ 'error' ] ) ) { |
|
| 145 | + $merge_error_message = isset( $merge_variables[ 'message' ] ) ? $merge_variables[ 'message' ] : $submission_handler->default_error_response_message; |
|
| 146 | + $merge_vars_error_array = $submission_handler->handle_merge_variables_error( $merge_variables[ 'error' ], $merge_error_message ); |
|
| 147 | + if ( $merge_vars_error_array[ 'success' ] === false ) { |
|
| 148 | + $process_submission_response = $submission_handler->wrap_form_submission_response( $merge_vars_error_array[ 'message' ], $is_success = false ); |
|
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | // Only add groups if they exist |
| 161 | 161 | if ( ! empty( $groups ) ) { |
| 162 | - $member_data['interests'] = $groups; |
|
| 162 | + $member_data[ 'interests' ] = $groups; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Check if this member already exists |
@@ -169,30 +169,30 @@ discard block |
||
| 169 | 169 | // 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 |
| 170 | 170 | // Or, if this member but their status is 'unsubscribed' it means we're dealing with someone who unsubscribed and they need to re-subscribe |
| 171 | 171 | // Continue as if they're a new member to force another double opt-in email |
| 172 | -$double_optin_resubscribe = is_array( $member_exists ) && isset( $member_exists['status'] ) && ( $member_exists['status'] === 'pending' || $member_exists['status'] === 'unsubscribed' ); |
|
| 172 | +$double_optin_resubscribe = is_array( $member_exists ) && isset( $member_exists[ 'status' ] ) && ( $member_exists[ 'status' ] === 'pending' || $member_exists[ 'status' ] === 'unsubscribed' ); |
|
| 173 | 173 | |
| 174 | 174 | if ( is_wp_error( $member_exists ) || $double_optin_resubscribe === true ) { |
| 175 | 175 | $new_subscriber = true; |
| 176 | 176 | |
| 177 | 177 | // Check the opt-in value - is it double or single? |
| 178 | 178 | // Double opt-in means 'status_if_new' => 'pending' |
| 179 | - $double_optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
| 179 | + $double_optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
| 180 | 180 | |
| 181 | 181 | // If the user was unsubscribed and is re-subscribing, we set the status to 'pending', which |
| 182 | 182 | // causes Mailchimp to send them a confirmation email. This is the only way Mailchimp will |
| 183 | 183 | // allow us to re-subscribe the user. |
| 184 | - $was_unsubscribed = is_array( $member_exists ) && isset( $member_exists['status'] ) && $member_exists['status'] === 'unsubscribed'; |
|
| 184 | + $was_unsubscribed = is_array( $member_exists ) && isset( $member_exists[ 'status' ] ) && $member_exists[ 'status' ] === 'unsubscribed'; |
|
| 185 | 185 | |
| 186 | 186 | if ( $double_optin === 1 || $was_unsubscribed === true ) { |
| 187 | 187 | |
| 188 | 188 | // Double opt-in |
| 189 | - $member_data['status_if_new'] = 'pending'; |
|
| 190 | - $member_data['status'] = 'pending'; |
|
| 189 | + $member_data[ 'status_if_new' ] = 'pending'; |
|
| 190 | + $member_data[ 'status' ] = 'pending'; |
|
| 191 | 191 | } else { |
| 192 | 192 | |
| 193 | 193 | // Single opt-in |
| 194 | - $member_data['status_if_new'] = 'subscribed'; |
|
| 195 | - $member_data['status'] = 'subscribed'; |
|
| 194 | + $member_data[ 'status_if_new' ] = 'subscribed'; |
|
| 195 | + $member_data[ 'status' ] = 'subscribed'; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | } else { |
@@ -201,28 +201,28 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | // But first let's set our flag, and set the MailChimp status flag |
| 203 | 203 | $new_subscriber = false; |
| 204 | - $member_data['status'] = 'subscribed'; |
|
| 204 | + $member_data[ 'status' ] = 'subscribed'; |
|
| 205 | 205 | |
| 206 | 206 | // Check our update_existing_user optin setting |
| 207 | - $update_existing_user = ( $optin_settings['update_existing_user'] === '1' ) ? true : false; |
|
| 207 | + $update_existing_user = ( $optin_settings[ 'update_existing_user' ] === '1' ) ? true : false; |
|
| 208 | 208 | |
| 209 | 209 | // If update_existing_user is false (not allowed) then simply fail and return a response message |
| 210 | 210 | if ( $update_existing_user === false ) { |
| 211 | 211 | $disallow_update_array = $submission_handler->handle_disallowed_existing_user_update(); |
| 212 | - if ( $disallow_update_array['success'] === false ) { |
|
| 213 | - $process_submission_response = $submission_handler->wrap_form_submission_response( $disallow_update_array['message'], $is_success = false ); |
|
| 212 | + if ( $disallow_update_array[ 'success' ] === false ) { |
|
| 213 | + $process_submission_response = $submission_handler->wrap_form_submission_response( $disallow_update_array[ 'message' ], $is_success = false ); |
|
| 214 | 214 | return; |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // If update_existing_user is true, we need to check our 'send_update_email' option |
| 219 | - $send_update_email = ( $optin_settings['send_update_email'] === '1' ) ? true : false; |
|
| 219 | + $send_update_email = ( $optin_settings[ 'send_update_email' ] === '1' ) ? true : false; |
|
| 220 | 220 | |
| 221 | 221 | // If $send_update_email is true (we send the email) then we need to fire off the 'send update email' logic |
| 222 | 222 | if ( $send_update_email === true ) { |
| 223 | 223 | $update_existing_user_array = $submission_handler->handle_updating_existing_user(); |
| 224 | - if ( $update_existing_user_array['success'] === false ) { |
|
| 225 | - $process_submission_response = $submission_handler->wrap_form_submission_response( $update_existing_user_array['message'], $is_success = false ); |
|
| 224 | + if ( $update_existing_user_array[ 'success' ] === false ) { |
|
| 225 | + $process_submission_response = $submission_handler->wrap_form_submission_response( $update_existing_user_array[ 'message' ], $is_success = false ); |
|
| 226 | 226 | return; |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // Handle errors in the response |
| 257 | -if ( isset( $success_array ) && isset( $success_array['success'] ) && $success_array['success'] === false ) { |
|
| 258 | - $process_submission_response = isset( $success_array['message'] ) ? $success_array['message'] : ''; |
|
| 259 | - $process_submission_response = $submission_handler->wrap_form_submission_response( $success_array['message'], $is_success = false ); |
|
| 257 | +if ( isset( $success_array ) && isset( $success_array[ 'success' ] ) && $success_array[ 'success' ] === false ) { |
|
| 258 | + $process_submission_response = isset( $success_array[ 'message' ] ) ? $success_array[ 'message' ] : ''; |
|
| 259 | + $process_submission_response = $submission_handler->wrap_form_submission_response( $success_array[ 'message' ], $is_success = false ); |
|
| 260 | 260 | return; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | // For non-AJAX submissions, if we have a new subscriber we need to increment our submissions count by 1 |
| 267 | 267 | // For AJAX, this is an AJAX call that gets fired off after form submission |
| 268 | 268 | if ( $new_subscriber === true ) { |
| 269 | - $submissions = (int) $form_settings['submissions'] + 1; |
|
| 269 | + $submissions = (int) $form_settings[ 'submissions' ] + 1; |
|
| 270 | 270 | $interface->update_form_field( $form_id, 'submissions', $submissions ); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -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 ) { |
@@ -30,54 +30,54 @@ discard block |
||
| 30 | 30 | $form_submitted = isset( $form_submitted ) ? $form_submitted : 0; |
| 31 | 31 | |
| 32 | 32 | /* If the user hasn't authenticated yet, lets kill off */ |
| 33 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
| 34 | - return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>'; |
|
| 33 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
| 34 | + return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // if the user forgot to specify a form ID, lets kill of and warn them. |
| 38 | - if( ! $atts['form'] ) { |
|
| 38 | + if ( ! $atts[ 'form' ] ) { |
|
| 39 | 39 | return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' ); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // store our variables |
| 43 | - $form_id = (int) $atts['form']; // form id (the id of the form in the database) |
|
| 43 | + $form_id = (int) $atts[ 'form' ]; // form id (the id of the form in the database) |
|
| 44 | 44 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 45 | 45 | $form_data = $interface->get_form( $form_id ); |
| 46 | 46 | |
| 47 | 47 | // confirm we have some results, or return an error |
| 48 | 48 | if ( empty( $form_data ) ) { |
| 49 | - return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 49 | + return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /* |
| 53 | 53 | * Check if the user wants to use reCAPTCHA Spam Prevention |
| 54 | 54 | */ |
| 55 | - if ( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) { |
|
| 55 | + if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) { |
|
| 56 | 56 | // allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page) |
| 57 | - if ( $atts['recaptcha'] != '0' ) { |
|
| 57 | + if ( $atts[ 'recaptcha' ] != '0' ) { |
|
| 58 | 58 | // if either of the Private the Secret key is left blank, we should display an error back to the user |
| 59 | - if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) { |
|
| 60 | - return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
| 59 | + if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) { |
|
| 60 | + return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
| 61 | 61 | } |
| 62 | - if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) { |
|
| 63 | - return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
| 62 | + if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) { |
|
| 63 | + return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if( ! empty( $atts['recaptcha_type'] ) ) { |
|
| 67 | - echo $atts['recaptcha_type']; |
|
| 66 | + if ( ! empty( $atts[ 'recaptcha_type' ] ) ) { |
|
| 67 | + echo $atts[ 'recaptcha_type' ]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Store the site language (to load recaptcha in a specific language) |
| 71 | 71 | $locale = get_locale(); |
| 72 | 72 | $locale_split = explode( '_', $locale ); |
| 73 | 73 | // Setup reCAPTCHA parameters |
| 74 | - $lang = ( ! empty( $locale_split ) ? $locale_split[0] : $locale ); |
|
| 75 | - $lang = ( ! empty( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $lang; |
|
| 76 | - $type = ( ! empty( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type |
|
| 77 | - $theme= ( ! empty( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme |
|
| 78 | - $size = ( ! empty( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size |
|
| 79 | - $data_callback = ( ! empty( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size |
|
| 80 | - $expired_callback = ( ! empty( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size |
|
| 74 | + $lang = ( ! empty( $locale_split ) ? $locale_split[ 0 ] : $locale ); |
|
| 75 | + $lang = ( ! empty( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $lang; |
|
| 76 | + $type = ( ! empty( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type |
|
| 77 | + $theme = ( ! empty( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme |
|
| 78 | + $size = ( ! empty( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size |
|
| 79 | + $data_callback = ( ! empty( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size |
|
| 80 | + $expired_callback = ( ! empty( $atts[ 'recaptcha_expired_callback' ] ) ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size |
|
| 81 | 81 | // Pass the shortcode parameters through a filter |
| 82 | 82 | $recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array( |
| 83 | 83 | 'language' => $lang, |
@@ -86,48 +86,48 @@ discard block |
||
| 86 | 86 | 'size' => $size, |
| 87 | 87 | 'success_callback' => $data_callback, |
| 88 | 88 | 'expired_callback' => $expired_callback, |
| 89 | - ), $atts['form'] ); |
|
| 89 | + ), $atts[ 'form' ] ); |
|
| 90 | 90 | |
| 91 | 91 | // enqueue Google recaptcha JS |
| 92 | - wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery', 'form-submission-helpers' ) , 'all' ); |
|
| 92 | + wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery', 'form-submission-helpers' ), 'all' ); |
|
| 93 | 93 | wp_enqueue_script( 'google-recaptcha-js' ); |
| 94 | - $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' ); |
|
| 95 | - $recaptcha_box = '<div class="g-recaptcha" data-sitekey="' . esc_attr( $recaptcha_site_key ) . '" data-theme="' . esc_attr( $recaptcha_shortcode_params['theme'] ) . '" data-type="' . esc_attr( $recaptcha_shortcode_params['type'] ) . '" data-size="' . esc_attr( $recaptcha_shortcode_params['size'] ) . '" data-callback="' . esc_attr( $recaptcha_shortcode_params['success_callback'] ) . '" data-expired-callback="' . esc_attr( $recaptcha_shortcode_params['expired_callback'] ) . '"></div>'; |
|
| 94 | + $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' ); |
|
| 95 | + $recaptcha_box = '<div class="g-recaptcha" data-sitekey="' . esc_attr( $recaptcha_site_key ) . '" data-theme="' . esc_attr( $recaptcha_shortcode_params[ 'theme' ] ) . '" data-type="' . esc_attr( $recaptcha_shortcode_params[ 'type' ] ) . '" data-size="' . esc_attr( $recaptcha_shortcode_params[ 'size' ] ) . '" data-callback="' . esc_attr( $recaptcha_shortcode_params[ 'success_callback' ] ) . '" data-expired-callback="' . esc_attr( $recaptcha_shortcode_params[ 'expired_callback' ] ) . '"></div>'; |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // place our results into a separate variable for easy looping |
| 100 | - $additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? $form_data['form_settings'] : false; |
|
| 100 | + $additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? $form_data[ 'form_settings' ] : false; |
|
| 101 | 101 | |
| 102 | 102 | // store our options from the additional form settings array |
| 103 | - $form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : ''; |
|
| 104 | - $inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : ''; |
|
| 105 | - $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text'; |
|
| 106 | - $submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 107 | - $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : ''; |
|
| 108 | - $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : ''; |
|
| 103 | + $form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : ''; |
|
| 104 | + $inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : ''; |
|
| 105 | + $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text'; |
|
| 106 | + $submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 107 | + $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : ''; |
|
| 108 | + $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : ''; |
|
| 109 | 109 | |
| 110 | 110 | // scheuldes |
| 111 | - $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false; |
|
| 112 | - $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';; |
|
| 113 | - $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : ''; |
|
| 114 | - $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : ''; |
|
| 115 | - $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : ''; |
|
| 111 | + $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false; |
|
| 112 | + $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ; |
|
| 113 | + $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : ''; |
|
| 114 | + $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : ''; |
|
| 115 | + $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : ''; |
|
| 116 | 116 | |
| 117 | 117 | // register required |
| 118 | - $form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false; |
|
| 119 | - $form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : ''; |
|
| 118 | + $form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false; |
|
| 119 | + $form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : ''; |
|
| 120 | 120 | |
| 121 | 121 | // store number of fields |
| 122 | - $field_count = (int) count( $form_data['fields'] ); |
|
| 122 | + $field_count = (int) count( $form_data[ 'fields' ] ); |
|
| 123 | 123 | |
| 124 | 124 | // confirm we actually have fields, before looping |
| 125 | - if ( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
| 125 | + if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
| 126 | 126 | // loop over each field, if it's set to hidden -- subtract it from the field count |
| 127 | 127 | // this throws off the layout for inline forms setup below |
| 128 | - foreach ( $form_data['fields'] as $form_field ) { |
|
| 129 | - if ( isset( $form_field['hide'] ) && (string) $form_field['hide'] === '1' ) { |
|
| 130 | - $field_count --; |
|
| 128 | + foreach ( $form_data[ 'fields' ] as $form_field ) { |
|
| 129 | + if ( isset( $form_field[ 'hide' ] ) && (string) $form_field[ 'hide' ] === '1' ) { |
|
| 130 | + $field_count--; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * If login is required, abort |
| 137 | 137 | * @since 6.0.3.8 |
| 138 | 138 | */ |
| 139 | - if( $form_login_required ) { |
|
| 140 | - if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
| 139 | + if ( $form_login_required ) { |
|
| 140 | + if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
| 141 | 141 | ob_start(); |
| 142 | 142 | ?> |
| 143 | 143 | <div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required"> |
@@ -153,19 +153,19 @@ discard block |
||
| 153 | 153 | * Check if schedule is set for this form |
| 154 | 154 | * @since 6.0.3.8 |
| 155 | 155 | */ |
| 156 | - if( $form_schedule_state ) { |
|
| 156 | + if ( $form_schedule_state ) { |
|
| 157 | 157 | // store current date |
| 158 | 158 | $current_date = strtotime( current_time( 'm/d/Y g:iA' ) ); |
| 159 | 159 | |
| 160 | 160 | // the the current date is less than the form scheduled start date |
| 161 | - if( $current_date < $form_schedule_start ) { |
|
| 161 | + if ( $current_date < $form_schedule_start ) { |
|
| 162 | 162 | echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message, $form_id, $form_schedule_start ); |
| 163 | 163 | return; |
| 164 | 164 | // abort |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // The current date is past or equal to the end date, aka form has now expired |
| 168 | - if( $current_date >= $form_schedule_end ) { |
|
| 168 | + if ( $current_date >= $form_schedule_end ) { |
|
| 169 | 169 | echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message, $form_id, $form_schedule_end ); |
| 170 | 170 | return; |
| 171 | 171 | // abort |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | // setup the submit button text |
| 176 | 176 | // shortcode parameter takes precedence over option |
| 177 | - $submit = ( ! empty( $atts['submit'] ) ) ? $atts['submit'] : $submit_button_text; |
|
| 177 | + $submit = ( ! empty( $atts[ 'submit' ] ) ) ? $atts[ 'submit' ] : $submit_button_text; |
|
| 178 | 178 | |
| 179 | 179 | /* |
| 180 | 180 | * Check for the constant to prevent styles from loading |
| 181 | 181 | * to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php |
| 182 | 182 | * @since 6.0.3.8 |
| 183 | 183 | */ |
| 184 | - if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
| 184 | + if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
| 185 | 185 | // enqueue the form styles |
| 186 | 186 | wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css' ); |
| 187 | 187 | } |
@@ -189,19 +189,19 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * Check for form inline parameter |
| 191 | 191 | */ |
| 192 | - $form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension |
|
| 192 | + $form_inline = ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension |
|
| 193 | 193 | // recheck from our form options |
| 194 | 194 | if ( ! $form_inline ) { |
| 195 | - $form_inline = (bool) $additional_form_settings['yikes-easy-mc-inline-form']; |
|
| 195 | + $form_inline = (bool) $additional_form_settings[ 'yikes-easy-mc-inline-form' ]; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
| 199 | - if( is_user_logged_in() ) { |
|
| 200 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 199 | + if ( is_user_logged_in() ) { |
|
| 200 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 201 | 201 | $edit_form_link = '<span class="edit-link">'; |
| 202 | - $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts['form'] ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 202 | + $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts[ 'form' ] ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 203 | 203 | $edit_form_link .= '</span>'; |
| 204 | - $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts['form'], ucwords( $form_data['form_name'] ) ); |
|
| 204 | + $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts[ 'form' ], ucwords( $form_data[ 'form_name' ] ) ); |
|
| 205 | 205 | } else { |
| 206 | 206 | $edit_form_link = ''; |
| 207 | 207 | } |
@@ -211,16 +211,16 @@ discard block |
||
| 211 | 211 | // or else MailChimp throws errors at you |
| 212 | 212 | // extract our array keys |
| 213 | 213 | // @todo Remove array_keys() and in_array() usage here. |
| 214 | - if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
| 215 | - $array_keys = array_keys( $form_data['fields'] ); |
|
| 214 | + if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
| 215 | + $array_keys = array_keys( $form_data[ 'fields' ] ); |
|
| 216 | 216 | // check for EMAIL in that array |
| 217 | - if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) { |
|
| 218 | - return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>'; |
|
| 217 | + if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) { |
|
| 218 | + return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>'; |
|
| 219 | 219 | } |
| 220 | 220 | } else { |
| 221 | - $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 222 | - if( is_user_logged_in() ) { |
|
| 223 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 221 | + $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 222 | + if ( is_user_logged_in() ) { |
|
| 223 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 224 | 224 | return $error . $edit_form_link; |
| 225 | 225 | } |
| 226 | 226 | } else { |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if( $form_inline ) { |
|
| 231 | + if ( $form_inline ) { |
|
| 232 | 232 | $field_width = (float) ( 100 / $field_count ); |
| 233 | 233 | $submit_button_width = (float) ( 20 / $field_count ); |
| 234 | 234 | $inline_offset = apply_filters( 'yikes-mailchimp-inline-offset', 1.0, $form_id ); |
@@ -293,17 +293,17 @@ discard block |
||
| 293 | 293 | * Set a custom title using custom_title="lorem ipsum" parameter in the shortcode |
| 294 | 294 | * - This takes precedence over the title set |
| 295 | 295 | */ |
| 296 | - if ( $atts['title'] ) { |
|
| 297 | - if ( ! empty( $atts['custom_title'] ) ) { |
|
| 296 | + if ( $atts[ 'title' ] ) { |
|
| 297 | + if ( ! empty( $atts[ 'custom_title' ] ) ) { |
|
| 298 | 298 | /** |
| 299 | 299 | * Filter the title that is displayed through the shortcode. |
| 300 | 300 | * |
| 301 | 301 | * @param string $title The title to display. |
| 302 | 302 | * @param int $form_id The form ID. |
| 303 | 303 | */ |
| 304 | - $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ); |
|
| 304 | + $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ); |
|
| 305 | 305 | } else { |
| 306 | - $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data['form_name'] ), $form_id ); |
|
| 306 | + $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data[ 'form_name' ] ), $form_id ); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | echo sprintf( '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-%1$s">%2$s</h3>', $form_id, $title ); |
@@ -313,17 +313,17 @@ discard block |
||
| 313 | 313 | * Allow users to specify a custom description for this form, no html support |
| 314 | 314 | * @since 6.0.3.8 |
| 315 | 315 | */ |
| 316 | - if ( $atts['description'] ) { |
|
| 317 | - if ( ! empty( $atts['custom_description'] ) ) { |
|
| 316 | + if ( $atts[ 'description' ] ) { |
|
| 317 | + if ( ! empty( $atts[ 'custom_description' ] ) ) { |
|
| 318 | 318 | /** |
| 319 | 319 | * Filter the description that is displayed through the shortcode. |
| 320 | 320 | * |
| 321 | 321 | * @param string $title The title to display. |
| 322 | 322 | * @param int $form_id The form ID. |
| 323 | 323 | */ |
| 324 | - $description = apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ); |
|
| 324 | + $description = apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ); |
|
| 325 | 325 | } else { |
| 326 | - $description = apply_filters( 'yikes-mailchimp-form-description', $form_data['form_description'], $form_id ); |
|
| 326 | + $description = apply_filters( 'yikes-mailchimp-form-description', $form_data[ 'form_description' ], $form_id ); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | echo sprintf( '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-%1$s">%2$s</section>', $form_id, $description ); |
@@ -338,10 +338,10 @@ discard block |
||
| 338 | 338 | $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 339 | 339 | |
| 340 | 340 | // Check for AJAX |
| 341 | - if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_data['submission_settings']['ajax'] == 1 ) { |
|
| 341 | + if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_data[ 'submission_settings' ][ 'ajax' ] == 1 ) { |
|
| 342 | 342 | |
| 343 | 343 | // Enqueue our ajax script |
| 344 | - wp_enqueue_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . "public/js/yikes-mc-ajax-forms{$min}.js" , array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
| 344 | + wp_enqueue_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . "public/js/yikes-mc-ajax-forms{$min}.js", array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
| 345 | 345 | wp_localize_script( 'yikes-easy-mc-ajax', 'yikes_mailchimp_ajax', array( |
| 346 | 346 | 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
| 347 | 347 | 'page_data' => $page_data, |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // Generic JavaScript functions for interacting with the form |
| 356 | - wp_enqueue_script( 'form-submission-helpers', YIKES_MC_URL . "public/js/form-submission-helpers{$min}.js" , array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
| 356 | + wp_enqueue_script( 'form-submission-helpers', YIKES_MC_URL . "public/js/form-submission-helpers{$min}.js", array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
| 357 | 357 | wp_localize_script( 'form-submission-helpers', 'form_submission_helpers', array( |
| 358 | 358 | 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
| 359 | 359 | 'preloader_url' => apply_filters( 'yikes-mailchimp-preloader', esc_url_raw( admin_url( 'images/wpspin_light.gif' ) ) ), |
@@ -372,67 +372,67 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | // render the form! |
| 374 | 374 | ?> |
| 375 | - <form id="<?php echo sanitize_title( $form_data['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_data['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" method="POST" data-attr-form-id="<?php echo esc_attr( $form_id ); ?>"> |
|
| 375 | + <form id="<?php echo sanitize_title( $form_data[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_data[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" method="POST" data-attr-form-id="<?php echo esc_attr( $form_id ); ?>"> |
|
| 376 | 376 | |
| 377 | 377 | <?php |
| 378 | 378 | // Set a default constant for hidden fields |
| 379 | 379 | $hidden_label_count = 0; |
| 380 | 380 | |
| 381 | 381 | // Loop over our form fields |
| 382 | - foreach( $form_data['fields'] as $field ) { |
|
| 382 | + foreach ( $form_data[ 'fields' ] as $field ) { |
|
| 383 | 383 | // input array |
| 384 | 384 | $field_array = array(); |
| 385 | 385 | // label array |
| 386 | 386 | $label_array = array(); |
| 387 | 387 | // label classes array |
| 388 | 388 | $label_class_array = array(); |
| 389 | - if( $field['additional-classes'] != '' ) { |
|
| 389 | + if ( $field[ 'additional-classes' ] != '' ) { |
|
| 390 | 390 | // split custom classes at spaces |
| 391 | - $custom_classes = explode( ' ' , $field['additional-classes'] ); |
|
| 391 | + $custom_classes = explode( ' ', $field[ 'additional-classes' ] ); |
|
| 392 | 392 | // check our custom class array for field-left/field-right |
| 393 | 393 | // if it's set we need to assign it to our label and remove it from the field classes |
| 394 | 394 | // input half left |
| 395 | - if( in_array( 'field-left-half' , $custom_classes ) ) { |
|
| 395 | + if ( in_array( 'field-left-half', $custom_classes ) ) { |
|
| 396 | 396 | // $label_array['class'] = 'class="field-left-half"'; |
| 397 | - $label_class_array[] = 'field-left-half'; |
|
| 398 | - $key = array_search( 'field-left-half' , $custom_classes ); |
|
| 399 | - unset( $custom_classes[$key] ); |
|
| 397 | + $label_class_array[ ] = 'field-left-half'; |
|
| 398 | + $key = array_search( 'field-left-half', $custom_classes ); |
|
| 399 | + unset( $custom_classes[ $key ] ); |
|
| 400 | 400 | } // input half right |
| 401 | - if( in_array( 'field-right-half' , $custom_classes ) ) { |
|
| 401 | + if ( in_array( 'field-right-half', $custom_classes ) ) { |
|
| 402 | 402 | // $label_array['class'] = 'class="field-right-half"'; |
| 403 | - $label_class_array[] = 'field-right-half'; |
|
| 404 | - $key = array_search( 'field-right-half' , $custom_classes ); |
|
| 405 | - unset( $custom_classes[$key] ); |
|
| 403 | + $label_class_array[ ] = 'field-right-half'; |
|
| 404 | + $key = array_search( 'field-right-half', $custom_classes ); |
|
| 405 | + unset( $custom_classes[ $key ] ); |
|
| 406 | 406 | } // input thirds (1/3 width, floated left) |
| 407 | - if( in_array( 'field-third' , $custom_classes ) ) { |
|
| 407 | + if ( in_array( 'field-third', $custom_classes ) ) { |
|
| 408 | 408 | // $label_array['class'] = 'class="field-third"'; |
| 409 | - $label_class_array[] = 'field-third'; |
|
| 410 | - $key = array_search( 'field-third' , $custom_classes ); |
|
| 411 | - unset( $custom_classes[$key] ); |
|
| 409 | + $label_class_array[ ] = 'field-third'; |
|
| 410 | + $key = array_search( 'field-third', $custom_classes ); |
|
| 411 | + unset( $custom_classes[ $key ] ); |
|
| 412 | 412 | } // 2 column radio |
| 413 | - if( in_array( 'option-2-col' , $custom_classes ) ) { |
|
| 413 | + if ( in_array( 'option-2-col', $custom_classes ) ) { |
|
| 414 | 414 | // $label_array['class'] = 'class="option-2-col"'; |
| 415 | - $label_class_array[] = 'option-2-col'; |
|
| 416 | - $key = array_search( 'option-2-col' , $custom_classes ); |
|
| 417 | - unset( $custom_classes[$key] ); |
|
| 415 | + $label_class_array[ ] = 'option-2-col'; |
|
| 416 | + $key = array_search( 'option-2-col', $custom_classes ); |
|
| 417 | + unset( $custom_classes[ $key ] ); |
|
| 418 | 418 | } // 3 column radio |
| 419 | - if( in_array( 'option-3-col' , $custom_classes ) ) { |
|
| 419 | + if ( in_array( 'option-3-col', $custom_classes ) ) { |
|
| 420 | 420 | // $label_array['class'] = 'class="option-3-col"'; |
| 421 | - $label_class_array[] = 'option-3-col'; |
|
| 422 | - $key = array_search( 'option-3-col' , $custom_classes ); |
|
| 423 | - unset( $custom_classes[$key] ); |
|
| 421 | + $label_class_array[ ] = 'option-3-col'; |
|
| 422 | + $key = array_search( 'option-3-col', $custom_classes ); |
|
| 423 | + unset( $custom_classes[ $key ] ); |
|
| 424 | 424 | } // 4 column radio |
| 425 | - if( in_array( 'option-4-col' , $custom_classes ) ) { |
|
| 425 | + if ( in_array( 'option-4-col', $custom_classes ) ) { |
|
| 426 | 426 | // $label_array['class'] = 'class="option-4-col"'; |
| 427 | - $label_class_array[] = 'option-4-col'; |
|
| 428 | - $key = array_search( 'option-4-col' , $custom_classes ); |
|
| 429 | - unset( $custom_classes[$key] ); |
|
| 427 | + $label_class_array[ ] = 'option-4-col'; |
|
| 428 | + $key = array_search( 'option-4-col', $custom_classes ); |
|
| 429 | + unset( $custom_classes[ $key ] ); |
|
| 430 | 430 | } // inline radio & checkboxes etc |
| 431 | - if( in_array( 'option-inline' , $custom_classes ) ) { |
|
| 431 | + if ( in_array( 'option-inline', $custom_classes ) ) { |
|
| 432 | 432 | // $label_array['class'] = 'class="option-inline"'; |
| 433 | - $label_class_array[] = 'option-inline'; |
|
| 434 | - $key = array_search( 'option-inline' , $custom_classes ); |
|
| 435 | - unset( $custom_classes[$key] ); |
|
| 433 | + $label_class_array[ ] = 'option-inline'; |
|
| 434 | + $key = array_search( 'option-inline', $custom_classes ); |
|
| 435 | + unset( $custom_classes[ $key ] ); |
|
| 436 | 436 | } |
| 437 | 437 | } else { |
| 438 | 438 | $custom_classes = array(); |
@@ -440,19 +440,19 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | // if the form is set to inline, add the inline class to our labels |
| 442 | 442 | // since @6.0.3.8 |
| 443 | - if( $form_inline ) { |
|
| 444 | - $label_class_array[] = 'label-inline'; |
|
| 443 | + if ( $form_inline ) { |
|
| 444 | + $label_class_array[ ] = 'label-inline'; |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - if( isset( $field['hide-label'] ) ) { |
|
| 448 | - if( absint( $field['hide-label'] ) === 1 ) { |
|
| 447 | + if ( isset( $field[ 'hide-label' ] ) ) { |
|
| 448 | + if ( absint( $field[ 'hide-label' ] ) === 1 ) { |
|
| 449 | 449 | $hidden_label_count++; |
| 450 | - $custom_classes[] = 'field-no-label'; |
|
| 450 | + $custom_classes[ ] = 'field-no-label'; |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /* Store tag variable based on field type */ |
| 455 | - if( isset( $field['merge'] ) ) { |
|
| 455 | + if ( isset( $field[ 'merge' ] ) ) { |
|
| 456 | 456 | $group = ''; |
| 457 | 457 | $tag = 'merge'; |
| 458 | 458 | } else { |
@@ -462,28 +462,28 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | // build up our array |
| 464 | 464 | $field_id_string = 'yikes-easy-mc-form-' . $form_id . '-' . $field[ $tag ]; |
| 465 | - $field_array['id'] = 'id="' . esc_attr( $field_id_string ) . '" '; |
|
| 466 | - $field_array['name'] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" '; |
|
| 467 | - $field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : ''; |
|
| 468 | - $field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' . esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" '; |
|
| 465 | + $field_array[ 'id' ] = 'id="' . esc_attr( $field_id_string ) . '" '; |
|
| 466 | + $field_array[ 'name' ] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" '; |
|
| 467 | + $field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : ''; |
|
| 468 | + $field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" '; |
|
| 469 | 469 | |
| 470 | 470 | // email must always be required and visible |
| 471 | - if( $field['type'] == 'email' ) { |
|
| 472 | - $field_array['required'] = 'required="required"'; |
|
| 473 | - $label_array['visible'] = ''; |
|
| 474 | - $label_class_array[] = $field['merge'] . '-label'; |
|
| 475 | - $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
| 471 | + if ( $field[ 'type' ] == 'email' ) { |
|
| 472 | + $field_array[ 'required' ] = 'required="required"'; |
|
| 473 | + $label_array[ 'visible' ] = ''; |
|
| 474 | + $label_class_array[ ] = $field[ 'merge' ] . '-label'; |
|
| 475 | + $label_class_array[ ] = 'yikes-mailchimp-field-required'; |
|
| 476 | 476 | } else { |
| 477 | - $field_array['required'] = isset( $field['require'] ) ? 'required="required"' : ''; |
|
| 478 | - $label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
|
| 479 | - $label_class_array[] = ( $tag === 'merge' ) ? $field['merge'] . '-label' : $field['group_id'] . '-label'; |
|
| 480 | - if ( isset( $field['require'] ) ) $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
| 477 | + $field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : ''; |
|
| 478 | + $label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : ''; |
|
| 479 | + $label_class_array[ ] = ( $tag === 'merge' ) ? $field[ 'merge' ] . '-label' : $field[ 'group_id' ] . '-label'; |
|
| 480 | + if ( isset( $field[ 'require' ] ) ) $label_class_array[ ] = 'yikes-mailchimp-field-required'; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | // if both hide label and hide field are checked, we gotta hide the field! |
| 484 | - if( isset( $field['hide' ] ) && $field['hide'] == 1 ) { |
|
| 485 | - if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) { |
|
| 486 | - $field_array['visible'] = 'style="display:none;"'; |
|
| 484 | + if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) { |
|
| 485 | + if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) { |
|
| 486 | + $field_array[ 'visible' ] = 'style="display:none;"'; |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
@@ -491,20 +491,20 @@ discard block |
||
| 491 | 491 | $label_class_array = function_exists( 'sanitize_html_class' ) ? array_map( 'sanitize_html_class', $label_class_array ) : $label_class_array; |
| 492 | 492 | |
| 493 | 493 | // Turn the clases into a string |
| 494 | - $label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . ' "'; |
|
| 494 | + $label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . ' "'; |
|
| 495 | 495 | |
| 496 | 496 | // Filter the field array data |
| 497 | 497 | $field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id ); |
| 498 | 498 | |
| 499 | 499 | /* Loop Over Standard Fields (aka merge variables) */ |
| 500 | - if( isset( $field['merge'] ) ) { |
|
| 500 | + if ( isset( $field[ 'merge' ] ) ) { |
|
| 501 | 501 | |
| 502 | 502 | // Handle the Description logic in one spot, here: |
| 503 | - $show_description = isset( $field['description'] ) && trim( $field['description'] ) !== '' ? true : false; |
|
| 504 | - $description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false; |
|
| 503 | + $show_description = isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ? true : false; |
|
| 504 | + $description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false; |
|
| 505 | 505 | if ( $show_description === true ) { |
| 506 | - $description = '<p class="form-field-description" id="form-field-description-' . $field['merge'] . '">'; |
|
| 507 | - $description .= apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
| 506 | + $description = '<p class="form-field-description" id="form-field-description-' . $field[ 'merge' ] . '">'; |
|
| 507 | + $description .= apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
| 508 | 508 | $description .= '</p>'; |
| 509 | 509 | |
| 510 | 510 | /** |
@@ -516,11 +516,11 @@ discard block |
||
| 516 | 516 | * @param string | $field['description'] | The field's description text |
| 517 | 517 | * @param int | $form_id |
| 518 | 518 | */ |
| 519 | - $description = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
| 519 | + $description = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description-html', $description, esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // loop over our fields by Type |
| 523 | - switch ( $field['type'] ) { |
|
| 523 | + switch ( $field[ 'type' ] ) { |
|
| 524 | 524 | |
| 525 | 525 | default: |
| 526 | 526 | case 'email': |
@@ -528,24 +528,24 @@ discard block |
||
| 528 | 528 | case 'number': |
| 529 | 529 | |
| 530 | 530 | // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type) |
| 531 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 531 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 532 | 532 | $default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value ); |
| 533 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 533 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 534 | 534 | |
| 535 | 535 | ?> |
| 536 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 536 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 537 | 537 | |
| 538 | 538 | <!-- dictate label visibility --> |
| 539 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 540 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 541 | - <?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?> |
|
| 539 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 540 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 541 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?> |
|
| 542 | 542 | </span> |
| 543 | 543 | <?php } ?> |
| 544 | 544 | |
| 545 | 545 | <!-- Description Above --> |
| 546 | 546 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 547 | 547 | |
| 548 | - <input <?php echo implode( ' ' , $field_array ); if( $field['type'] != 'email' && $field['type'] != 'number' ) { ?> type="text" <?php } else if( $field['type'] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 548 | + <input <?php echo implode( ' ', $field_array ); if ( $field[ 'type' ] != 'email' && $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else if ( $field[ 'type' ] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 549 | 549 | |
| 550 | 550 | <!-- Description Below --> |
| 551 | 551 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -557,23 +557,23 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | case 'url': |
| 559 | 559 | case 'imageurl': |
| 560 | - $default_value = ( isset( $field['default'] ) ) ? $field['default'] : ''; |
|
| 561 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 560 | + $default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : ''; |
|
| 561 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 562 | 562 | ?> |
| 563 | 563 | |
| 564 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 564 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 565 | 565 | |
| 566 | 566 | <!-- dictate label visibility --> |
| 567 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 568 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 569 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 567 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 568 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 569 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 570 | 570 | </span> |
| 571 | 571 | <?php } ?> |
| 572 | 572 | |
| 573 | 573 | <!-- Description Above --> |
| 574 | 574 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 575 | 575 | |
| 576 | - <input <?php echo implode( ' ' , $field_array ); ?> type="url" <?php if( $field['type'] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>" > |
|
| 576 | + <input <?php echo implode( ' ', $field_array ); ?> type="url" <?php if ( $field[ 'type' ] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>" > |
|
| 577 | 577 | |
| 578 | 578 | <!-- Description Below --> |
| 579 | 579 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -584,24 +584,24 @@ discard block |
||
| 584 | 584 | break; |
| 585 | 585 | |
| 586 | 586 | case 'phone': |
| 587 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 588 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 589 | - $phone_format = $field['phone_format']; |
|
| 587 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 588 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 589 | + $phone_format = $field[ 'phone_format' ]; |
|
| 590 | 590 | ?> |
| 591 | 591 | |
| 592 | - <label for="<?php echo esc_attr( $field_id_string ) ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 592 | + <label for="<?php echo esc_attr( $field_id_string ) ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 593 | 593 | |
| 594 | 594 | <!-- dictate label visibility --> |
| 595 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 596 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 597 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 595 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 596 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 597 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 598 | 598 | </span> |
| 599 | 599 | <?php } ?> |
| 600 | 600 | |
| 601 | 601 | <!-- Description Above --> |
| 602 | 602 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 603 | 603 | |
| 604 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?> data-phone-type="international" title="<?php _e( 'International Phone Number' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern' , '[0-9,-,+]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####' , 'yikes-inc-easy-mailchimp-extender' ); ?>" data-phone-type="us" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern' , '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 604 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?> data-phone-type="international" title="<?php _e( 'International Phone Number', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern', '[0-9,-,+]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####', 'yikes-inc-easy-mailchimp-extender' ); ?>" data-phone-type="us" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 605 | 605 | |
| 606 | 606 | <!-- Description Below --> |
| 607 | 607 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -611,23 +611,23 @@ discard block |
||
| 611 | 611 | break; |
| 612 | 612 | |
| 613 | 613 | case 'zip': |
| 614 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 615 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 614 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 615 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 616 | 616 | |
| 617 | 617 | ?> |
| 618 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 618 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 619 | 619 | |
| 620 | 620 | <!-- dictate label visibility --> |
| 621 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 622 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 623 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 621 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 622 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 623 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 624 | 624 | </span> |
| 625 | 625 | <?php } ?> |
| 626 | 626 | |
| 627 | 627 | <!-- Description Above --> |
| 628 | 628 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 629 | 629 | |
| 630 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 630 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>"> |
|
| 631 | 631 | |
| 632 | 632 | <!-- Description Below --> |
| 633 | 633 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | case 'address': |
| 641 | 641 | |
| 642 | 642 | // required fields |
| 643 | - $required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' ); |
|
| 643 | + $required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' ); |
|
| 644 | 644 | |
| 645 | 645 | /** |
| 646 | 646 | * Filter to control the default country (the option pre-selected in the country dropdown). |
@@ -656,55 +656,55 @@ discard block |
||
| 656 | 656 | if ( $show_description === true && $description_above === true ) { echo $description; } |
| 657 | 657 | |
| 658 | 658 | // Placeholder logic |
| 659 | - if ( ! empty( $field_array['placeholder'] ) ) { |
|
| 659 | + if ( ! empty( $field_array[ 'placeholder' ] ) ) { |
|
| 660 | 660 | |
| 661 | 661 | $use_address_placeholder = true; |
| 662 | 662 | |
| 663 | 663 | // Don't use the address field's array placeholder - use the custom placeholder |
| 664 | - unset( $field_array['placeholder'] ); |
|
| 664 | + unset( $field_array[ 'placeholder' ] ); |
|
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | // store number for looping |
| 668 | 668 | $x = 1; |
| 669 | - foreach( $required_fields as $type => $label ) { |
|
| 669 | + foreach ( $required_fields as $type => $label ) { |
|
| 670 | 670 | |
| 671 | 671 | // set the field names for the address fields |
| 672 | - $field_array['name'] = 'name="' . $field[$tag] . '[' . $type . ']' . '"'; |
|
| 672 | + $field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"'; |
|
| 673 | 673 | |
| 674 | 674 | // Set the placeholder value if we need to |
| 675 | 675 | $placeholder = isset( $use_address_placeholder ) ? apply_filters( 'yikes-mailchimp-address-' . $type . '-placeholder', ucwords( $label ) ) : ''; |
| 676 | 676 | |
| 677 | 677 | // reset the label classes for left-half/right-half for addresses |
| 678 | - if( isset( $label_array['class'] ) ) { |
|
| 678 | + if ( isset( $label_array[ 'class' ] ) ) { |
|
| 679 | 679 | if ( $x % 2 == 0 ) { |
| 680 | - $label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] ); |
|
| 680 | + $label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] ); |
|
| 681 | 681 | } else { |
| 682 | - $label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] ); |
|
| 682 | + $label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] ); |
|
| 683 | 683 | } |
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | // Never force addr2 to be required |
| 687 | 687 | if ( $type === 'addr2' ) { |
| 688 | - $field_array['required'] = apply_filters( 'yikes-mailchimp-address-2-required', '', $form_id ); |
|
| 688 | + $field_array[ 'required' ] = apply_filters( 'yikes-mailchimp-address-2-required', '', $form_id ); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | - switch( $type ) { |
|
| 691 | + switch ( $type ) { |
|
| 692 | 692 | |
| 693 | 693 | default: |
| 694 | 694 | case 'addr1': |
| 695 | 695 | case 'addr2': |
| 696 | 696 | case 'city': |
| 697 | 697 | ?> |
| 698 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 698 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>> |
|
| 699 | 699 | |
| 700 | 700 | <!-- dictate label visibility --> |
| 701 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 702 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 703 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
| 701 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 702 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 703 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
| 704 | 704 | </span> |
| 705 | 705 | <?php } ?> |
| 706 | 706 | |
| 707 | - <input <?php echo implode( ' ' , $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" value="<?php if( isset( $_POST[$field['merge']][$type] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']][$type] ); } ?>"> |
|
| 707 | + <input <?php echo implode( ' ', $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ][ $type ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ][ $type ] ); } ?>"> |
|
| 708 | 708 | |
| 709 | 709 | </label> |
| 710 | 710 | <?php |
@@ -713,16 +713,16 @@ discard block |
||
| 713 | 713 | |
| 714 | 714 | case 'state': |
| 715 | 715 | ?> |
| 716 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="state-dropdown"> |
|
| 716 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown"> |
|
| 717 | 717 | |
| 718 | 718 | <!-- dictate label visibility --> |
| 719 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 720 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 721 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
| 719 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 720 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 721 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
| 722 | 722 | </span> |
| 723 | 723 | <?php } ?> |
| 724 | 724 | |
| 725 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 725 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 726 | 726 | <?php |
| 727 | 727 | $state_and_province_list = file_get_contents( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-and-province-dropdown.php' ); |
| 728 | 728 | /** |
@@ -748,21 +748,21 @@ discard block |
||
| 748 | 748 | case 'zip': |
| 749 | 749 | |
| 750 | 750 | ?> |
| 751 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" placeholder="<?php echo $placeholder; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="zip-input"<?php if ( ! isset( $countries_with_zip_code_field[ $default_country ] ) ) { ?> style="display: none;"<?php } ?>> |
|
| 751 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" placeholder="<?php echo $placeholder; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! isset( $countries_with_zip_code_field[ $default_country ] ) ) { ?> style="display: none;"<?php } ?>> |
|
| 752 | 752 | |
| 753 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 754 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 755 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
| 753 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 754 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 755 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
| 756 | 756 | </span> |
| 757 | 757 | <?php } ?> |
| 758 | 758 | |
| 759 | 759 | <?php |
| 760 | 760 | // If zip lookup plugin is installed, the ZIP field comes back as an array and we need to handle it differently... |
| 761 | - if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { |
|
| 762 | - if ( is_array( $_POST[$field['merge']] ) && isset( $_POST[$field['merge']]['zip'] ) ) { |
|
| 763 | - $zip_value = $_POST[$field['merge']]['zip']; |
|
| 761 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { |
|
| 762 | + if ( is_array( $_POST[ $field[ 'merge' ] ] ) && isset( $_POST[ $field[ 'merge' ] ][ 'zip' ] ) ) { |
|
| 763 | + $zip_value = $_POST[ $field[ 'merge' ] ][ 'zip' ]; |
|
| 764 | 764 | } else { |
| 765 | - $zip_value = $_POST[$field['merge']]; |
|
| 765 | + $zip_value = $_POST[ $field[ 'merge' ] ]; |
|
| 766 | 766 | } |
| 767 | 767 | } else { |
| 768 | 768 | |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | } |
| 783 | 783 | ?> |
| 784 | 784 | |
| 785 | - <input <?php echo implode( ' ' , $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?', $form_id ); ?>" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo esc_attr( $zip_value ); ?>"> |
|
| 785 | + <input <?php echo implode( ' ', $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?', $form_id ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo esc_attr( $zip_value ); ?>"> |
|
| 786 | 786 | |
| 787 | 787 | </label> |
| 788 | 788 | <?php |
@@ -792,16 +792,16 @@ discard block |
||
| 792 | 792 | case 'country': |
| 793 | 793 | ?> |
| 794 | 794 | |
| 795 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 795 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>> |
|
| 796 | 796 | |
| 797 | 797 | <!-- dictate label visibility --> |
| 798 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 799 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 800 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?> |
|
| 798 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 799 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 800 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?> |
|
| 801 | 801 | </span> |
| 802 | 802 | <?php } ?> |
| 803 | 803 | |
| 804 | - <select <?php echo implode( ' ' , $field_array ); ?> data-country="true"> |
|
| 804 | + <select <?php echo implode( ' ', $field_array ); ?> data-country="true"> |
|
| 805 | 805 | <?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?> |
| 806 | 806 | </select> |
| 807 | 807 | </label> |
@@ -847,40 +847,40 @@ discard block |
||
| 847 | 847 | wp_register_script( 'yikes-datepicker-scripts', YIKES_MC_URL . 'public/js/yikes-datepicker-scripts.min.js', array( 'jquery-ui-datepicker' ), YIKES_MC_VERSION, false ); |
| 848 | 848 | wp_localize_script( 'yikes-datepicker-scripts', 'datepicker_settings', $datepicker_options ); |
| 849 | 849 | wp_enqueue_script( 'yikes-datepicker-scripts' ); |
| 850 | - wp_enqueue_style( 'jquery-datepicker-styles' , YIKES_MC_URL . 'public/css/jquery-ui.min.css' ); |
|
| 851 | - wp_enqueue_style( 'yikes-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-datepicker-styles.min.css' ); |
|
| 850 | + wp_enqueue_style( 'jquery-datepicker-styles', YIKES_MC_URL . 'public/css/jquery-ui.min.css' ); |
|
| 851 | + wp_enqueue_style( 'yikes-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-datepicker-styles.min.css' ); |
|
| 852 | 852 | |
| 853 | - switch ( $field['type'] ) { |
|
| 853 | + switch ( $field[ 'type' ] ) { |
|
| 854 | 854 | default: |
| 855 | 855 | case 'date': |
| 856 | - $date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yyyy'; |
|
| 856 | + $date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yyyy'; |
|
| 857 | 857 | break; |
| 858 | 858 | |
| 859 | 859 | case 'birthday': |
| 860 | - $date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd'; |
|
| 860 | + $date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd'; |
|
| 861 | 861 | break; |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 865 | - $default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id ); |
|
| 864 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 865 | + $default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id ); |
|
| 866 | 866 | |
| 867 | 867 | // store empty number for looping |
| 868 | 868 | $x = 0; |
| 869 | 869 | |
| 870 | 870 | ?> |
| 871 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 871 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 872 | 872 | |
| 873 | 873 | <!-- dictate label visibility --> |
| 874 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 875 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 876 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 874 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 875 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 876 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 877 | 877 | </span> |
| 878 | 878 | <?php } ?> |
| 879 | 879 | |
| 880 | 880 | <!-- Description Above --> |
| 881 | 881 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 882 | 882 | |
| 883 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>" data-date-format="<?php echo esc_attr( strtolower( $date_format ) ); ?>"> |
|
| 883 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>" data-date-format="<?php echo esc_attr( strtolower( $date_format ) ); ?>"> |
|
| 884 | 884 | |
| 885 | 885 | <!-- Description Below --> |
| 886 | 886 | <?php if ( $show_description === true && $description_above === false ) { echo $description; } ?> |
@@ -891,26 +891,26 @@ discard block |
||
| 891 | 891 | break; |
| 892 | 892 | |
| 893 | 893 | case 'dropdown': |
| 894 | - $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
| 895 | - $default_choice = is_array( $field['default_choice'] ) ? $field['default_choice'] : array( $field['default_choice'] ); |
|
| 894 | + $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
| 895 | + $default_choice = is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : array( $field[ 'default_choice' ] ); |
|
| 896 | 896 | |
| 897 | 897 | // store empty number for looping |
| 898 | 898 | $x = 0; |
| 899 | 899 | ?> |
| 900 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 900 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 901 | 901 | <!-- dictate label visibility --> |
| 902 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 903 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 904 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 902 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 903 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 904 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 905 | 905 | </span> |
| 906 | 906 | <?php } |
| 907 | 907 | |
| 908 | 908 | // decode for looping |
| 909 | - $choices = json_decode( $field['choices'], true ); |
|
| 909 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 910 | 910 | |
| 911 | 911 | // If the form was submitted, but failed, let's default to the chosen option |
| 912 | - if( isset( $_POST[ $field['merge'] ] ) && $form_submitted === 0 ) { |
|
| 913 | - $default_choice = is_array( $_POST[ $field['merge'] ] ) ? $_POST[ $field['merge'] ] : array( $_POST[ $field['merge'] ] ); |
|
| 912 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted === 0 ) { |
|
| 913 | + $default_choice = is_array( $_POST[ $field[ 'merge' ] ] ) ? $_POST[ $field[ 'merge' ] ] : array( $_POST[ $field[ 'merge' ] ] ); |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | ?> |
@@ -918,11 +918,11 @@ discard block |
||
| 918 | 918 | <!-- Description Above --> |
| 919 | 919 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 920 | 920 | |
| 921 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 921 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 922 | 922 | <?php |
| 923 | 923 | $no_default_name = apply_filters( 'yikes-mailchimp-dropdown-field-no-default-option-name', __( 'Select...', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); |
| 924 | 924 | echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : ''; |
| 925 | - foreach( $choices as $choice ) { ?> |
|
| 925 | + foreach ( $choices as $choice ) { ?> |
|
| 926 | 926 | <option |
| 927 | 927 | value="<?php echo esc_attr( $choice ); ?>" |
| 928 | 928 | <?php if ( $no_default !== true && in_array( $x, $default_choice ) || in_array( $choice, $default_choice, true ) ) { echo 'selected="selected"'; } ?>> |
@@ -945,17 +945,17 @@ discard block |
||
| 945 | 945 | case 'radio': |
| 946 | 946 | case 'checkbox': |
| 947 | 947 | // remove the ID (as to not assign the same ID to every radio button) |
| 948 | - unset( $field_array['id'] ); |
|
| 949 | - $choices = json_decode( $field['choices'], true ); |
|
| 948 | + unset( $field_array[ 'id' ] ); |
|
| 949 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 950 | 950 | |
| 951 | 951 | // assign a default choice |
| 952 | - $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
| 953 | - $default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? $field['default_choice'] : $choices[0]; |
|
| 952 | + $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
| 953 | + $default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? $field[ 'default_choice' ] : $choices[ 0 ]; |
|
| 954 | 954 | $default_choice = ( is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
| 955 | 955 | |
| 956 | 956 | // If the form was submitted, but failed, let's default to the chosen option |
| 957 | - if( isset( $_POST[ $field['merge'] ] ) && $form_submitted === 0 ) { |
|
| 958 | - $default_choice = is_array( $_POST[ $field['merge'] ] ) ? $_POST[ $field['merge'] ] : array( $_POST[ $field['merge'] ] ); |
|
| 957 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted === 0 ) { |
|
| 958 | + $default_choice = is_array( $_POST[ $field[ 'merge' ] ] ) ? $_POST[ $field[ 'merge' ] ] : array( $_POST[ $field[ 'merge' ] ] ); |
|
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | $count = count( $choices ); |
@@ -963,29 +963,29 @@ discard block |
||
| 963 | 963 | $x = 0; |
| 964 | 964 | |
| 965 | 965 | ?> |
| 966 | - <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 966 | + <label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 967 | 967 | |
| 968 | 968 | <!-- dictate label visibility --> |
| 969 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 970 | - <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label"> |
|
| 971 | - <?php echo esc_attr( apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label', stripslashes( $field['label'] ) ) ); ?> |
|
| 969 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 970 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label"> |
|
| 971 | + <?php echo esc_attr( apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 972 | 972 | </span> |
| 973 | 973 | <?php } |
| 974 | 974 | |
| 975 | 975 | // <!-- Description Above --> |
| 976 | 976 | if ( $show_description === true && $description_above === true ) { echo $description; } |
| 977 | 977 | |
| 978 | - foreach( $choices as $choice ) { |
|
| 978 | + foreach ( $choices as $choice ) { |
|
| 979 | 979 | ?> |
| 980 | - <label for="<?php echo esc_attr( $field['merge'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $i === $count ) { ?> last-selection<?php } ?>"> |
|
| 980 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $i === $count ) { ?> last-selection<?php } ?>"> |
|
| 981 | 981 | <input |
| 982 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 983 | - name="<?php echo esc_attr( $field['merge'] ); ?>" |
|
| 984 | - id="<?php echo esc_attr( $field['merge'] . '-' . $i ); ?>" |
|
| 982 | + type="<?php echo esc_attr( $field[ 'type' ] ); ?>" |
|
| 983 | + name="<?php echo esc_attr( $field[ 'merge' ] ); ?>" |
|
| 984 | + id="<?php echo esc_attr( $field[ 'merge' ] . '-' . $i ); ?>" |
|
| 985 | 985 | <?php if ( $no_default !== true && in_array( $x, $default_choice ) || in_array( $choice, $default_choice, true ) ) { echo 'checked="checked"'; } ?> |
| 986 | - <?php echo $field_array['required']; ?> |
|
| 986 | + <?php echo $field_array[ 'required' ]; ?> |
|
| 987 | 987 | value="<?php echo esc_attr( $choice ); ?>"> |
| 988 | - <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
| 988 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
| 989 | 989 | </label> |
| 990 | 990 | <?php |
| 991 | 991 | $i++; |
@@ -1006,11 +1006,11 @@ discard block |
||
| 1006 | 1006 | /**** Interest Groups ****/ |
| 1007 | 1007 | |
| 1008 | 1008 | // Handle the Description logic in one spot, here: |
| 1009 | - $show_description = isset( $field['description'] ) && trim( $field['description'] ) !== '' ? true : false; |
|
| 1010 | - $description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false; |
|
| 1009 | + $show_description = isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ? true : false; |
|
| 1010 | + $description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false; |
|
| 1011 | 1011 | if ( $show_description === true ) { |
| 1012 | - $description = '<p class="form-field-description" id="form-field-description-' . $field['group_id'] . '">'; |
|
| 1013 | - $description .= apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
| 1012 | + $description = '<p class="form-field-description" id="form-field-description-' . $field[ 'group_id' ] . '">'; |
|
| 1013 | + $description .= apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
| 1014 | 1014 | $description .= '</p>'; |
| 1015 | 1015 | |
| 1016 | 1016 | /** |
@@ -1022,26 +1022,26 @@ discard block |
||
| 1022 | 1022 | * @param string | $field['description'] | The field's description text |
| 1023 | 1023 | * @param int | $form_id |
| 1024 | 1024 | */ |
| 1025 | - $description = apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
|
| 1025 | + $description = apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description-html', $description, esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); |
|
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | // Get the default choice(s) from the field settings and turn them into an array if not already |
| 1029 | - $default_choice = ( isset( $field['default_choice'] ) ) ? $field['default_choice'] : ''; |
|
| 1029 | + $default_choice = ( isset( $field[ 'default_choice' ] ) ) ? $field[ 'default_choice' ] : ''; |
|
| 1030 | 1030 | $default_choice = ( is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
| 1031 | 1031 | |
| 1032 | 1032 | // get our groups |
| 1033 | - $groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array(); |
|
| 1033 | + $groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array(); |
|
| 1034 | 1034 | |
| 1035 | 1035 | $count = count( $groups ); |
| 1036 | 1036 | |
| 1037 | - if( $field['type'] === 'checkboxes' ) { |
|
| 1037 | + if ( $field[ 'type' ] === 'checkboxes' ) { |
|
| 1038 | 1038 | $type = 'checkbox'; |
| 1039 | - } else if( $field['type'] === 'radio' ) { |
|
| 1039 | + } else if ( $field[ 'type' ] === 'radio' ) { |
|
| 1040 | 1040 | $type = 'radio'; |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | // loop over the interest group field types |
| 1044 | - switch ( $field['type'] ) { |
|
| 1044 | + switch ( $field[ 'type' ] ) { |
|
| 1045 | 1045 | |
| 1046 | 1046 | case 'checkboxes': |
| 1047 | 1047 | case 'radio': |
@@ -1049,11 +1049,11 @@ discard block |
||
| 1049 | 1049 | $x = 1; // used to find the last item of our array |
| 1050 | 1050 | |
| 1051 | 1051 | ?> |
| 1052 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1053 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1052 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1053 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1054 | 1054 | <!-- dictate label visibility --> |
| 1055 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label"> |
|
| 1056 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 1055 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label"> |
|
| 1056 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 1057 | 1057 | </span> |
| 1058 | 1058 | <?php |
| 1059 | 1059 | } |
@@ -1062,8 +1062,8 @@ discard block |
||
| 1062 | 1062 | if ( $show_description === true && $description_above === true ) { echo $description; } |
| 1063 | 1063 | |
| 1064 | 1064 | // Display Submission Errors |
| 1065 | - if( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
| 1066 | - if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) { |
|
| 1065 | + if ( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
| 1066 | + if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) { |
|
| 1067 | 1067 | ?> |
| 1068 | 1068 | <p class="yikes-mailchimp-required-interest-group-error"> |
| 1069 | 1069 | <?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?> |
@@ -1075,20 +1075,20 @@ discard block |
||
| 1075 | 1075 | foreach ( $groups as $group_id => $name ) { |
| 1076 | 1076 | |
| 1077 | 1077 | // If the form was submitted and failed, set the submitted/chosen values as the default |
| 1078 | - if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) { |
|
| 1078 | + if ( isset( $_POST[ 'group-' . $field[ 'group_id' ] ] ) && $form_submitted === 0 ) { |
|
| 1079 | 1079 | |
| 1080 | 1080 | // Format default choice as array |
| 1081 | - $default_choice = ( is_array( $_POST[ 'group-' . $field['group_id'] ] ) ) ? $_POST[ 'group-' . $field['group_id'] ] : array( $_POST[ 'group-' . $field['group_id'] ] ); |
|
| 1081 | + $default_choice = ( is_array( $_POST[ 'group-' . $field[ 'group_id' ] ] ) ) ? $_POST[ 'group-' . $field[ 'group_id' ] ] : array( $_POST[ 'group-' . $field[ 'group_id' ] ] ); |
|
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | ?> |
| 1085 | - <label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>"> |
|
| 1085 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>"> |
|
| 1086 | 1086 | <input |
| 1087 | - <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { if ( $field['type'] !== 'checkboxes' ) { ?> required="required" <?php } ?> |
|
| 1087 | + <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { if ( $field[ 'type' ] !== 'checkboxes' ) { ?> required="required" <?php } ?> |
|
| 1088 | 1088 | class="yikes-interest-group-required" <?php } ?> |
| 1089 | 1089 | type="<?php echo esc_attr( $type ); ?>" |
| 1090 | - name="group-<?php echo esc_attr( $field['group_id'] ); ?>[]" |
|
| 1091 | - id="<?php echo esc_attr( $field['group_id'] . '-' . $i ); ?>" |
|
| 1090 | + name="group-<?php echo esc_attr( $field[ 'group_id' ] ); ?>[]" |
|
| 1091 | + id="<?php echo esc_attr( $field[ 'group_id' ] . '-' . $i ); ?>" |
|
| 1092 | 1092 | <?php if ( in_array( $group_id, $default_choice ) ) { echo 'checked="checked"'; } ?> |
| 1093 | 1093 | value="<?php echo esc_attr( $group_id ); ?>"> |
| 1094 | 1094 | <?php echo esc_attr( $name ); ?> |
@@ -1110,32 +1110,32 @@ discard block |
||
| 1110 | 1110 | |
| 1111 | 1111 | ?> |
| 1112 | 1112 | |
| 1113 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1113 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1114 | 1114 | <!-- dictate label visibility --> |
| 1115 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1116 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>"> |
|
| 1117 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 1115 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1116 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>"> |
|
| 1117 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 1118 | 1118 | </span> |
| 1119 | 1119 | <?php } ?> |
| 1120 | 1120 | |
| 1121 | 1121 | <!-- Description Above --> |
| 1122 | 1122 | <?php if ( $show_description === true && $description_above === true ) { echo $description; } ?> |
| 1123 | 1123 | |
| 1124 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 1124 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 1125 | 1125 | |
| 1126 | 1126 | <?php |
| 1127 | - $no_default = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default'; |
|
| 1127 | + $no_default = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default'; |
|
| 1128 | 1128 | $no_default_name = apply_filters( 'yikes-mailchimp-dropdown-ig-no-default-option-name', __( 'Select...', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); |
| 1129 | 1129 | echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : ''; |
| 1130 | 1130 | |
| 1131 | 1131 | $i = 0; |
| 1132 | - foreach( $groups as $group_id => $name ) { |
|
| 1132 | + foreach ( $groups as $group_id => $name ) { |
|
| 1133 | 1133 | |
| 1134 | 1134 | // If the form was submitted and failed, set the submitted/chosen values as the default |
| 1135 | - if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) { |
|
| 1135 | + if ( isset( $_POST[ 'group-' . $field[ 'group_id' ] ] ) && $form_submitted === 0 ) { |
|
| 1136 | 1136 | |
| 1137 | 1137 | // Format default choice as array |
| 1138 | - $default_choice = ( is_array( $_POST[ 'group-' . $field['group_id'] ] ) ) ? $_POST[ 'group-' . $field['group_id'] ] : array( $_POST[ 'group-' . $field['group_id'] ] ); |
|
| 1138 | + $default_choice = ( is_array( $_POST[ 'group-' . $field[ 'group_id' ] ] ) ) ? $_POST[ 'group-' . $field[ 'group_id' ] ] : array( $_POST[ 'group-' . $field[ 'group_id' ] ] ); |
|
| 1139 | 1139 | } |
| 1140 | 1140 | ?> |
| 1141 | 1141 | <option |
@@ -1163,12 +1163,12 @@ discard block |
||
| 1163 | 1163 | |
| 1164 | 1164 | ?> |
| 1165 | 1165 | |
| 1166 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1166 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1167 | 1167 | |
| 1168 | 1168 | <!-- dictate label visibility --> |
| 1169 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1170 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
| 1171 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 1169 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1170 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
| 1171 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 1172 | 1172 | </span> |
| 1173 | 1173 | <?php } |
| 1174 | 1174 | |
@@ -1178,17 +1178,17 @@ discard block |
||
| 1178 | 1178 | // Turn $default_choice into an array if it isn't already |
| 1179 | 1179 | $default_choice = ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice : array( $default_choice ); |
| 1180 | 1180 | |
| 1181 | - foreach( $groups as $group_id => $name ) { |
|
| 1181 | + foreach ( $groups as $group_id => $name ) { |
|
| 1182 | 1182 | ?> |
| 1183 | - <label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;"> |
|
| 1183 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;"> |
|
| 1184 | 1184 | <input |
| 1185 | 1185 | type="checkbox" |
| 1186 | - name="group-<?php echo esc_attr( $field['group_id'] ); ?>[]" |
|
| 1187 | - id="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" |
|
| 1186 | + name="group-<?php echo esc_attr( $field[ 'group_id' ] ); ?>[]" |
|
| 1187 | + id="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" |
|
| 1188 | 1188 | value="<?php echo esc_attr( $group_id ) ?>" |
| 1189 | 1189 | <?php if ( in_array( $group_id, $default_choice ) ) { echo 'checked="checked"'; } ?> |
| 1190 | 1190 | > |
| 1191 | - <?php echo esc_attr( stripslashes( str_replace( '' , '\'', $name ) ) ); ?> |
|
| 1191 | + <?php echo esc_attr( stripslashes( str_replace( '', '\'', $name ) ) ); ?> |
|
| 1192 | 1192 | </label> |
| 1193 | 1193 | <?php |
| 1194 | 1194 | $i++; |
@@ -1209,11 +1209,11 @@ discard block |
||
| 1209 | 1209 | do_action( 'yikes-mailchimp-additional-form-fields', $form_data ); |
| 1210 | 1210 | |
| 1211 | 1211 | /* if we've enabled reCAPTCHA protection */ |
| 1212 | - if( isset( $recaptcha_box ) ) { |
|
| 1212 | + if ( isset( $recaptcha_box ) ) { |
|
| 1213 | 1213 | echo $recaptcha_box; |
| 1214 | 1214 | } |
| 1215 | - if( is_user_logged_in() ) { |
|
| 1216 | - $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
| 1215 | + if ( is_user_logged_in() ) { |
|
| 1216 | + $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
| 1217 | 1217 | } else { |
| 1218 | 1218 | $admin_class = ''; |
| 1219 | 1219 | } |
@@ -1223,29 +1223,29 @@ discard block |
||
| 1223 | 1223 | <input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value=""> |
| 1224 | 1224 | |
| 1225 | 1225 | <!-- List ID --> |
| 1226 | - <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo esc_attr( $form_data['list_id'] ); ?>"> |
|
| 1226 | + <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo esc_attr( $form_data[ 'list_id' ] ); ?>"> |
|
| 1227 | 1227 | |
| 1228 | 1228 | <!-- The form that is being submitted! Used to display error/success messages above the correct form --> |
| 1229 | 1229 | <input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo esc_attr( $form_id ); ?>"> |
| 1230 | 1230 | |
| 1231 | 1231 | <!-- Submit Button --> |
| 1232 | 1232 | <?php |
| 1233 | - if( $form_inline ) { |
|
| 1233 | + if ( $form_inline ) { |
|
| 1234 | 1234 | $submit_button_label_classes = array( 'empty-label' ); |
| 1235 | 1235 | // If the number of fields, is equal to the hidden label count, add our class |
| 1236 | 1236 | // eg: All field labels are set to hidden. |
| 1237 | 1237 | if ( absint( $field_count ) === absint( $hidden_label_count ) ) { |
| 1238 | - $submit_button_label_classes[] = 'labels-hidden'; |
|
| 1238 | + $submit_button_label_classes[ ] = 'labels-hidden'; |
|
| 1239 | 1239 | } |
| 1240 | 1240 | echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '"> </span>'; |
| 1241 | 1241 | } |
| 1242 | 1242 | // display the image or text based button |
| 1243 | - if( $submit_button_type == 'text' ) { |
|
| 1244 | - echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '"> <span class="yikes-mailchimp-submit-button-span-text">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</span></button>', $form_data['id'] ); |
|
| 1243 | + if ( $submit_button_type == 'text' ) { |
|
| 1244 | + echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '"> <span class="yikes-mailchimp-submit-button-span-text">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '</span></button>', $form_data[ 'id' ] ); |
|
| 1245 | 1245 | } else { |
| 1246 | - echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">', $form_data['id'] ); |
|
| 1246 | + echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">', $form_data[ 'id' ] ); |
|
| 1247 | 1247 | } |
| 1248 | - if( $form_inline ) { |
|
| 1248 | + if ( $form_inline ) { |
|
| 1249 | 1249 | echo '</label>'; |
| 1250 | 1250 | } |
| 1251 | 1251 | ?> |
@@ -1257,8 +1257,8 @@ discard block |
||
| 1257 | 1257 | |
| 1258 | 1258 | <?php |
| 1259 | 1259 | /* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
| 1260 | - if( is_user_logged_in() ) { |
|
| 1261 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 1260 | + if ( is_user_logged_in() ) { |
|
| 1261 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 1262 | 1262 | echo $edit_form_link; |
| 1263 | 1263 | } |
| 1264 | 1264 | } |
@@ -1274,7 +1274,7 @@ discard block |
||
| 1274 | 1274 | * for non-admins |
| 1275 | 1275 | */ |
| 1276 | 1276 | if ( ! current_user_can( 'manage_options' ) ) { |
| 1277 | - $impressions = $form_data['impressions'] + 1; |
|
| 1277 | + $impressions = $form_data[ 'impressions' ] + 1; |
|
| 1278 | 1278 | $interface->update_form_field( $form_id, 'impressions', $impressions ); |
| 1279 | 1279 | } |
| 1280 | 1280 | |
@@ -250,18 +250,18 @@ discard block |
||
| 250 | 250 | $this->handle_empty_email_message = __( 'Error: The email is invalid.', 'yikes-inc-easy-mailchimp-extender' ); |
| 251 | 251 | $this->handle_non_empty_honeypot_message = __( 'Error: It looks like the honeypot was filled out and the form was not properly submitted.', 'yikes-inc-easy-mailchimp-extender' ); |
| 252 | 252 | $this->handle_disallowed_existing_user_update_message = __( 'The email you entered is already a subscriber to this list.', 'yikes-inc-easy-mailchimp-extender' ); |
| 253 | - $this->default_error_response_message = __( 'Whoops! It looks like something went wrong. Please try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 253 | + $this->default_error_response_message = __( 'Whoops! It looks like something went wrong. Please try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 254 | 254 | $this->handle_updating_existing_user_message = __( 'You\'re already subscribed. ', 'yikes-inc-easy-mailchimp-extender' ); |
| 255 | 255 | $this->handle_updating_existing_user_link_message = __( 'To update your MailChimp profile, please click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ); |
| 256 | 256 | $this->handle_empty_required_field_message = __( 'A required field is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
| 257 | 257 | $this->handle_empty_required_interest_group_message = __( 'A required interest group is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
| 258 | - $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 258 | + $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 259 | 259 | $this->handle_non_filled_recaptcha_message_message = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' ); |
| 260 | - $this->generic_recaptcha_error_message = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 260 | + $this->generic_recaptcha_error_message = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 261 | 261 | |
| 262 | 262 | // Define our success messages |
| 263 | - $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 264 | - $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 263 | + $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 264 | + $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 265 | 265 | $this->existing_subscriber_profile_update_message = __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' ); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -373,16 +373,16 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | // Check if the current iteration has a 'date_format' key set (i.e. date/birthday fields) |
| 376 | - if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) { |
|
| 377 | - $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ]['date_format'] ); |
|
| 376 | + if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) { |
|
| 377 | + $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ][ 'date_format' ] ); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | $merge_variables[ $merge_tag ] = $sanitized; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | // Do not send the email field twice |
| 384 | - if ( isset( $merge_variables['EMAIL'] ) ) { |
|
| 385 | - unset( $merge_variables['EMAIL'] ); |
|
| 384 | + if ( isset( $merge_variables[ 'EMAIL' ] ) ) { |
|
| 385 | + unset( $merge_variables[ 'EMAIL' ] ); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | if ( count( $pieces ) === 3 ) { |
| 460 | 460 | |
| 461 | 461 | // $pieces[1] = MM. $pieces[0] = DD. $date = MM/DD/YYYY |
| 462 | - $date = $pieces[1] . '/' . $pieces[0] . '/' . $pieces[2]; |
|
| 462 | + $date = $pieces[ 1 ] . '/' . $pieces[ 0 ] . '/' . $pieces[ 2 ]; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | return $date; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | if ( count( $pieces ) === 2 ) { |
| 485 | 485 | |
| 486 | 486 | // $pieces[1] = MM. $pieces[0] = DD. $birthday = MM/DD |
| 487 | - $birthday = $pieces[1] . '/' . $pieces[0]; |
|
| 487 | + $birthday = $pieces[ 1 ] . '/' . $pieces[ 0 ]; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | return $birthday; |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | // Loop through the interest groups and create a single array like {group_id} => false |
| 518 | 518 | foreach ( $interest_groupings as $group_data ) { |
| 519 | 519 | |
| 520 | - foreach ( $group_data['items'] as $item ) { |
|
| 521 | - $groups[$item['id']] = false; |
|
| 520 | + foreach ( $group_data[ 'items' ] as $item ) { |
|
| 521 | + $groups[ $item[ 'id' ] ] = false; |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | } |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
| 632 | 632 | |
| 633 | 633 | // Get the optin value |
| 634 | - $optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
| 634 | + $optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
| 635 | 635 | |
| 636 | 636 | if ( 1 === $optin ) { |
| 637 | 637 | |
@@ -661,13 +661,13 @@ discard block |
||
| 661 | 661 | |
| 662 | 662 | // Construct our success array variables |
| 663 | 663 | $return_success_array = array( |
| 664 | - 'hide' => $submission_settings['hide_form_post_signup'], |
|
| 664 | + 'hide' => $submission_settings[ 'hide_form_post_signup' ], |
|
| 665 | 665 | 'error' => 0, |
| 666 | 666 | 'response' => $response_message, |
| 667 | - 'redirection' => $redirect_array['redirection'], |
|
| 668 | - 'redirect' => $redirect_array['redirect'], |
|
| 669 | - 'new_window' => $redirect_array['new_window'], |
|
| 670 | - 'redirect_timer' => $redirect_array['redirect_timer'], |
|
| 667 | + 'redirection' => $redirect_array[ 'redirection' ], |
|
| 668 | + 'redirect' => $redirect_array[ 'redirect' ], |
|
| 669 | + 'new_window' => $redirect_array[ 'new_window' ], |
|
| 670 | + 'redirect_timer' => $redirect_array[ 'redirect_timer' ], |
|
| 671 | 671 | ); |
| 672 | 672 | |
| 673 | 673 | // Return success array |
@@ -689,12 +689,12 @@ discard block |
||
| 689 | 689 | $details = ''; |
| 690 | 690 | |
| 691 | 691 | // Loop through the error data and retrieve any fields and messages |
| 692 | - if ( isset( $error_data['data'] ) ) { |
|
| 693 | - foreach ( $error_data['data'] as $datum ) { |
|
| 694 | - if ( ! isset( $datum['field'], $datum['message'] ) ) { |
|
| 692 | + if ( isset( $error_data[ 'data' ] ) ) { |
|
| 693 | + foreach ( $error_data[ 'data' ] as $datum ) { |
|
| 694 | + if ( ! isset( $datum[ 'field' ], $datum[ 'message' ] ) ) { |
|
| 695 | 695 | continue; |
| 696 | 696 | } |
| 697 | - $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum['field'] ]['label'], $datum['message'] ); |
|
| 697 | + $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum[ 'field' ] ][ 'label' ], $datum[ 'message' ] ); |
|
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | |
@@ -737,21 +737,21 @@ discard block |
||
| 737 | 737 | $missing_fields = array(); |
| 738 | 738 | |
| 739 | 739 | // Loop through submitted form data |
| 740 | - foreach( $data as $merge_tag => $value ) { |
|
| 740 | + foreach ( $data as $merge_tag => $value ) { |
|
| 741 | 741 | |
| 742 | 742 | // Skip interest groups |
| 743 | - if ( isset( $form_fields[ $merge_tag ]['group_id'] ) ) { |
|
| 743 | + if ( isset( $form_fields[ $merge_tag ][ 'group_id' ] ) ) { |
|
| 744 | 744 | continue; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | // check if this field is required |
| 748 | - if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ]['require'] ) && $form_fields[ $merge_tag ]['require'] === '1' ) { |
|
| 748 | + if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ][ 'require' ] ) && $form_fields[ $merge_tag ][ 'require' ] === '1' ) { |
|
| 749 | 749 | |
| 750 | 750 | // Check if the field(s) are empty |
| 751 | 751 | if ( is_array( $value ) ) { |
| 752 | 752 | |
| 753 | 753 | // Loop through the data and check if any are empty |
| 754 | - foreach( $value as $field => $val ) { |
|
| 754 | + foreach ( $value as $field => $val ) { |
|
| 755 | 755 | |
| 756 | 756 | /** |
| 757 | 757 | * 'yikes-mailchimp-ignore-required-array-field' |
@@ -770,13 +770,13 @@ discard block |
||
| 770 | 770 | |
| 771 | 771 | // Set the merge label (e.g. MMERGE6) as the key so we don't get the same field multiple times |
| 772 | 772 | // (e.g. For arrays, like an address, where multiple address fields are empty) |
| 773 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
| 773 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
| 774 | 774 | } |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | } else if ( empty( $value ) ) { |
| 778 | 778 | $field_is_missing = true; |
| 779 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
| 779 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
| 780 | 780 | } |
| 781 | 781 | } |
| 782 | 782 | } |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | foreach ( $form_fields as $merge_tag => $field_data ) { |
| 827 | 827 | |
| 828 | 828 | // If an interest group and it's required |
| 829 | - if ( isset( $field_data['group_id'] ) && isset( $field_data['require'] ) && $field_data['require'] === '1' ) { |
|
| 829 | + if ( isset( $field_data[ 'group_id' ] ) && isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] === '1' ) { |
|
| 830 | 830 | |
| 831 | 831 | // Check if it was submitted (meaning, check if it's set in our $data array) |
| 832 | 832 | if ( ! isset( $data[ 'group-' . $merge_tag ] ) ) { |
@@ -888,30 +888,30 @@ discard block |
||
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | // Construct the API URL |
| 891 | - $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER['REMOTE_ADDR'] ); |
|
| 891 | + $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] ); |
|
| 892 | 892 | $response = wp_remote_get( $url ); |
| 893 | - $response_body = json_decode( $response['body'], true ); |
|
| 893 | + $response_body = json_decode( $response[ 'body' ], true ); |
|
| 894 | 894 | |
| 895 | 895 | // Set up errors array |
| 896 | 896 | $recaptcha_errors = array(); |
| 897 | 897 | |
| 898 | 898 | // if we've hit an error, lets return the error! |
| 899 | - if ( true !== $response_body['success'] ) { |
|
| 899 | + if ( true !== $response_body[ 'success' ] ) { |
|
| 900 | 900 | |
| 901 | - if( isset( $response_body['error-codes'] ) ) { |
|
| 901 | + if ( isset( $response_body[ 'error-codes' ] ) ) { |
|
| 902 | 902 | |
| 903 | 903 | // Loop through response error codes |
| 904 | - foreach ( $response_body['error-codes'] as $error_code ) { |
|
| 904 | + foreach ( $response_body[ 'error-codes' ] as $error_code ) { |
|
| 905 | 905 | if ( 'missing-input-response' === $error_code ) { |
| 906 | 906 | $error_code = $this->handle_non_filled_recaptcha_message; |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | // Add our error_code to the errors array |
| 910 | - $recaptcha_errors[] = $error_code; |
|
| 910 | + $recaptcha_errors[ ] = $error_code; |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | } else { |
| 914 | - $recaptcha_errors[] = $this->generic_recaptcha_error_message; |
|
| 914 | + $recaptcha_errors[ ] = $this->generic_recaptcha_error_message; |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | /** |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
| 1020 | 1020 | */ |
| 1021 | 1021 | public function handle_empty_fields_generic( $fields_array ) { |
| 1022 | - foreach( $fields_array as $field ) { |
|
| 1022 | + foreach ( $fields_array as $field ) { |
|
| 1023 | 1023 | if ( $field === null ) { |
| 1024 | 1024 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_fields_generic_message ); |
| 1025 | 1025 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | |
| 1086 | 1086 | // Append our 'send-update-email' link and text |
| 1087 | 1087 | $response .= $link_start_tag; |
| 1088 | - $response .= $this->handle_updating_existing_user_link_message; |
|
| 1088 | + $response .= $this->handle_updating_existing_user_link_message; |
|
| 1089 | 1089 | $response .= $link_close_tag; |
| 1090 | 1090 | |
| 1091 | 1091 | // Check for a user-defined message |
@@ -1108,14 +1108,14 @@ discard block |
||
| 1108 | 1108 | */ |
| 1109 | 1109 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
| 1110 | 1110 | |
| 1111 | - switch( $slug ) { |
|
| 1111 | + switch ( $slug ) { |
|
| 1112 | 1112 | case 'already-subscribed': |
| 1113 | 1113 | |
| 1114 | 1114 | // Check if this error message exists |
| 1115 | - if ( isset( $this->error_messages['already-subscribed'] ) && ! empty( $this->error_messages['already-subscribed'] ) ) { |
|
| 1115 | + if ( isset( $this->error_messages[ 'already-subscribed' ] ) && ! empty( $this->error_messages[ 'already-subscribed' ] ) ) { |
|
| 1116 | 1116 | |
| 1117 | 1117 | // Check if the substring (that we replace) '[email]' is located in the string and replace it |
| 1118 | - $response_text = str_replace( '[email]', $this->email, $this->error_messages['already-subscribed'] ); |
|
| 1118 | + $response_text = str_replace( '[email]', $this->email, $this->error_messages[ 'already-subscribed' ] ); |
|
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | 1121 | /** |
@@ -1134,13 +1134,13 @@ discard block |
||
| 1134 | 1134 | case 'update-link': |
| 1135 | 1135 | |
| 1136 | 1136 | // Check if this error message exists |
| 1137 | - if ( $data !== false && isset( $this->error_messages['update-link'] ) && ! empty( $this->error_messages['update-link'] ) ) { |
|
| 1137 | + if ( $data !== false && isset( $this->error_messages[ 'update-link' ] ) && ! empty( $this->error_messages[ 'update-link' ] ) ) { |
|
| 1138 | 1138 | |
| 1139 | 1139 | // Check if the substring (that we replace) '[link]' is located in the string and replace it |
| 1140 | - $response_text = str_replace( '[link]', $data['link_start_tag'], $this->error_messages['update-link'] ); |
|
| 1140 | + $response_text = str_replace( '[link]', $data[ 'link_start_tag' ], $this->error_messages[ 'update-link' ] ); |
|
| 1141 | 1141 | |
| 1142 | 1142 | // Remove [/link] |
| 1143 | - $response_text = str_replace( '[/link]', $data['link_close_tag'], $response_text ); |
|
| 1143 | + $response_text = str_replace( '[/link]', $data[ 'link_close_tag' ], $response_text ); |
|
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | /** |
@@ -1159,8 +1159,8 @@ discard block |
||
| 1159 | 1159 | case 'success': |
| 1160 | 1160 | |
| 1161 | 1161 | // 'success' is the user-defined success message for double opt-in |
| 1162 | - if ( isset( $this->error_messages['success'] ) && ! empty( $this->error_messages['success'] ) ) { |
|
| 1163 | - $response_text = $this->error_messages['success']; |
|
| 1162 | + if ( isset( $this->error_messages[ 'success' ] ) && ! empty( $this->error_messages[ 'success' ] ) ) { |
|
| 1163 | + $response_text = $this->error_messages[ 'success' ]; |
|
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | 1166 | /** |
@@ -1179,8 +1179,8 @@ discard block |
||
| 1179 | 1179 | |
| 1180 | 1180 | case 'success-single-optin': |
| 1181 | 1181 | |
| 1182 | - if ( isset( $this->error_messages['success-single-optin'] ) && ! empty( $this->error_messages['success-single-optin'] ) ) { |
|
| 1183 | - $response_text = $this->error_messages['success-single-optin']; |
|
| 1182 | + if ( isset( $this->error_messages[ 'success-single-optin' ] ) && ! empty( $this->error_messages[ 'success-single-optin' ] ) ) { |
|
| 1183 | + $response_text = $this->error_messages[ 'success-single-optin' ]; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
@@ -1199,8 +1199,8 @@ discard block |
||
| 1199 | 1199 | |
| 1200 | 1200 | case 'success-resubscribed': |
| 1201 | 1201 | |
| 1202 | - if ( isset( $this->error_messages['success-resubscribed'] ) && ! empty( $this->error_messages['success-resubscribed'] ) ) { |
|
| 1203 | - $response_text = $this->error_messages['success-resubscribed']; |
|
| 1202 | + if ( isset( $this->error_messages[ 'success-resubscribed' ] ) && ! empty( $this->error_messages[ 'success-resubscribed' ] ) ) { |
|
| 1203 | + $response_text = $this->error_messages[ 'success-resubscribed' ]; |
|
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | /** |
@@ -1222,8 +1222,8 @@ discard block |
||
| 1222 | 1222 | $original_response_text = $response_text; |
| 1223 | 1223 | $user_defined_response_text = ''; |
| 1224 | 1224 | |
| 1225 | - if ( isset( $this->error_messages['general-error'] ) && ! empty( $this->error_messages['general-error'] ) ) { |
|
| 1226 | - $user_defined_response_text = $this->error_messages['general-error']; |
|
| 1225 | + if ( isset( $this->error_messages[ 'general-error' ] ) && ! empty( $this->error_messages[ 'general-error' ] ) ) { |
|
| 1226 | + $user_defined_response_text = $this->error_messages[ 'general-error' ]; |
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | /** |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | } else { |
| 1286 | 1286 | global $process_submission_response; |
| 1287 | 1287 | |
| 1288 | - $process_submission_response = isset( $success_array['response'] ) ? $success_array['response'] : ''; // DEFAULT SUCCESS? |
|
| 1288 | + $process_submission_response = isset( $success_array[ 'response' ] ) ? $success_array[ 'response' ] : ''; // DEFAULT SUCCESS? |
|
| 1289 | 1289 | $process_submission_response = $this->wrap_form_submission_response( $process_submission_response, $is_success = true ); |
| 1290 | 1290 | } |
| 1291 | 1291 | } |
@@ -1338,8 +1338,8 @@ discard block |
||
| 1338 | 1338 | // Add additional fields we've been supplied |
| 1339 | 1339 | if ( ! empty( $additional_fields ) ) { |
| 1340 | 1340 | |
| 1341 | - foreach( $additional_fields as $key => $value ) { |
|
| 1342 | - $response_array[$key] = $value; |
|
| 1341 | + foreach ( $additional_fields as $key => $value ) { |
|
| 1342 | + $response_array[ $key ] = $value; |
|
| 1343 | 1343 | } |
| 1344 | 1344 | } |
| 1345 | 1345 | |
@@ -1370,20 +1370,20 @@ discard block |
||
| 1370 | 1370 | ); |
| 1371 | 1371 | |
| 1372 | 1372 | // Let's confirm we have a value before trying to use it |
| 1373 | - $redirect_setting = isset( $submission_settings['redirect_on_submission'] ) ? $submission_settings['redirect_on_submission'] : false; |
|
| 1373 | + $redirect_setting = isset( $submission_settings[ 'redirect_on_submission' ] ) ? $submission_settings[ 'redirect_on_submission' ] : false; |
|
| 1374 | 1374 | |
| 1375 | 1375 | // Check the redirect flag |
| 1376 | 1376 | if ( '1' === $redirect_setting ) { |
| 1377 | 1377 | |
| 1378 | 1378 | // Supply return array with default value of 1 |
| 1379 | - $redirect_array['redirection'] = 1; |
|
| 1379 | + $redirect_array[ 'redirection' ] = 1; |
|
| 1380 | 1380 | |
| 1381 | 1381 | // Let's confirm we have redirect_page/custom_redirect_url/new_window values |
| 1382 | - $redirect_page_setting = isset( $submission_settings['redirect_page'] ) ? $submission_settings['redirect_page'] : false; |
|
| 1383 | - $custom_redirect_setting = isset( $submission_settings['custom_redirect_url'] ) ? $submission_settings['custom_redirect_url'] : false; |
|
| 1384 | - $redirect_new_window = isset( $submission_settings['redirect_new_window'] ) ? $submission_settings['redirect_new_window'] : false; |
|
| 1382 | + $redirect_page_setting = isset( $submission_settings[ 'redirect_page' ] ) ? $submission_settings[ 'redirect_page' ] : false; |
|
| 1383 | + $custom_redirect_setting = isset( $submission_settings[ 'custom_redirect_url' ] ) ? $submission_settings[ 'custom_redirect_url' ] : false; |
|
| 1384 | + $redirect_new_window = isset( $submission_settings[ 'redirect_new_window' ] ) ? $submission_settings[ 'redirect_new_window' ] : false; |
|
| 1385 | 1385 | |
| 1386 | - $redirect_array['new_window'] = $redirect_new_window; |
|
| 1386 | + $redirect_array[ 'new_window' ] = $redirect_new_window; |
|
| 1387 | 1387 | |
| 1388 | 1388 | // Check if we're redirecting to a custom_url or just the redirect_page |
| 1389 | 1389 | $redirect_url = ( 'custom_url' !== $redirect_page_setting ) ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
@@ -1408,9 +1408,9 @@ discard block |
||
| 1408 | 1408 | */ |
| 1409 | 1409 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id ); |
| 1410 | 1410 | |
| 1411 | - $redirect_array['redirect_timer'] = $redirect_timer; |
|
| 1411 | + $redirect_array[ 'redirect_timer' ] = $redirect_timer; |
|
| 1412 | 1412 | |
| 1413 | - $redirect_array['redirect'] = $redirect_url; |
|
| 1413 | + $redirect_array[ 'redirect' ] = $redirect_url; |
|
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | 1416 | return $redirect_array; |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | // Prevent direct access to the file |
| 9 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 9 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 10 | 10 | |
| 11 | 11 | class Yikes_Easy_MC_bbPress_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
| 12 | 12 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function subscribe_from_bbpress( $anonymous_data, $user_id, $trigger ) { |
| 47 | 47 | $user_data = get_userdata( $user_id ); |
| 48 | - return $this->subscribe_user_integration( $user_data->user_email, $this->type , array( |
|
| 48 | + return $this->subscribe_user_integration( $user_data->user_email, $this->type, array( |
|
| 49 | 49 | 'FNAME' => $user_data->first_name, |
| 50 | 50 | 'LNAME' => $user_data->last_name, |
| 51 | 51 | ) ); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /***********************/ |
| 102 | 102 | /** Create A Form **/ |
| 103 | 103 | /**********************/ |
| 104 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-form' ) {
|
|
| 104 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-form' ) {
|
|
| 105 | 105 | |
| 106 | 106 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_form' ) ); |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | /***********************/ |
| 111 | 111 | /** Delete A Form **/ |
| 112 | 112 | /**********************/ |
| 113 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-delete-form' ) {
|
|
| 113 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-delete-form' ) {
|
|
| 114 | 114 | |
| 115 | 115 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_delete_form' ) ); |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /**********************************/ |
| 120 | 120 | /** Duplicate/Clone A Form **/ |
| 121 | 121 | /********************************/ |
| 122 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-duplicate-form' ) {
|
|
| 122 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-duplicate-form' ) {
|
|
| 123 | 123 | |
| 124 | 124 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_duplicate_form' ) ); |
| 125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | /*************************************/ |
| 129 | 129 | /** Reset Form Impression Stats **/ |
| 130 | 130 | /***********************************/ |
| 131 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-reset-stats' ) {
|
|
| 131 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-reset-stats' ) {
|
|
| 132 | 132 | |
| 133 | 133 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_reset_impression_stats' ) ); |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | /**********************************/ |
| 138 | 138 | /** Update A Form **/ |
| 139 | 139 | /********************************/ |
| 140 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-update-form' ) {
|
|
| 140 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-update-form' ) {
|
|
| 141 | 141 | |
| 142 | 142 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_update_form' ) ); |
| 143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | /**************************************************/ |
| 147 | 147 | /** Clear Store MailChimp Transient Data **/ |
| 148 | 148 | /*************************************************/ |
| 149 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-transient-data' ) {
|
|
| 149 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-transient-data' ) {
|
|
| 150 | 150 | |
| 151 | 151 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_transient_data' ) ); |
| 152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | /*******************************************/ |
| 156 | 156 | /** Remove a user from a mailing list **/ |
| 157 | 157 | /*****************************************/ |
| 158 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-unsubscribe-user' ) {
|
|
| 158 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-unsubscribe-user' ) {
|
|
| 159 | 159 | |
| 160 | 160 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_unsubscribe_user' ) ); |
| 161 | 161 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | /*******************************************/ |
| 165 | 165 | /** Create misisng error log file **/ |
| 166 | 166 | /*****************************************/ |
| 167 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-error-log' ) {
|
|
| 167 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-error-log' ) {
|
|
| 168 | 168 | |
| 169 | 169 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_missing_error_log' ) ); |
| 170 | 170 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | /**************************************************/ |
| 197 | 197 | /** Clear MailChimp Error Log Data **/ |
| 198 | 198 | /*************************************************/ |
| 199 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-error-log' ) {
|
|
| 199 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-error-log' ) {
|
|
| 200 | 200 | |
| 201 | 201 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_error_log' ) ); |
| 202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /*********************************************/ |
| 206 | 206 | /** Export MailChimp Opt-in Forms **/ |
| 207 | 207 | /*******************************************/ |
| 208 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-forms' ) {
|
|
| 208 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-forms' ) {
|
|
| 209 | 209 | |
| 210 | 210 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_forms' ) ); |
| 211 | 211 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | /*********************************************/ |
| 215 | 215 | /** Export Plugin Settings **/ |
| 216 | 216 | /*******************************************/ |
| 217 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-settings' ) {
|
|
| 217 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-settings' ) {
|
|
| 218 | 218 | |
| 219 | 219 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_plugin_settings' ) ); |
| 220 | 220 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | /*******************************************/ |
| 224 | 224 | /** Import Class Inclusion **/ |
| 225 | 225 | /*****************************************/ |
| 226 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) {
|
|
| 226 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-import-forms' ) {
|
|
| 227 | 227 | |
| 228 | 228 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_import_forms' ) ); |
| 229 | 229 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /*******************************************/ |
| 233 | 233 | /** Premium Support Request **/ |
| 234 | 234 | /*****************************************/ |
| 235 | - if ( isset( $_POST['submit-premium-support-request'] ) ) {
|
|
| 235 | + if ( isset( $_POST[ 'submit-premium-support-request' ] ) ) {
|
|
| 236 | 236 | |
| 237 | 237 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_premium_support_request' ) ); |
| 238 | 238 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /****************************************/ |
| 242 | 242 | /** Dismiss Options Migrations **/ |
| 243 | 243 | /****************************************/ |
| 244 | - if ( isset( $_REQUEST['dismiss_migration_nonce'] ) ) {
|
|
| 244 | + if ( isset( $_REQUEST[ 'dismiss_migration_nonce' ] ) ) {
|
|
| 245 | 245 | |
| 246 | 246 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_dismiss_option_migrate' ) ); |
| 247 | 247 | |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | * @ return array $links New array of plugin actions |
| 278 | 278 | */ |
| 279 | 279 | public function easy_forms_plugin_action_links( $links ) {
|
| 280 | - $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=yikes-inc-easy-mailchimp-settings') ) .'">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 281 | - $links[] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES, Inc.', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 280 | + $links[ ] = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) . '">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 281 | + $links[ ] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES, Inc.', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 282 | 282 | return $links; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -379,17 +379,17 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | public function yikes_easy_mailchimp_export_forms() {
|
| 381 | 381 | // grab our nonce. |
| 382 | - $nonce = $_REQUEST['nonce']; |
|
| 382 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 383 | 383 | // grab the forms. |
| 384 | - $forms = isset( $_REQUEST['export_forms'] ) ? $_REQUEST['export_forms'] : array(); |
|
| 384 | + $forms = isset( $_REQUEST[ 'export_forms' ] ) ? $_REQUEST[ 'export_forms' ] : array(); |
|
| 385 | 385 | // validate nonce. |
| 386 | 386 | if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) {
|
| 387 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 387 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // run the export function. |
| 391 | 391 | // parameters: ( $table_name, $form_ids, $file_name ). |
| 392 | - Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export('Yikes-Inc-Easy-MailChimp-Forms-Export', $forms );
|
|
| 392 | + Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export( 'Yikes-Inc-Easy-MailChimp-Forms-Export', $forms ); |
|
| 393 | 393 | // re-direct the user back to the page. |
| 394 | 394 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); |
| 395 | 395 | die(); |
@@ -403,10 +403,10 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public function yikes_easy_mailchimp_export_plugin_settings() {
|
| 405 | 405 | // grab our nonce |
| 406 | - $nonce = $_REQUEST['nonce']; |
|
| 406 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 407 | 407 | // validate nonce. |
| 408 | 408 | if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) {
|
| 409 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 409 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // run the export function. |
@@ -423,10 +423,10 @@ discard block |
||
| 423 | 423 | */ |
| 424 | 424 | public function yikes_easy_mailchimp_import_forms() {
|
| 425 | 425 | // grab our nonce. |
| 426 | - $nonce = $_REQUEST['nonce']; |
|
| 426 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 427 | 427 | // validate nonce. |
| 428 | 428 | if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) {
|
| 429 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 429 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 430 | 430 | } |
| 431 | 431 | // include the export class. |
| 432 | 432 | if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) {
|
@@ -447,18 +447,18 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function yikes_easy_mailchimp_premium_support_request() {
|
| 449 | 449 | |
| 450 | - if ( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) {
|
|
| 450 | + if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] != 'yikes-support-request' ) {
|
|
| 451 | 451 | return __( 'We encountered an error. Please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - $email = isset( $_POST['user-email'] ) ? $_POST['user-email'] : ''; |
|
| 455 | - $topic = isset( $_POST['support-topic'] ) ? $_POST['support-topic'] : ''; |
|
| 456 | - $issue = isset( $_POST['support-content'] ) ? $_POST['support-content'] : ''; |
|
| 457 | - $priority = isset( $_POST['support-priority'] ) ? $_POST['support-priority'] : 1; |
|
| 458 | - $license = isset( $_POST['license_key'] ) ? $_POST['license_key'] : ''; |
|
| 459 | - $plugin_name = isset( $_POST['plugin-name'] ) ? $_POST['plugin-name'] : ''; |
|
| 460 | - $plugin_slug = isset( $_POST['plugin-slug'] ) ? $_POST['plugin-slug'] : ''; |
|
| 461 | - $name = isset( $_POST['user-name'] ) ? $_POST['user-name'] : 'MailChimp Support'; |
|
| 454 | + $email = isset( $_POST[ 'user-email' ] ) ? $_POST[ 'user-email' ] : ''; |
|
| 455 | + $topic = isset( $_POST[ 'support-topic' ] ) ? $_POST[ 'support-topic' ] : ''; |
|
| 456 | + $issue = isset( $_POST[ 'support-content' ] ) ? $_POST[ 'support-content' ] : ''; |
|
| 457 | + $priority = isset( $_POST[ 'support-priority' ] ) ? $_POST[ 'support-priority' ] : 1; |
|
| 458 | + $license = isset( $_POST[ 'license_key' ] ) ? $_POST[ 'license_key' ] : ''; |
|
| 459 | + $plugin_name = isset( $_POST[ 'plugin-name' ] ) ? $_POST[ 'plugin-name' ] : ''; |
|
| 460 | + $plugin_slug = isset( $_POST[ 'plugin-slug' ] ) ? $_POST[ 'plugin-slug' ] : ''; |
|
| 461 | + $name = isset( $_POST[ 'user-name' ] ) ? $_POST[ 'user-name' ] : 'MailChimp Support'; |
|
| 462 | 462 | |
| 463 | 463 | $edd_item_id = $this->get_premium_license( $plugin_slug ); |
| 464 | 464 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | public function get_premium_license( $plugin_slug ) {
|
| 495 | 495 | |
| 496 | - switch( $plugin_slug ) {
|
|
| 496 | + switch ( $plugin_slug ) {
|
|
| 497 | 497 | |
| 498 | 498 | case 'form-customizer': |
| 499 | 499 | return defined( 'YIKES_CUSTOMIZER_EDD_ITEM_ID' ) ? YIKES_CUSTOMIZER_EDD_ITEM_ID : ''; |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | // add a new option to store the plugin activation date/time. |
| 554 | 554 | // @since v6.0.0. |
| 555 | 555 | // this is used to notify the user that they should review after 2 weeks. |
| 556 | - if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) {
|
|
| 556 | + if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) ) {
|
|
| 557 | 557 | add_option( 'yikes_easy_mailchimp_activation_date', strtotime( "now" ) ); |
| 558 | 558 | } |
| 559 | 559 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | $install_date = get_option( 'yikes_easy_mailchimp_activation_date' ); |
| 564 | 564 | $past_date = strtotime( '-14 days' ); |
| 565 | 565 | if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) {
|
| 566 | - add_action( 'admin_notices', array( $this , 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
| 566 | + add_action( 'admin_notices', array( $this, 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
@@ -576,13 +576,13 @@ discard block |
||
| 576 | 576 | */ |
| 577 | 577 | public function yikes_easy_mailchimp_display_review_us_notice() {
|
| 578 | 578 | /* Lets only display our admin notice on YT4WP pages to not annoy the hell out of people :) */ |
| 579 | - if ( in_array( get_current_screen()->base , array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) {
|
|
| 579 | + if ( in_array( get_current_screen()->base, array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base, 'yikes-inc-easy-mailchimp' ) !== false ) {
|
|
| 580 | 580 | |
| 581 | 581 | // The URL of the page the user is currently on |
| 582 | - $current_uri = isset( $_SERVER['REQUEST_URI'] ) && ! empty( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : false; |
|
| 583 | - $current_host = isset( $_SERVER['HTTP_HOST'] ) && ! empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : false; |
|
| 582 | + $current_uri = isset( $_SERVER[ 'REQUEST_URI' ] ) && ! empty( $_SERVER[ 'REQUEST_URI' ] ) ? $_SERVER[ 'REQUEST_URI' ] : false; |
|
| 583 | + $current_host = isset( $_SERVER[ 'HTTP_HOST' ] ) && ! empty( $_SERVER[ 'HTTP_HOST' ] ) ? $_SERVER[ 'HTTP_HOST' ] : false; |
|
| 584 | 584 | $current_protocol = is_ssl() === true ? 'https://' : 'http://'; |
| 585 | - $current_url = ( $current_uri !== false && $current_host !== false ) ? $current_protocol . $current_host . $current_uri : admin_url(); |
|
| 585 | + $current_url = ( $current_uri !== false && $current_host !== false ) ? $current_protocol . $current_host . $current_uri : admin_url(); |
|
| 586 | 586 | |
| 587 | 587 | $plugin_name = '<strong>Easy Forms for MailChimp</strong>'; |
| 588 | 588 | // Review URL - Change to the URL of your plugin on WordPress.org. |
@@ -593,17 +593,17 @@ discard block |
||
| 593 | 593 | // Make sure all of our variables have values. |
| 594 | 594 | $reviewurl = ( ! empty( $reviewurl ) ) ? $reviewurl : ''; |
| 595 | 595 | $addons_url = ( ! empty( $addons_url ) ) ? $addons_url : ''; |
| 596 | - $nobugurl = ( ! empty( $nobugurl ) ) ? $nobugurl : ''; |
|
| 596 | + $nobugurl = ( ! empty( $nobugurl ) ) ? $nobugurl : ''; |
|
| 597 | 597 | |
| 598 | 598 | $review_message = '<div id="yikes-mailchimp-logo"></div>'; |
| 599 | 599 | $review_message .= sprintf( |
| 600 | 600 | __( 'It looks like you\'ve been using %1$s for 2 weeks now. We hope you\'re enjoying the features included with the free version. If so, please consider leaving us a review. Reviews only help to catch other users attention as well as provide us with feedback to grow and improve upon. If you\'re really enjoying the plugin, consider buying an add-on or developer license for some really awesome features and premium support.', 'yikes-inc-easy-mailchimp-extender' ) |
| 601 | 601 | . '<span class="button-container"> <a href="%2$s" target="_blank" class="button-secondary"><span class="dashicons dashicons-star-filled"></span>' |
| 602 | - . __( "Leave A Review" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 602 | + . __( "Leave A Review", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 603 | 603 | . '</a> <a href="%3$s" class="button-secondary"><span class="dashicons dashicons-upload"></span>' |
| 604 | - . __( "View Addons" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 604 | + . __( "View Addons", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 605 | 605 | . '</a> <a href="%4$s" class="button-secondary"><span class="dashicons dashicons-no-alt"></span>' |
| 606 | - . __( "Dismiss" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 606 | + . __( "Dismiss", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 607 | 607 | . "</a> </span>", |
| 608 | 608 | $plugin_name, $reviewurl, $addons_url, $nobugurl ); |
| 609 | 609 | ?> |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | @since v3.1.1 |
| 621 | 621 | */ |
| 622 | 622 | public function yikes_easy_mailchimp_stop_bugging_me() {
|
| 623 | - if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) && (int) filter_var( $_GET['yikes_easy_mc_icons_nobug'], FILTER_SANITIZE_NUMBER_INT ) === 1 ) {
|
|
| 623 | + if ( isset( $_GET[ 'yikes_easy_mc_icons_nobug' ] ) && (int) filter_var( $_GET[ 'yikes_easy_mc_icons_nobug' ], FILTER_SANITIZE_NUMBER_INT ) === 1 ) {
|
|
| 624 | 624 | add_option( 'yikes_easy_mailchimp_review_stop_bugging_me', true ); |
| 625 | 625 | } |
| 626 | 626 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | // inlcude the js for tinymce. |
| 659 | 659 | public function yks_mc_add_tinymce_plugin( $plugin_array ) {
|
| 660 | 660 | |
| 661 | - $plugin_array['yks_mc_tinymce_button'] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
| 661 | + $plugin_array[ 'yks_mc_tinymce_button' ] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
| 662 | 662 | |
| 663 | 663 | return $plugin_array; |
| 664 | 664 | } |
@@ -679,13 +679,13 @@ discard block |
||
| 679 | 679 | if ( ! empty( $list_data ) ) {
|
| 680 | 680 | // build an array to pass to our javascript. |
| 681 | 681 | foreach ( $list_data as $id => $form ) {
|
| 682 | - $lists[] = array( |
|
| 683 | - 'text' => urlencode( $form['form_name'] ), |
|
| 682 | + $lists[ ] = array( |
|
| 683 | + 'text' => urlencode( $form[ 'form_name' ] ), |
|
| 684 | 684 | 'value' => $id, |
| 685 | 685 | ); |
| 686 | 686 | } |
| 687 | 687 | } else {
|
| 688 | - $lists[0] = array( |
|
| 688 | + $lists[ 0 ] = array( |
|
| 689 | 689 | 'text' => __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ), |
| 690 | 690 | 'value' => '-', |
| 691 | 691 | ); |
@@ -773,8 +773,8 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | wp_enqueue_style( 'wp-color-picker' ); |
| 775 | 775 | wp_enqueue_script( 'wp-color-picker' ); |
| 776 | - wp_enqueue_script( 'jquery.timepicker.js',YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js', array( 'jquery' ) , $this->version, false ); |
|
| 777 | - wp_enqueue_script( 'edit-form-js', YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js', array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ) , $this->version, false ); |
|
| 776 | + wp_enqueue_script( 'jquery.timepicker.js', YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js', array( 'jquery' ), $this->version, false ); |
|
| 777 | + wp_enqueue_script( 'edit-form-js', YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js', array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ), $this->version, false ); |
|
| 778 | 778 | |
| 779 | 779 | $localized_data = array( |
| 780 | 780 | 'ajax_url' => esc_url_raw( admin_url( 'admin-ajax.php' ) ), |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | * Convert the php date format string to a js date format |
| 869 | 869 | */ |
| 870 | 870 | public function yikes_jQuery_datepicker_date_format( $site_option ) {
|
| 871 | - switch( $site_option ) {
|
|
| 871 | + switch ( $site_option ) {
|
|
| 872 | 872 | //Predefined WP date formats |
| 873 | 873 | default: |
| 874 | 874 | case 'F j, Y': |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | |
| 1081 | 1081 | /* Register General Settings Section */ |
| 1082 | 1082 | |
| 1083 | - register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this , 'yikes_mc_validate_api_key' ) ); |
|
| 1083 | + register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this, 'yikes_mc_validate_api_key' ) ); |
|
| 1084 | 1084 | |
| 1085 | 1085 | register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mailchimp-use-nonce' ); |
| 1086 | 1086 | |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | add_settings_field( |
| 1126 | 1126 | 'optin-checkbox-init', |
| 1127 | 1127 | __( 'Select Checkboxes to Generate', 'yikes-inc-easy-mailchimp-extender' ), |
| 1128 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1128 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1129 | 1129 | 'yikes_inc_easy_mc_checkbox_settings' |
| 1130 | 1130 | ); |
| 1131 | 1131 | /* End Checkbox Settings */ |
@@ -1147,21 +1147,21 @@ discard block |
||
| 1147 | 1147 | add_settings_field( |
| 1148 | 1148 | 'yikes-mc-recaptcha-site-key', |
| 1149 | 1149 | __( 'Enter reCAPTCHA Site Key', 'yikes-inc-easy-mailchimp-extender' ), |
| 1150 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1150 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1151 | 1151 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1152 | 1152 | ); |
| 1153 | 1153 | |
| 1154 | 1154 | add_settings_field( |
| 1155 | 1155 | 'yikes-mc-recaptcha-secret-key', |
| 1156 | 1156 | __( 'Enter reCAPTCHA Secret Key', 'yikes-inc-easy-mailchimp-extender' ), |
| 1157 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1157 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1158 | 1158 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1159 | 1159 | ); |
| 1160 | 1160 | |
| 1161 | 1161 | add_settings_field( |
| 1162 | 1162 | 'yikes-mc-recaptcha-status', |
| 1163 | 1163 | __( 'Enable ReCaptcha', 'yikes-inc-easy-mailchimp-extender' ), |
| 1164 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1164 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1165 | 1165 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1166 | 1166 | ); |
| 1167 | 1167 | |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | add_settings_field( |
| 1182 | 1182 | 'yikes-mailchimp-debug-status', |
| 1183 | 1183 | __( 'Enable Debugging', 'yikes-inc-easy-mailchimp-extender' ), |
| 1184 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1184 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1185 | 1185 | 'yikes_easy_mc_settings_debug_section' |
| 1186 | 1186 | ); |
| 1187 | 1187 | |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1202 | 1202 | return ''; |
| 1203 | 1203 | } |
| 1204 | - $api_key = strip_tags ( trim( $input ) ); |
|
| 1204 | + $api_key = strip_tags( trim( $input ) ); |
|
| 1205 | 1205 | $dash_position = strpos( trim( $input ), '-' ); |
| 1206 | 1206 | if ( $dash_position !== false ) {
|
| 1207 | 1207 | $manager = new Yikes_Inc_Easy_MailChimp_API_Manager( $api_key ); |
@@ -1216,9 +1216,9 @@ discard block |
||
| 1216 | 1216 | update_option( 'yikes-mc-api-validation', 'valid_api_key' ); |
| 1217 | 1217 | // Clear the API key transient data |
| 1218 | 1218 | $this->delete_yikes_mailchimp_transients(); |
| 1219 | - } else {
|
|
| 1219 | + } else {
|
|
| 1220 | 1220 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 1221 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message() , __( "Connecting to MailChimp" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Settings Page/General Settings" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1221 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message(), __( "Connecting to MailChimp", 'yikes-inc-easy-mailchimp-extender' ), __( "Settings Page/General Settings", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1222 | 1222 | update_option( 'yikes-mc-api-invalid-key-response', $response->get_error_message() ); |
| 1223 | 1223 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1224 | 1224 | } |
@@ -1267,11 +1267,11 @@ discard block |
||
| 1267 | 1267 | public function check_for_old_yks_mc_options() {
|
| 1268 | 1268 | $old_plugin_options = get_option( 'ykseme_storage' ); |
| 1269 | 1269 | // only perform options migrations if the site is not a multi-site setup |
| 1270 | - if ( !is_multisite() ) {
|
|
| 1270 | + if ( ! is_multisite() ) {
|
|
| 1271 | 1271 | if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) {
|
| 1272 | 1272 | // display a notice to the user that they should 'migrate' |
| 1273 | 1273 | // from the old plugin settings to the new ones |
| 1274 | - add_action( 'admin_notices', array( $this , 'display_options_migrate_notice' ) , 11 ); |
|
| 1274 | + add_action( 'admin_notices', array( $this, 'display_options_migrate_notice' ), 11 ); |
|
| 1275 | 1275 | } |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
@@ -1304,11 +1304,11 @@ discard block |
||
| 1304 | 1304 | |
| 1305 | 1305 | // Confirm that the necessary forms table in the database exists, else bail |
| 1306 | 1306 | global $wpdb; |
| 1307 | - if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) {
|
|
| 1307 | + if ( $wpdb->get_var( "show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'" ) != $wpdb->prefix . "yikes_easy_mc_forms" ) {
|
|
| 1308 | 1308 | return; |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | - if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) {
|
|
| 1311 | + if ( isset( $_GET[ 'yikes-mc-options-migration-dismissed' ] ) && $_GET[ 'yikes-mc-options-migration-dismissed' ] == 'true' ) {
|
|
| 1312 | 1312 | // Delete the options, start a-new! (this will disable the migration notice altogether) |
| 1313 | 1313 | delete_option( 'widget_yikes_mc_widget' ); |
| 1314 | 1314 | delete_option( 'api_validation' ); |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | } else {
|
| 1323 | 1323 | ?> |
| 1324 | 1324 | <div class="yikes-easy-mc-updated migrate-options-notice"> |
| 1325 | - <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list." , 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?></p> |
|
| 1325 | + <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?></p> |
|
| 1326 | 1326 | <p><?php _e( "Before you continue, it's strongly recommended you the perform the migration to ensure the plugin continues to function properly.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
| 1327 | 1327 | <p><em><?php _e( "It's also strongly recommended that you take a backup of your database.", 'yikes-inc-easy-mailchimp-extender' ); ?></em></p> |
| 1328 | 1328 | <section id="migration-buttons"> |
@@ -1347,9 +1347,9 @@ discard block |
||
| 1347 | 1347 | * and return the index ( used to find the list name assigned to a form ) |
| 1348 | 1348 | * - http://stackoverflow.com/questions/6661530/php-multi-dimensional-array-search |
| 1349 | 1349 | */ |
| 1350 | - function findMCListID($id, $array) {
|
|
| 1351 | - foreach ($array as $key => $val) {
|
|
| 1352 | - if ($val['id'] === $id) {
|
|
| 1350 | + function findMCListID( $id, $array ) {
|
|
| 1351 | + foreach ( $array as $key => $val ) {
|
|
| 1352 | + if ( $val[ 'id' ] === $id ) {
|
|
| 1353 | 1353 | return $key; |
| 1354 | 1354 | } |
| 1355 | 1355 | } |
@@ -1359,8 +1359,8 @@ discard block |
||
| 1359 | 1359 | /* Ajax Migrate Options */ |
| 1360 | 1360 | function migrate_archived_options() {
|
| 1361 | 1361 | // all options prefixed with 'yikes-mc-' |
| 1362 | - $option_name = 'yikes-mc-'.$_POST['option_name']; |
|
| 1363 | - $option_value = $_POST['option_value']; |
|
| 1362 | + $option_name = 'yikes-mc-' . $_POST[ 'option_name' ]; |
|
| 1363 | + $option_value = $_POST[ 'option_value' ]; |
|
| 1364 | 1364 | if ( json_decode( $option_value ) ) {
|
| 1365 | 1365 | // decode our lists() array, and store it |
| 1366 | 1366 | $opt_value = json_decode( $option_value, true ); |
@@ -1374,22 +1374,22 @@ discard block |
||
| 1374 | 1374 | |
| 1375 | 1375 | /* Ajax Migrate Forms */ |
| 1376 | 1376 | function migrate_previously_setup_forms() {
|
| 1377 | - $option_name = $_POST['option_name']; |
|
| 1378 | - $done = $_POST['done_import']; |
|
| 1377 | + $option_name = $_POST[ 'option_name' ]; |
|
| 1378 | + $done = $_POST[ 'done_import' ]; |
|
| 1379 | 1379 | // Create some starter forms for the user |
| 1380 | 1380 | // based on previously imported lists (to our old version) |
| 1381 | 1381 | if ( $option_name == 'yikes-mc-lists' ) {
|
| 1382 | - $option_value = $_POST['option_value']; |
|
| 1383 | - $new_options = json_decode( stripslashes_deep( $option_value ) , true ); |
|
| 1382 | + $option_value = $_POST[ 'option_value' ]; |
|
| 1383 | + $new_options = json_decode( stripslashes_deep( $option_value ), true ); |
|
| 1384 | 1384 | |
| 1385 | - $list_id = $new_options['id']; |
|
| 1386 | - $form_name = $new_options['name']; |
|
| 1387 | - $fields = $new_options['fields']; // our fields array |
|
| 1385 | + $list_id = $new_options[ 'id' ]; |
|
| 1386 | + $form_name = $new_options[ 'name' ]; |
|
| 1387 | + $fields = $new_options[ 'fields' ]; // our fields array |
|
| 1388 | 1388 | |
| 1389 | - $custom_styles = isset( $new_options['custom_styles'] ) ? $new_options['custom_styles']: '0'; // store as an array with all of our styles |
|
| 1390 | - $custom_template = isset( $new_options['custom_template'] ) ? $new_options['custom_template'] : '0'; // store template data as an array ( active , template used ) |
|
| 1391 | - $redirect_user_on_submit = isset( $new_options['yks_mailchimp_redirect_'.$list_id] ) ? '1' : '0'; |
|
| 1392 | - $redirect_page = isset( $new_options['page_id_'.$list_id] ) ? $new_options['page_id_'.$list_id] : ''; |
|
| 1389 | + $custom_styles = isset( $new_options[ 'custom_styles' ] ) ? $new_options[ 'custom_styles' ] : '0'; // store as an array with all of our styles |
|
| 1390 | + $custom_template = isset( $new_options[ 'custom_template' ] ) ? $new_options[ 'custom_template' ] : '0'; // store template data as an array ( active , template used ) |
|
| 1391 | + $redirect_user_on_submit = isset( $new_options[ 'yks_mailchimp_redirect_' . $list_id ] ) ? '1' : '0'; |
|
| 1392 | + $redirect_page = isset( $new_options[ 'page_id_' . $list_id ] ) ? $new_options[ 'page_id_' . $list_id ] : ''; |
|
| 1393 | 1393 | |
| 1394 | 1394 | /* Insert Forms Function */ |
| 1395 | 1395 | $this->form_interface->create_form( array( |
@@ -1425,8 +1425,8 @@ discard block |
||
| 1425 | 1425 | * @since v5.6 - complete re-write |
| 1426 | 1426 | */ |
| 1427 | 1427 | public function generate_options_pages_sidebar_menu() {
|
| 1428 | - if ( isset( $_REQUEST['section'] ) ) {
|
|
| 1429 | - $selected = $_REQUEST['section']; |
|
| 1428 | + if ( isset( $_REQUEST[ 'section' ] ) ) {
|
|
| 1429 | + $selected = $_REQUEST[ 'section' ]; |
|
| 1430 | 1430 | } |
| 1431 | 1431 | $installed_addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
| 1432 | 1432 | |
@@ -1443,25 +1443,25 @@ discard block |
||
| 1443 | 1443 | <h3><span><?php _e( 'Additional Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
| 1444 | 1444 | <div class="inside"> |
| 1445 | 1445 | <ul id="settings-nav"> |
| 1446 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'general-settings' || !isset( $_REQUEST['section'] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1447 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1448 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1449 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1450 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1451 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1446 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'general-settings' || ! isset( $_REQUEST[ 'section' ] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1447 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1448 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1449 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1450 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1451 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1452 | 1452 | </ul> |
| 1453 | 1453 | <?php |
| 1454 | 1454 | // create our add-on settings pages |
| 1455 | - if ( !empty( $installed_addons ) ) {
|
|
| 1455 | + if ( ! empty( $installed_addons ) ) {
|
|
| 1456 | 1456 | ?> |
| 1457 | 1457 | <hr class="add-on-settings-divider" /> |
| 1458 | 1458 | <strong><?php _e( 'Addon Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 1459 | 1459 | <ul id="addon-settings-nav"> |
| 1460 | 1460 | <?php |
| 1461 | - foreach( $installed_addons as $addon_name ) {
|
|
| 1461 | + foreach ( $installed_addons as $addon_name ) {
|
|
| 1462 | 1462 | ?> |
| 1463 | 1463 | <li> |
| 1464 | - <?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion='.$addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
|
|
| 1464 | + <?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=' . $addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
|
|
| 1465 | 1465 | <?php |
| 1466 | 1466 | } |
| 1467 | 1467 | ?> |
@@ -1510,19 +1510,19 @@ discard block |
||
| 1510 | 1510 | <select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); disabled( true, empty( $lists ) ); ?>> |
| 1511 | 1511 | <?php |
| 1512 | 1512 | if ( ! empty( $lists ) ) {
|
| 1513 | - foreach( $lists as $mailing_list ) {
|
|
| 1513 | + foreach ( $lists as $mailing_list ) {
|
|
| 1514 | 1514 | ?> |
| 1515 | - <option value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option>
|
|
| 1515 | + <option value="<?php echo $mailing_list[ 'id' ]; ?>"><?php echo stripslashes( $mailing_list[ 'name' ] ) . ' (' . $mailing_list[ 'stats' ][ 'member_count' ] . ') '; ?></option>
|
|
| 1516 | 1516 | <?php |
| 1517 | 1517 | } |
| 1518 | 1518 | } else {
|
| 1519 | 1519 | if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
| 1520 | 1520 | ?> |
| 1521 | - <option><?php echo __( "Please enter a valid API key." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1521 | + <option><?php echo __( "Please enter a valid API key.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1522 | 1522 | <?php |
| 1523 | 1523 | } else {
|
| 1524 | 1524 | ?> |
| 1525 | - <option><?php echo __( "No lists were found on the account." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1525 | + <option><?php echo __( "No lists were found on the account.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1526 | 1526 | <?php |
| 1527 | 1527 | |
| 1528 | 1528 | } |
@@ -1531,8 +1531,8 @@ discard block |
||
| 1531 | 1531 | </select> |
| 1532 | 1532 | |
| 1533 | 1533 | <?php |
| 1534 | - if ( isset( $_GET['transient-cleared'] ) ) {
|
|
| 1535 | - if ( 'true' === $_GET['transient-cleared'] ) {
|
|
| 1534 | + if ( isset( $_GET[ 'transient-cleared' ] ) ) {
|
|
| 1535 | + if ( 'true' === $_GET[ 'transient-cleared' ] ) {
|
|
| 1536 | 1536 | ?> |
| 1537 | 1537 | <div class="yikes-list-refreshed-notice"> |
| 1538 | 1538 | <p><?php esc_attr_e( 'MailChimp list data has been succesfully refreshed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -1545,7 +1545,7 @@ discard block |
||
| 1545 | 1545 | if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) {
|
| 1546 | 1546 | ?> |
| 1547 | 1547 | <p class="description"> |
| 1548 | - <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ) , __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
| 1548 | + <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ), __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
| 1549 | 1549 | </p> |
| 1550 | 1550 | <?php |
| 1551 | 1551 | } |
@@ -1554,9 +1554,9 @@ discard block |
||
| 1554 | 1554 | </label> |
| 1555 | 1555 | <?php |
| 1556 | 1556 | if ( $this->is_user_mc_api_valid_form( false ) ) {
|
| 1557 | - echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ) , 'primary', '', false , array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
| 1557 | + echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ), 'primary', '', false, array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
| 1558 | 1558 | } else {
|
| 1559 | - echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 1559 | + echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 1560 | 1560 | ?> |
| 1561 | 1561 | <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
| 1562 | 1562 | <?php |
@@ -1586,7 +1586,7 @@ discard block |
||
| 1586 | 1586 | $post_types = get_post_types(); |
| 1587 | 1587 | ?> |
| 1588 | 1588 | <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if ( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>">
|
| 1589 | - <?php _e( "Select A Page or Post" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1589 | + <?php _e( "Select A Page or Post", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1590 | 1590 | <select id="redirect-user-to-selection" name="redirect-user-to-selection" onchange="shouldWeDisplayCustomURL( this );return;"> |
| 1591 | 1591 | <?php |
| 1592 | 1592 | |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | $excluded_post_types = apply_filters( 'yikes-mailchimp-excluded-redirect-post-types', $excluded_post_types ); |
| 1603 | 1603 | |
| 1604 | 1604 | // loop over registered post types, and query! |
| 1605 | - foreach( $post_types as $registered_post_type ) {
|
|
| 1605 | + foreach ( $post_types as $registered_post_type ) {
|
|
| 1606 | 1606 | |
| 1607 | 1607 | // exclude a few built in custom post types and any defined by the filter |
| 1608 | 1608 | if ( ! in_array( $registered_post_type, $excluded_post_types ) ) {
|
@@ -1624,8 +1624,8 @@ discard block |
||
| 1624 | 1624 | ?> |
| 1625 | 1625 | <optgroup label="<?php echo ucwords( str_replace( '_', ' ', $registered_post_type ) ); ?>"> |
| 1626 | 1626 | <?php |
| 1627 | - foreach( $post_ids as $post_id ) {
|
|
| 1628 | - ?><option <?php selected( $redirect_page , $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php |
|
| 1627 | + foreach ( $post_ids as $post_id ) {
|
|
| 1628 | + ?><option <?php selected( $redirect_page, $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php |
|
| 1629 | 1629 | } |
| 1630 | 1630 | ?> |
| 1631 | 1631 | </optgroup> |
@@ -1641,7 +1641,7 @@ discard block |
||
| 1641 | 1641 | </select> |
| 1642 | 1642 | |
| 1643 | 1643 | <label name="custom-redirect-url" class="custom_redirect_url_label" <?php if ( ! isset( $redirect_page ) || $redirect_page != 'custom_url' ) { echo 'style="display:none;"'; } ?>>
|
| 1644 | - <?php _e( "Enter Custom URL" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1644 | + <?php _e( "Enter Custom URL", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1645 | 1645 | <input type="text" class="widefat custom-redirect-url" name="custom-redirect-url" value="<?php echo $custom_redirect_url; ?>" /> |
| 1646 | 1646 | </label> |
| 1647 | 1647 | |
@@ -1706,7 +1706,7 @@ discard block |
||
| 1706 | 1706 | </p> |
| 1707 | 1707 | </div> |
| 1708 | 1708 | |
| 1709 | - <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s" , 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
| 1709 | + <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s", 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
| 1710 | 1710 | |
| 1711 | 1711 | <section id="about-yikes-inc" class="inside"> |
| 1712 | 1712 | <a href="https://www.yikesinc.com" target="_blank" title="YIKES Inc."> |
@@ -1724,7 +1724,7 @@ discard block |
||
| 1724 | 1724 | <!-- review us container --> |
| 1725 | 1725 | <h3><?php _e( 'Easy Forms for MailChimp Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
| 1726 | 1726 | <div id="review-yikes-easy-mc" class="inside"> |
| 1727 | - <p><?php _e( "Check out available add-ons for some seriously enhanced features." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1727 | + <p><?php _e( "Check out available add-ons for some seriously enhanced features.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1728 | 1728 | <p><a class="button-secondary" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); ?>" title="<?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
| 1729 | 1729 | </div> |
| 1730 | 1730 | |
@@ -1751,11 +1751,11 @@ discard block |
||
| 1751 | 1751 | |
| 1752 | 1752 | // if no list id, die! |
| 1753 | 1753 | if ( ! $list_id ) {
|
| 1754 | - wp_die( __( "We've encountered an error. No list ID was sent." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1754 | + wp_die( __( "We've encountered an error. No list ID was sent.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1755 | 1755 | } |
| 1756 | 1756 | |
| 1757 | 1757 | if ( ! $merge_variables ) {
|
| 1758 | - wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1758 | + wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1759 | 1759 | } |
| 1760 | 1760 | |
| 1761 | 1761 | if ( ! empty( $form_fields ) ) {
|
@@ -1766,17 +1766,17 @@ discard block |
||
| 1766 | 1766 | $available_interest_groups = array(); |
| 1767 | 1767 | |
| 1768 | 1768 | // Default variables as arrays - these are used for holding the MailChimp merge field ID |
| 1769 | - $merge_field_ids = array(); |
|
| 1770 | - $mailchimp_merge_field_ids = array(); |
|
| 1769 | + $merge_field_ids = array(); |
|
| 1770 | + $mailchimp_merge_field_ids = array(); |
|
| 1771 | 1771 | |
| 1772 | 1772 | // loop over merge variables |
| 1773 | - if ( ! empty( $merge_variables['merge_fields'] ) ) {
|
|
| 1774 | - $available_merge_variables = wp_list_pluck( $merge_variables['merge_fields'], 'tag' ); |
|
| 1775 | - $mailchimp_merge_field_ids = wp_list_pluck( $merge_variables['merge_fields'], 'merge_id' ); |
|
| 1773 | + if ( ! empty( $merge_variables[ 'merge_fields' ] ) ) {
|
|
| 1774 | + $available_merge_variables = wp_list_pluck( $merge_variables[ 'merge_fields' ], 'tag' ); |
|
| 1775 | + $mailchimp_merge_field_ids = wp_list_pluck( $merge_variables[ 'merge_fields' ], 'merge_id' ); |
|
| 1776 | 1776 | |
| 1777 | 1777 | // Array will look like $merge_tag => $merge_id |
| 1778 | - foreach( $available_merge_variables as $index => $merge_tag ) {
|
|
| 1779 | - $merge_field_ids[$merge_tag] = $mailchimp_merge_field_ids[$index]; |
|
| 1778 | + foreach ( $available_merge_variables as $index => $merge_tag ) {
|
|
| 1779 | + $merge_field_ids[ $merge_tag ] = $mailchimp_merge_field_ids[ $index ]; |
|
| 1780 | 1780 | } |
| 1781 | 1781 | } |
| 1782 | 1782 | |
@@ -1791,46 +1791,46 @@ discard block |
||
| 1791 | 1791 | $excluded_fields = array_diff( $assigned_fields, $merged_fields ); |
| 1792 | 1792 | |
| 1793 | 1793 | $i = 1; |
| 1794 | - foreach( $form_fields as $field ) {
|
|
| 1794 | + foreach ( $form_fields as $field ) {
|
|
| 1795 | 1795 | |
| 1796 | - if ( isset( $field['merge'] ) ) {
|
|
| 1796 | + if ( isset( $field[ 'merge' ] ) ) {
|
|
| 1797 | 1797 | // @todo: don't use in_array() |
| 1798 | - $excluded_field = in_array( $field['merge'], $excluded_fields, true ); |
|
| 1798 | + $excluded_field = in_array( $field[ 'merge' ], $excluded_fields, true ); |
|
| 1799 | 1799 | ?> |
| 1800 | - <section class="draggable" id="<?php echo $field['merge']; ?>"> |
|
| 1800 | + <section class="draggable" id="<?php echo $field[ 'merge' ]; ?>"> |
|
| 1801 | 1801 | <!-- top --> |
| 1802 | 1802 | <a class="expansion-section-title settings-sidebar"> |
| 1803 | 1803 | <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span> |
| 1804 | - <span class="yikes-mc-expansion-section-field-label"> <?php echo stripslashes( $field['label'] ); ?> </span> |
|
| 1804 | + <span class="yikes-mc-expansion-section-field-label"> <?php echo stripslashes( $field[ 'label' ] ); ?> </span> |
|
| 1805 | 1805 | <?php if ( $excluded_field ) { ?>
|
| 1806 | 1806 | <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-doesnt-exist-notice" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
| 1807 | 1807 | <?php } ?> |
| 1808 | - <input maxlength="50" type="text" class="yikes-mc-edit-field-label-input" value="<?php echo stripslashes( $field['label'] ); ?>" /> |
|
| 1808 | + <input maxlength="50" type="text" class="yikes-mc-edit-field-label-input" value="<?php echo stripslashes( $field[ 'label' ] ); ?>" /> |
|
| 1809 | 1809 | <span class="dashicons dashicons-yes yikes-mc-save-field-label-edits-icon" title="<?php _e( 'Click to save changes.', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
| 1810 | 1810 | <span class="dashicons dashicons-edit yikes-mc-edit-field-label-icon" title="<?php _e( 'Click to edit the label', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
| 1811 | 1811 | <span class="yikes-mc-edit-field-label-message"></span> |
| 1812 | - <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
| 1812 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
| 1813 | 1813 | </a> |
| 1814 | 1814 | <!-- expansion section --> |
| 1815 | 1815 | <div class="yikes-mc-settings-expansion-section"> |
| 1816 | 1816 | |
| 1817 | 1817 | <?php if ( $excluded_field ) { ?>
|
| 1818 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1818 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1819 | 1819 | <?php } ?> |
| 1820 | 1820 | |
| 1821 | 1821 | <!-- store field data --> |
| 1822 | - <input type="hidden" class="yikes-mc-merge-field-label" name="field[<?php echo $field['merge']; ?>][label]" value="<?php echo htmlspecialchars( $field['label'] ); ?>" /> |
|
| 1823 | - <input type="hidden" class="yikes-mc-merge-field-type" name="field[<?php echo $field['merge']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
| 1824 | - <input type="hidden" class="yikes-mc-merge-field-tag" name="field[<?php echo $field['merge']; ?>][merge]" value="<?php echo $field['merge']; ?>" /> |
|
| 1825 | - <input type="hidden" class="field-<?php echo $field['merge']; ?>-position position-input" name="field[<?php echo $field['merge']; ?>][position]" value="<?php echo $i++; ?>" /> |
|
| 1826 | - <?php if ( isset( $merge_field_ids[ $field['merge'] ] ) && is_int( $merge_field_ids[ $field['merge'] ] ) ) { ?>
|
|
| 1827 | - <input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field['merge']; ?>][id]" value="<?php echo $merge_field_ids[ $field['merge'] ] ?>" /> |
|
| 1822 | + <input type="hidden" class="yikes-mc-merge-field-label" name="field[<?php echo $field[ 'merge' ]; ?>][label]" value="<?php echo htmlspecialchars( $field[ 'label' ] ); ?>" /> |
|
| 1823 | + <input type="hidden" class="yikes-mc-merge-field-type" name="field[<?php echo $field[ 'merge' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
| 1824 | + <input type="hidden" class="yikes-mc-merge-field-tag" name="field[<?php echo $field[ 'merge' ]; ?>][merge]" value="<?php echo $field[ 'merge' ]; ?>" /> |
|
| 1825 | + <input type="hidden" class="field-<?php echo $field[ 'merge' ]; ?>-position position-input" name="field[<?php echo $field[ 'merge' ]; ?>][position]" value="<?php echo $i++; ?>" /> |
|
| 1826 | + <?php if ( isset( $merge_field_ids[ $field[ 'merge' ] ] ) && is_int( $merge_field_ids[ $field[ 'merge' ] ] ) ) { ?>
|
|
| 1827 | + <input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field[ 'merge' ]; ?>][id]" value="<?php echo $merge_field_ids[ $field[ 'merge' ] ] ?>" /> |
|
| 1828 | 1828 | <?php } ?> |
| 1829 | 1829 | |
| 1830 | - <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
|
|
| 1831 | - $choices = json_decode( $field['choices'], true ); |
|
| 1830 | + <?php if ( $field[ 'type' ] == 'radio' || $field[ 'type' ] == 'dropdown' || $field[ 'type' ] == 'select' ) {
|
|
| 1831 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 1832 | 1832 | ?> |
| 1833 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
| 1833 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
| 1834 | 1834 | <?php } ?> |
| 1835 | 1835 | |
| 1836 | 1836 | <!-- Single or Double Opt-in --> |
@@ -1846,12 +1846,12 @@ discard block |
||
| 1846 | 1846 | </label> |
| 1847 | 1847 | </td> |
| 1848 | 1848 | <td> |
| 1849 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field['merge']; ?>"> |
|
| 1849 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field[ 'merge' ]; ?>"> |
|
| 1850 | 1850 | </td> |
| 1851 | 1851 | </tr> |
| 1852 | 1852 | |
| 1853 | 1853 | <!-- Placeholder Value --> |
| 1854 | - <?php switch( $field['type'] ) {
|
|
| 1854 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 1855 | 1855 | |
| 1856 | 1856 | case 'text': |
| 1857 | 1857 | case 'email': |
@@ -1865,13 +1865,13 @@ discard block |
||
| 1865 | 1865 | <!-- Placeholder --> |
| 1866 | 1866 | <tr valign="top"> |
| 1867 | 1867 | <td scope="row"> |
| 1868 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1868 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1869 | 1869 | <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1870 | 1870 | </label> |
| 1871 | 1871 | </td> |
| 1872 | 1872 | <td> |
| 1873 | - <input type="text" id="placeholder_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="<?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : '' ; ?>" /> |
|
| 1874 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1873 | + <input type="text" id="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="<?php echo isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : ''; ?>" /> |
|
| 1874 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1875 | 1875 | </td> |
| 1876 | 1876 | </tr> |
| 1877 | 1877 | <?php |
@@ -1882,13 +1882,13 @@ discard block |
||
| 1882 | 1882 | ?> |
| 1883 | 1883 | <tr valign="top"> |
| 1884 | 1884 | <td scope="row"> |
| 1885 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1885 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1886 | 1886 | <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1887 | 1887 | </label> |
| 1888 | 1888 | </td> |
| 1889 | 1889 | <td> |
| 1890 | - <input type="checkbox" id="placeholder_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="1" <?php echo isset( $field['placeholder'] ) && ! empty( $field['placeholder'] ) ? 'checked="checked"' : '' ; ?> /> |
|
| 1891 | - <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 1890 | + <input type="checkbox" id="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="1" <?php echo isset( $field[ 'placeholder' ] ) && ! empty( $field[ 'placeholder' ] ) ? 'checked="checked"' : ''; ?> /> |
|
| 1891 | + <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 1892 | 1892 | </td> |
| 1893 | 1893 | </tr> |
| 1894 | 1894 | <?php |
@@ -1898,7 +1898,7 @@ discard block |
||
| 1898 | 1898 | ?> |
| 1899 | 1899 | |
| 1900 | 1900 | <!-- Default Value --> |
| 1901 | - <?php switch( $field['type'] ) {
|
|
| 1901 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 1902 | 1902 | default: |
| 1903 | 1903 | case 'text': |
| 1904 | 1904 | case 'number': |
@@ -1906,15 +1906,15 @@ discard block |
||
| 1906 | 1906 | ?> |
| 1907 | 1907 | <tr valign="top"> |
| 1908 | 1908 | <td scope="row"> |
| 1909 | - <label for="default_value_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1909 | + <label for="default_value_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1910 | 1910 | <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1911 | 1911 | </label> |
| 1912 | 1912 | </td> |
| 1913 | 1913 | <td> |
| 1914 | - <input id="default_value_<?php echo esc_attr( $field['merge'] ); ?>" <?php if ( $field['type'] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field['merge']; ?>][default]" <?php if ( $field['type'] != 'url' ) { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( $field['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field['default'] ) ) ) : ''; ?>" <?php } ?> />
|
|
| 1915 | - <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1914 | + <input id="default_value_<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php if ( $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][default]" <?php if ( $field[ 'type' ] != 'url' ) { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'default' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field[ 'default' ] ) ) ) : ''; ?>" <?php } ?> />
|
|
| 1915 | + <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1916 | 1916 | <?php |
| 1917 | - switch( $field['type'] ) {
|
|
| 1917 | + switch ( $field[ 'type' ] ) {
|
|
| 1918 | 1918 | case 'text': |
| 1919 | 1919 | ?> |
| 1920 | 1920 | <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
@@ -1936,28 +1936,28 @@ discard block |
||
| 1936 | 1936 | </td> |
| 1937 | 1937 | <td> |
| 1938 | 1938 | <?php |
| 1939 | - $field['default_choice'] = ! isset( $field['default_choice'] ) ? 'no-default' : $field['default_choice']; |
|
| 1939 | + $field[ 'default_choice' ] = ! isset( $field[ 'default_choice' ] ) ? 'no-default' : $field[ 'default_choice' ]; |
|
| 1940 | 1940 | $x = 0; |
| 1941 | 1941 | ?> |
| 1942 | - <label for="<?php echo $field['merge'] . '-no-default'; ?>"> |
|
| 1943 | - <input id="<?php echo $field['merge'] . '-no-default'; ?>" |
|
| 1942 | + <label for="<?php echo $field[ 'merge' ] . '-no-default'; ?>"> |
|
| 1943 | + <input id="<?php echo $field[ 'merge' ] . '-no-default'; ?>" |
|
| 1944 | 1944 | type="radio" |
| 1945 | - name="field[<?php echo $field['merge']; ?>][default_choice]" |
|
| 1946 | - value="no-default" <?php checked( $field['default_choice'], 'no-default' ); ?> |
|
| 1945 | + name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]" |
|
| 1946 | + value="no-default" <?php checked( $field[ 'default_choice' ], 'no-default' ); ?> |
|
| 1947 | 1947 | > |
| 1948 | 1948 | No Default |
| 1949 | 1949 | </label> |
| 1950 | 1950 | <?php |
| 1951 | 1951 | foreach ( $choices as $choice => $value ) { ?>
|
| 1952 | - <label for="<?php echo $field['merge'].'-'.$x; ?>"> |
|
| 1953 | - <input id="<?php echo $field['merge'].'-'.$x; ?>" |
|
| 1952 | + <label for="<?php echo $field[ 'merge' ] . '-' . $x; ?>"> |
|
| 1953 | + <input id="<?php echo $field[ 'merge' ] . '-' . $x; ?>" |
|
| 1954 | 1954 | type="radio" |
| 1955 | - name="field[<?php echo $field['merge']; ?>][default_choice]" |
|
| 1956 | - value="<?php echo $x; ?>" <?php checked( $field['default_choice'], $x ); ?>> |
|
| 1955 | + name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]" |
|
| 1956 | + value="<?php echo $x; ?>" <?php checked( $field[ 'default_choice' ], $x ); ?>> |
|
| 1957 | 1957 | <?php echo $value; ?> |
| 1958 | 1958 | </label> |
| 1959 | 1959 | <?php $x++; } ?> |
| 1960 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1960 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1961 | 1961 | </td> |
| 1962 | 1962 | </tr> |
| 1963 | 1963 | |
@@ -1973,13 +1973,13 @@ discard block |
||
| 1973 | 1973 | </label> |
| 1974 | 1974 | </td> |
| 1975 | 1975 | <td> |
| 1976 | - <select type="default" name="field[<?php echo $field['merge']; ?>][default_choice]"> |
|
| 1977 | - <option value="no-default" <?php selected( $field['default_choice'] , 'no-default' ); ?>>No Default</option> |
|
| 1978 | - <?php foreach( json_decode( $field['choices'], true ) as $choice => $value ) { ?>
|
|
| 1979 | - <option value="<?php echo $choice; ?>" <?php selected( $field['default_choice'] , $choice ); ?>><?php echo $value; ?></option> |
|
| 1976 | + <select type="default" name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]"> |
|
| 1977 | + <option value="no-default" <?php selected( $field[ 'default_choice' ], 'no-default' ); ?>>No Default</option> |
|
| 1978 | + <?php foreach ( json_decode( $field[ 'choices' ], true ) as $choice => $value ) { ?>
|
|
| 1979 | + <option value="<?php echo $choice; ?>" <?php selected( $field[ 'default_choice' ], $choice ); ?>><?php echo $value; ?></option> |
|
| 1980 | 1980 | <?php } ?> |
| 1981 | 1981 | </select> |
| 1982 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1982 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1983 | 1983 | </td> |
| 1984 | 1984 | </tr> |
| 1985 | 1985 | |
@@ -1996,82 +1996,82 @@ discard block |
||
| 1996 | 1996 | <!-- Field Description --> |
| 1997 | 1997 | <tr valign="top"> |
| 1998 | 1998 | <td scope="row"> |
| 1999 | - <label for="description_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1999 | + <label for="description_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2000 | 2000 | <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2001 | 2001 | </label> |
| 2002 | 2002 | </td> |
| 2003 | 2003 | <td> |
| 2004 | - <textarea class="widefat field-description-input" id="description_<?php echo esc_attr( $field['merge'] ); ?>" name="field[<?php echo $field['merge']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
| 2005 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2004 | + <textarea class="widefat field-description-input" id="description_<?php echo esc_attr( $field[ 'merge' ] ); ?>" name="field[<?php echo $field[ 'merge' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
| 2005 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2006 | 2006 | </td> |
| 2007 | 2007 | </tr> |
| 2008 | 2008 | <!-- Description Above Field --> |
| 2009 | 2009 | <tr valign="top"> |
| 2010 | 2010 | <td scope="row"> |
| 2011 | - <label for="description_above_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2011 | + <label for="description_above_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2012 | 2012 | <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2013 | 2013 | </label> |
| 2014 | 2014 | </td> |
| 2015 | 2015 | <td> |
| 2016 | - <input type="checkbox" id="description_above_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat field-description-input" name="field[<?php echo $field['merge']; ?>][description_above]" value="1" <?php echo isset( $field['description_above'] ) && $field['description_above'] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2017 | - <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 2016 | + <input type="checkbox" id="description_above_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'merge' ]; ?>][description_above]" value="1" <?php echo isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2017 | + <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 2018 | 2018 | </td> |
| 2019 | 2019 | </tr> |
| 2020 | 2020 | <!-- Additional Classes --> |
| 2021 | 2021 | <tr valign="top"> |
| 2022 | 2022 | <td scope="row"> |
| 2023 | - <label for="classes_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2023 | + <label for="classes_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2024 | 2024 | <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2025 | 2025 | </label> |
| 2026 | 2026 | </td> |
| 2027 | 2027 | <td> |
| 2028 | - <input type="text" id="classes_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
| 2029 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
| 2028 | + <input type="text" id="classes_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
| 2029 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
| 2030 | 2030 | </td> |
| 2031 | 2031 | </tr> |
| 2032 | 2032 | <!-- Required Toggle --> |
| 2033 | 2033 | <tr valign="top" class="yikes-checkbox-container yikes-checkbox-container-first"> |
| 2034 | 2034 | <td scope="row"> |
| 2035 | - <label for="field-required-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2035 | + <label for="field-required-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2036 | 2036 | <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2037 | 2037 | </label> |
| 2038 | 2038 | </td> |
| 2039 | 2039 | <td> |
| 2040 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
| 2041 | - <input id="field-required-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][require]" <?php checked( $checked , 1 ); ?> <?php if ( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2042 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2040 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
| 2041 | + <input id="field-required-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][require]" <?php checked( $checked, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2042 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2043 | 2043 | </td> |
| 2044 | 2044 | </tr> |
| 2045 | 2045 | <!-- Visible Toggle --> |
| 2046 | 2046 | <tr valign="top" class="yikes-checkbox-container"> |
| 2047 | 2047 | <td scope="row"> |
| 2048 | - <label for="hide-field-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2048 | + <label for="hide-field-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2049 | 2049 | <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2050 | 2050 | </label> |
| 2051 | 2051 | </td> |
| 2052 | 2052 | <td> |
| 2053 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
| 2054 | - <input id="hide-field-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][hide]" <?php checked( $hide , 1 ); ?> <?php if ( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2055 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2053 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
| 2054 | + <input id="hide-field-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][hide]" <?php checked( $hide, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2055 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2056 | 2056 | </td> |
| 2057 | 2057 | </tr> |
| 2058 | 2058 | <!-- Toggle Field Label Visibility --> |
| 2059 | 2059 | <tr valign="top" class="yikes-checkbox-container"> |
| 2060 | 2060 | <td scope="row"> |
| 2061 | - <label for="hide-label-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2061 | + <label for="hide-label-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2062 | 2062 | <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2063 | 2063 | </label> |
| 2064 | 2064 | </td> |
| 2065 | 2065 | <td> |
| 2066 | - <?php $hide_label = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
| 2067 | - <input id="hide-label-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" name="field[<?php echo $field['merge']; ?>][hide-label]" value="1" <?php checked( $hide_label , 1 ); ?>/> |
|
| 2068 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2066 | + <?php $hide_label = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
| 2067 | + <input id="hide-label-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" name="field[<?php echo $field[ 'merge' ]; ?>][hide-label]" value="1" <?php checked( $hide_label, 1 ); ?>/> |
|
| 2068 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2069 | 2069 | </td> |
| 2070 | 2070 | </tr> |
| 2071 | 2071 | <!-- Display Phone/Date Formats back to the user --> |
| 2072 | 2072 | <!-- Phone Format Initial Load --> |
| 2073 | 2073 | <?php |
| 2074 | - switch( $field['type'] ) {
|
|
| 2074 | + switch ( $field[ 'type' ] ) {
|
|
| 2075 | 2075 | /* Store the phone format, for properly regex pattern */ |
| 2076 | 2076 | case 'phone': |
| 2077 | 2077 | case 'birthday': |
@@ -2081,23 +2081,23 @@ discard block |
||
| 2081 | 2081 | <td scope="row"> |
| 2082 | 2082 | <label for="placeholder"> |
| 2083 | 2083 | <?php |
| 2084 | - switch( $field['type'] ) {
|
|
| 2084 | + switch ( $field[ 'type' ] ) {
|
|
| 2085 | 2085 | default: |
| 2086 | 2086 | case 'birthday': |
| 2087 | 2087 | $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2088 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD'; |
|
| 2088 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD'; |
|
| 2089 | 2089 | $format_name = 'date_format'; |
| 2090 | 2090 | break; |
| 2091 | 2091 | |
| 2092 | 2092 | case 'date': |
| 2093 | 2093 | $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2094 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD/YYYY'; |
|
| 2094 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD/YYYY'; |
|
| 2095 | 2095 | $format_name = 'date_format'; |
| 2096 | 2096 | break; |
| 2097 | 2097 | |
| 2098 | 2098 | case 'phone': |
| 2099 | 2099 | $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2100 | - $format = isset( $field['phone_format'] ) && ! empty( $field['phone_format'] ) ? $field['phone_format'] : __( 'International', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2100 | + $format = isset( $field[ 'phone_format' ] ) && ! empty( $field[ 'phone_format' ] ) ? $field[ 'phone_format' ] : __( 'International', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2101 | 2101 | $format_name = 'phone_format'; |
| 2102 | 2102 | break; |
| 2103 | 2103 | } |
@@ -2107,7 +2107,7 @@ discard block |
||
| 2107 | 2107 | </td> |
| 2108 | 2108 | <td> |
| 2109 | 2109 | <strong><?php echo $format; ?></strong> |
| 2110 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 2110 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 2111 | 2111 | <p class="description"><small> |
| 2112 | 2112 | <?php printf( __( 'To change the %s please head over to <a href="%s" title="MailChimp" target="_blank">MailChimp</a>. If you alter the format, you should re-import this field.', 'yikes-inc-easy-mailchimp-extender' ), strtolower( $type ), esc_url( 'http://www.mailchimp.com' ) ); ?> |
| 2113 | 2113 | </small></p> |
@@ -2128,8 +2128,8 @@ discard block |
||
| 2128 | 2128 | </td> |
| 2129 | 2129 | <td> |
| 2130 | 2130 | <span class="toggle-container"> |
| 2131 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2132 | - <a href="#" class="remove-field" alt="<?php echo $field['merge']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2131 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2132 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'merge' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2133 | 2133 | </span> |
| 2134 | 2134 | </td> |
| 2135 | 2135 | </tr> |
@@ -2147,35 +2147,35 @@ discard block |
||
| 2147 | 2147 | /**** Interest Group ****/ |
| 2148 | 2148 | |
| 2149 | 2149 | ?> |
| 2150 | - <section class="draggable" id="<?php echo $field['group_id']; ?>"> |
|
| 2150 | + <section class="draggable" id="<?php echo $field[ 'group_id' ]; ?>"> |
|
| 2151 | 2151 | <!-- top --> |
| 2152 | 2152 | <a href="#" class="expansion-section-title settings-sidebar"> |
| 2153 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php echo stripslashes( $field['label'] ); ?> |
|
| 2154 | - <?php if ( in_array( $field['group_id'] , $excluded_fields ) ) { ?>
|
|
| 2153 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php echo stripslashes( $field[ 'label' ] ); ?> |
|
| 2154 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?>
|
|
| 2155 | 2155 | <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-no-longer-exists-warning" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
| 2156 | 2156 | <?php } ?> |
| 2157 | - <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
| 2157 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
| 2158 | 2158 | </a> |
| 2159 | 2159 | <!-- expansion section --> |
| 2160 | 2160 | <div class="yikes-mc-settings-expansion-section"> |
| 2161 | 2161 | |
| 2162 | 2162 | <!-- check if this field exists in the available interest group array --> |
| 2163 | - <?php if ( in_array( $field['group_id'] , $excluded_fields ) ) { ?>
|
|
| 2164 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 2163 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?>
|
|
| 2164 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 2165 | 2165 | <?php } ?> |
| 2166 | 2166 | |
| 2167 | 2167 | <!-- store the label --> |
| 2168 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][label]" value="<?php echo htmlspecialchars( $field['label'] ); ?>" /> |
|
| 2169 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
| 2170 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][group_id]" value="<?php echo $field['group_id']; ?>" /> |
|
| 2171 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field['groups'], true ) ) ); ?>' /> |
|
| 2168 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][label]" value="<?php echo htmlspecialchars( $field[ 'label' ] ); ?>" /> |
|
| 2169 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
| 2170 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][group_id]" value="<?php echo $field[ 'group_id' ]; ?>" /> |
|
| 2171 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field[ 'groups' ], true ) ) ); ?>' /> |
|
| 2172 | 2172 | |
| 2173 | 2173 | <!-- Single or Double Opt-in --> |
| 2174 | 2174 | <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); --> |
| 2175 | 2175 | |
| 2176 | 2176 | <table class="form-table form-field-container"> |
| 2177 | 2177 | <!-- Default Value --> |
| 2178 | - <?php switch( $field['type'] ) {
|
|
| 2178 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 2179 | 2179 | default: |
| 2180 | 2180 | case 'radio': |
| 2181 | 2181 | case 'checkboxes': |
@@ -2188,15 +2188,15 @@ discard block |
||
| 2188 | 2188 | </td> |
| 2189 | 2189 | <td> |
| 2190 | 2190 | <?php |
| 2191 | - $field['default_choice'] = isset( $field['default_choice'] ) ? $field['default_choice'] : ''; |
|
| 2191 | + $field[ 'default_choice' ] = isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : ''; |
|
| 2192 | 2192 | |
| 2193 | 2193 | $default_shown = false; |
| 2194 | 2194 | |
| 2195 | - foreach ( json_decode( $field['groups'], true ) as $id => $group ) {
|
|
| 2196 | - $field_id = "{$field['group_id']}-{$id}";
|
|
| 2197 | - $field_type = 'hidden' == $field['type'] ? 'checkbox' : $field['type']; |
|
| 2195 | + foreach ( json_decode( $field[ 'groups' ], true ) as $id => $group ) {
|
|
| 2196 | + $field_id = "{$field[ 'group_id' ]}-{$id}";
|
|
| 2197 | + $field_type = 'hidden' == $field[ 'type' ] ? 'checkbox' : $field[ 'type' ]; |
|
| 2198 | 2198 | $field_type = 'checkboxes' == $field_type ? 'checkbox' : $field_type; |
| 2199 | - $field_name = "field[{$field['group_id']}][default_choice]";
|
|
| 2199 | + $field_name = "field[{$field[ 'group_id' ]}][default_choice]";
|
|
| 2200 | 2200 | $field_name = 'checkbox' == $field_type ? $field_name . '[]' : $field_name; |
| 2201 | 2201 | |
| 2202 | 2202 | // Determine if the current group is checked. |
@@ -2204,12 +2204,12 @@ discard block |
||
| 2204 | 2204 | switch ( $field_type ) {
|
| 2205 | 2205 | case 'radio': |
| 2206 | 2206 | default: |
| 2207 | - $checked = checked( $field['default_choice'], $id, false ); |
|
| 2207 | + $checked = checked( $field[ 'default_choice' ], $id, false ); |
|
| 2208 | 2208 | break; |
| 2209 | 2209 | |
| 2210 | 2210 | case 'checkbox': |
| 2211 | 2211 | case 'hidden': |
| 2212 | - if ( is_array( $field['default_choice'] ) && in_array( $id, $field['default_choice'] ) ) {
|
|
| 2212 | + if ( is_array( $field[ 'default_choice' ] ) && in_array( $id, $field[ 'default_choice' ] ) ) {
|
|
| 2213 | 2213 | $checked = checked( true, true, false ); |
| 2214 | 2214 | } |
| 2215 | 2215 | break; |
@@ -2224,7 +2224,7 @@ discard block |
||
| 2224 | 2224 | type="<?php echo $field_type; ?>" |
| 2225 | 2225 | name="<?php echo $field_name; ?>" |
| 2226 | 2226 | value="no-default" |
| 2227 | - <?php checked( $field['default_choice'], 'no-default' ); ?>> |
|
| 2227 | + <?php checked( $field[ 'default_choice' ], 'no-default' ); ?>> |
|
| 2228 | 2228 | No Default |
| 2229 | 2229 | </label> |
| 2230 | 2230 | <?php |
@@ -2240,7 +2240,7 @@ discard block |
||
| 2240 | 2240 | </label> |
| 2241 | 2241 | <?php |
| 2242 | 2242 | } ?> |
| 2243 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2243 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2244 | 2244 | </td> |
| 2245 | 2245 | </tr> |
| 2246 | 2246 | |
@@ -2256,13 +2256,13 @@ discard block |
||
| 2256 | 2256 | </label> |
| 2257 | 2257 | </td> |
| 2258 | 2258 | <td> |
| 2259 | - <select type="default" name="field[<?php echo $field['group_id']; ?>][default_choice]"> |
|
| 2259 | + <select type="default" name="field[<?php echo $field[ 'group_id' ]; ?>][default_choice]"> |
|
| 2260 | 2260 | <option value="no-default">No Default</option> |
| 2261 | - <?php foreach( json_decode( stripslashes_deep( $field['groups'] ) , true ) as $id => $group ) { ?>
|
|
| 2262 | - <option value="<?php echo $id; ?>" <?php selected( $field['default_choice'] , $id ); ?>><?php echo stripslashes( $group ); ?></option> |
|
| 2261 | + <?php foreach ( json_decode( stripslashes_deep( $field[ 'groups' ] ), true ) as $id => $group ) { ?>
|
|
| 2262 | + <option value="<?php echo $id; ?>" <?php selected( $field[ 'default_choice' ], $id ); ?>><?php echo stripslashes( $group ); ?></option> |
|
| 2263 | 2263 | <?php } ?> |
| 2264 | 2264 | </select> |
| 2265 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2265 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2266 | 2266 | </td> |
| 2267 | 2267 | </tr> |
| 2268 | 2268 | |
@@ -2275,78 +2275,78 @@ discard block |
||
| 2275 | 2275 | <!-- Field Description --> |
| 2276 | 2276 | <tr valign="top"> |
| 2277 | 2277 | <td scope="row"> |
| 2278 | - <label for="description_<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2278 | + <label for="description_<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2279 | 2279 | <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2280 | 2280 | </label> |
| 2281 | 2281 | </td> |
| 2282 | 2282 | <td> |
| 2283 | - <textarea id="description_<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat field-description-input" name="field[<?php echo $field['group_id']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
| 2284 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2283 | + <textarea id="description_<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'group_id' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
| 2284 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2285 | 2285 | </td> |
| 2286 | 2286 | </tr> |
| 2287 | 2287 | |
| 2288 | 2288 | <!-- Description Above Field --> |
| 2289 | 2289 | <tr valign="top"> |
| 2290 | 2290 | <td scope="row"> |
| 2291 | - <label for="description_above_<?php echo $field['group_id']; ?>"> |
|
| 2291 | + <label for="description_above_<?php echo $field[ 'group_id' ]; ?>"> |
|
| 2292 | 2292 | <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2293 | 2293 | </label> |
| 2294 | 2294 | </td> |
| 2295 | 2295 | <td> |
| 2296 | - <input type="checkbox" id="description_above_<?php echo $field['group_id']; ?>" class="widefat field-description-input" name="field[<?php echo $field['group_id']; ?>][description_above]" value="1" <?php echo isset( $field['description_above'] ) && $field['description_above'] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2297 | - <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 2296 | + <input type="checkbox" id="description_above_<?php echo $field[ 'group_id' ]; ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'group_id' ]; ?>][description_above]" value="1" <?php echo isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2297 | + <span class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 2298 | 2298 | </td> |
| 2299 | 2299 | </tr> |
| 2300 | 2300 | |
| 2301 | 2301 | <!-- Additional Classes --> |
| 2302 | 2302 | <tr valign="top"> |
| 2303 | 2303 | <td scope="row"> |
| 2304 | - <label for="classes_<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2304 | + <label for="classes_<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2305 | 2305 | <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2306 | 2306 | </label> |
| 2307 | 2307 | </td> |
| 2308 | 2308 | <td> |
| 2309 | - <input type="text" id="classes_<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" name="field[<?php echo $field['group_id']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
| 2310 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
| 2309 | + <input type="text" id="classes_<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'group_id' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
| 2310 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
| 2311 | 2311 | </td> |
| 2312 | 2312 | </tr> |
| 2313 | 2313 | <!-- Required Toggle --> |
| 2314 | 2314 | <tr valign="top"> |
| 2315 | 2315 | <td scope="row"> |
| 2316 | - <label for="field-required-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2316 | + <label for="field-required-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2317 | 2317 | <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2318 | 2318 | </label> |
| 2319 | 2319 | </td> |
| 2320 | 2320 | <td> |
| 2321 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
| 2322 | - <input type="checkbox" id="field-required-<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][require]" <?php checked( $checked , 1 ); ?>> |
|
| 2323 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2321 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
| 2322 | + <input type="checkbox" id="field-required-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][require]" <?php checked( $checked, 1 ); ?>> |
|
| 2323 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2324 | 2324 | </td> |
| 2325 | 2325 | </tr> |
| 2326 | 2326 | <!-- Visible Toggle --> |
| 2327 | 2327 | <tr valign="top"> |
| 2328 | 2328 | <td scope="row"> |
| 2329 | - <label for="hide-field-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2329 | + <label for="hide-field-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2330 | 2330 | <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2331 | 2331 | </label> |
| 2332 | 2332 | </td> |
| 2333 | 2333 | <td> |
| 2334 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
| 2335 | - <input type="checkbox" id="hide-field-<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][hide]" <?php checked( $hide , 1 ); ?>> |
|
| 2336 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2334 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
| 2335 | + <input type="checkbox" id="hide-field-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][hide]" <?php checked( $hide, 1 ); ?>> |
|
| 2336 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2337 | 2337 | </td> |
| 2338 | 2338 | </tr> |
| 2339 | 2339 | <!-- Toggle Field Label Visibility --> |
| 2340 | 2340 | <tr valign="top"> |
| 2341 | 2341 | <td scope="row"> |
| 2342 | - <label for="hide-label-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2342 | + <label for="hide-label-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2343 | 2343 | <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2344 | 2344 | </label> |
| 2345 | 2345 | </td> |
| 2346 | 2346 | <td> |
| 2347 | - <?php $hide = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
| 2348 | - <input type="checkbox" id="hide-label-<?php echo esc_attr( $field['group_id'] ); ?>" name="field[<?php echo $field['group_id']; ?>][hide-label]" value="1" <?php checked( $hide , 1 ); ?>/> |
|
| 2349 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2347 | + <?php $hide = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
| 2348 | + <input type="checkbox" id="hide-label-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" name="field[<?php echo $field[ 'group_id' ]; ?>][hide-label]" value="1" <?php checked( $hide, 1 ); ?>/> |
|
| 2349 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2350 | 2350 | </td> |
| 2351 | 2351 | </tr> |
| 2352 | 2352 | <!-- Toggle Buttons --> |
@@ -2356,8 +2356,8 @@ discard block |
||
| 2356 | 2356 | </td> |
| 2357 | 2357 | <td> |
| 2358 | 2358 | <span class="toggle-container"> |
| 2359 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2360 | - <a href="#" class="remove-field" alt="<?php echo $field['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2359 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2360 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2361 | 2361 | </span> |
| 2362 | 2362 | </td> |
| 2363 | 2363 | </tr> |
@@ -2378,7 +2378,7 @@ discard block |
||
| 2378 | 2378 | add_thickbox(); |
| 2379 | 2379 | // enqueue jquery qtip for our tooltip |
| 2380 | 2380 | wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js', array( 'jquery' ) ); |
| 2381 | - wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
| 2381 | + wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
| 2382 | 2382 | $available_tags = array( |
| 2383 | 2383 | array( |
| 2384 | 2384 | 'tag' => '{page_title}',
|
@@ -2433,14 +2433,14 @@ discard block |
||
| 2433 | 2433 | <h3><?php _e( 'Pre Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
| 2434 | 2434 | <p class="description"><?php _e( 'You can use any of the following tags to populate a MailChimp text field with dynamic content. This can be used to determine which page the user signed up on, if the user was logged in and more.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
| 2435 | 2435 | <ul> |
| 2436 | - <?php foreach( apply_filters( 'yikes-mailchimp-custom-default-value-tags', $available_tags ) as $tag ) { ?>
|
|
| 2436 | + <?php foreach ( apply_filters( 'yikes-mailchimp-custom-default-value-tags', $available_tags ) as $tag ) { ?>
|
|
| 2437 | 2437 | <li class="tooltop-tag"> |
| 2438 | 2438 | <!-- link/tag --> |
| 2439 | - <a href="#" onclick="populateDefaultValue( '<?php echo $tag['tag']; ?>' );return false;" data-attr-tag="<?php echo $tag['tag']; ?>" title="<?php echo $tag['title']; ?>"><?php echo $tag['title']; ?></a> |
|
| 2439 | + <a href="#" onclick="populateDefaultValue( '<?php echo $tag[ 'tag' ]; ?>' );return false;" data-attr-tag="<?php echo $tag[ 'tag' ]; ?>" title="<?php echo $tag[ 'title' ]; ?>"><?php echo $tag[ 'title' ]; ?></a> |
|
| 2440 | 2440 | <!-- help icon --> |
| 2441 | 2441 | <span class="dashicons dashicons-editor-help"></span> |
| 2442 | 2442 | <!-- tooltip --> |
| 2443 | - <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag['description']; ?></div> |
|
| 2443 | + <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag[ 'description' ]; ?></div> |
|
| 2444 | 2444 | </li> |
| 2445 | 2445 | <?php } ?> |
| 2446 | 2446 | </ul> |
@@ -2456,46 +2456,46 @@ discard block |
||
| 2456 | 2456 | * - |
| 2457 | 2457 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 2458 | 2458 | */ |
| 2459 | - public function build_available_merge_vars( $form_fields , $available_merge_variables ) {
|
|
| 2459 | + public function build_available_merge_vars( $form_fields, $available_merge_variables ) {
|
|
| 2460 | 2460 | $fields_assigned_to_form = array(); |
| 2461 | 2461 | foreach ( $form_fields as $field ) {
|
| 2462 | - if ( isset( $field['merge'] ) ) {
|
|
| 2463 | - $fields_assigned_to_form[ $field['merge'] ] = true; |
|
| 2462 | + if ( isset( $field[ 'merge' ] ) ) {
|
|
| 2463 | + $fields_assigned_to_form[ $field[ 'merge' ] ] = true; |
|
| 2464 | 2464 | } |
| 2465 | 2465 | } |
| 2466 | 2466 | |
| 2467 | - if ( ! empty( $available_merge_variables['merge_fields'] ) ) {
|
|
| 2467 | + if ( ! empty( $available_merge_variables[ 'merge_fields' ] ) ) {
|
|
| 2468 | 2468 | ?> |
| 2469 | 2469 | <ul id="available-fields"><?php |
| 2470 | - foreach ( $available_merge_variables['merge_fields'] as $merge_var ) {
|
|
| 2471 | - if ( isset( $fields_assigned_to_form[ $merge_var['tag'] ] ) ) {
|
|
| 2470 | + foreach ( $available_merge_variables[ 'merge_fields' ] as $merge_var ) {
|
|
| 2471 | + if ( isset( $fields_assigned_to_form[ $merge_var[ 'tag' ] ] ) ) {
|
|
| 2472 | 2472 | ?> |
| 2473 | 2473 | <li class="available-form-field not-available" |
| 2474 | - alt="<?php echo $merge_var['tag']; ?>" |
|
| 2475 | - data-attr-field-type="<?php echo esc_attr( $merge_var['type'] ); ?>" |
|
| 2476 | - data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>" |
|
| 2477 | - data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>" |
|
| 2474 | + alt="<?php echo $merge_var[ 'tag' ]; ?>" |
|
| 2475 | + data-attr-field-type="<?php echo esc_attr( $merge_var[ 'type' ] ); ?>" |
|
| 2476 | + data-attr-field-name="<?php echo esc_attr( $merge_var[ 'name' ] ); ?>" |
|
| 2477 | + data-attr-form-id="<?php echo esc_attr( $available_merge_variables[ 'list_id' ] ); ?>" |
|
| 2478 | 2478 | title="<?php esc_attr_e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" |
| 2479 | 2479 | disabled="disabled"> |
| 2480 | - <?php echo stripslashes( $merge_var['name'] ); |
|
| 2481 | - if ( $merge_var['required'] ) {
|
|
| 2480 | + <?php echo stripslashes( $merge_var[ 'name' ] ); |
|
| 2481 | + if ( $merge_var[ 'required' ] ) {
|
|
| 2482 | 2482 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
| 2483 | 2483 | } ?> |
| 2484 | - <small class="field-type-text"><?php echo $merge_var['type']; ?></small> |
|
| 2484 | + <small class="field-type-text"><?php echo $merge_var[ 'type' ]; ?></small> |
|
| 2485 | 2485 | </li> |
| 2486 | 2486 | <?php |
| 2487 | 2487 | } else {
|
| 2488 | 2488 | ?> |
| 2489 | 2489 | <li class="available-form-field" |
| 2490 | - alt="<?php echo $merge_var['tag']; ?>" |
|
| 2491 | - data-attr-field-type="<?php echo esc_attr( $merge_var['type'] ); ?>" |
|
| 2492 | - data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>" |
|
| 2493 | - data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>"> |
|
| 2494 | - <?php echo stripslashes( $merge_var['name'] ); |
|
| 2495 | - if ( $merge_var['required'] ) {
|
|
| 2490 | + alt="<?php echo $merge_var[ 'tag' ]; ?>" |
|
| 2491 | + data-attr-field-type="<?php echo esc_attr( $merge_var[ 'type' ] ); ?>" |
|
| 2492 | + data-attr-field-name="<?php echo esc_attr( $merge_var[ 'name' ] ); ?>" |
|
| 2493 | + data-attr-form-id="<?php echo esc_attr( $available_merge_variables[ 'list_id' ] ); ?>"> |
|
| 2494 | + <?php echo stripslashes( $merge_var[ 'name' ] ); |
|
| 2495 | + if ( $merge_var[ 'required' ] ) {
|
|
| 2496 | 2496 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
| 2497 | 2497 | } ?> |
| 2498 | - <small class="field-type-text"><?php echo $merge_var['type']; ?></small> |
|
| 2498 | + <small class="field-type-text"><?php echo $merge_var[ 'type' ]; ?></small> |
|
| 2499 | 2499 | </li> |
| 2500 | 2500 | <?php |
| 2501 | 2501 | } |
@@ -2517,12 +2517,12 @@ discard block |
||
| 2517 | 2517 | * - |
| 2518 | 2518 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 2519 | 2519 | */ |
| 2520 | - public function build_available_interest_groups( $form_fields , $available_interest_groups , $list_id ) {
|
|
| 2520 | + public function build_available_interest_groups( $form_fields, $available_interest_groups, $list_id ) {
|
|
| 2521 | 2521 | $fields_assigned_to_form = array(); |
| 2522 | 2522 | if ( ! empty( $form_fields ) ) {
|
| 2523 | 2523 | foreach ( $form_fields as $field ) {
|
| 2524 | - if ( isset( $field['group_id'] ) ) {
|
|
| 2525 | - $fields_assigned_to_form[ $field['group_id'] ] = true; |
|
| 2524 | + if ( isset( $field[ 'group_id' ] ) ) {
|
|
| 2525 | + $fields_assigned_to_form[ $field[ 'group_id' ] ] = true; |
|
| 2526 | 2526 | } |
| 2527 | 2527 | } |
| 2528 | 2528 | } |
@@ -2531,29 +2531,29 @@ discard block |
||
| 2531 | 2531 | ?> |
| 2532 | 2532 | <ul id="available-interest-groups"><?php |
| 2533 | 2533 | foreach ( $available_interest_groups as $interest_group ) {
|
| 2534 | - if ( isset( $fields_assigned_to_form[ $interest_group['id'] ] ) ) {
|
|
| 2534 | + if ( isset( $fields_assigned_to_form[ $interest_group[ 'id' ] ] ) ) {
|
|
| 2535 | 2535 | ?> |
| 2536 | 2536 | <li class="available-interest-group not-available" |
| 2537 | - alt="<?php echo $interest_group['id']; ?>" |
|
| 2538 | - data-attr-field-name="<?php echo htmlspecialchars( $interest_group['title'] ); ?>" |
|
| 2539 | - data-attr-field-type="<?php echo $interest_group['type']; ?>" |
|
| 2537 | + alt="<?php echo $interest_group[ 'id' ]; ?>" |
|
| 2538 | + data-attr-field-name="<?php echo htmlspecialchars( $interest_group[ 'title' ] ); ?>" |
|
| 2539 | + data-attr-field-type="<?php echo $interest_group[ 'type' ]; ?>" |
|
| 2540 | 2540 | data-attr-form-id="<?php echo $list_id; ?>" title="<?php _e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" |
| 2541 | 2541 | disabled="disabled" |
| 2542 | 2542 | > |
| 2543 | - <?php echo stripslashes( $interest_group['title'] ); ?> |
|
| 2544 | - <small class="field-type-text"><?php echo $interest_group['type']; ?></small> |
|
| 2543 | + <?php echo stripslashes( $interest_group[ 'title' ] ); ?> |
|
| 2544 | + <small class="field-type-text"><?php echo $interest_group[ 'type' ]; ?></small> |
|
| 2545 | 2545 | </li> |
| 2546 | 2546 | <?php |
| 2547 | 2547 | } else {
|
| 2548 | 2548 | ?> |
| 2549 | 2549 | <li class="available-interest-group" |
| 2550 | - alt="<?php echo $interest_group['id']; ?>" |
|
| 2551 | - data-attr-field-name="<?php echo htmlspecialchars( $interest_group['title'] ); ?>" |
|
| 2552 | - data-attr-field-type="<?php echo $interest_group['type']; ?>" |
|
| 2550 | + alt="<?php echo $interest_group[ 'id' ]; ?>" |
|
| 2551 | + data-attr-field-name="<?php echo htmlspecialchars( $interest_group[ 'title' ] ); ?>" |
|
| 2552 | + data-attr-field-type="<?php echo $interest_group[ 'type' ]; ?>" |
|
| 2553 | 2553 | data-attr-form-id="<?php echo $list_id; ?>" |
| 2554 | 2554 | > |
| 2555 | - <?php echo stripslashes( $interest_group['title'] ); ?> |
|
| 2556 | - <small class="field-type-text"><?php echo $interest_group['type']; ?></small> |
|
| 2555 | + <?php echo stripslashes( $interest_group[ 'title' ] ); ?> |
|
| 2556 | + <small class="field-type-text"><?php echo $interest_group[ 'type' ]; ?></small> |
|
| 2557 | 2557 | </li> |
| 2558 | 2558 | <?php |
| 2559 | 2559 | } |
@@ -2575,15 +2575,15 @@ discard block |
||
| 2575 | 2575 | * - must clean up db tables , ensure what data is going in and what is needed... |
| 2576 | 2576 | */ |
| 2577 | 2577 | public function yikes_easy_mailchimp_create_form() {
|
| 2578 | - $nonce = $_REQUEST['nonce']; |
|
| 2578 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2579 | 2579 | if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) {
|
| 2580 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2580 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2581 | 2581 | } |
| 2582 | 2582 | |
| 2583 | 2583 | $result = $this->form_interface->create_form( array( |
| 2584 | - 'list_id' => sanitize_key( $_POST['associated-list'] ), |
|
| 2585 | - 'form_name' => stripslashes( $_POST['form-name'] ), |
|
| 2586 | - 'form_description' => stripslashes( $_POST['form-description'] ), |
|
| 2584 | + 'list_id' => sanitize_key( $_POST[ 'associated-list' ] ), |
|
| 2585 | + 'form_name' => stripslashes( $_POST[ 'form-name' ] ), |
|
| 2586 | + 'form_description' => stripslashes( $_POST[ 'form-description' ] ), |
|
| 2587 | 2587 | ) ); |
| 2588 | 2588 | |
| 2589 | 2589 | // if an error occurs during the form creation process |
@@ -2591,11 +2591,11 @@ discard block |
||
| 2591 | 2591 | // write it to the error log |
| 2592 | 2592 | // if the form was not created successfully |
| 2593 | 2593 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 2594 | - $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender') , __( "Creating a new form" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Forms" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2594 | + $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ), __( "Creating a new form", 'yikes-inc-easy-mailchimp-extender' ), __( "Forms", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2595 | 2595 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&sql_error=' . urlencode( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ) ) ) ) ); |
| 2596 | 2596 | } else {
|
| 2597 | 2597 | // redirect the user to the new form edit page |
| 2598 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result) ) ); |
|
| 2598 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result ) ) ); |
|
| 2599 | 2599 | } |
| 2600 | 2600 | exit(); |
| 2601 | 2601 | } |
@@ -2608,11 +2608,11 @@ discard block |
||
| 2608 | 2608 | */ |
| 2609 | 2609 | public function yikes_easy_mailchimp_delete_form() {
|
| 2610 | 2610 | // grab & store our variables ( associated list & form name ) |
| 2611 | - $nonce = $_REQUEST['nonce']; |
|
| 2612 | - $post_id_to_delete = $_REQUEST['mailchimp-form']; |
|
| 2611 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2612 | + $post_id_to_delete = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2613 | 2613 | // verify our nonce |
| 2614 | - if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) {
|
|
| 2615 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2614 | + if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-' . $post_id_to_delete ) ) {
|
|
| 2615 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2616 | 2616 | } |
| 2617 | 2617 | |
| 2618 | 2618 | $this->form_interface->delete_form( $post_id_to_delete ); |
@@ -2628,19 +2628,19 @@ discard block |
||
| 2628 | 2628 | */ |
| 2629 | 2629 | public function yikes_easy_mailchimp_duplicate_form() {
|
| 2630 | 2630 | // grab & store our variables ( associated list & form name ) |
| 2631 | - $nonce = $_REQUEST['nonce']; |
|
| 2632 | - $post_id_to_clone = $_REQUEST['mailchimp-form']; |
|
| 2631 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2632 | + $post_id_to_clone = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2633 | 2633 | // verify our nonce |
| 2634 | - if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) {
|
|
| 2635 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2634 | + if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-' . $post_id_to_clone ) ) {
|
|
| 2635 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2636 | 2636 | } |
| 2637 | 2637 | |
| 2638 | 2638 | // Get the current form data. |
| 2639 | 2639 | $form_data = $this->form_interface->get_form( $post_id_to_clone ); |
| 2640 | 2640 | |
| 2641 | 2641 | // Update some of the data before duplication |
| 2642 | - $form_data['form_name'] .= ' - Copy'; |
|
| 2643 | - $form_data['impressions'] = $form_data['submissions'] = 0; |
|
| 2642 | + $form_data[ 'form_name' ] .= ' - Copy'; |
|
| 2643 | + $form_data[ 'impressions' ] = $form_data[ 'submissions' ] = 0; |
|
| 2644 | 2644 | |
| 2645 | 2645 | // Create the new form, and handle the result. |
| 2646 | 2646 | $result = $this->form_interface->create_form( $form_data ); |
@@ -2671,11 +2671,11 @@ discard block |
||
| 2671 | 2671 | */ |
| 2672 | 2672 | public function yikes_easy_mailchimp_reset_impression_stats() {
|
| 2673 | 2673 | // grab & store our variables ( associated list & form name ) |
| 2674 | - $nonce = $_REQUEST['nonce']; |
|
| 2675 | - $form_id_to_reset = $_REQUEST['mailchimp-form']; |
|
| 2674 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2675 | + $form_id_to_reset = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2676 | 2676 | // verify our nonce |
| 2677 | - if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) {
|
|
| 2678 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2677 | + if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-' . $form_id_to_reset ) ) {
|
|
| 2678 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2679 | 2679 | } |
| 2680 | 2680 | |
| 2681 | 2681 | $result = $this->form_interface->update_form( |
@@ -2703,8 +2703,8 @@ discard block |
||
| 2703 | 2703 | */ |
| 2704 | 2704 | public function yikes_easy_mailchimp_update_form() {
|
| 2705 | 2705 | |
| 2706 | - $nonce = $_REQUEST['nonce']; |
|
| 2707 | - $form_id = $_REQUEST['id']; |
|
| 2706 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2707 | + $form_id = $_REQUEST[ 'id' ]; |
|
| 2708 | 2708 | |
| 2709 | 2709 | // verify our nonce |
| 2710 | 2710 | if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) {
|
@@ -2718,70 +2718,70 @@ discard block |
||
| 2718 | 2718 | } |
| 2719 | 2719 | |
| 2720 | 2720 | // Store our values! |
| 2721 | - $list_id = $_POST['associated-list']; |
|
| 2722 | - $form_name = stripslashes( $_POST['form-name'] ); |
|
| 2723 | - $form_description = sanitize_text_field( stripslashes( $_POST['form-description'] ) ); |
|
| 2724 | - $redirect_user_on_submit = $_POST['redirect-user-on-submission']; |
|
| 2725 | - $redirect_page = $_POST['redirect-user-to-selection']; |
|
| 2721 | + $list_id = $_POST[ 'associated-list' ]; |
|
| 2722 | + $form_name = stripslashes( $_POST[ 'form-name' ] ); |
|
| 2723 | + $form_description = sanitize_text_field( stripslashes( $_POST[ 'form-description' ] ) ); |
|
| 2724 | + $redirect_user_on_submit = $_POST[ 'redirect-user-on-submission' ]; |
|
| 2725 | + $redirect_page = $_POST[ 'redirect-user-to-selection' ]; |
|
| 2726 | 2726 | |
| 2727 | 2727 | // stripslashes_deep on save, to prevent foreign languages from added excessive backslashes |
| 2728 | - $assigned_fields = isset( $_POST['field'] ) ? stripslashes_deep( $_POST['field'] ): array(); |
|
| 2728 | + $assigned_fields = isset( $_POST[ 'field' ] ) ? stripslashes_deep( $_POST[ 'field' ] ) : array(); |
|
| 2729 | 2729 | |
| 2730 | 2730 | // setup our submission settings serialized array |
| 2731 | 2731 | $submission_settings = array( |
| 2732 | - 'ajax' => $_POST['form-ajax-submission'], |
|
| 2733 | - 'redirect_on_submission' => $_POST['redirect-user-on-submission'], |
|
| 2734 | - 'redirect_page' => $_POST['redirect-user-to-selection'], |
|
| 2735 | - 'custom_redirect_url' => esc_url( $_POST['custom-redirect-url'] ), |
|
| 2736 | - 'redirect_new_window' => $_POST['redirect_new_window'], |
|
| 2737 | - 'hide_form_post_signup' => $_POST['hide-form-post-signup'], |
|
| 2738 | - 'replace_interests' => $_POST['replace-interest-groups'], |
|
| 2732 | + 'ajax' => $_POST[ 'form-ajax-submission' ], |
|
| 2733 | + 'redirect_on_submission' => $_POST[ 'redirect-user-on-submission' ], |
|
| 2734 | + 'redirect_page' => $_POST[ 'redirect-user-to-selection' ], |
|
| 2735 | + 'custom_redirect_url' => esc_url( $_POST[ 'custom-redirect-url' ] ), |
|
| 2736 | + 'redirect_new_window' => $_POST[ 'redirect_new_window' ], |
|
| 2737 | + 'hide_form_post_signup' => $_POST[ 'hide-form-post-signup' ], |
|
| 2738 | + 'replace_interests' => $_POST[ 'replace-interest-groups' ], |
|
| 2739 | 2739 | ); |
| 2740 | 2740 | |
| 2741 | 2741 | // setup our opt-in settings serialized array |
| 2742 | 2742 | $optin_settings = array( |
| 2743 | - 'optin' => $_POST['single-double-optin'], |
|
| 2744 | - 'update_existing_user' => $_POST['update-existing-user'], |
|
| 2745 | - 'send_update_email' => $_POST['update-existing-email'], |
|
| 2743 | + 'optin' => $_POST[ 'single-double-optin' ], |
|
| 2744 | + 'update_existing_user' => $_POST[ 'update-existing-user' ], |
|
| 2745 | + 'send_update_email' => $_POST[ 'update-existing-email' ], |
|
| 2746 | 2746 | ); |
| 2747 | 2747 | |
| 2748 | 2748 | // Setup our error settings serialized array |
| 2749 | 2749 | $error_settings = array( |
| 2750 | - 'success' => trim( $_POST['yikes-easy-mc-success-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-success-message'] ) ) : '', |
|
| 2751 | - 'success-single-optin' => trim( $_POST['yikes-easy-mc-success-single-optin-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-success-single-optin-message'] ) ) : '', |
|
| 2752 | - 'success-resubscribed' => trim( $_POST['yikes-easy-mc-user-resubscribed-success-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-resubscribed-success-message'] ) ) : '', |
|
| 2753 | - 'general-error' => trim( $_POST['yikes-easy-mc-general-error-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-general-error-message'] ) ) : '', |
|
| 2754 | - 'already-subscribed' => trim( $_POST['yikes-easy-mc-user-subscribed-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-subscribed-message'] ) ) : '', |
|
| 2755 | - 'update-link' => trim( $_POST['yikes-easy-mc-user-update-link'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-update-link'] ) ) : '', |
|
| 2756 | - 'email-subject' => trim( $_POST['yikes-easy-mc-user-email-subject'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-email-subject'] ) ) : '', |
|
| 2757 | - 'email-body' => trim( $_POST['yikes-easy-mc-user-email-body'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-email-body'] ) ) : '', |
|
| 2758 | - 'update-email-success' => trim( $_POST['yikes-easy-mc-update-email-successful'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-update-email-successful'] ) ) : '', |
|
| 2759 | - 'update-email-failure' => trim( $_POST['yikes-easy-mc-update-email-failure'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-update-email-failure'] ) ) : '', |
|
| 2750 | + 'success' => trim( $_POST[ 'yikes-easy-mc-success-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-success-message' ] ) ) : '', |
|
| 2751 | + 'success-single-optin' => trim( $_POST[ 'yikes-easy-mc-success-single-optin-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-success-single-optin-message' ] ) ) : '', |
|
| 2752 | + 'success-resubscribed' => trim( $_POST[ 'yikes-easy-mc-user-resubscribed-success-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-resubscribed-success-message' ] ) ) : '', |
|
| 2753 | + 'general-error' => trim( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ) : '', |
|
| 2754 | + 'already-subscribed' => trim( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ) : '', |
|
| 2755 | + 'update-link' => trim( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ) : '', |
|
| 2756 | + 'email-subject' => trim( $_POST[ 'yikes-easy-mc-user-email-subject' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-email-subject' ] ) ) : '', |
|
| 2757 | + 'email-body' => trim( $_POST[ 'yikes-easy-mc-user-email-body' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-email-body' ] ) ) : '', |
|
| 2758 | + 'update-email-success' => trim( $_POST[ 'yikes-easy-mc-update-email-successful' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-update-email-successful' ] ) ) : '', |
|
| 2759 | + 'update-email-failure' => trim( $_POST[ 'yikes-easy-mc-update-email-failure' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-update-email-failure' ] ) ) : '', |
|
| 2760 | 2760 | ); |
| 2761 | 2761 | |
| 2762 | 2762 | // Setup the new form settings array |
| 2763 | 2763 | // @since 6.0.3.8 |
| 2764 | 2764 | // To Do: Combine date & time so it's a single unix timestamp |
| 2765 | 2765 | $form_settings = array( |
| 2766 | - 'yikes-easy-mc-form-class-names' => trim( $_POST['yikes-easy-mc-form-class-names'] ), |
|
| 2767 | - 'yikes-easy-mc-inline-form' => $_POST['yikes-easy-mc-inline-form'][0], |
|
| 2768 | - 'yikes-easy-mc-submit-button-type' => $_POST['yikes-easy-mc-submit-button-type'][0], |
|
| 2769 | - 'yikes-easy-mc-submit-button-text' => trim( $_POST['yikes-easy-mc-submit-button-text'] ), |
|
| 2770 | - 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST['yikes-easy-mc-submit-button-image'] ) ), |
|
| 2771 | - 'yikes-easy-mc-submit-button-classes' => trim( $_POST['yikes-easy-mc-submit-button-classes'] ), |
|
| 2772 | - 'yikes-easy-mc-form-schedule' => ( isset( $_POST['yikes-easy-mc-form-schedule'] ) ) ? '1' : '0', |
|
| 2773 | - 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST['yikes-easy-mc-form-restriction-start-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-start-time'] ), |
|
| 2774 | - 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST['yikes-easy-mc-form-restriction-end-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-end-time'] ), |
|
| 2775 | - 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST['yikes-easy-mc-form-restriction-pending-message'] ), |
|
| 2776 | - 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST['yikes-easy-mc-form-restriction-expired-message'] ), |
|
| 2777 | - 'yikes-easy-mc-form-login-required' => ( isset( $_POST['yikes-easy-mc-form-login-required'] ) ) ? '1' : '0', |
|
| 2778 | - 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST['yikes-easy-mc-form-restriction-login-message'] ), |
|
| 2766 | + 'yikes-easy-mc-form-class-names' => trim( $_POST[ 'yikes-easy-mc-form-class-names' ] ), |
|
| 2767 | + 'yikes-easy-mc-inline-form' => $_POST[ 'yikes-easy-mc-inline-form' ][ 0 ], |
|
| 2768 | + 'yikes-easy-mc-submit-button-type' => $_POST[ 'yikes-easy-mc-submit-button-type' ][ 0 ], |
|
| 2769 | + 'yikes-easy-mc-submit-button-text' => trim( $_POST[ 'yikes-easy-mc-submit-button-text' ] ), |
|
| 2770 | + 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST[ 'yikes-easy-mc-submit-button-image' ] ) ), |
|
| 2771 | + 'yikes-easy-mc-submit-button-classes' => trim( $_POST[ 'yikes-easy-mc-submit-button-classes' ] ), |
|
| 2772 | + 'yikes-easy-mc-form-schedule' => ( isset( $_POST[ 'yikes-easy-mc-form-schedule' ] ) ) ? '1' : '0', |
|
| 2773 | + 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-start-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-start-time' ] ), |
|
| 2774 | + 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-end-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-end-time' ] ), |
|
| 2775 | + 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-pending-message' ] ), |
|
| 2776 | + 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-expired-message' ] ), |
|
| 2777 | + 'yikes-easy-mc-form-login-required' => ( isset( $_POST[ 'yikes-easy-mc-form-login-required' ] ) ) ? '1' : '0', |
|
| 2778 | + 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-login-message' ] ), |
|
| 2779 | 2779 | ); |
| 2780 | 2780 | |
| 2781 | 2781 | // additional custom fields (extensions / user defined fields) |
| 2782 | 2782 | $custom_fields = array(); |
| 2783 | - if ( isset( $_POST['custom-field'] ) ) {
|
|
| 2784 | - foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) {
|
|
| 2783 | + if ( isset( $_POST[ 'custom-field' ] ) ) {
|
|
| 2784 | + foreach ( $_POST[ 'custom-field' ] as $custom_field => $custom_value ) {
|
|
| 2785 | 2785 | if ( is_array( $custom_value ) ) {
|
| 2786 | 2786 | $custom_fields[ $custom_field ] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!) |
| 2787 | 2787 | } else {
|
@@ -2813,7 +2813,7 @@ discard block |
||
| 2813 | 2813 | $this->form_interface->update_form( $form_id, $form_updates ); |
| 2814 | 2814 | |
| 2815 | 2815 | /* Custom action hook which allows users to update specific options when a form is updated - used in add ons */ |
| 2816 | - do_action( 'yikes-mailchimp-save-form', $form_id, $custom_fields ); |
|
| 2816 | + do_action( 'yikes-mailchimp-save-form', $form_id, $custom_fields ); |
|
| 2817 | 2817 | |
| 2818 | 2818 | // redirect the user to the manage forms page, display confirmation |
| 2819 | 2819 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form_id . '&updated-form=true' ) ) ); |
@@ -2824,11 +2824,11 @@ discard block |
||
| 2824 | 2824 | $email_body = '<p>' . __( 'Greetings,', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
| 2825 | 2825 | |
| 2826 | 2826 | $email_body .= '<p>'; |
| 2827 | - $email_body .= __( 'A request has been made to update your MailChimp account profile information.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2828 | - $email_body .= __( ' To do so please use the following link: ', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2829 | - $email_body .= '[link]'; |
|
| 2830 | - $email_body .= __( 'Update MailChimp Profile Info', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2831 | - $email_body .= '[/link]'; |
|
| 2827 | + $email_body .= __( 'A request has been made to update your MailChimp account profile information.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2828 | + $email_body .= __( ' To do so please use the following link: ', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2829 | + $email_body .= '[link]'; |
|
| 2830 | + $email_body .= __( 'Update MailChimp Profile Info', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2831 | + $email_body .= '[/link]'; |
|
| 2832 | 2832 | $email_body .= '</p>'; |
| 2833 | 2833 | |
| 2834 | 2834 | $email_body .= '<p>' . __( 'If you did not request this update, please disregard this email.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
@@ -2844,13 +2844,13 @@ discard block |
||
| 2844 | 2844 | |
| 2845 | 2845 | /* Unsubscribe a given user from our list */ |
| 2846 | 2846 | public function yikes_easy_mailchimp_unsubscribe_user() {
|
| 2847 | - $nonce = $_REQUEST['nonce']; |
|
| 2848 | - $list_id = $_REQUEST['mailchimp-list']; |
|
| 2849 | - $email_id = $_REQUEST['email_id']; |
|
| 2847 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2848 | + $list_id = $_REQUEST[ 'mailchimp-list' ]; |
|
| 2849 | + $email_id = $_REQUEST[ 'email_id' ]; |
|
| 2850 | 2850 | |
| 2851 | 2851 | // verify our nonce |
| 2852 | 2852 | if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) {
|
| 2853 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2853 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2854 | 2854 | } |
| 2855 | 2855 | |
| 2856 | 2856 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_unsubscribe( $list_id, $email_id ); |
@@ -2869,21 +2869,21 @@ discard block |
||
| 2869 | 2869 | |
| 2870 | 2870 | public function yikes_easy_mailchimp_create_missing_error_log() {
|
| 2871 | 2871 | // grab our nonnce |
| 2872 | - $nonce = $_REQUEST['nonce']; |
|
| 2872 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2873 | 2873 | // validate nonce |
| 2874 | - if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) {
|
|
| 2875 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2874 | + if ( ! wp_verify_nonce( $nonce, 'create_error_log' ) ) {
|
|
| 2875 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2876 | 2876 | } |
| 2877 | 2877 | // setup the path to the error log |
| 2878 | 2878 | $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' ); |
| 2879 | 2879 | try {
|
| 2880 | 2880 | // create the file |
| 2881 | - fwrite( $error_log , '' ); |
|
| 2881 | + fwrite( $error_log, '' ); |
|
| 2882 | 2882 | // close out |
| 2883 | 2883 | fclose( $error_log ); |
| 2884 | 2884 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=true' ) ) ); |
| 2885 | 2885 | } catch ( Exception $e ) {
|
| 2886 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message='.urlencode( $e->getMessage() ) ) ) ); |
|
| 2886 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message=' . urlencode( $e->getMessage() ) ) ) ); |
|
| 2887 | 2887 | } |
| 2888 | 2888 | } |
| 2889 | 2889 | |
@@ -2894,9 +2894,9 @@ discard block |
||
| 2894 | 2894 | public function yikes_easy_mailchimp_clear_transient_data() {
|
| 2895 | 2895 | |
| 2896 | 2896 | // verify our nonce |
| 2897 | - $nonce = $_REQUEST['nonce']; |
|
| 2897 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2898 | 2898 | if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) {
|
| 2899 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2899 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2900 | 2900 | } |
| 2901 | 2901 | |
| 2902 | 2902 | $this->delete_yikes_mailchimp_transients(); |
@@ -2905,10 +2905,10 @@ discard block |
||
| 2905 | 2905 | $referer = wp_get_referer(); |
| 2906 | 2906 | if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) {
|
| 2907 | 2907 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings&transient-cleared=true' ) ) ); |
| 2908 | - } elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) {
|
|
| 2908 | + } elseif ( isset( $_REQUEST[ 'page' ] ) && $_REQUEST[ 'page' ] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST[ 'id' ] ) && ! empty( $_REQUEST[ 'id' ] ) ) {
|
|
| 2909 | 2909 | |
| 2910 | 2910 | // else check if we were editing a form. |
| 2911 | - $id = filter_var( $_REQUEST['id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 2911 | + $id = filter_var( $_REQUEST[ 'id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 2912 | 2912 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $id ) ) ); |
| 2913 | 2913 | } else {
|
| 2914 | 2914 | // else redirect to the manage forms page. |
@@ -2952,7 +2952,7 @@ discard block |
||
| 2952 | 2952 | */ |
| 2953 | 2953 | public function yikes_mailchimp_load_helper_class() {
|
| 2954 | 2954 | // check to see if it's already loaded up. |
| 2955 | - if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
|
|
| 2955 | + if ( ! class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
|
|
| 2956 | 2956 | // Include our main helper class file |
| 2957 | 2957 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/init.php' ); |
| 2958 | 2958 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @since 6.1.3 |
| 44 | 44 | */ |
| 45 | 45 | if ( ! defined( 'YIKES_MC_VERSION' ) ) { |
| 46 | - define( 'YIKES_MC_VERSION' , '6.4.4' ); |
|
| 46 | + define( 'YIKES_MC_VERSION', '6.4.4' ); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @since 6.0.0 |
| 53 | 53 | */ |
| 54 | 54 | if ( ! defined( 'YIKES_MC_PATH' ) ) { |
| 55 | - define( 'YIKES_MC_PATH' , plugin_dir_path( __FILE__ ) ); |
|
| 55 | + define( 'YIKES_MC_PATH', plugin_dir_path( __FILE__ ) ); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @since 6.0.0 |
| 62 | 62 | */ |
| 63 | 63 | if ( ! defined( 'YIKES_MC_URL' ) ) { |
| 64 | - define( 'YIKES_MC_URL' , plugin_dir_url( __FILE__ ) ); |
|
| 64 | + define( 'YIKES_MC_URL', plugin_dir_url( __FILE__ ) ); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Include our autoloader |