@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * Create our own custom the_content(); filter to prevent plugins and such from hooking in where not wanted |
|
| 77 | - * |
|
| 78 | - * @since 6.0.3 |
|
| 79 | - */ |
|
| 76 | + * Create our own custom the_content(); filter to prevent plugins and such from hooking in where not wanted |
|
| 77 | + * |
|
| 78 | + * @since 6.0.3 |
|
| 79 | + */ |
|
| 80 | 80 | public function yikes_custom_frontend_content_filter() { |
| 81 | 81 | add_filter( 'yikes-mailchimp-frontend-content', 'wptexturize' ); |
| 82 | 82 | add_filter( 'yikes-mailchimp-frontend-content', 'convert_smilies' ); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * load our checkbox classes |
| 94 | 94 | * |
| 95 | 95 | * @since 6.0.0 |
| 96 | - **/ |
|
| 96 | + **/ |
|
| 97 | 97 | public function load_checkbox_integration_classes() { |
| 98 | 98 | // store our options |
| 99 | 99 | $integrations = get_option( 'optin-checkbox-init' , '' ); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @since 6.0.0 |
| 47 | 47 | */ |
| 48 | 48 | if ( ! defined( 'YIKES_MC_VERSION' ) ) { |
| 49 | - define( 'YIKES_MC_VERSION' , $version ); |
|
| 49 | + define( 'YIKES_MC_VERSION', $version ); |
|
| 50 | 50 | } |
| 51 | 51 | /* |
| 52 | 52 | * Include our helper functions |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | // include our ajax processing class |
| 64 | 64 | require_once( YIKES_MC_PATH . 'public/partials/ajax/class.public_ajax.php' ); |
| 65 | 65 | // Include our error logging class |
| 66 | - add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 ); |
|
| 66 | + add_action( 'init', array( $this, 'load_error_logging_class' ), 1 ); |
|
| 67 | 67 | // load our checkbox classes |
| 68 | - add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 ); |
|
| 68 | + add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 ); |
|
| 69 | 69 | // custom front end filter |
| 70 | 70 | add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) ); |
| 71 | 71 | // Process non-ajax forms in the header |
@@ -100,15 +100,15 @@ discard block |
||
| 100 | 100 | **/ |
| 101 | 101 | public function load_checkbox_integration_classes() { |
| 102 | 102 | // store our options |
| 103 | - $integrations = get_option( 'optin-checkbox-init' , '' ); |
|
| 104 | - if( !empty( $integrations ) ) { |
|
| 103 | + $integrations = get_option( 'optin-checkbox-init', '' ); |
|
| 104 | + if ( ! empty( $integrations ) ) { |
|
| 105 | 105 | // load our mail integrations class |
| 106 | 106 | require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php'; |
| 107 | 107 | // loop over selected classes and load them up! |
| 108 | - foreach( $integrations as $integration => $value ) { |
|
| 109 | - if( isset( $value['value'] ) && $value['value'] == 'on' ) { |
|
| 108 | + foreach ( $integrations as $integration => $value ) { |
|
| 109 | + if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) { |
|
| 110 | 110 | // load our class extensions |
| 111 | - require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php'; |
|
| 111 | + require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php'; |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @since 6.0.0 |
| 123 | 123 | */ |
| 124 | 124 | public function load_error_logging_class() { |
| 125 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 125 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 126 | 126 | // if error logging is enabled we should include our error logging class |
| 127 | 127 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 128 | 128 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging; |
@@ -135,18 +135,18 @@ discard block |
||
| 135 | 135 | * @since 6.0.3.4 |
| 136 | 136 | */ |
| 137 | 137 | public function yikes_process_non_ajax_forms( $form_submitted ) { |
| 138 | - global $wpdb,$post; |
|
| 139 | - $form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id |
|
| 140 | - if( $form_id ) { |
|
| 138 | + global $wpdb, $post; |
|
| 139 | + $form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id |
|
| 140 | + if ( $form_id ) { |
|
| 141 | 141 | $form_settings = self::yikes_retrieve_form_settings( $form_id ); |
| 142 | - if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) { |
|
| 143 | - if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted |
|
| 142 | + if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) { |
|
| 143 | + if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted |
|
| 144 | 144 | // lets include our form processing file |
| 145 | 145 | include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' ); |
| 146 | - if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) { |
|
| 147 | - if( $form_submitted == 1 ) { |
|
| 146 | + if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) { |
|
| 147 | + if ( $form_submitted == 1 ) { |
|
| 148 | 148 | // decode our settings |
| 149 | - $redirect_page = ( 'custom_url' != $form_settings['submission_settings']['redirect_page'] ) ? get_permalink( (int) $form_settings['submission_settings']['redirect_page'] ) : $form_settings['submission_settings']['custom_redirect_url']; |
|
| 149 | + $redirect_page = ( 'custom_url' != $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) ? get_permalink( (int) $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) : $form_settings[ 'submission_settings' ][ 'custom_redirect_url' ]; |
|
| 150 | 150 | wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) ); |
| 151 | 151 | exit; |
| 152 | 152 | } |
@@ -162,27 +162,27 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public static function yikes_retrieve_form_settings( $form_id ) { |
| 164 | 164 | // if no form id, abort |
| 165 | - if( ! $form_id ) { |
|
| 165 | + if ( ! $form_id ) { |
|
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | global $wpdb; |
| 169 | 169 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form_id . '', ARRAY_A ); // query for our form data |
| 170 | - if( $form_results ) { |
|
| 170 | + if ( $form_results ) { |
|
| 171 | 171 | // empty array, to populate with form settings |
| 172 | 172 | $form_settings = array(); |
| 173 | - $form_data = $form_results[0]; // store the results |
|
| 173 | + $form_data = $form_results[ 0 ]; // store the results |
|
| 174 | 174 | // store the settings in our array |
| 175 | - $form_settings['list_id'] = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
| 176 | - $form_settings['form_name'] = esc_attr( $form_data['form_name'] ); // form name |
|
| 177 | - $form_settings['form_description'] = esc_attr( stripslashes( $form_data['form_description'] ) ); |
|
| 178 | - $form_settings['fields'] = json_decode( $form_data['fields'] , true ); |
|
| 179 | - $form_settings['styles'] = json_decode( stripslashes( $form_data['custom_styles'] ) , true ); |
|
| 180 | - $form_settings['send_welcome'] = $form_data['send_welcome_email']; |
|
| 181 | - $form_settings['submission_settings'] = json_decode( stripslashes( $form_data['submission_settings'] ) , true ); |
|
| 182 | - $form_settings['optin_settings'] = json_decode( stripslashes( $form_data['optin_settings'] ) , true ); |
|
| 183 | - $form_settings['error_messages'] = json_decode( $form_data['error_messages'] , true ); |
|
| 184 | - $form_settings['notifications'] = isset( $form_data['custom_notifications'] ) ? json_decode( stripslashes( $form_data['custom_notifications'] ) , true ) : ''; |
|
| 185 | - $form_settings['submissions'] = $form_data['submissions']; |
|
| 175 | + $form_settings[ 'list_id' ] = sanitize_key( $form_data[ 'list_id' ] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
| 176 | + $form_settings[ 'form_name' ] = esc_attr( $form_data[ 'form_name' ] ); // form name |
|
| 177 | + $form_settings[ 'form_description' ] = esc_attr( stripslashes( $form_data[ 'form_description' ] ) ); |
|
| 178 | + $form_settings[ 'fields' ] = json_decode( $form_data[ 'fields' ], true ); |
|
| 179 | + $form_settings[ 'styles' ] = json_decode( stripslashes( $form_data[ 'custom_styles' ] ), true ); |
|
| 180 | + $form_settings[ 'send_welcome' ] = $form_data[ 'send_welcome_email' ]; |
|
| 181 | + $form_settings[ 'submission_settings' ] = json_decode( stripslashes( $form_data[ 'submission_settings' ] ), true ); |
|
| 182 | + $form_settings[ 'optin_settings' ] = json_decode( stripslashes( $form_data[ 'optin_settings' ] ), true ); |
|
| 183 | + $form_settings[ 'error_messages' ] = json_decode( $form_data[ 'error_messages' ], true ); |
|
| 184 | + $form_settings[ 'notifications' ] = isset( $form_data[ 'custom_notifications' ] ) ? json_decode( stripslashes( $form_data[ 'custom_notifications' ] ), true ) : ''; |
|
| 185 | + $form_settings[ 'submissions' ] = $form_data[ 'submissions' ]; |
|
| 186 | 186 | // return the given form settings in an array |
| 187 | 187 | return $form_settings; |
| 188 | 188 | } |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | return; |
| 210 | 210 | } |
| 211 | 211 | // trim trailing period |
| 212 | - if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) { |
|
| 213 | - $response_text = $form_settings['error_messages']['update-link']; |
|
| 212 | + if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) { |
|
| 213 | + $response_text = $form_settings[ 'error_messages' ][ 'update-link' ]; |
|
| 214 | 214 | // extract the link text |
| 215 | 215 | preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text ); |
| 216 | 216 | if ( $link_text && ! empty( $link_text ) ) { |
| 217 | 217 | // Extract the custom link text ([link]*[/link]) |
| 218 | - $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) ); |
|
| 218 | + $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) ); |
|
| 219 | 219 | // Replace the link text, with our custom link text |
| 220 | 220 | $response_text = str_replace( $link_text, $custom_link_text, $response_text ); |
| 221 | 221 | } |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | return; |
| 243 | 243 | } |
| 244 | 244 | // trim trailing period |
| 245 | - if ( isset( $form_settings['error_messages']['already-subscribed'] ) && ! empty( $form_settings['error_messages']['already-subscribed'] ) ) { |
|
| 246 | - $response_text = str_replace( '[email]', $email, $form_settings['error_messages']['already-subscribed'] ); |
|
| 245 | + if ( isset( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) { |
|
| 246 | + $response_text = str_replace( '[email]', $email, $form_settings[ 'error_messages' ][ 'already-subscribed' ] ); |
|
| 247 | 247 | } |
| 248 | 248 | // Return our new string |
| 249 | 249 | return $response_text; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | // Process our form submissions (non ajax forms) |
| 19 | 19 | if ( ! isset( $_POST['yikes_easy_mc_new_subscriber'] ) || ! wp_verify_nonce( $_POST['yikes_easy_mc_new_subscriber'], 'yikes_easy_mc_form_submit' ) ) { |
| 20 | 20 | |
| 21 | - $process_submission_response = '<p><small class="form_submission_error">' . __( "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' ) . '</small></p>'; |
|
| 21 | + $process_submission_response = '<p><small class="form_submission_error">' . __( "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' ) . '</small></p>'; |
|
| 22 | 22 | return; |
| 23 | 23 | |
| 24 | 24 | } else { |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | $merge_variables = apply_filters( 'yikes-mailchimp-before-submission-' . $form_id, $merge_variables ); |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | - * Action hooks fired before API request |
|
| 128 | - * @since 6.0.5.5 |
|
| 129 | - * @param $merge_variables array Array of merge variable to use |
|
| 130 | - * @param $form_id integer The form ID to target (eg: 1, 2 etc.) |
|
| 131 | - */ |
|
| 127 | + * Action hooks fired before API request |
|
| 128 | + * @since 6.0.5.5 |
|
| 129 | + * @param $merge_variables array Array of merge variable to use |
|
| 130 | + * @param $form_id integer The form ID to target (eg: 1, 2 etc.) |
|
| 131 | + */ |
|
| 132 | 132 | do_action( 'yikes-mailchimp-before-submission', $merge_variables ); |
| 133 | 133 | do_action( 'yikes-mailchimp-before-submission-' . $form_id, $merge_variables ); |
| 134 | 134 | |
@@ -8,45 +8,45 @@ discard block |
||
| 8 | 8 | global $form_submitted, $process_submission_response; |
| 9 | 9 | |
| 10 | 10 | // confirm we have a form id to work with |
| 11 | -$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? $_POST['yikes-mailchimp-submitted-form'] : false; |
|
| 12 | -if( ! $form_id ) { |
|
| 11 | +$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? $_POST[ 'yikes-mailchimp-submitted-form' ] : false; |
|
| 12 | +if ( ! $form_id ) { |
|
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $_POST['yikes-mailchimp-submitted-form'] ); |
|
| 16 | +$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $_POST[ 'yikes-mailchimp-submitted-form' ] ); |
|
| 17 | 17 | |
| 18 | 18 | // Process our form submissions (non ajax forms) |
| 19 | -if ( ! isset( $_POST['yikes_easy_mc_new_subscriber'] ) || ! wp_verify_nonce( $_POST['yikes_easy_mc_new_subscriber'], 'yikes_easy_mc_form_submit' ) ) { |
|
| 19 | +if ( ! isset( $_POST[ 'yikes_easy_mc_new_subscriber' ] ) || ! wp_verify_nonce( $_POST[ 'yikes_easy_mc_new_subscriber' ], 'yikes_easy_mc_form_submit' ) ) { |
|
| 20 | 20 | |
| 21 | - $process_submission_response = '<p><small class="form_submission_error">' . __( "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' ) . '</small></p>'; |
|
| 21 | + $process_submission_response = '<p><small class="form_submission_error">' . __( "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' ) . '</small></p>'; |
|
| 22 | 22 | return; |
| 23 | 23 | |
| 24 | 24 | } else { |
| 25 | 25 | |
| 26 | 26 | /* Check for Honeypot filled */ |
| 27 | - $honey_pot_filled = ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $_POST['yikes-mailchimp-honeypot'] != '' ) ? true : false; |
|
| 27 | + $honey_pot_filled = ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $_POST[ 'yikes-mailchimp-honeypot' ] != '' ) ? true : false; |
|
| 28 | 28 | // if it was filled out, return an error... |
| 29 | 29 | if ( $honey_pot_filled ) { |
| 30 | - $process_submission_response = '<p><small class="form_submission_error">' . __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted." , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>'; |
|
| 30 | + $process_submission_response = '<p><small class="form_submission_error">' . __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted.", 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>'; |
|
| 31 | 31 | return; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Check reCAPTCHA Response |
| 35 | - if( isset( $_POST['g-recaptcha-response'] ) ) { |
|
| 36 | - $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $_POST['g-recaptcha-response'] . '&remoteip=' . $_SERVER["REMOTE_ADDR"] ); |
|
| 35 | + if ( isset( $_POST[ 'g-recaptcha-response' ] ) ) { |
|
| 36 | + $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $_POST[ 'g-recaptcha-response' ] . '&remoteip=' . $_SERVER[ "REMOTE_ADDR" ] ); |
|
| 37 | 37 | $response = wp_remote_get( $url ); |
| 38 | - $response_body = json_decode( $response['body'] , true ); |
|
| 38 | + $response_body = json_decode( $response[ 'body' ], true ); |
|
| 39 | 39 | |
| 40 | 40 | // if we've hit an error, lets return the error! |
| 41 | - if( $response_body['success'] != 1 ) { |
|
| 41 | + if ( $response_body[ 'success' ] != 1 ) { |
|
| 42 | 42 | $recaptcha_error = array(); // empty array to store error messages |
| 43 | - foreach( $response_body['error-codes'] as $error_code ) { |
|
| 44 | - if( $error_code == 'missing-input-response' ) { |
|
| 43 | + foreach ( $response_body[ 'error-codes' ] as $error_code ) { |
|
| 44 | + if ( $error_code == 'missing-input-response' ) { |
|
| 45 | 45 | $error_code = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' ); |
| 46 | 46 | } |
| 47 | - $recaptcha_error[] = $error_code; |
|
| 47 | + $recaptcha_error[ ] = $error_code; |
|
| 48 | 48 | } |
| 49 | - $process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ' , $recaptcha_error ) ) . "</p>"; |
|
| 49 | + $process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ', $recaptcha_error ) ) . "</p>"; |
|
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -56,20 +56,20 @@ discard block |
||
| 56 | 56 | * No HTML5 validation, and don't want to use jQuery for non-ajax forms |
| 57 | 57 | */ |
| 58 | 58 | $missing_required_checkbox_interest_groups = array(); |
| 59 | - foreach( $form_settings['fields'] as $merge_tag => $field_data ) { |
|
| 60 | - if( is_numeric( $merge_tag ) ) { |
|
| 59 | + foreach ( $form_settings[ 'fields' ] as $merge_tag => $field_data ) { |
|
| 60 | + if ( is_numeric( $merge_tag ) ) { |
|
| 61 | 61 | // check if the checkbox group was set to required, if so return an error |
| 62 | - if( isset( $field_data['require'] ) && $field_data['require'] == 1 ) { |
|
| 63 | - if( $field_data['type'] == 'checkboxes' ) { |
|
| 64 | - if( ! isset( $_POST[$merge_tag] ) ) { |
|
| 65 | - $missing_required_checkbox_interest_groups[] = $merge_tag; |
|
| 62 | + if ( isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] == 1 ) { |
|
| 63 | + if ( $field_data[ 'type' ] == 'checkboxes' ) { |
|
| 64 | + if ( ! isset( $_POST[ $merge_tag ] ) ) { |
|
| 65 | + $missing_required_checkbox_interest_groups[ ] = $merge_tag; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
| 72 | + if ( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
| 73 | 73 | $process_submission_response = '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-mailchimp-interest-group-required-top-error', sprintf( _n( 'It looks like you forgot to fill in a required field.', 'It looks like you forgot to fill in %s required fields.', count( $missing_required_checkbox_interest_groups ), 'yikes-inc-easy-mailchimp-extender' ), count( $missing_required_checkbox_interest_groups ) ), count( $missing_required_checkbox_interest_groups ), $form_id ) . '</p>'; |
| 74 | 74 | return; |
| 75 | 75 | } |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // loop to push variables to our array |
| 81 | 81 | foreach ( $_POST as $merge_tag => $value ) { |
| 82 | - if( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) { |
|
| 82 | + if ( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) { |
|
| 83 | 83 | // check if the current iteration has a 'date_format' key set |
| 84 | 84 | // (aka - date/birthday fields) |
| 85 | - if( isset( $form_settings['fields'][$merge_tag]['date_format'] ) ) { |
|
| 85 | + if ( isset( $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] ) ) { |
|
| 86 | 86 | // check if EU date format |
| 87 | - if( $form_settings['fields'][$merge_tag]['date_format'] == 'DD/MM/YYYY' ) { |
|
| 87 | + if ( $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] == 'DD/MM/YYYY' ) { |
|
| 88 | 88 | // convert '/' to '.' and to UNIX timestamp |
| 89 | 89 | $value = ( '' != $value ) ? date( 'Y-m-d', strtotime( str_replace( '/', '.', $value ) ) ) : ''; |
| 90 | 90 | } else { |
@@ -92,23 +92,23 @@ discard block |
||
| 92 | 92 | $value = ( '' != $value ) ? date( 'Y-m-d', strtotime( $value ) ) : ''; |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | - if( is_numeric( $merge_tag ) ) { // this is is an interest group! |
|
| 96 | - $merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) ); |
|
| 95 | + if ( is_numeric( $merge_tag ) ) { // this is is an interest group! |
|
| 96 | + $merge_variables[ 'groupings' ][ ] = array( 'id' => $merge_tag, 'groups' => ( is_array( $value ) ) ? $value : array( $value ) ); |
|
| 97 | 97 | } else { // or else it's just a standard merge variable |
| 98 | - $merge_variables[$merge_tag] = $value; |
|
| 98 | + $merge_variables[ $merge_tag ] = $value; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // store the opt-in time |
| 104 | - $merge_variables['optin_time'] = current_time( 'Y-m-d H:i:s', 1 ); |
|
| 104 | + $merge_variables[ 'optin_time' ] = current_time( 'Y-m-d H:i:s', 1 ); |
|
| 105 | 105 | |
| 106 | 106 | // Submit our form data |
| 107 | - $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
| 107 | + $api_key = trim( get_option( 'yikes-mc-api-key', '' ) ); |
|
| 108 | 108 | $dash_position = strpos( $api_key, '-' ); |
| 109 | 109 | |
| 110 | 110 | // setup the end point |
| 111 | - if( $dash_position !== false ) { |
|
| 111 | + if ( $dash_position !== false ) { |
|
| 112 | 112 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/subscribe.json'; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * Allow users to check for submit value |
| 137 | 137 | * and pass back an error to the user |
| 138 | 138 | */ |
| 139 | - if( isset( $merge_variables['error'] ) ) { |
|
| 140 | - $process_submission_response = apply_filters( 'yikes-mailchimp-frontend-content' , $merge_variables['message'] ); |
|
| 139 | + if ( isset( $merge_variables[ 'error' ] ) ) { |
|
| 140 | + $process_submission_response = apply_filters( 'yikes-mailchimp-frontend-content', $merge_variables[ 'message' ] ); |
|
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | * Setup whether or not we should update the user, or display the error with email generation |
| 146 | 146 | * @since 6.1 |
| 147 | 147 | */ |
| 148 | - if ( isset( $form_settings['optin_settings']['update_existing_user'] ) && 1 === absint( $form_settings['optin_settings']['update_existing_user'] ) ) { |
|
| 148 | + if ( isset( $form_settings[ 'optin_settings' ][ 'update_existing_user' ] ) && 1 === absint( $form_settings[ 'optin_settings' ][ 'update_existing_user' ] ) ) { |
|
| 149 | 149 | $update_existing_user = 1; |
| 150 | 150 | // Should we send the update email |
| 151 | - if ( isset( $form_settings['optin_settings']['send_update_email'] ) && 1 === absint( $form_settings['optin_settings']['send_update_email'] ) ) { |
|
| 151 | + if ( isset( $form_settings[ 'optin_settings' ][ 'send_update_email' ] ) && 1 === absint( $form_settings[ 'optin_settings' ][ 'send_update_email' ] ) ) { |
|
| 152 | 152 | $update_existing_user = 0; |
| 153 | 153 | } |
| 154 | 154 | } else { |
@@ -160,14 +160,14 @@ discard block |
||
| 160 | 160 | $subscribe_response = wp_remote_post( $api_endpoint, array( |
| 161 | 161 | 'body' => apply_filters( 'yikes-mailchimp-user-subscribe-api-request', array( |
| 162 | 162 | 'apikey' => $api_key, |
| 163 | - 'id' => $_POST['yikes-mailchimp-associated-list-id'], |
|
| 164 | - 'email' => array( 'email' => sanitize_email( $_POST['EMAIL'] ) ), |
|
| 163 | + 'id' => $_POST[ 'yikes-mailchimp-associated-list-id' ], |
|
| 164 | + 'email' => array( 'email' => sanitize_email( $_POST[ 'EMAIL' ] ) ), |
|
| 165 | 165 | 'merge_vars' => $merge_variables, |
| 166 | - 'double_optin' => $form_settings['optin_settings']['optin'], |
|
| 166 | + 'double_optin' => $form_settings[ 'optin_settings' ][ 'optin' ], |
|
| 167 | 167 | 'update_existing' => $update_existing_user, // Decide if we should update the user or not |
| 168 | - 'send_welcome' => $form_settings['optin_settings']['send_welcome_email'], |
|
| 169 | - 'replace_interests' => ( isset( $form_settings['submission_settings']['replace_interests'] ) ) ? $form_settings['submission_settings']['replace_interests'] : 1, // defaults to replace |
|
| 170 | - ), $form_id, $_POST['yikes-mailchimp-associated-list-id'], $_POST['EMAIL'] ), |
|
| 168 | + 'send_welcome' => $form_settings[ 'optin_settings' ][ 'send_welcome_email' ], |
|
| 169 | + 'replace_interests' => ( isset( $form_settings[ 'submission_settings' ][ 'replace_interests' ] ) ) ? $form_settings[ 'submission_settings' ][ 'replace_interests' ] : 1, // defaults to replace |
|
| 170 | + ), $form_id, $_POST[ 'yikes-mailchimp-associated-list-id' ], $_POST[ 'EMAIL' ] ), |
|
| 171 | 171 | 'timeout' => 10, |
| 172 | 172 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
| 173 | 173 | ) ); |
@@ -175,67 +175,67 @@ discard block |
||
| 175 | 175 | $subscribe_response = json_decode( wp_remote_retrieve_body( $subscribe_response ), true ); |
| 176 | 176 | |
| 177 | 177 | // check for any errors |
| 178 | - if( isset( $subscribe_response['error'] ) ) { |
|
| 178 | + if ( isset( $subscribe_response[ 'error' ] ) ) { |
|
| 179 | 179 | |
| 180 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 180 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 181 | 181 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 182 | 182 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 183 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response['error'], __( "Subscribe New User" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" ); |
|
| 183 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response[ 'error' ], __( "Subscribe New User", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" ); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $update_account_details_link = ''; |
| 187 | - switch( $subscribe_response['code'] ) { |
|
| 187 | + switch ( $subscribe_response[ 'code' ] ) { |
|
| 188 | 188 | // user already subscribed |
| 189 | 189 | case '214': |
| 190 | - $custom_already_subscribed_text = apply_filters( 'yikes-easy-mailchimp-update-existing-subscriber-text', sprintf( __( ' To update your MailChimp profile, please %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a class="send-update-email" data-list-id="' . $_POST['yikes-mailchimp-associated-list-id'] . '" data-user-email="' . sanitize_email( $_POST['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ), $form_id, '<a class="send-update-email" data-list-id="' . $_POST['yikes-mailchimp-associated-list-id'] . '" data-user-email="' . sanitize_email( $_POST['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); |
|
| 191 | - $update_account_details_link = ( 1 === absint( $form_settings['optin_settings']['update_existing_user'] ) && 1 === absint( $form_settings['optin_settings']['send_update_email'] ) ) ? $custom_already_subscribed_text : false; |
|
| 192 | - if( $update_account_details_link ) { |
|
| 190 | + $custom_already_subscribed_text = apply_filters( 'yikes-easy-mailchimp-update-existing-subscriber-text', sprintf( __( ' To update your MailChimp profile, please %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a class="send-update-email" data-list-id="' . $_POST[ 'yikes-mailchimp-associated-list-id' ] . '" data-user-email="' . sanitize_email( $_POST[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ), $form_id, '<a class="send-update-email" data-list-id="' . $_POST[ 'yikes-mailchimp-associated-list-id' ] . '" data-user-email="' . sanitize_email( $_POST[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); |
|
| 191 | + $update_account_details_link = ( 1 === absint( $form_settings[ 'optin_settings' ][ 'update_existing_user' ] ) && 1 === absint( $form_settings[ 'optin_settings' ][ 'send_update_email' ] ) ) ? $custom_already_subscribed_text : false; |
|
| 192 | + if ( $update_account_details_link ) { |
|
| 193 | 193 | // if update account details is set, we need to include our script to send out the update email |
| 194 | - wp_enqueue_script( 'update-existing-subscriber.js', YIKES_MC_URL . 'public/js/yikes-update-existing-subscriber.js' , array( 'jquery' ), 'all' ); |
|
| 194 | + wp_enqueue_script( 'update-existing-subscriber.js', YIKES_MC_URL . 'public/js/yikes-update-existing-subscriber.js', array( 'jquery' ), 'all' ); |
|
| 195 | 195 | wp_localize_script( 'update-existing-subscriber.js', 'update_subscriber_details_data', array( |
| 196 | 196 | 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
| 197 | 197 | 'preloader_url' => apply_filters( 'yikes-mailchimp-preloader', esc_url_raw( admin_url( 'images/wpspin_light.gif' ) ) ), |
| 198 | 198 | ) ); |
| 199 | 199 | } |
| 200 | - if( ! empty( $form_settings['error_messages']['already-subscribed'] ) ) { |
|
| 201 | - $process_submission_response = '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $form_settings['error_messages']['already-subscribed'], $form_id, $_POST['EMAIL'] ) . ' ' . $update_account_details_link . '</p>'; |
|
| 200 | + if ( ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) { |
|
| 201 | + $process_submission_response = '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $form_settings[ 'error_messages' ][ 'already-subscribed' ], $form_id, $_POST[ 'EMAIL' ] ) . ' ' . $update_account_details_link . '</p>'; |
|
| 202 | 202 | } else { |
| 203 | - $process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response['error'] . ' ' . $update_account_details_link . '</p>'; |
|
| 203 | + $process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response[ 'error' ] . ' ' . $update_account_details_link . '</p>'; |
|
| 204 | 204 | } |
| 205 | 205 | break; |
| 206 | 206 | // missing a required field |
| 207 | 207 | case '250': |
| 208 | 208 | // get all merge variables in array, loop and str_replace error code with field name |
| 209 | - $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
| 209 | + $api_key = trim( get_option( 'yikes-mc-api-key', '' ) ); |
|
| 210 | 210 | $dash_position = strpos( $api_key, '-' ); |
| 211 | - if( $dash_position !== false ) { |
|
| 211 | + if ( $dash_position !== false ) { |
|
| 212 | 212 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json'; |
| 213 | 213 | } |
| 214 | 214 | $merge_variables = wp_remote_post( $api_endpoint, array( |
| 215 | 215 | 'body' => array( |
| 216 | 216 | 'apikey' => $api_key, |
| 217 | - 'id' => array( $_POST['yikes-mailchimp-associated-list-id'] ) , |
|
| 217 | + 'id' => array( $_POST[ 'yikes-mailchimp-associated-list-id' ] ), |
|
| 218 | 218 | ), |
| 219 | 219 | 'timeout' => 10, |
| 220 | 220 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ), |
| 221 | 221 | ) ); |
| 222 | 222 | $merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true ); |
| 223 | - if( isset( $merge_variables['error'] ) ) { |
|
| 224 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 223 | + if ( isset( $merge_variables[ 'error' ] ) ) { |
|
| 224 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 225 | 225 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 226 | 226 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 227 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" ); |
|
| 227 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" ); |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | // re-store our data |
| 231 | - $merge_variables = $merge_variables['data'][0]['merge_vars']; |
|
| 231 | + $merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ]; |
|
| 232 | 232 | $merge_variable_name_array = array(); |
| 233 | - foreach( $merge_variables as $merge_var ) { |
|
| 234 | - $merge_variables_name_array[$merge_var['tag']] = $merge_var['name']; |
|
| 233 | + foreach ( $merge_variables as $merge_var ) { |
|
| 234 | + $merge_variables_name_array[ $merge_var[ 'tag' ] ] = $merge_var[ 'name' ]; |
|
| 235 | 235 | } |
| 236 | - $error_message = $subscribe_response['error']; |
|
| 236 | + $error_message = $subscribe_response[ 'error' ]; |
|
| 237 | 237 | // replace tag with name in the error message. |
| 238 | - foreach( $merge_variables_name_array as $tag => $name ) { |
|
| 238 | + foreach ( $merge_variables_name_array as $tag => $name ) { |
|
| 239 | 239 | $error_message = str_replace( $tag, $name, $error_message ); |
| 240 | 240 | } |
| 241 | 241 | $process_submission_response = '<p class="yikes-easy-mc-error-message">' . $error_message . '.</p>'; |
@@ -243,18 +243,18 @@ discard block |
||
| 243 | 243 | // [email protected] is not allowed |
| 244 | 244 | case '-99': |
| 245 | 245 | // generic error |
| 246 | - $process_submission_response = '<p class="yikes-easy-mc-error-message">' . str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response['error'] ) ) . '</p>'; |
|
| 246 | + $process_submission_response = '<p class="yikes-easy-mc-error-message">' . str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response[ 'error' ] ) ) . '</p>'; |
|
| 247 | 247 | break; |
| 248 | 248 | // invalid email (or no email at all) |
| 249 | 249 | case '-100': |
| 250 | - $process_submission_response = ( ! empty( $form_settings['error_messages']['invalid-email'] ) ) ? '<p class="yikes-easy-mc-error-message">' . $form_settings['error_messages']['invalid-email'] . '</p>' : '<p class="yikes-easy-mc-error-message">' . __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 250 | + $process_submission_response = ( ! empty( $form_settings[ 'error_messages' ][ 'invalid-email' ] ) ) ? '<p class="yikes-easy-mc-error-message">' . $form_settings[ 'error_messages' ][ 'invalid-email' ] . '</p>' : '<p class="yikes-easy-mc-error-message">' . __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 251 | 251 | break; |
| 252 | 252 | default: |
| 253 | 253 | // generic error |
| 254 | - if( ! empty( $form_settings['error_messages']['general-error'] ) ) { |
|
| 255 | - $process_submission_response = '<p class="yikes-easy-mc-error-message">' . $form_settings['error_messages']['general-error'] . '</p>'; |
|
| 254 | + if ( ! empty( $form_settings[ 'error_messages' ][ 'general-error' ] ) ) { |
|
| 255 | + $process_submission_response = '<p class="yikes-easy-mc-error-message">' . $form_settings[ 'error_messages' ][ 'general-error' ] . '</p>'; |
|
| 256 | 256 | } else { |
| 257 | - $process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response['error'] . '</p>'; |
|
| 257 | + $process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response[ 'error' ] . '</p>'; |
|
| 258 | 258 | } |
| 259 | 259 | break; |
| 260 | 260 | } |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | $form_submitted = 1; |
| 266 | 266 | |
| 267 | 267 | // Display the success message |
| 268 | - if( ! empty( $form_settings['error_messages']['success'] ) ) { |
|
| 269 | - $process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', stripslashes( esc_html( $form_settings['error_messages']['success'] ) ), $form_id, $merge_variables ) . '</p>'; |
|
| 268 | + if ( ! empty( $form_settings[ 'error_messages' ][ 'success' ] ) ) { |
|
| 269 | + $process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', stripslashes( esc_html( $form_settings[ 'error_messages' ][ 'success' ] ) ), $form_id, $merge_variables ) . '</p>'; |
|
| 270 | 270 | // echo stripslashes( esc_html( $error_messages['success'] ) ); |
| 271 | 271 | } else { |
| 272 | - $default_success_response = ( 1 === $form_settings['optin_settings']['optin'] ) ? __( 'Thank you for subscribing! Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ) : __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 272 | + $default_success_response = ( 1 === $form_settings[ 'optin_settings' ][ 'optin' ] ) ? __( 'Thank you for subscribing! Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ) : __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 273 | 273 | $process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', $default_success_response, $form_id, $merge_variables ) . '</p>'; |
| 274 | 274 | // echo $default_success_response; |
| 275 | 275 | } |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | * optional @form - the ID of the form to filter |
| 283 | 283 | * @since 6.0.0 |
| 284 | 284 | */ |
| 285 | - do_action( 'yikes-mailchimp-after-submission' , $merge_variables ); |
|
| 286 | - do_action( 'yikes-mailchimp-after-submission-' . $form_id , $merge_variables ); |
|
| 285 | + do_action( 'yikes-mailchimp-after-submission', $merge_variables ); |
|
| 286 | + do_action( 'yikes-mailchimp-after-submission-' . $form_id, $merge_variables ); |
|
| 287 | 287 | |
| 288 | 288 | /* |
| 289 | 289 | * Non-AJAX redirects now handled in class-yikes-inc-easy-mailchimp-extender-public.php |
@@ -301,23 +301,23 @@ discard block |
||
| 301 | 301 | * @$notifications - the notification array |
| 302 | 302 | * @since 6.0.0 |
| 303 | 303 | */ |
| 304 | - do_action( 'yikes-mailchimp-form-submission' , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] ); |
|
| 305 | - do_action( 'yikes-mailchimp-form-submission-' . $form_id , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] ); |
|
| 304 | + do_action( 'yikes-mailchimp-form-submission', $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] ); |
|
| 305 | + do_action( 'yikes-mailchimp-form-submission-' . $form_id, $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] ); |
|
| 306 | 306 | |
| 307 | 307 | /* |
| 308 | 308 | * Increase the submission count for this form |
| 309 | 309 | * on a successful submission |
| 310 | 310 | * @since 6.0.0 |
| 311 | 311 | */ |
| 312 | - $form_settings['submissions']++; |
|
| 312 | + $form_settings[ 'submissions' ]++; |
|
| 313 | 313 | $wpdb->update( |
| 314 | 314 | $wpdb->prefix . 'yikes_easy_mc_forms', |
| 315 | 315 | array( |
| 316 | - 'submissions' => $form_settings['submissions'], |
|
| 316 | + 'submissions' => $form_settings[ 'submissions' ], |
|
| 317 | 317 | ), |
| 318 | 318 | array( 'ID' => $form_id ), |
| 319 | 319 | array( |
| 320 | - '%d', // send welcome email |
|
| 320 | + '%d', // send welcome email |
|
| 321 | 321 | ), |
| 322 | 322 | array( '%d' ) |
| 323 | 323 | ); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | 'recaptcha_data_callback' => '', // set a custom js callback function to run after a successful recaptcha response - default none |
| 22 | 22 | 'recaptcha_expired_callback' => '', // set a custom js callback function to run after the recaptcha has expired - default none |
| 23 | 23 | 'inline' => '0', |
| 24 | - ), $atts , 'yikes-mailchimp' ) |
|
| 24 | + ), $atts, 'yikes-mailchimp' ) |
|
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | 27 | // set globals |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | $form_submitted = isset( $form_submitted ) ? $form_submitted : 0; |
| 32 | 32 | |
| 33 | 33 | /* If the user hasn't authenticated yet, lets kill off */ |
| 34 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
| 35 | - 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>'; |
|
| 34 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
| 35 | + 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>'; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // if the user forgot to specify a form ID, lets kill of and warn them. |
| 39 | - if( ! $form ) { |
|
| 39 | + if ( ! $form ) { |
|
| 40 | 40 | return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' ); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -45,39 +45,39 @@ discard block |
||
| 45 | 45 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A ); |
| 46 | 46 | |
| 47 | 47 | // confirm we have some results, or return an error |
| 48 | - if( !$form_results ) { |
|
| 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' ); |
|
| 48 | + if ( ! $form_results ) { |
|
| 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( ! isset( $atts['recaptcha'] ) || ( isset( $atts['recaptcha'] ) && $atts['recaptcha'] == '1' ) ) { |
|
| 57 | + if ( ! isset( $atts[ 'recaptcha' ] ) || ( isset( $atts[ 'recaptcha' ] ) && $atts[ 'recaptcha' ] == '1' ) ) { |
|
| 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 = ( isset( $locale_split ) ? $locale_split[0] : $locale ); |
|
| 75 | - $lang = ( isset( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $locale_split[0]; |
|
| 76 | - $type = ( isset( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type |
|
| 77 | - $theme= ( isset( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme |
|
| 78 | - $size = ( isset( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size |
|
| 79 | - $data_callback = ( isset( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size |
|
| 80 | - $expired_callback = ( isset( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size |
|
| 74 | + $lang = ( isset( $locale_split ) ? $locale_split[ 0 ] : $locale ); |
|
| 75 | + $lang = ( isset( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $locale_split[ 0 ]; |
|
| 76 | + $type = ( isset( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type |
|
| 77 | + $theme = ( isset( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme |
|
| 78 | + $size = ( isset( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size |
|
| 79 | + $data_callback = ( isset( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size |
|
| 80 | + $expired_callback = ( isset( $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, |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | 'expired_callback' => $expired_callback, |
| 89 | 89 | ), $form ); |
| 90 | 90 | // enqueue Google recaptcha JS |
| 91 | - wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ) , 'all' ); |
|
| 91 | + wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ), 'all' ); |
|
| 92 | 92 | wp_enqueue_script( 'google-recaptcha-js' ); |
| 93 | - $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' ); |
|
| 94 | - $recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params['theme'] . '" data-type="' . $recaptcha_shortcode_params['type'] . '" data-size="' . $recaptcha_shortcode_params['size'] . '" data-callback="' . $recaptcha_shortcode_params['success_callback'] . '" data-expired-callback="' . $recaptcha_shortcode_params['expired_callback'] . '"></div>'; |
|
| 93 | + $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' ); |
|
| 94 | + $recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params[ 'theme' ] . '" data-type="' . $recaptcha_shortcode_params[ 'type' ] . '" data-size="' . $recaptcha_shortcode_params[ 'size' ] . '" data-callback="' . $recaptcha_shortcode_params[ 'success_callback' ] . '" data-expired-callback="' . $recaptcha_shortcode_params[ 'expired_callback' ] . '"></div>'; |
|
| 95 | 95 | ?> |
| 96 | 96 | <script type="text/javascript"> |
| 97 | 97 | /* Script Callback to init. multiple recaptchas on a single page */ |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // place our results into a seperate variable for easy looping |
| 121 | - $form_data = $form_results[0]; |
|
| 121 | + $form_data = $form_results[ 0 ]; |
|
| 122 | 122 | |
| 123 | 123 | // store our variables |
| 124 | - $form_id = (int) $form_data['id']; // form id (the id of the form in the database) |
|
| 124 | + $form_id = (int) $form_data[ 'id' ]; // form id (the id of the form in the database) |
|
| 125 | 125 | |
| 126 | 126 | /* |
| 127 | 127 | * Get the stored form settings |
@@ -130,32 +130,32 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | $form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $form_id ); |
| 132 | 132 | |
| 133 | - $additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? json_decode( $form_data['form_settings'], true ) : false; |
|
| 133 | + $additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? json_decode( $form_data[ 'form_settings' ], true ) : false; |
|
| 134 | 134 | // store our options from the additional form settings array |
| 135 | - $form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : ''; |
|
| 136 | - $inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : ''; |
|
| 137 | - $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text'; |
|
| 138 | - $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' ); |
|
| 139 | - $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : ''; |
|
| 140 | - $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : ''; |
|
| 135 | + $form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : ''; |
|
| 136 | + $inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : ''; |
|
| 137 | + $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text'; |
|
| 138 | + $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' ); |
|
| 139 | + $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : ''; |
|
| 140 | + $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : ''; |
|
| 141 | 141 | // scheuldes |
| 142 | - $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false; |
|
| 143 | - $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';; |
|
| 144 | - $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : ''; |
|
| 145 | - $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : ''; |
|
| 146 | - $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : ''; |
|
| 142 | + $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false; |
|
| 143 | + $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ; |
|
| 144 | + $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : ''; |
|
| 145 | + $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : ''; |
|
| 146 | + $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : ''; |
|
| 147 | 147 | // register required |
| 148 | - $form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false; |
|
| 149 | - $form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : ''; |
|
| 148 | + $form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false; |
|
| 149 | + $form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : ''; |
|
| 150 | 150 | // store number of fields |
| 151 | - $field_count = (int) count( $form_settings['fields'] ); |
|
| 151 | + $field_count = (int) count( $form_settings[ 'fields' ] ); |
|
| 152 | 152 | |
| 153 | 153 | // confirm we actually have fields, before looping |
| 154 | - if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
| 154 | + if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
| 155 | 155 | // loop over each field, if it's set to hidden -- subtract it from the field count |
| 156 | 156 | // this throws off the layout for inline forms setup below |
| 157 | - foreach( json_decode( $form_data['fields'] ) as $form_field ) { |
|
| 158 | - if( isset( $form_field->hide ) && $form_field->hide == 1 ) { |
|
| 157 | + foreach ( json_decode( $form_data[ 'fields' ] ) as $form_field ) { |
|
| 158 | + if ( isset( $form_field->hide ) && $form_field->hide == 1 ) { |
|
| 159 | 159 | $field_count--; |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | * If login is required, abort |
| 166 | 166 | * @since 6.0.3.8 |
| 167 | 167 | */ |
| 168 | - if( $form_login_required ) { |
|
| 169 | - if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
| 168 | + if ( $form_login_required ) { |
|
| 169 | + if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
| 170 | 170 | ob_start(); |
| 171 | 171 | ?> |
| 172 | 172 | <div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required"> |
@@ -182,19 +182,19 @@ discard block |
||
| 182 | 182 | * Check if schedule is set for this form |
| 183 | 183 | * @since 6.0.3.8 |
| 184 | 184 | */ |
| 185 | - if( $form_schedule_state ) { |
|
| 185 | + if ( $form_schedule_state ) { |
|
| 186 | 186 | // store current date |
| 187 | 187 | $current_date = strtotime( current_time( 'm/d/Y g:iA' ) ); |
| 188 | 188 | |
| 189 | 189 | // the the current date is less than the form scheduled start date |
| 190 | - if( $current_date < $form_schedule_start ) { |
|
| 190 | + if ( $current_date < $form_schedule_start ) { |
|
| 191 | 191 | echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message ); |
| 192 | 192 | return; |
| 193 | 193 | // abort |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // The current date is past or equal to the end date, aka form has now expired |
| 197 | - if( $current_date >= $form_schedule_end ) { |
|
| 197 | + if ( $current_date >= $form_schedule_end ) { |
|
| 198 | 198 | echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message ); |
| 199 | 199 | return; |
| 200 | 200 | // abort |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | // setup the submit button text |
| 205 | 205 | // shortcode parameter takes precedence over option |
| 206 | - if( isset( $atts['submit'] ) ) { |
|
| 207 | - $submit = $atts['submit']; |
|
| 206 | + if ( isset( $atts[ 'submit' ] ) ) { |
|
| 207 | + $submit = $atts[ 'submit' ]; |
|
| 208 | 208 | } else { |
| 209 | 209 | $submit = $submit_button_text; |
| 210 | 210 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $page_data = $post; |
| 215 | 215 | |
| 216 | 216 | // Remove the post_password from this for security |
| 217 | - if( isset( $page_data->post_password ) ) { |
|
| 217 | + if ( isset( $page_data->post_password ) ) { |
|
| 218 | 218 | unset( $page_data->post_password ); |
| 219 | 219 | } |
| 220 | 220 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php |
| 229 | 229 | * @since 6.0.3.8 |
| 230 | 230 | */ |
| 231 | - if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
| 231 | + if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
| 232 | 232 | // enqueue the form styles |
| 233 | 233 | wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css', array( $last_key ) ); |
| 234 | 234 | } |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | /** |
| 237 | 237 | * Check for form inline parameter |
| 238 | 238 | */ |
| 239 | - $form_inline = ( isset( $atts['inline'] ) && ( $atts['inline'] == 1 || $atts['inline'] == 'true' ) ) ? true : false; |
|
| 239 | + $form_inline = ( isset( $atts[ 'inline' ] ) && ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' ) ) ? true : false; |
|
| 240 | 240 | // recheck from our form options |
| 241 | - if( ! $form_inline ) { |
|
| 242 | - $form_inline = ( isset( $additional_form_settings['yikes-easy-mc-inline-form'] ) && $additional_form_settings['yikes-easy-mc-inline-form'] == 1 ) ? true : false; |
|
| 241 | + if ( ! $form_inline ) { |
|
| 242 | + $form_inline = ( isset( $additional_form_settings[ 'yikes-easy-mc-inline-form' ] ) && $additional_form_settings[ 'yikes-easy-mc-inline-form' ] == 1 ) ? true : false; |
|
| 243 | 243 | } |
| 244 | - if( $form_inline ) { |
|
| 244 | + if ( $form_inline ) { |
|
| 245 | 245 | $field_width = (float) ( 100 / $field_count ); |
| 246 | 246 | $submit_button_width = (float) ( 20 / $field_count ); |
| 247 | 247 | /* |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | <?php |
| 271 | 271 | |
| 272 | 272 | /* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
| 273 | - if( is_user_logged_in() ) { |
|
| 274 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 273 | + if ( is_user_logged_in() ) { |
|
| 274 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 275 | 275 | $edit_form_link = '<span class="edit-link">'; |
| 276 | - $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 276 | + $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 277 | 277 | $edit_form_link .= '</span>'; |
| 278 | - $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings['form_name'] ) ); |
|
| 278 | + $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings[ 'form_name' ] ) ); |
|
| 279 | 279 | } else { |
| 280 | 280 | $edit_form_link = ''; |
| 281 | 281 | } |
@@ -284,16 +284,16 @@ discard block |
||
| 284 | 284 | // ensure there is an 'email' field the user can fill out |
| 285 | 285 | // or else MailChimp throws errors at you |
| 286 | 286 | // extract our array keys |
| 287 | - if( isset( $form_settings['fields'] ) && ! empty( $form_settings['fields'] ) ) { |
|
| 288 | - $array_keys = array_keys( $form_settings['fields'] ); |
|
| 287 | + if ( isset( $form_settings[ 'fields' ] ) && ! empty( $form_settings[ 'fields' ] ) ) { |
|
| 288 | + $array_keys = array_keys( $form_settings[ 'fields' ] ); |
|
| 289 | 289 | // check for EMAIL in that array |
| 290 | - if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) { |
|
| 291 | - 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>'; |
|
| 290 | + if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) { |
|
| 291 | + 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>'; |
|
| 292 | 292 | } |
| 293 | 293 | } else { |
| 294 | - $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 295 | - if( is_user_logged_in() ) { |
|
| 296 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 294 | + $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 295 | + if ( is_user_logged_in() ) { |
|
| 296 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 297 | 297 | return $error . $edit_form_link; |
| 298 | 298 | } |
| 299 | 299 | } else { |
@@ -311,13 +311,13 @@ discard block |
||
| 311 | 311 | * Set a custom title using custom_title="lorem ipsum" parameter in the shortcode |
| 312 | 312 | * - This takes precedence over the title set |
| 313 | 313 | */ |
| 314 | - if( ! empty( $title ) && $title == 1 && isset( $atts['custom_title'] ) ) { |
|
| 315 | - echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ) . '</h3>'; |
|
| 314 | + if ( ! empty( $title ) && $title == 1 && isset( $atts[ 'custom_title' ] ) ) { |
|
| 315 | + echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ) . '</h3>'; |
|
| 316 | 316 | } else { |
| 317 | 317 | // display the form description if the user |
| 318 | 318 | // has specified to do so |
| 319 | - if( ! empty( $title ) && $title == 1 ) { |
|
| 320 | - echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings['form_name'] ), $form_id ) . '</h3>'; |
|
| 319 | + if ( ! empty( $title ) && $title == 1 ) { |
|
| 320 | + echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings[ 'form_name' ] ), $form_id ) . '</h3>'; |
|
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
@@ -325,21 +325,21 @@ discard block |
||
| 325 | 325 | * Allow users to specify a custom description for this form, no html support |
| 326 | 326 | * @since 6.0.3.8 |
| 327 | 327 | */ |
| 328 | - if( ! empty( $description ) && $description == 1 && isset( $atts['custom_description'] ) ) { |
|
| 329 | - echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ) ) . '</section>'; |
|
| 328 | + if ( ! empty( $description ) && $description == 1 && isset( $atts[ 'custom_description' ] ) ) { |
|
| 329 | + echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ) ) . '</section>'; |
|
| 330 | 330 | } else { |
| 331 | 331 | // display the form description if the user |
| 332 | 332 | // has specified to do so |
| 333 | - if( ! empty( $description ) && $description == 1 ) { |
|
| 334 | - echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings['form_description'], $form_id ) ) . '</section>'; |
|
| 333 | + if ( ! empty( $description ) && $description == 1 ) { |
|
| 334 | + echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings[ 'form_description' ], $form_id ) ) . '</section>'; |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | // Check for AJAX |
| 339 | - if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_settings['submission_settings']['ajax'] == 1 ) { |
|
| 339 | + if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_settings[ 'submission_settings' ][ 'ajax' ] == 1 ) { |
|
| 340 | 340 | // enqueue our ajax script |
| 341 | - wp_register_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , 'yikes-inc-easy-mailchimp-extender', false ); |
|
| 342 | - wp_localize_script( 'yikes-easy-mc-ajax' , 'object' , array( |
|
| 341 | + wp_register_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js', array( 'jquery' ), 'yikes-inc-easy-mailchimp-extender', false ); |
|
| 342 | + wp_localize_script( 'yikes-easy-mc-ajax', 'object', array( |
|
| 343 | 343 | 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
| 344 | 344 | 'page_data' => $page_data, |
| 345 | 345 | 'interest_group_checkbox_error' => apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ), |
@@ -357,63 +357,63 @@ discard block |
||
| 357 | 357 | |
| 358 | 358 | // render the form! |
| 359 | 359 | ?> |
| 360 | - <form id="<?php echo sanitize_title( $form_settings['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_settings['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>"> |
|
| 360 | + <form id="<?php echo sanitize_title( $form_settings[ '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_settings[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>"> |
|
| 361 | 361 | |
| 362 | 362 | <?php |
| 363 | - foreach( $form_settings['fields'] as $field ) { |
|
| 363 | + foreach ( $form_settings[ 'fields' ] as $field ) { |
|
| 364 | 364 | // input array |
| 365 | 365 | $field_array = array(); |
| 366 | 366 | // label array |
| 367 | 367 | $label_array = array(); |
| 368 | 368 | // label classes array |
| 369 | 369 | $label_class_array = array(); |
| 370 | - if( $field['additional-classes'] != '' ) { |
|
| 370 | + if ( $field[ 'additional-classes' ] != '' ) { |
|
| 371 | 371 | // split custom classes at spaces |
| 372 | - $custom_classes = explode( ' ' , $field['additional-classes'] ); |
|
| 372 | + $custom_classes = explode( ' ', $field[ 'additional-classes' ] ); |
|
| 373 | 373 | // check our custom class array for field-left/field-right |
| 374 | 374 | // if it's set we need to assign it to our label and remove it from the field classes |
| 375 | 375 | // input half left |
| 376 | - if( in_array( 'field-left-half' , $custom_classes ) ) { |
|
| 376 | + if ( in_array( 'field-left-half', $custom_classes ) ) { |
|
| 377 | 377 | // $label_array['class'] = 'class="field-left-half"'; |
| 378 | - $label_class_array[] = 'field-left-half'; |
|
| 379 | - $key = array_search( 'field-left-half' , $custom_classes ); |
|
| 380 | - unset( $custom_classes[$key] ); |
|
| 378 | + $label_class_array[ ] = 'field-left-half'; |
|
| 379 | + $key = array_search( 'field-left-half', $custom_classes ); |
|
| 380 | + unset( $custom_classes[ $key ] ); |
|
| 381 | 381 | } // input half right |
| 382 | - if( in_array( 'field-right-half' , $custom_classes ) ) { |
|
| 382 | + if ( in_array( 'field-right-half', $custom_classes ) ) { |
|
| 383 | 383 | // $label_array['class'] = 'class="field-right-half"'; |
| 384 | - $label_class_array[] = 'field-right-half'; |
|
| 385 | - $key = array_search( 'field-right-half' , $custom_classes ); |
|
| 386 | - unset( $custom_classes[$key] ); |
|
| 384 | + $label_class_array[ ] = 'field-right-half'; |
|
| 385 | + $key = array_search( 'field-right-half', $custom_classes ); |
|
| 386 | + unset( $custom_classes[ $key ] ); |
|
| 387 | 387 | } // input thirds (1/3 width, floated left) |
| 388 | - if( in_array( 'field-third' , $custom_classes ) ) { |
|
| 388 | + if ( in_array( 'field-third', $custom_classes ) ) { |
|
| 389 | 389 | // $label_array['class'] = 'class="field-third"'; |
| 390 | - $label_class_array[] = 'field-third'; |
|
| 391 | - $key = array_search( 'field-third' , $custom_classes ); |
|
| 392 | - unset( $custom_classes[$key] ); |
|
| 390 | + $label_class_array[ ] = 'field-third'; |
|
| 391 | + $key = array_search( 'field-third', $custom_classes ); |
|
| 392 | + unset( $custom_classes[ $key ] ); |
|
| 393 | 393 | } // 2 column radio |
| 394 | - if( in_array( 'option-2-col' , $custom_classes ) ) { |
|
| 394 | + if ( in_array( 'option-2-col', $custom_classes ) ) { |
|
| 395 | 395 | // $label_array['class'] = 'class="option-2-col"'; |
| 396 | - $label_class_array[] = 'option-2-col'; |
|
| 397 | - $key = array_search( 'option-2-col' , $custom_classes ); |
|
| 398 | - unset( $custom_classes[$key] ); |
|
| 396 | + $label_class_array[ ] = 'option-2-col'; |
|
| 397 | + $key = array_search( 'option-2-col', $custom_classes ); |
|
| 398 | + unset( $custom_classes[ $key ] ); |
|
| 399 | 399 | } // 3 column radio |
| 400 | - if( in_array( 'option-3-col' , $custom_classes ) ) { |
|
| 400 | + if ( in_array( 'option-3-col', $custom_classes ) ) { |
|
| 401 | 401 | // $label_array['class'] = 'class="option-3-col"'; |
| 402 | - $label_class_array[] = 'option-3-col'; |
|
| 403 | - $key = array_search( 'option-3-col' , $custom_classes ); |
|
| 404 | - unset( $custom_classes[$key] ); |
|
| 402 | + $label_class_array[ ] = 'option-3-col'; |
|
| 403 | + $key = array_search( 'option-3-col', $custom_classes ); |
|
| 404 | + unset( $custom_classes[ $key ] ); |
|
| 405 | 405 | } // 4 column radio |
| 406 | - if( in_array( 'option-4-col' , $custom_classes ) ) { |
|
| 406 | + if ( in_array( 'option-4-col', $custom_classes ) ) { |
|
| 407 | 407 | // $label_array['class'] = 'class="option-4-col"'; |
| 408 | - $label_class_array[] = 'option-4-col'; |
|
| 409 | - $key = array_search( 'option-4-col' , $custom_classes ); |
|
| 410 | - unset( $custom_classes[$key] ); |
|
| 408 | + $label_class_array[ ] = 'option-4-col'; |
|
| 409 | + $key = array_search( 'option-4-col', $custom_classes ); |
|
| 410 | + unset( $custom_classes[ $key ] ); |
|
| 411 | 411 | } // inline radio & checkboxes etc |
| 412 | - if( in_array( 'option-inline' , $custom_classes ) ) { |
|
| 412 | + if ( in_array( 'option-inline', $custom_classes ) ) { |
|
| 413 | 413 | // $label_array['class'] = 'class="option-inline"'; |
| 414 | - $label_class_array[] = 'option-inline'; |
|
| 415 | - $key = array_search( 'option-inline' , $custom_classes ); |
|
| 416 | - unset( $custom_classes[$key] ); |
|
| 414 | + $label_class_array[ ] = 'option-inline'; |
|
| 415 | + $key = array_search( 'option-inline', $custom_classes ); |
|
| 416 | + unset( $custom_classes[ $key ] ); |
|
| 417 | 417 | } |
| 418 | 418 | } else { |
| 419 | 419 | $custom_classes = array(); |
@@ -421,67 +421,67 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | // if the form is set to inline, add the inline class to our labels |
| 423 | 423 | // since @6.0.3.8 |
| 424 | - if( $form_inline ) { |
|
| 425 | - $label_class_array[] = 'label-inline'; |
|
| 424 | + if ( $form_inline ) { |
|
| 425 | + $label_class_array[ ] = 'label-inline'; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - if( isset( $field['hide-label'] ) ) { |
|
| 429 | - if( $field['hide-label'] == 1 ) { |
|
| 430 | - $custom_classes[] = 'field-no-label'; |
|
| 428 | + if ( isset( $field[ 'hide-label' ] ) ) { |
|
| 429 | + if ( $field[ 'hide-label' ] == 1 ) { |
|
| 430 | + $custom_classes[ ] = 'field-no-label'; |
|
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /* Store tag variable based on field type */ |
| 435 | - if( isset( $field['merge'] ) ) { |
|
| 435 | + if ( isset( $field[ 'merge' ] ) ) { |
|
| 436 | 436 | $tag = 'merge'; |
| 437 | 437 | } else { |
| 438 | 438 | $tag = 'group_id'; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // build up our array |
| 442 | - $field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" '; |
|
| 443 | - $field_array['name'] = 'name="' . esc_attr( $field[$tag] ) . '" '; |
|
| 444 | - $field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : ''; |
|
| 445 | - $field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' . esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" '; |
|
| 442 | + $field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" '; |
|
| 443 | + $field_array[ 'name' ] = 'name="' . esc_attr( $field[ $tag ] ) . '" '; |
|
| 444 | + $field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : ''; |
|
| 445 | + $field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" '; |
|
| 446 | 446 | |
| 447 | 447 | // email must always be required and visible |
| 448 | - if( $field['type'] == 'email' ) { |
|
| 449 | - $field_array['required'] = 'required="required"'; |
|
| 450 | - $label_array['visible'] = ''; |
|
| 448 | + if ( $field[ 'type' ] == 'email' ) { |
|
| 449 | + $field_array[ 'required' ] = 'required="required"'; |
|
| 450 | + $label_array[ 'visible' ] = ''; |
|
| 451 | 451 | // $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"'; |
| 452 | - $label_class_array[] = $field['merge'] . '-label'; |
|
| 453 | - $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
| 452 | + $label_class_array[ ] = $field[ 'merge' ] . '-label'; |
|
| 453 | + $label_class_array[ ] = 'yikes-mailchimp-field-required'; |
|
| 454 | 454 | } else { |
| 455 | - if( $tag == 'merge' ) { |
|
| 456 | - $field_array['required'] = isset( $field['require'] ) ? 'required="required"' : ''; |
|
| 457 | - $label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
|
| 455 | + if ( $tag == 'merge' ) { |
|
| 456 | + $field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : ''; |
|
| 457 | + $label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : ''; |
|
| 458 | 458 | // $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"'; |
| 459 | - $label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label'; |
|
| 459 | + $label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label'; |
|
| 460 | 460 | } else { |
| 461 | - $field_array['required'] = isset( $field['require'] ) ? 'required="required"' : ''; |
|
| 462 | - $label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
|
| 461 | + $field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : ''; |
|
| 462 | + $label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : ''; |
|
| 463 | 463 | // $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"'; |
| 464 | - $label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label'; |
|
| 464 | + $label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label'; |
|
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | // if both hide label and hide field are checked, we gotta hide the field! |
| 469 | - if( isset( $field['hide' ] ) && $field['hide'] == 1 ) { |
|
| 470 | - if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) { |
|
| 471 | - $field_array['visible'] = 'style="display:none;"'; |
|
| 469 | + if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) { |
|
| 470 | + if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) { |
|
| 471 | + $field_array[ 'visible' ] = 'style="display:none;"'; |
|
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - $label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"'; |
|
| 475 | + $label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"'; |
|
| 476 | 476 | |
| 477 | 477 | // filter the field array data |
| 478 | 478 | $field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id ); |
| 479 | 479 | |
| 480 | 480 | /* Loop Over Standard Fields (aka merge variables) */ |
| 481 | - if( isset( $field['merge'] ) ) { |
|
| 481 | + if ( isset( $field[ 'merge' ] ) ) { |
|
| 482 | 482 | |
| 483 | 483 | // loop over our fields by Type |
| 484 | - switch ( $field['type'] ) { |
|
| 484 | + switch ( $field[ 'type' ] ) { |
|
| 485 | 485 | |
| 486 | 486 | default: |
| 487 | 487 | case 'email': |
@@ -489,25 +489,25 @@ discard block |
||
| 489 | 489 | case 'number': |
| 490 | 490 | |
| 491 | 491 | // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type) |
| 492 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 492 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 493 | 493 | $default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value ); |
| 494 | 494 | ?> |
| 495 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 495 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 496 | 496 | |
| 497 | 497 | <!-- dictate label visibility --> |
| 498 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 499 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 500 | - <?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?> |
|
| 498 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 499 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 500 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?> |
|
| 501 | 501 | </span> |
| 502 | 502 | <?php } ?> |
| 503 | 503 | |
| 504 | - <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 $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 504 | + <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 $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 505 | 505 | |
| 506 | 506 | <!-- description --> |
| 507 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 507 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 508 | 508 | <p class="form-field-description"> |
| 509 | 509 | <small> |
| 510 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?> |
|
| 510 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?> |
|
| 511 | 511 | </small> |
| 512 | 512 | </p> |
| 513 | 513 | <?php } ?> |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | case 'url': |
| 521 | 521 | case 'imageurl': |
| 522 | - $default_value = ( isset( $field['default'] ) ) ? $field['default'] : ''; |
|
| 522 | + $default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : ''; |
|
| 523 | 523 | ?> |
| 524 | 524 | |
| 525 | 525 | <script type="text/javascript"> |
@@ -531,22 +531,22 @@ discard block |
||
| 531 | 531 | } |
| 532 | 532 | </script> |
| 533 | 533 | |
| 534 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 534 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 535 | 535 | |
| 536 | 536 | <!-- dictate label visibility --> |
| 537 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 538 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 539 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 537 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 538 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 539 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 540 | 540 | </span> |
| 541 | 541 | <?php } ?> |
| 542 | 542 | |
| 543 | - <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 $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;"> |
|
| 543 | + <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 $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;"> |
|
| 544 | 544 | |
| 545 | 545 | <!-- description --> |
| 546 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 546 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 547 | 547 | <p class="form-field-description"> |
| 548 | 548 | <small> |
| 549 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?> |
|
| 549 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?> |
|
| 550 | 550 | </small> |
| 551 | 551 | </p> |
| 552 | 552 | <?php } ?> |
@@ -557,8 +557,8 @@ discard block |
||
| 557 | 557 | break; |
| 558 | 558 | |
| 559 | 559 | case 'phone': |
| 560 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 561 | - $phone_format = $field['phone_format']; |
|
| 560 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 561 | + $phone_format = $field[ 'phone_format' ]; |
|
| 562 | 562 | ?> |
| 563 | 563 | <script type="text/javascript"> |
| 564 | 564 | /* Replace incorrect values and format it correctly for MailChimp API */ |
@@ -571,22 +571,22 @@ discard block |
||
| 571 | 571 | } |
| 572 | 572 | </script> |
| 573 | 573 | |
| 574 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 574 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 575 | 575 | |
| 576 | 576 | <!-- dictate label visibility --> |
| 577 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 578 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 579 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 577 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 578 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 579 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 580 | 580 | </span> |
| 581 | 581 | <?php } ?> |
| 582 | 582 | |
| 583 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?> 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' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern' , '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 583 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?> 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' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 584 | 584 | |
| 585 | 585 | <!-- description --> |
| 586 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 586 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 587 | 587 | <p class="form-field-description"> |
| 588 | 588 | <small> |
| 589 | - <?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field['merge'] ) . '-description', stripslashes( $field['description'] ), $form_id ); ?> |
|
| 589 | + <?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field[ 'merge' ] ) . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?> |
|
| 590 | 590 | </small> |
| 591 | 591 | </p> |
| 592 | 592 | <?php } ?> |
@@ -596,25 +596,25 @@ discard block |
||
| 596 | 596 | break; |
| 597 | 597 | |
| 598 | 598 | case 'zip': |
| 599 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 599 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 600 | 600 | |
| 601 | 601 | ?> |
| 602 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 602 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 603 | 603 | |
| 604 | 604 | <!-- dictate label visibility --> |
| 605 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 606 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 607 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 605 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 606 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 607 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 608 | 608 | </span> |
| 609 | 609 | <?php } ?> |
| 610 | 610 | |
| 611 | - <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 $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 611 | + <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 $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 612 | 612 | |
| 613 | 613 | <!-- description --> |
| 614 | - <?php if( isset( $field['description'] ) ) { ?> |
|
| 614 | + <?php if ( isset( $field[ 'description' ] ) ) { ?> |
|
| 615 | 615 | <p class="form-field-description"> |
| 616 | 616 | <small> |
| 617 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?> |
|
| 617 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?> |
|
| 618 | 618 | </small> |
| 619 | 619 | </p> |
| 620 | 620 | <?php } ?> |
@@ -626,28 +626,28 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | case 'address': |
| 628 | 628 | // required fields |
| 629 | - $required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' ); |
|
| 629 | + $required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' ); |
|
| 630 | 630 | |
| 631 | 631 | // setup the default country value |
| 632 | 632 | $default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' ); |
| 633 | 633 | |
| 634 | 634 | // store number for looping |
| 635 | 635 | $x = 1; |
| 636 | - foreach( $required_fields as $type => $label ) { |
|
| 636 | + foreach ( $required_fields as $type => $label ) { |
|
| 637 | 637 | |
| 638 | 638 | // set the field names for the addrress fields |
| 639 | - $field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"'; |
|
| 639 | + $field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"'; |
|
| 640 | 640 | |
| 641 | 641 | // reset the label classes for left-half/right-half for addresses |
| 642 | - if( isset( $label_array['class'] ) ) { |
|
| 642 | + if ( isset( $label_array[ 'class' ] ) ) { |
|
| 643 | 643 | if ( $x % 2 == 0 ) { |
| 644 | - $label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] ); |
|
| 644 | + $label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] ); |
|
| 645 | 645 | } else { |
| 646 | - $label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] ); |
|
| 646 | + $label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] ); |
|
| 647 | 647 | } |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - switch( $type ) { |
|
| 650 | + switch ( $type ) { |
|
| 651 | 651 | |
| 652 | 652 | default: |
| 653 | 653 | case 'addr1': |
@@ -656,17 +656,17 @@ discard block |
||
| 656 | 656 | |
| 657 | 657 | |
| 658 | 658 | ?> |
| 659 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 659 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 660 | 660 | |
| 661 | 661 | <!-- dictate label visibility --> |
| 662 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 663 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 664 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?> |
|
| 662 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 663 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 664 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?> |
|
| 665 | 665 | </span> |
| 666 | 666 | <?php } ?> |
| 667 | 667 | |
| 668 | 668 | |
| 669 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>"> |
|
| 669 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>"> |
|
| 670 | 670 | |
| 671 | 671 | </label> |
| 672 | 672 | <?php |
@@ -676,16 +676,16 @@ discard block |
||
| 676 | 676 | case 'state': |
| 677 | 677 | |
| 678 | 678 | ?> |
| 679 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="state-dropdown"<?php if( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>> |
|
| 679 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown"<?php if ( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>> |
|
| 680 | 680 | |
| 681 | 681 | <!-- dictate label visibility --> |
| 682 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 683 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 684 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?> |
|
| 682 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 683 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 684 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?> |
|
| 685 | 685 | </span> |
| 686 | 686 | <?php } ?> |
| 687 | 687 | |
| 688 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 688 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 689 | 689 | <?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?> |
| 690 | 690 | </select> |
| 691 | 691 | |
@@ -698,15 +698,15 @@ discard block |
||
| 698 | 698 | case 'zip': |
| 699 | 699 | |
| 700 | 700 | ?> |
| 701 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="zip-input"<?php if( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>> |
|
| 701 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>> |
|
| 702 | 702 | |
| 703 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 704 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 705 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?> |
|
| 703 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 704 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 705 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?> |
|
| 706 | 706 | </span> |
| 707 | 707 | <?php } ?> |
| 708 | 708 | |
| 709 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-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 $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 709 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-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 $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 710 | 710 | |
| 711 | 711 | </label> |
| 712 | 712 | <?php |
@@ -744,16 +744,16 @@ discard block |
||
| 744 | 744 | $default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' ); |
| 745 | 745 | ?> |
| 746 | 746 | |
| 747 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 747 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 748 | 748 | |
| 749 | 749 | <!-- dictate label visibility --> |
| 750 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 751 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 752 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?> |
|
| 750 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 751 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 752 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?> |
|
| 753 | 753 | </span> |
| 754 | 754 | <?php } ?> |
| 755 | 755 | |
| 756 | - <select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;"> |
|
| 756 | + <select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;"> |
|
| 757 | 757 | <?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?> |
| 758 | 758 | </select> |
| 759 | 759 | </label> |
@@ -764,10 +764,10 @@ discard block |
||
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | // description |
| 767 | - if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 767 | + if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 768 | 768 | <p class="form-field-description"> |
| 769 | 769 | <small> |
| 770 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
| 770 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
| 771 | 771 | </small> |
| 772 | 772 | </p> |
| 773 | 773 | <?php } |
@@ -777,19 +777,19 @@ discard block |
||
| 777 | 777 | case 'birthday': |
| 778 | 778 | |
| 779 | 779 | // bootstrap datepicker requirements |
| 780 | - wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) ); |
|
| 781 | - wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) ); |
|
| 782 | - wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' ); |
|
| 783 | - wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) ); |
|
| 780 | + wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) ); |
|
| 781 | + wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) ); |
|
| 782 | + wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' ); |
|
| 783 | + wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) ); |
|
| 784 | 784 | |
| 785 | - switch ( $field['type'] ) { |
|
| 785 | + switch ( $field[ 'type' ] ) { |
|
| 786 | 786 | default: |
| 787 | 787 | case 'date': |
| 788 | - $date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yy'; |
|
| 788 | + $date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yy'; |
|
| 789 | 789 | break; |
| 790 | 790 | |
| 791 | 791 | case 'birthday': |
| 792 | - $date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd'; |
|
| 792 | + $date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd'; |
|
| 793 | 793 | break; |
| 794 | 794 | } |
| 795 | 795 | // initialize the datepicker |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | padding: .85em .5em !important; |
| 801 | 801 | } |
| 802 | 802 | <?php |
| 803 | - if( wp_is_mobile() ) { |
|
| 803 | + if ( wp_is_mobile() ) { |
|
| 804 | 804 | ?> |
| 805 | 805 | .datepicker-dropdown { |
| 806 | 806 | margin-top: 0px; |
@@ -836,10 +836,10 @@ discard block |
||
| 836 | 836 | numberOfMonths: 1, |
| 837 | 837 | today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>' |
| 838 | 838 | }; |
| 839 | - jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) { |
|
| 840 | - var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' ); |
|
| 839 | + jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) { |
|
| 840 | + var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' ); |
|
| 841 | 841 | date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px'; |
| 842 | - var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' ); |
|
| 842 | + var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' ); |
|
| 843 | 843 | if( date_picker_width > 500 ) { |
| 844 | 844 | date_picker_width = 500; |
| 845 | 845 | } |
@@ -849,27 +849,27 @@ discard block |
||
| 849 | 849 | </script> |
| 850 | 850 | <?php |
| 851 | 851 | |
| 852 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 852 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 853 | 853 | // store empty number for looping |
| 854 | 854 | $x = 0; |
| 855 | 855 | |
| 856 | 856 | ?> |
| 857 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 857 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 858 | 858 | |
| 859 | 859 | <!-- dictate label visibility --> |
| 860 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
| 861 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 862 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 860 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 861 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 862 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 863 | 863 | </span> |
| 864 | 864 | <?php } ?> |
| 865 | 865 | |
| 866 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 866 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> placeholder="<?php echo esc_attr( $field[ 'placeholder' ] ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
| 867 | 867 | |
| 868 | 868 | <!-- description --> |
| 869 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 869 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 870 | 870 | <p class="form-field-description"> |
| 871 | 871 | <small> |
| 872 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
| 872 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
| 873 | 873 | </small> |
| 874 | 874 | </p> |
| 875 | 875 | <?php } ?> |
@@ -880,36 +880,36 @@ discard block |
||
| 880 | 880 | break; |
| 881 | 881 | |
| 882 | 882 | case 'dropdown': |
| 883 | - $default_value = $field['default_choice']; |
|
| 883 | + $default_value = $field[ 'default_choice' ]; |
|
| 884 | 884 | // store empty number for looping |
| 885 | 885 | $x = 0; |
| 886 | 886 | // hidden labels |
| 887 | 887 | |
| 888 | 888 | ?> |
| 889 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 889 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 890 | 890 | <!-- dictate label visibility --> |
| 891 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 892 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
| 893 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 891 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 892 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
| 893 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 894 | 894 | </span> |
| 895 | 895 | <?php } ?> |
| 896 | 896 | |
| 897 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 897 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 898 | 898 | <?php |
| 899 | 899 | // decode for looping |
| 900 | - $choices = json_decode( $field['choices'], true ); |
|
| 901 | - foreach( $choices as $choice ) { |
|
| 902 | - ?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php |
|
| 900 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 901 | + foreach ( $choices as $choice ) { |
|
| 902 | + ?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php |
|
| 903 | 903 | $x++; |
| 904 | 904 | } |
| 905 | 905 | ?> |
| 906 | 906 | </select> |
| 907 | 907 | |
| 908 | 908 | <!-- description --> |
| 909 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 909 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 910 | 910 | <p class="form-field-description"> |
| 911 | 911 | <small> |
| 912 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
| 912 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
| 913 | 913 | </small> |
| 914 | 914 | </p> |
| 915 | 915 | <?php } ?> |
@@ -923,13 +923,13 @@ discard block |
||
| 923 | 923 | case 'radio': |
| 924 | 924 | case 'checkbox': |
| 925 | 925 | // remove the ID (as to not assign the same ID to every radio button) |
| 926 | - unset( $field_array['id'] ); |
|
| 927 | - $choices = json_decode( $field['choices'], true ); |
|
| 926 | + unset( $field_array[ 'id' ] ); |
|
| 927 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 928 | 928 | // assign a default choice |
| 929 | - $default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0]; |
|
| 929 | + $default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ]; |
|
| 930 | 930 | // if the form was submit, but failed, let's reset the post data |
| 931 | - if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { |
|
| 932 | - $default_value = $_POST[$field['merge']]; |
|
| 931 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { |
|
| 932 | + $default_value = $_POST[ $field[ 'merge' ] ]; |
|
| 933 | 933 | } |
| 934 | 934 | $count = count( $choices ); |
| 935 | 935 | $i = 1; |
@@ -938,20 +938,20 @@ discard block |
||
| 938 | 938 | // hidden labels |
| 939 | 939 | |
| 940 | 940 | ?> |
| 941 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 941 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 942 | 942 | |
| 943 | 943 | <!-- dictate label visibility --> |
| 944 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 945 | - <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label"> |
|
| 946 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 944 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 945 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label"> |
|
| 946 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 947 | 947 | </span> |
| 948 | 948 | <?php } |
| 949 | 949 | |
| 950 | - foreach( $choices as $choice ) { |
|
| 950 | + foreach ( $choices as $choice ) { |
|
| 951 | 951 | ?> |
| 952 | - <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 } ?>" <?php if( $i == 1 ) { echo $field_array['required']; } ?>> |
|
| 953 | - <input type="<?php echo esc_attr( $field['type'] ); ?>" name="<?php echo $field['merge']; ?>" id="<?php echo $field['merge'] . '-' . $i; ?>" <?php checked( $default_value , $x ); ?> value="<?php echo esc_attr( $choice ); ?>"> |
|
| 954 | - <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
| 952 | + <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 } ?>" <?php if ( $i == 1 ) { echo $field_array[ 'required' ]; } ?>> |
|
| 953 | + <input type="<?php echo esc_attr( $field[ 'type' ] ); ?>" name="<?php echo $field[ 'merge' ]; ?>" id="<?php echo $field[ 'merge' ] . '-' . $i; ?>" <?php checked( $default_value, $x ); ?> value="<?php echo esc_attr( $choice ); ?>"> |
|
| 954 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
| 955 | 955 | </label> |
| 956 | 956 | <?php |
| 957 | 957 | $i++; |
@@ -959,10 +959,10 @@ discard block |
||
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | // description |
| 962 | - if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 962 | + if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 963 | 963 | <p class="form-field-description"> |
| 964 | 964 | <small> |
| 965 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
| 965 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
| 966 | 966 | </small> |
| 967 | 967 | </p> |
| 968 | 968 | <?php } ?> |
@@ -978,26 +978,26 @@ discard block |
||
| 978 | 978 | |
| 979 | 979 | |
| 980 | 980 | // store default choice |
| 981 | - $default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : ( isset( $field['default_choice'] ) ? $field['default_choice'] : '' ); |
|
| 981 | + $default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : ( isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : '' ); |
|
| 982 | 982 | |
| 983 | 983 | // if the form was submit, but failed, let's reset the post data |
| 984 | - if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) { |
|
| 985 | - $default_choice = $_POST[$field['group_id']]; |
|
| 984 | + if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) { |
|
| 985 | + $default_choice = $_POST[ $field[ 'group_id' ] ]; |
|
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | // get our groups |
| 989 | - $groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array(); |
|
| 989 | + $groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array(); |
|
| 990 | 990 | |
| 991 | 991 | $count = count( $groups ); |
| 992 | 992 | |
| 993 | - if( $field['type'] == 'checkboxes' ) { |
|
| 993 | + if ( $field[ 'type' ] == 'checkboxes' ) { |
|
| 994 | 994 | $type = 'checkbox'; |
| 995 | - } else if( $field['type'] == 'radio' ) { |
|
| 995 | + } else if ( $field[ 'type' ] == 'radio' ) { |
|
| 996 | 996 | $type = 'radio'; |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | // loop over the interest group field types |
| 1000 | - switch ( $field['type'] ) { |
|
| 1000 | + switch ( $field[ 'type' ] ) { |
|
| 1001 | 1001 | |
| 1002 | 1002 | case 'checkboxes': |
| 1003 | 1003 | case 'radio': |
@@ -1005,18 +1005,18 @@ discard block |
||
| 1005 | 1005 | $x = 1; // used to find the last item of our array |
| 1006 | 1006 | |
| 1007 | 1007 | ?> |
| 1008 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1009 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1008 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1009 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1010 | 1010 | <!-- dictate label visibility --> |
| 1011 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label"> |
|
| 1012 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?> |
|
| 1011 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label"> |
|
| 1012 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?> |
|
| 1013 | 1013 | </span> |
| 1014 | 1014 | <?php |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | // Display Submission Errors |
| 1018 | - if( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
| 1019 | - if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) { |
|
| 1018 | + if ( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
| 1019 | + if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) { |
|
| 1020 | 1020 | ?> |
| 1021 | 1021 | <p class="yikes-mailchimp-required-interest-group-error"> |
| 1022 | 1022 | <?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?> |
@@ -1027,19 +1027,19 @@ discard block |
||
| 1027 | 1027 | |
| 1028 | 1028 | |
| 1029 | 1029 | |
| 1030 | - foreach( $groups as $group ) { |
|
| 1031 | - if( $field['type'] == 'checkboxes' ) { |
|
| 1030 | + foreach ( $groups as $group ) { |
|
| 1031 | + if ( $field[ 'type' ] == 'checkboxes' ) { |
|
| 1032 | 1032 | /* Setup the defaults for this field - varies if the field was previously submitted */ |
| 1033 | - if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) { |
|
| 1034 | - $default_choice = $_POST[$field['group_id']]; |
|
| 1035 | - } elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) { |
|
| 1036 | - $default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array(); |
|
| 1033 | + if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) { |
|
| 1034 | + $default_choice = $_POST[ $field[ 'group_id' ] ]; |
|
| 1035 | + } elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) { |
|
| 1036 | + $default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array(); |
|
| 1037 | 1037 | } |
| 1038 | 1038 | } |
| 1039 | 1039 | ?> |
| 1040 | - <label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>"> |
|
| 1041 | - <input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( ( ( isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i , $default_choice )) || ! isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i , $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[$field['group_id']] ) ) && in_array( esc_attr( $group['name'] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>"> |
|
| 1042 | - <?php echo $group['name']; ?> |
|
| 1040 | + <label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>"> |
|
| 1041 | + <input <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( ( ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i, $default_choice ) ) || ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i, $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[ $field[ 'group_id' ] ] ) ) && in_array( esc_attr( $group[ 'name' ] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>"> |
|
| 1042 | + <?php echo $group[ 'name' ]; ?> |
|
| 1043 | 1043 | </label> |
| 1044 | 1044 | <?php |
| 1045 | 1045 | $i++; |
@@ -1047,10 +1047,10 @@ discard block |
||
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | // description |
| 1050 | - if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 1050 | + if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 1051 | 1051 | <p class="form-field-description"> |
| 1052 | 1052 | <small> |
| 1053 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?> |
|
| 1053 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?> |
|
| 1054 | 1054 | </small> |
| 1055 | 1055 | </p> |
| 1056 | 1056 | <?php } ?> |
@@ -1064,28 +1064,28 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | ?> |
| 1066 | 1066 | |
| 1067 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1067 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1068 | 1068 | <!-- dictate label visibility --> |
| 1069 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1070 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>"> |
|
| 1071 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?> |
|
| 1069 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1070 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>"> |
|
| 1071 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?> |
|
| 1072 | 1072 | </span> |
| 1073 | 1073 | <?php } ?> |
| 1074 | 1074 | |
| 1075 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
| 1075 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
| 1076 | 1076 | <?php |
| 1077 | 1077 | $i = 0; |
| 1078 | - foreach( $groups as $group ) { |
|
| 1079 | - ?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( $group['name'] ); ?></option><?php |
|
| 1078 | + foreach ( $groups as $group ) { |
|
| 1079 | + ?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group[ 'name' ]; ?>"><?php echo esc_attr( $group[ 'name' ] ); ?></option><?php |
|
| 1080 | 1080 | $i++; |
| 1081 | 1081 | } |
| 1082 | 1082 | ?> |
| 1083 | 1083 | </select> |
| 1084 | 1084 | |
| 1085 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 1085 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 1086 | 1086 | <p class="form-field-description"> |
| 1087 | 1087 | <small> |
| 1088 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?> |
|
| 1088 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?> |
|
| 1089 | 1089 | </small> |
| 1090 | 1090 | </p> |
| 1091 | 1091 | <?php } ?> |
@@ -1102,21 +1102,21 @@ discard block |
||
| 1102 | 1102 | |
| 1103 | 1103 | ?> |
| 1104 | 1104 | |
| 1105 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
| 1105 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
| 1106 | 1106 | |
| 1107 | 1107 | <!-- dictate label visibility --> |
| 1108 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
| 1109 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
| 1110 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
| 1108 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
| 1109 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
| 1110 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
| 1111 | 1111 | </span> |
| 1112 | 1112 | <?php } |
| 1113 | 1113 | |
| 1114 | 1114 | |
| 1115 | - foreach( $groups as $group ) { |
|
| 1115 | + foreach ( $groups as $group ) { |
|
| 1116 | 1116 | ?> |
| 1117 | - <label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;"> |
|
| 1118 | - <input type="radio" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( in_array( $i , $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>"> |
|
| 1119 | - <?php echo esc_attr( stripslashes( str_replace( '' , '\'', $group['name'] ) ) ); ?> |
|
| 1117 | + <label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;"> |
|
| 1118 | + <input type="radio" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( in_array( $i, $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>"> |
|
| 1119 | + <?php echo esc_attr( stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ) ); ?> |
|
| 1120 | 1120 | </label> |
| 1121 | 1121 | <?php |
| 1122 | 1122 | $i++; |
@@ -1124,10 +1124,10 @@ discard block |
||
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | 1126 | // description |
| 1127 | - if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
| 1127 | + if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
| 1128 | 1128 | <p class="form-field-description"> |
| 1129 | 1129 | <small> |
| 1130 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
| 1130 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
| 1131 | 1131 | </small> |
| 1132 | 1132 | </p> |
| 1133 | 1133 | <?php } |
@@ -1144,11 +1144,11 @@ discard block |
||
| 1144 | 1144 | do_action( 'yikes-mailchimp-additional-form-fields', $form_data ); |
| 1145 | 1145 | |
| 1146 | 1146 | /* if we've enabled reCAPTCHA protection */ |
| 1147 | - if( isset( $recaptcha_box ) ) { |
|
| 1147 | + if ( isset( $recaptcha_box ) ) { |
|
| 1148 | 1148 | echo $recaptcha_box; |
| 1149 | 1149 | } |
| 1150 | - if( is_user_logged_in() ) { |
|
| 1151 | - $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
| 1150 | + if ( is_user_logged_in() ) { |
|
| 1151 | + $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
| 1152 | 1152 | } else { |
| 1153 | 1153 | $admin_class = ''; |
| 1154 | 1154 | } |
@@ -1158,23 +1158,23 @@ discard block |
||
| 1158 | 1158 | <input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value=""> |
| 1159 | 1159 | |
| 1160 | 1160 | <!-- List ID --> |
| 1161 | - <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings['list_id']; ?>"> |
|
| 1161 | + <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings[ 'list_id' ]; ?>"> |
|
| 1162 | 1162 | |
| 1163 | 1163 | <!-- Form that is being submitted! Used to display error/success messages above the correct form --> |
| 1164 | 1164 | <input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>"> |
| 1165 | 1165 | |
| 1166 | 1166 | <!-- Submit Button --> |
| 1167 | 1167 | <?php |
| 1168 | - if( $form_inline ) { |
|
| 1168 | + if ( $form_inline ) { |
|
| 1169 | 1169 | echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="empty-label"> </span>'; |
| 1170 | 1170 | } |
| 1171 | 1171 | // display the image or text based button |
| 1172 | - if( $submit_button_type == 'text' ) { |
|
| 1173 | - 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'] ) . '">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</button>', $form_data['id'] ); |
|
| 1172 | + if ( $submit_button_type == 'text' ) { |
|
| 1173 | + 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' ] ) . '">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '</button>', $form_data[ 'id' ] ); |
|
| 1174 | 1174 | } else { |
| 1175 | - 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'] ); |
|
| 1175 | + 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' ] ); |
|
| 1176 | 1176 | } |
| 1177 | - if( $form_inline ) { |
|
| 1177 | + if ( $form_inline ) { |
|
| 1178 | 1178 | echo '</label>'; |
| 1179 | 1179 | } |
| 1180 | 1180 | ?> |
@@ -1186,8 +1186,8 @@ discard block |
||
| 1186 | 1186 | |
| 1187 | 1187 | <?php |
| 1188 | 1188 | /* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
| 1189 | - if( is_user_logged_in() ) { |
|
| 1190 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 1189 | + if ( is_user_logged_in() ) { |
|
| 1190 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 1191 | 1191 | echo $edit_form_link; |
| 1192 | 1192 | } |
| 1193 | 1193 | } |
@@ -1202,16 +1202,16 @@ discard block |
||
| 1202 | 1202 | * Update the impressions count |
| 1203 | 1203 | * for non-admins |
| 1204 | 1204 | */ |
| 1205 | - if( !current_user_can( 'manage_options' ) ) { |
|
| 1206 | - $form_data['impressions']++; |
|
| 1205 | + if ( ! current_user_can( 'manage_options' ) ) { |
|
| 1206 | + $form_data[ 'impressions' ]++; |
|
| 1207 | 1207 | $wpdb->update( |
| 1208 | 1208 | $wpdb->prefix . 'yikes_easy_mc_forms', |
| 1209 | 1209 | array( |
| 1210 | - 'impressions' => $form_data['impressions'], |
|
| 1210 | + 'impressions' => $form_data[ 'impressions' ], |
|
| 1211 | 1211 | ), |
| 1212 | 1212 | array( 'ID' => $form ), |
| 1213 | 1213 | array( |
| 1214 | - '%d', // send welcome email |
|
| 1214 | + '%d', // send welcome email |
|
| 1215 | 1215 | ), |
| 1216 | 1216 | array( '%d' ) |
| 1217 | 1217 | ); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -7,12 +7,12 @@ |
||
| 7 | 7 | <div class="wrap"> |
| 8 | 8 | |
| 9 | 9 | <!-- Freddie Logo --> |
| 10 | - <img src="<?php echo esc_url( YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png' ); ?>" alt="<?php esc_attr_e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
| 10 | + <img src="<?php echo esc_url( YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png' ); ?>" alt="<?php esc_attr_e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
| 11 | 11 | |
| 12 | - <h1>YIKES Easy Forms for MailChimp | <?php echo esc_attr__( 'Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="https://yikesplugins.com/plugins/?plugins=MailChimp" target="_blank" class="button-primary coming-soon-button" title="<?php esc_attr_e( 'View All Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php esc_attr_e( 'View All Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?> <span class="dashicons dashicons-external"></span></a></h1> |
|
| 12 | + <h1>YIKES Easy Forms for MailChimp | <?php echo esc_attr__( 'Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="https://yikesplugins.com/plugins/?plugins=MailChimp" target="_blank" class="button-primary coming-soon-button" title="<?php esc_attr_e( 'View All Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php esc_attr_e( 'View All Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class="dashicons dashicons-external"></span></a></h1> |
|
| 13 | 13 | |
| 14 | 14 | <!-- Addons Page Description --> |
| 15 | - <p class="yikes-easy-mc-about-text about-text"><?php esc_attr_e( "Below you'll find a list of add-ons available for YIKES Easy Forms for MailChimp. Each add-on extends the base functionality of the free plugin." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 15 | + <p class="yikes-easy-mc-about-text about-text"><?php esc_attr_e( "Below you'll find a list of add-ons available for YIKES Easy Forms for MailChimp. Each add-on extends the base functionality of the free plugin.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 16 | 16 | |
| 17 | 17 | <!-- Add-On Container --> |
| 18 | 18 | <section id="add-ons"> |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |