@@ -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; |
@@ -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 | ); |
@@ -5,34 +5,34 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // parse our form data |
8 | -parse_str( $_POST['form_data'], $data ); |
|
8 | +parse_str( $_POST[ 'form_data' ], $data ); |
|
9 | 9 | // store the form ID to use in our hooks and filters |
10 | -$form = $_POST['form_id']; |
|
10 | +$form = $_POST[ 'form_id' ]; |
|
11 | 11 | |
12 | 12 | // Retreive the form data from the database instead of posting it with the form-submission |
13 | 13 | global $wpdb; |
14 | 14 | // return it as an array, so we can work with it to build our form below |
15 | 15 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A ); |
16 | 16 | |
17 | -if( $form_results ) { |
|
18 | - $form_data = $form_results[0]; |
|
17 | +if ( $form_results ) { |
|
18 | + $form_data = $form_results[ 0 ]; |
|
19 | 19 | // List ID |
20 | - $list_id = $form_data['list_id']; |
|
20 | + $list_id = $form_data[ 'list_id' ]; |
|
21 | 21 | // decode our submission settings |
22 | - $submission_settings = json_decode( stripslashes( $form_data['submission_settings'] ), true ); |
|
22 | + $submission_settings = json_decode( stripslashes( $form_data[ 'submission_settings' ] ), true ); |
|
23 | 23 | // decode our optin settings |
24 | - $optin_settings = json_decode( stripslashes( $form_data['optin_settings'] ), true ); |
|
24 | + $optin_settings = json_decode( stripslashes( $form_data[ 'optin_settings' ] ), true ); |
|
25 | 25 | // decode our fields |
26 | - $form_fields = json_decode( stripslashes( $form_data['fields'] ), true ); |
|
26 | + $form_fields = json_decode( stripslashes( $form_data[ 'fields' ] ), true ); |
|
27 | 27 | /* Decode our error messages |
28 | 28 | * Workaround for international characters (cyrillic etc) |
29 | 29 | * See: https://wordpress.org/support/topic/custom-messages-do-not-support-cyrillic-characters?replies=11#post-7629620 |
30 | 30 | */ |
31 | - $error_messages = ( get_magic_quotes_gpc() ) ? json_decode( stripslashes( $form_data['error_messages'] ), true ) : json_decode( $form_data['error_messages'], true ); |
|
31 | + $error_messages = ( get_magic_quotes_gpc() ) ? json_decode( stripslashes( $form_data[ 'error_messages' ] ), true ) : json_decode( $form_data[ 'error_messages' ], true ); |
|
32 | 32 | /** Submit Process **/ |
33 | - $notifications = json_decode( stripslashes( $form_data['custom_notifications'] ), true ); |
|
33 | + $notifications = json_decode( stripslashes( $form_data[ 'custom_notifications' ] ), true ); |
|
34 | 34 | /* Page Data */ |
35 | - $page_data = $_POST['page_data']; |
|
35 | + $page_data = $_POST[ 'page_data' ]; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Empty array to build up merge variables |
@@ -42,39 +42,39 @@ discard block |
||
42 | 42 | $error = 0; |
43 | 43 | |
44 | 44 | /* Check for Honeypot filled */ |
45 | -$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && $data['yikes-mailchimp-honeypot'] != '' ) ? true : false; |
|
45 | +$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && $data[ 'yikes-mailchimp-honeypot' ] != '' ) ? true : false; |
|
46 | 46 | // if it was filled out, return an error... |
47 | -if( $honey_pot_filled ) { |
|
47 | +if ( $honey_pot_filled ) { |
|
48 | 48 | wp_send_json_error( array( |
49 | 49 | 'hide' => '0', |
50 | 50 | 'error' => 1, |
51 | - 'response' => __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted." , 'yikes-inc-easy-mailchimp-extender' ) |
|
51 | + 'response' => __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted.", 'yikes-inc-easy-mailchimp-extender' ) |
|
52 | 52 | ) ); |
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Check reCAPTCHA Response was submitted with the form data |
57 | -if( isset( $data['g-recaptcha-response'] ) ) { |
|
58 | - $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $data['g-recaptcha-response'] . '&remoteip=' . $_SERVER["REMOTE_ADDR"] ); |
|
57 | +if ( isset( $data[ 'g-recaptcha-response' ] ) ) { |
|
58 | + $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $data[ 'g-recaptcha-response' ] . '&remoteip=' . $_SERVER[ "REMOTE_ADDR" ] ); |
|
59 | 59 | $response = wp_remote_get( $url ); |
60 | - $response_body = json_decode( $response['body'] , true ); |
|
60 | + $response_body = json_decode( $response[ 'body' ], true ); |
|
61 | 61 | // if we've hit an error, lets return the error! |
62 | - if( $response_body['success'] != 1 ) { |
|
62 | + if ( $response_body[ 'success' ] != 1 ) { |
|
63 | 63 | $error_messages = array(); // empty array to store error messages |
64 | - if( isset( $response_body['error-codes'] ) ) { |
|
65 | - foreach( $response_body['error-codes'] as $error_code ) { |
|
66 | - if( $error_code == 'missing-input-response' ) { |
|
64 | + if ( isset( $response_body[ 'error-codes' ] ) ) { |
|
65 | + foreach ( $response_body[ 'error-codes' ] as $error_code ) { |
|
66 | + if ( $error_code == 'missing-input-response' ) { |
|
67 | 67 | $error_code = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' ); |
68 | 68 | } |
69 | - $error_messages[] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code; |
|
69 | + $error_messages[ ] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code; |
|
70 | 70 | } |
71 | 71 | } else { |
72 | - $error_messages[] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
72 | + $error_messages[ ] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
73 | 73 | } |
74 | 74 | $error = 1; |
75 | 75 | wp_send_json_error( array( |
76 | 76 | 'hide' => '0', |
77 | - 'error' => $error , |
|
77 | + 'error' => $error, |
|
78 | 78 | 'response' => apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $error_messages ) ), |
79 | 79 | ) ); |
80 | 80 | exit(); |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | |
84 | 84 | // loop to push variables to our array |
85 | 85 | foreach ( $data as $merge_tag => $value ) { |
86 | - if( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) { |
|
86 | + if ( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) { |
|
87 | 87 | // check if the current iteration has a 'date_format' key set |
88 | 88 | // (aka - date/birthday fields) |
89 | - if( isset( $form_fields[$merge_tag]['date_format'] ) ) { |
|
89 | + if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) { |
|
90 | 90 | // check if EU date format |
91 | - if( $form_fields[$merge_tag]['date_format'] == 'DD/MM/YYYY' ) { |
|
91 | + if ( $form_fields[ $merge_tag ][ 'date_format' ] == 'DD/MM/YYYY' ) { |
|
92 | 92 | // convert '/' to '.' and to UNIX timestamp |
93 | 93 | $value = date( 'Y-m-d', strtotime( str_replace( '/', '.', $value ) ) ); |
94 | 94 | } else { |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | $value = date( 'Y-m-d', strtotime( $value ) ); |
97 | 97 | } |
98 | 98 | } |
99 | - if( is_numeric( $merge_tag ) ) { // this is is an interest group! |
|
100 | - $merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) ); |
|
99 | + if ( is_numeric( $merge_tag ) ) { // this is is an interest group! |
|
100 | + $merge_variables[ 'groupings' ][ ] = array( 'id' => $merge_tag, 'groups' => ( is_array( $value ) ) ? $value : array( $value ) ); |
|
101 | 101 | } else { // or else it's just a standard merge variable |
102 | - $merge_variables[$merge_tag] = $value; |
|
102 | + $merge_variables[ $merge_tag ] = $value; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | 106 | // store the opt-in time |
107 | -$merge_variables['optin_time'] = current_time( 'Y-m-d H:i:s', 1 ); |
|
107 | +$merge_variables[ 'optin_time' ] = current_time( 'Y-m-d H:i:s', 1 ); |
|
108 | 108 | |
109 | 109 | // Submit our form data |
110 | -$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
110 | +$api_key = trim( get_option( 'yikes-mc-api-key', '' ) ); |
|
111 | 111 | $dash_position = strpos( $api_key, '-' ); |
112 | 112 | |
113 | 113 | // setup the end point |
114 | -if( $dash_position !== false ) { |
|
114 | +if ( $dash_position !== false ) { |
|
115 | 115 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/subscribe.json'; |
116 | 116 | } |
117 | 117 | |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * Allow users to check for submit value |
138 | 138 | * and pass back an error to the user |
139 | 139 | */ |
140 | -if( isset( $merge_variables['error'] ) ) { |
|
140 | +if ( isset( $merge_variables[ 'error' ] ) ) { |
|
141 | 141 | // send our error response back |
142 | - wp_send_json_error( array( 'hide' => '0', 'error' => $merge_variables['error'] , 'response' => $merge_variables['message'] ) ); |
|
142 | + wp_send_json_error( array( 'hide' => '0', 'error' => $merge_variables[ 'error' ], 'response' => $merge_variables[ 'message' ] ) ); |
|
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * Setup whether or not we should update the user, or display the error with email generation |
148 | 148 | * @since 6.1 |
149 | 149 | */ |
150 | -if ( isset( $optin_settings['update_existing_user'] ) && 1 === absint( $optin_settings['update_existing_user'] ) ) { |
|
150 | +if ( isset( $optin_settings[ 'update_existing_user' ] ) && 1 === absint( $optin_settings[ 'update_existing_user' ] ) ) { |
|
151 | 151 | // Should we send the update email |
152 | - if ( isset( $optin_settings['send_update_email'] ) && 1 === absint( $optin_settings['send_update_email'] ) ) { |
|
152 | + if ( isset( $optin_settings[ 'send_update_email' ] ) && 1 === absint( $optin_settings[ 'send_update_email' ] ) ) { |
|
153 | 153 | $update_existing_user = 0; |
154 | 154 | } else { |
155 | 155 | $update_existing_user = 1; |
@@ -164,73 +164,73 @@ discard block |
||
164 | 164 | 'body' => apply_filters( 'yikes-mailchimp-user-subscribe-api-request', array( |
165 | 165 | 'apikey' => $api_key, |
166 | 166 | 'id' => $list_id, |
167 | - 'email' => array( 'email' => sanitize_email( $data['EMAIL'] ) ), |
|
167 | + 'email' => array( 'email' => sanitize_email( $data[ 'EMAIL' ] ) ), |
|
168 | 168 | 'merge_vars' => $merge_variables, |
169 | - 'double_optin' => $optin_settings['optin'], |
|
169 | + 'double_optin' => $optin_settings[ 'optin' ], |
|
170 | 170 | 'update_existing' => $update_existing_user, // Decide if we should update the user or not |
171 | - 'send_welcome' => $optin_settings['send_welcome_email'], |
|
172 | - 'replace_interests' => ( isset( $submission_settings['replace_interests'] ) ) ? $submission_settings['replace_interests'] : 1, // defaults to replace |
|
173 | - ), $form, $list_id, $data['EMAIL'] ), |
|
171 | + 'send_welcome' => $optin_settings[ 'send_welcome_email' ], |
|
172 | + 'replace_interests' => ( isset( $submission_settings[ 'replace_interests' ] ) ) ? $submission_settings[ 'replace_interests' ] : 1, // defaults to replace |
|
173 | + ), $form, $list_id, $data[ 'EMAIL' ] ), |
|
174 | 174 | 'timeout' => 10, |
175 | 175 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
176 | 176 | ) ); |
177 | 177 | |
178 | 178 | $subscribe_response = json_decode( wp_remote_retrieve_body( $subscribe_response ), true ); |
179 | 179 | |
180 | - if( isset( $subscribe_response['error'] ) ) { |
|
180 | + if ( isset( $subscribe_response[ 'error' ] ) ) { |
|
181 | 181 | |
182 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
182 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
183 | 183 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
184 | 184 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
185 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response['error'], __( "Subscribe New User" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" ); |
|
185 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response[ 'error' ], __( "Subscribe New User", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" ); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $update_account_details_link = ''; |
189 | 189 | $error = 1; |
190 | - switch( $subscribe_response['code'] ) { |
|
190 | + switch ( $subscribe_response[ 'code' ] ) { |
|
191 | 191 | // user already subscribed |
192 | 192 | case '214': |
193 | - $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="' . $list_id . '" data-user-email="' . sanitize_email( $data['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ), $form, '<a class="send-update-email" data-list-id="' . $_POST['yikes-mailchimp-associated-list-id'] . '" data-user-email="' . sanitize_email( $data['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); |
|
194 | - $update_account_details_link = ( 1 === absint( $optin_settings['update_existing_user'] ) && 1 === absint( $optin_settings['send_update_email'] ) ) ? $custom_already_subscribed_text : false; |
|
195 | - if( ! empty( $error_messages['already-subscribed'] ) ) { |
|
196 | - $error_response = apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $error_messages['already-subscribed'] , $form, $data['EMAIL'] ) . ' ' . $update_account_details_link; |
|
193 | + $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="' . $list_id . '" data-user-email="' . sanitize_email( $data[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ), $form, '<a class="send-update-email" data-list-id="' . $_POST[ 'yikes-mailchimp-associated-list-id' ] . '" data-user-email="' . sanitize_email( $data[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); |
|
194 | + $update_account_details_link = ( 1 === absint( $optin_settings[ 'update_existing_user' ] ) && 1 === absint( $optin_settings[ 'send_update_email' ] ) ) ? $custom_already_subscribed_text : false; |
|
195 | + if ( ! empty( $error_messages[ 'already-subscribed' ] ) ) { |
|
196 | + $error_response = apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $error_messages[ 'already-subscribed' ], $form, $data[ 'EMAIL' ] ) . ' ' . $update_account_details_link; |
|
197 | 197 | } else { |
198 | - $error_response = $subscribe_response['error'] . ' ' . $update_account_details_link; |
|
198 | + $error_response = $subscribe_response[ 'error' ] . ' ' . $update_account_details_link; |
|
199 | 199 | } |
200 | 200 | break; |
201 | 201 | // missing a required field |
202 | 202 | case '250': |
203 | 203 | // get all merge variables in array, loop and str_replace error code with field name |
204 | - $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
204 | + $api_key = trim( get_option( 'yikes-mc-api-key', '' ) ); |
|
205 | 205 | $dash_position = strpos( $api_key, '-' ); |
206 | - if( $dash_position !== false ) { |
|
206 | + if ( $dash_position !== false ) { |
|
207 | 207 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json'; |
208 | 208 | } |
209 | 209 | $merge_variables = wp_remote_post( $api_endpoint, array( |
210 | 210 | 'body' => array( |
211 | 211 | 'apikey' => $api_key, |
212 | - 'id' => array( $list_id ) , |
|
212 | + 'id' => array( $list_id ), |
|
213 | 213 | ), |
214 | 214 | 'timeout' => 10, |
215 | 215 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ), |
216 | 216 | ) ); |
217 | 217 | $merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true ); |
218 | - if( is_wp_error( $merge_variables ) || isset( $merge_variables['error'] ) ) { |
|
219 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
218 | + if ( is_wp_error( $merge_variables ) || isset( $merge_variables[ 'error' ] ) ) { |
|
219 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
220 | 220 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
221 | 221 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
222 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" ); |
|
222 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" ); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | // re-store our data |
226 | - $merge_variables = $merge_variables['data'][0]['merge_vars']; |
|
226 | + $merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ]; |
|
227 | 227 | $merge_variable_name_array = array(); |
228 | - foreach( $merge_variables as $merge_var ) { |
|
229 | - $merge_variables_name_array[$merge_var['tag']] = $merge_var['name']; |
|
228 | + foreach ( $merge_variables as $merge_var ) { |
|
229 | + $merge_variables_name_array[ $merge_var[ 'tag' ] ] = $merge_var[ 'name' ]; |
|
230 | 230 | } |
231 | - $error_message = $subscribe_response['error']; |
|
231 | + $error_message = $subscribe_response[ 'error' ]; |
|
232 | 232 | // replace tag with name in the error message. |
233 | - foreach( $merge_variables_name_array as $tag => $name ) { |
|
233 | + foreach ( $merge_variables_name_array as $tag => $name ) { |
|
234 | 234 | $error_message = str_replace( $tag, $name, $error_message ); |
235 | 235 | } |
236 | 236 | $error_response = $error_message; |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | // [email protected] is not allowed |
239 | 239 | case '-99': |
240 | 240 | // generic error |
241 | - $error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response['error'] ) ); |
|
241 | + $error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response[ 'error' ] ) ); |
|
242 | 242 | break; |
243 | 243 | // invalid email (or no email at all) |
244 | 244 | case '-100': |
245 | - $error_response = ( ! empty( $error_messages['invalid-email'] ) ) ? $error_messages['invalid-email'] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' ); |
|
245 | + $error_response = ( ! empty( $error_messages[ 'invalid-email' ] ) ) ? $error_messages[ 'invalid-email' ] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' ); |
|
246 | 246 | break; |
247 | 247 | default: |
248 | - $error_response = ( ! empty( $error_messages['general-error'] ) ) ? $error_messages['general-error'] : $subscribe_response['error']; |
|
248 | + $error_response = ( ! empty( $error_messages[ 'general-error' ] ) ) ? $error_messages[ 'general-error' ] : $subscribe_response[ 'error' ]; |
|
249 | 249 | break; |
250 | 250 | } |
251 | 251 | // send the response |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | /* |
264 | 264 | * Successful form submission redirect |
265 | 265 | */ |
266 | - if( $submission_settings['redirect_on_submission'] == '1' ) { |
|
266 | + if ( $submission_settings[ 'redirect_on_submission' ] == '1' ) { |
|
267 | 267 | $redirection = '1'; |
268 | - $redirect_url = ( 'custom_url' != $submission_settings['redirect_page'] ) ? get_permalink( $submission_settings['redirect_page'] ) : $submission_settings['custom_redirect_url']; |
|
268 | + $redirect_url = ( 'custom_url' != $submission_settings[ 'redirect_page' ] ) ? get_permalink( $submission_settings[ 'redirect_page' ] ) : $submission_settings[ 'custom_redirect_url' ]; |
|
269 | 269 | $redirect = '<script type="text/javascript">setTimeout(function() { window.location="' . apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_url ), $form, $page_data ) . '"; }, ' . apply_filters( 'yikes-mailchimp-redirect-timer', 1500 ) . ');</script>'; |
270 | 270 | } |
271 | 271 | |
@@ -281,16 +281,16 @@ discard block |
||
281 | 281 | do_action( 'yikes-mailchimp-after-submission-' . $form, $merge_variables ); |
282 | 282 | |
283 | 283 | // send our notifications if setup (must go before wp_send_json()) |
284 | - do_action( 'yikes-mailchimp-form-submission' , sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications ); |
|
285 | - do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications ); |
|
284 | + do_action( 'yikes-mailchimp-form-submission', sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications ); |
|
285 | + do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications ); |
|
286 | 286 | |
287 | - $default_success_response = ( 1 === $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' ); |
|
287 | + $default_success_response = ( 1 === $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' ); |
|
288 | 288 | |
289 | 289 | wp_send_json_success( |
290 | 290 | array( |
291 | - 'hide' => $submission_settings['hide_form_post_signup'], |
|
291 | + 'hide' => $submission_settings[ 'hide_form_post_signup' ], |
|
292 | 292 | 'error' => $error, |
293 | - 'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages['success'] ) ? $error_messages['success'] : $default_success_response ), $form, $merge_variables ), |
|
293 | + 'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages[ 'success' ] ) ? $error_messages[ 'success' ] : $default_success_response ), $form, $merge_variables ), |
|
294 | 294 | 'redirection' => isset( $redirection ) ? '1' : '0', |
295 | 295 | 'redirect' => isset( $redirect ) ? $redirect : '', |
296 | 296 | ) |
@@ -2,45 +2,45 @@ discard block |
||
2 | 2 | <?php |
3 | 3 | |
4 | 4 | // if an error was returned in the most recent query |
5 | - if( isset( $_GET['sql_error'] ) ) { |
|
5 | + if ( isset( $_GET[ 'sql_error' ] ) ) { |
|
6 | 6 | // if error logging is turned on, lets display a better error to help narrow things down |
7 | 7 | // lets also log things to the error log |
8 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
9 | - wp_die( '<strong>' . __( 'Error Creating Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong> <p>' . stripslashes( urldecode( $_GET['sql_error'] ) ) . '</p>' , __( 'Error Creating Form' , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
8 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
9 | + wp_die( '<strong>' . __( 'Error Creating Form', 'yikes-inc-easy-mailchimp-extender' ) . '</strong> <p>' . stripslashes( urldecode( $_GET[ 'sql_error' ] ) ) . '</p>', __( 'Error Creating Form', 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | 10 | } else { |
11 | - wp_die( '<strong>' . __( 'Error Creating Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong><p>' . __( "Please try again. If the error persists please get in contact with the YIKES Inc. support team." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>' ); |
|
11 | + wp_die( '<strong>' . __( 'Error Creating Form', 'yikes-inc-easy-mailchimp-extender' ) . '</strong><p>' . __( "Please try again. If the error persists please get in contact with the YIKES Inc. support team.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>' ); |
|
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | 15 | /* Get The Form ID we need to edit */ |
16 | - if( isset( $_GET['id'] ) ) { |
|
16 | + if ( isset( $_GET[ 'id' ] ) ) { |
|
17 | 17 | global $wpdb; |
18 | 18 | // grab and store the form ID |
19 | - $form_id = (int) $_GET['id']; |
|
19 | + $form_id = (int) $_GET[ 'id' ]; |
|
20 | 20 | // return it as an array, so we can work with it to build our form below |
21 | 21 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form_id . '', ARRAY_A ); |
22 | 22 | // Get all results for our form switcher |
23 | 23 | $all_forms = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms', ARRAY_A ); |
24 | 24 | |
25 | 25 | // if the form was not found return an error |
26 | - if( !$form_results ) { |
|
27 | - wp_die( printf( __( "Whoops! It looks like this form doesn't exist. If this error persists you may want to toggle on debugging on the <a href='%s'>%s</a> " , 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ), __( 'debug settings page' , 'yikes-inc-easy-mailchimp-extender' ) ), __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
26 | + if ( ! $form_results ) { |
|
27 | + wp_die( printf( __( "Whoops! It looks like this form doesn't exist. If this error persists you may want to toggle on debugging on the <a href='%s'>%s</a> ", 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ), __( 'debug settings page', 'yikes-inc-easy-mailchimp-extender' ) ), __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) ); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | // store our results |
31 | - $form = $form_results[0]; |
|
31 | + $form = $form_results[ 0 ]; |
|
32 | 32 | // set global form data, mainly for use in custom form field declarations |
33 | - $GLOBALS["form_data"] = $form; |
|
33 | + $GLOBALS[ "form_data" ] = $form; |
|
34 | 34 | |
35 | - $custom_styles = json_decode( $form['custom_styles'] , true ); |
|
36 | - $optin_settings = json_decode( $form['optin_settings'] , true ); |
|
37 | - $submission_settings = json_decode( $form['submission_settings'] , true ); |
|
38 | - $error_messages = json_decode( $form['error_messages'] , true ); |
|
39 | - $form_settings = ( isset( $form['form_settings'] ) ) ? json_decode( $form['form_settings'] , true ) : false; |
|
40 | - $custom_notifications = json_decode( $form['custom_notifications'] , true ); |
|
35 | + $custom_styles = json_decode( $form[ 'custom_styles' ], true ); |
|
36 | + $optin_settings = json_decode( $form[ 'optin_settings' ], true ); |
|
37 | + $submission_settings = json_decode( $form[ 'submission_settings' ], true ); |
|
38 | + $error_messages = json_decode( $form[ 'error_messages' ], true ); |
|
39 | + $form_settings = ( isset( $form[ 'form_settings' ] ) ) ? json_decode( $form[ 'form_settings' ], true ) : false; |
|
40 | + $custom_notifications = json_decode( $form[ 'custom_notifications' ], true ); |
|
41 | 41 | |
42 | 42 | // get defaults if none are saved in the database yet |
43 | - if( ! isset( $form_settings ) || empty( $form_settings ) ) { |
|
43 | + if ( ! isset( $form_settings ) || empty( $form_settings ) ) { |
|
44 | 44 | // setup defaults if none are saved |
45 | 45 | $form_settings = array( |
46 | 46 | 'yikes-easy-mc-form-class-names' => '', |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | 'yikes-easy-mc-form-schedule' => '0', |
53 | 53 | 'yikes-easy-mc-form-restriction-start' => strtotime( current_time( 'm/d/Y g:iA' ) ), // current date & time |
54 | 54 | 'yikes-easy-mc-form-restriction-end' => strtotime( current_time( 'm/d/Y g:iA' ) ) + ( 3600 * 24 ), // current date & time + 1 day |
55 | - 'yikes-easy-mc-form-restriction-pending-message' => sprintf( __( 'Signup is not yet open, and will be available on %s. Please come back then to signup.', 'yikes-inc-easy-mailchimp-extender' ), current_time( str_replace( '-', '/', get_option( 'date_format' ) ) ) . ' ' . __( 'at', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . current_time( 'g:iA' ) ) , |
|
56 | - 'yikes-easy-mc-form-restriction-expired-message' => sprintf( __( 'This signup for this form ended on %s.', 'yikes-inc-easy-mailchimp-extender' ), date( str_replace( '-', '/', get_option( 'date_format' ) ), strtotime( current_time( str_replace( '-', '/', get_option( 'date_format' ) ) ) ) + ( 3600 * 24 ) ) . ' ' . __( 'at', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . date( 'g:iA', strtotime( current_time( 'g:iA' ) ) + ( 3600 * 24 ) ) ) , |
|
55 | + 'yikes-easy-mc-form-restriction-pending-message' => sprintf( __( 'Signup is not yet open, and will be available on %s. Please come back then to signup.', 'yikes-inc-easy-mailchimp-extender' ), current_time( str_replace( '-', '/', get_option( 'date_format' ) ) ) . ' ' . __( 'at', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . current_time( 'g:iA' ) ), |
|
56 | + 'yikes-easy-mc-form-restriction-expired-message' => sprintf( __( 'This signup for this form ended on %s.', 'yikes-inc-easy-mailchimp-extender' ), date( str_replace( '-', '/', get_option( 'date_format' ) ), strtotime( current_time( str_replace( '-', '/', get_option( 'date_format' ) ) ) ) + ( 3600 * 24 ) ) . ' ' . __( 'at', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . date( 'g:iA', strtotime( current_time( 'g:iA' ) ) + ( 3600 * 24 ) ) ), |
|
57 | 57 | 'yikes-easy-mc-form-login-required' => '0', |
58 | 58 | 'yikes-easy-mc-form-restriction-login-message' => __( 'You need to be logged in to sign up for this mailing list.', 'yikes-inc-easy-mailchimp-extender' ), |
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
62 | - $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
62 | + $api_key = trim( get_option( 'yikes-mc-api-key', '' ) ); |
|
63 | 63 | $dash_position = strpos( $api_key, '-' ); |
64 | 64 | |
65 | 65 | // Check for a transient, if not - set one up for one hour |
66 | 66 | if ( false === ( $list_data = get_transient( 'yikes-easy-mailchimp-list-data' ) ) ) { |
67 | - if( $dash_position !== false ) { |
|
67 | + if ( $dash_position !== false ) { |
|
68 | 68 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
69 | 69 | } |
70 | 70 | $list_data = wp_remote_post( $api_endpoint, array( |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
77 | 77 | ) ); |
78 | 78 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); |
79 | - if( isset( $list_data['error'] ) ) { |
|
80 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
79 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
80 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
81 | 81 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
82 | 82 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
83 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "Edit Form Page" ); |
|
83 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "Edit Form Page" ); |
|
84 | 84 | } |
85 | 85 | } else { |
86 | 86 | // set our transient |
@@ -89,57 +89,57 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | // get the list data |
92 | - if( $dash_position !== false ) { |
|
92 | + if ( $dash_position !== false ) { |
|
93 | 93 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json'; |
94 | 94 | } |
95 | 95 | $available_merge_variables = wp_remote_post( $api_endpoint, array( |
96 | 96 | 'body' => array( |
97 | 97 | 'apikey' => $api_key, |
98 | - 'id' => array( $form['list_id'] ), |
|
98 | + 'id' => array( $form[ 'list_id' ] ), |
|
99 | 99 | ), |
100 | 100 | 'timeout' => 10, |
101 | 101 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
102 | 102 | ) ); |
103 | 103 | $available_merge_variables = json_decode( wp_remote_retrieve_body( $available_merge_variables ), true ); |
104 | - if( isset( $available_merge_variables['error'] ) ) { |
|
105 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
104 | + if ( isset( $available_merge_variables[ 'error' ] ) ) { |
|
105 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
106 | 106 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
107 | 107 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
108 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $available_merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "Edit Form Page" ); |
|
108 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $available_merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "Edit Form Page" ); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | // get the interest group data |
113 | - if( $dash_position !== false ) { |
|
113 | + if ( $dash_position !== false ) { |
|
114 | 114 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/interest-groupings.json'; |
115 | 115 | } |
116 | 116 | $interest_groupings = wp_remote_post( $api_endpoint, array( |
117 | 117 | 'body' => array( |
118 | 118 | 'apikey' => $api_key, |
119 | - 'id' => $form['list_id'] |
|
119 | + 'id' => $form[ 'list_id' ] |
|
120 | 120 | ), |
121 | 121 | 'timeout' => 10, |
122 | 122 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
123 | 123 | ) ); |
124 | 124 | $interest_groupings = json_decode( wp_remote_retrieve_body( $interest_groupings ), true ); |
125 | - $no_interest_groupings = '<p class="description error-descripion">' . __( 'No Interest Groups Found' , 'yikes-inc-easy-mailchimp-extender' ) . '.</p>'; |
|
126 | - if( isset( $interest_groupings['error'] ) ) { |
|
127 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
125 | + $no_interest_groupings = '<p class="description error-descripion">' . __( 'No Interest Groups Found', 'yikes-inc-easy-mailchimp-extender' ) . '.</p>'; |
|
126 | + if ( isset( $interest_groupings[ 'error' ] ) ) { |
|
127 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
128 | 128 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
129 | 129 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
130 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings['error'], __( "Get Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ), "Edit Form Page" ); |
|
130 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings[ 'error' ], __( "Get Interest Groups", 'yikes-inc-easy-mailchimp-extender' ), "Edit Form Page" ); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | 134 | |
135 | 135 | } else { |
136 | - wp_die( __( 'Oh No!' , 'yikes-inc-easy-mailchimp-extender' ) , __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
136 | + wp_die( __( 'Oh No!', 'yikes-inc-easy-mailchimp-extender' ), __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /* Confirm we've retreived our form data */ |
140 | - if( empty( $form ) ) { |
|
140 | + if ( empty( $form ) ) { |
|
141 | 141 | |
142 | - wp_die( __( "We've encountered an error. Please try again. If the error persists, please contact support." , 'yikes-inc-easy-mailchimp-extender' ) , __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
142 | + wp_die( __( "We've encountered an error. Please try again. If the error persists, please contact support.", 'yikes-inc-easy-mailchimp-extender' ), __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) ); |
|
143 | 143 | |
144 | 144 | } else { |
145 | 145 | |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | add_query_arg( |
150 | 150 | array( |
151 | 151 | 'action' => 'yikes-easy-mc-update-form', |
152 | - 'nonce' => wp_create_nonce( 'update-mailchimp-form'.-$form['id'] ) |
|
152 | + 'nonce' => wp_create_nonce( 'update-mailchimp-form' . -$form[ 'id' ] ) |
|
153 | 153 | ) |
154 | 154 | ) |
155 | 155 | ); |
156 | 156 | /* Display Our Form */ |
157 | 157 | ?> |
158 | 158 | <!-- Freddie Logo --> |
159 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
159 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
160 | 160 | |
161 | - <h1>YIKES Easy Forms for MailChimp | <?php echo __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . $form['form_name']; ?></h1> |
|
161 | + <h1>YIKES Easy Forms for MailChimp | <?php echo __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . $form[ 'form_name' ]; ?></h1> |
|
162 | 162 | |
163 | 163 | <!-- Settings Page Description --> |
164 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Update this MailChimp form\'s fields, styles and settings below.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
164 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Update this MailChimp form\'s fields, styles and settings below.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
165 | 165 | |
166 | 166 | <?php |
167 | - if( isset( $_REQUEST['updated-form'] ) && $_REQUEST['updated-form'] == 'true' ) { |
|
167 | + if ( isset( $_REQUEST[ 'updated-form' ] ) && $_REQUEST[ 'updated-form' ] == 'true' ) { |
|
168 | 168 | ?> |
169 | 169 | <div class="updated manage-form-admin-notice"> |
170 | 170 | <p><?php _e( 'Opt-in form successfully updated.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | <div class="inside"> |
189 | 189 | |
190 | 190 | <label for="form-name"> |
191 | - <h3 class="bg-transparent"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
192 | - <input autocomplete="disabled" id="form-name" name="form-name" type="text" value="<?php echo stripslashes( esc_html( $form['form_name'] ) ); ?>" class="widefat" /> |
|
193 | - <p class="description"><?php _e( "The title of this signup form." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
191 | + <h3 class="bg-transparent"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
192 | + <input autocomplete="disabled" id="form-name" name="form-name" type="text" value="<?php echo stripslashes( esc_html( $form[ 'form_name' ] ) ); ?>" class="widefat" /> |
|
193 | + <p class="description"><?php _e( "The title of this signup form.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
194 | 194 | </label> |
195 | 195 | |
196 | 196 | <label for="form-description"> |
197 | - <h3 class="bg-transparent"><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
198 | - <textarea name="form-description" id="form-description" class="large-text edit-form-form-description"><?php echo isset( $form['form_description'] ) ? stripslashes( esc_textarea( $form['form_description'] ) ) : ''; ?></textarea> |
|
199 | - <p class="description"><?php _e( "Descriptions are optional and you may choose to display it to visitors to your site." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
197 | + <h3 class="bg-transparent"><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
198 | + <textarea name="form-description" id="form-description" class="large-text edit-form-form-description"><?php echo isset( $form[ 'form_description' ] ) ? stripslashes( esc_textarea( $form[ 'form_description' ] ) ) : ''; ?></textarea> |
|
199 | + <p class="description"><?php _e( "Descriptions are optional and you may choose to display it to visitors to your site.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
200 | 200 | <p class="description"><?php printf( __( 'To display the number of subscribers for the list associated with this form, use %s in the form description field above.', 'yikes-inc-easy-mailchimp-extender' ), '<code>[yikes-mailchimp-subscriber-count]</code>' ); ?><p> |
201 | 201 | </label> |
202 | 202 | |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | |
213 | 213 | <ul id="yikes_easy_mc_toolbar_links"> |
214 | 214 | <li class="hidden_setting_list"> |
215 | - <a class="hidden_setting form-builder selected_hidden_setting" data-attr-container="form-builder" onclick="return false;" title="<?php esc_attr_e( 'Customize Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Form Builder' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
215 | + <a class="hidden_setting form-builder selected_hidden_setting" data-attr-container="form-builder" onclick="return false;" title="<?php esc_attr_e( 'Customize Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Form Builder', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
216 | 216 | <div class="selected_setting_triangle"></div> |
217 | 217 | </li> |
218 | 218 | <li class="hidden_setting_list"> |
219 | - <a class="hidden_setting form-settings" onclick="return false;" data-attr-container="form-settings" title="<?php esc_attr_e( 'Form Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Form Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
219 | + <a class="hidden_setting form-settings" onclick="return false;" data-attr-container="form-settings" title="<?php esc_attr_e( 'Form Settings', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Form Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
220 | 220 | </li> |
221 | 221 | <li class="hidden_setting_list"> |
222 | - <a class="hidden_setting error-messages" onclick="return false;" data-attr-container="error-messages" title="<?php esc_attr_e( 'Customize Form Messages' , 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Custom Messages' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
222 | + <a class="hidden_setting error-messages" onclick="return false;" data-attr-container="error-messages" title="<?php esc_attr_e( 'Customize Form Messages', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="#"> <?php _e( 'Custom Messages', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
223 | 223 | </li> |
224 | - <?php do_action( 'yikes-mailchimp-edit-form-section-links' , $form ); ?> |
|
224 | + <?php do_action( 'yikes-mailchimp-edit-form-section-links', $form ); ?> |
|
225 | 225 | </ul> |
226 | 226 | |
227 | 227 | </div> |
@@ -242,22 +242,22 @@ discard block |
||
242 | 242 | <div class="meta-box-sortables ui-sortable"> |
243 | 243 | <div class="postbox yikes-easy-mc-postbox"> |
244 | 244 | <!-- container title --> |
245 | - <h3 class="edit-form-title"><?php _e( 'Form Builder' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
246 | - <p id="edit-form-description" class="description"><?php _e( 'Select fields from the right to add to this form, you can click a field to reveal advanced options, or drag it to re-arrange its position in the form.' , 'yikes-inc-easy-mailchimp-extender' );?></p> |
|
245 | + <h3 class="edit-form-title"><?php _e( 'Form Builder', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
246 | + <p id="edit-form-description" class="description"><?php _e( 'Select fields from the right to add to this form, you can click a field to reveal advanced options, or drag it to re-arrange its position in the form.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
247 | 247 | <div id="form-builder-container" class="inside"> |
248 | 248 | <!-- #poststuff --> |
249 | - <?php echo $this->generate_form_editor( json_decode( $form['fields'] , true ) , $form['list_id'] , $available_merge_variables , isset( $interest_groupings ) ? $interest_groupings : array() ); ?> |
|
249 | + <?php echo $this->generate_form_editor( json_decode( $form[ 'fields' ], true ), $form[ 'list_id' ], $available_merge_variables, isset( $interest_groupings ) ? $interest_groupings : array() ); ?> |
|
250 | 250 | </div> |
251 | 251 | |
252 | 252 | <!-- Bulk Delete Form Fields --> |
253 | - <a href="#" class="clear-form-fields" <?php if( isset( $form['fields'] ) && count( json_decode( $form['fields'] , true ) ) <= 0 ) { ?> style="display:none;" <?php } ?>><?php _e( 'Clear Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
253 | + <a href="#" class="clear-form-fields" <?php if ( isset( $form[ 'fields' ] ) && count( json_decode( $form[ 'fields' ], true ) ) <= 0 ) { ?> style="display:none;" <?php } ?>><?php _e( 'Clear Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
254 | 254 | |
255 | 255 | <?php |
256 | - $display_none = ( isset( $form['fields'] ) && count( json_decode( $form['fields'] , true ) ) <= 0 ) ? 'display:none;' : ''; |
|
256 | + $display_none = ( isset( $form[ 'fields' ] ) && count( json_decode( $form[ 'fields' ], true ) ) <= 0 ) ? 'display:none;' : ''; |
|
257 | 257 | ?> |
258 | 258 | |
259 | 259 | <!-- Save Fields Button --> |
260 | - <?php echo submit_button( __( 'Update Form' ) , 'primary' , '' , false , array( 'onclick' => '', 'style' => 'float:right;margin-right:12px;'.$display_none ) ); ?> |
|
260 | + <?php echo submit_button( __( 'Update Form' ), 'primary', '', false, array( 'onclick' => '', 'style' => 'float:right;margin-right:12px;' . $display_none ) ); ?> |
|
261 | 261 | |
262 | 262 | <!-- .inside --> |
263 | 263 | </div> |
@@ -270,15 +270,15 @@ discard block |
||
270 | 270 | <div id="postbox-container-1" class="postbox-container"> |
271 | 271 | <div class="meta-box-sortables"> |
272 | 272 | <div class="postbox yikes-easy-mc-postbox"> |
273 | - <h3 class="edit-form-title"><span><?php _e( "Form Fields & Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
273 | + <h3 class="edit-form-title"><span><?php _e( "Form Fields & Interest Groups", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
274 | 274 | <div class="inside"> |
275 | 275 | |
276 | 276 | <h3 class="nav-tab-wrapper mv_ig_list"> |
277 | - <a href="#" class="nav-tab nav-tab-active" alt="merge-variables"><div class="arrow-down"></div><?php _e( 'Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
278 | - <?php if( !isset( $merge_variable_error ) ) { ?> |
|
279 | - <a href="#" class="nav-tab"><?php _e( 'Interest Groups' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
277 | + <a href="#" class="nav-tab nav-tab-active" alt="merge-variables"><div class="arrow-down"></div><?php _e( 'Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
278 | + <?php if ( ! isset( $merge_variable_error ) ) { ?> |
|
279 | + <a href="#" class="nav-tab"><?php _e( 'Interest Groups', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
280 | 280 | <?php } else { ?> |
281 | - <a href="#" class="nav-tab no-interest-groups-found-message" disabled="disabled" title="<?php _e( "No Interest Groups Exist" , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Interest Groups' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
281 | + <a href="#" class="nav-tab no-interest-groups-found-message" disabled="disabled" title="<?php _e( "No Interest Groups Exist", 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Interest Groups', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
282 | 282 | <?php } ?> |
283 | 283 | </h3> |
284 | 284 | |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | |
287 | 287 | <div id="merge-variables-container" class="list-container"> |
288 | 288 | <?php |
289 | - if( ! isset( $merge_variable_error ) ) { |
|
289 | + if ( ! isset( $merge_variable_error ) ) { |
|
290 | 290 | // build a list of available merge variables, |
291 | 291 | // but exclude the ones already assigned to the form |
292 | - echo '<p class="description">' . __( "Select a field below to add to the form builder." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
293 | - $this->build_available_merge_vars( json_decode( $form['fields'] , true ) , $available_merge_variables ); |
|
292 | + echo '<p class="description">' . __( "Select a field below to add to the form builder.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
293 | + $this->build_available_merge_vars( json_decode( $form[ 'fields' ], true ), $available_merge_variables ); |
|
294 | 294 | } else { |
295 | 295 | echo $merge_variable_error; |
296 | 296 | } |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | |
300 | 300 | <div id="interest-groups-container" class="list-container"> |
301 | 301 | <?php |
302 | - if( isset( $interest_groupings ) && ! isset( $interest_groupings['error'] ) ) { |
|
302 | + if ( isset( $interest_groupings ) && ! isset( $interest_groupings[ 'error' ] ) ) { |
|
303 | 303 | // build a list of available merge variables, |
304 | 304 | // but exclude the ones already assigned to the form |
305 | - echo '<p class="description">' . __( "Select an interest group below to add to the form builder." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
305 | + echo '<p class="description">' . __( "Select an interest group below to add to the form builder.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
306 | 306 | // $this->build_available_merge_vars( json_decode( $form['fields'] , true ) , $available_merge_variables ); |
307 | - $this->build_available_interest_groups( json_decode( $form['fields'] , true ) , $interest_groupings , $form['list_id'] ); |
|
307 | + $this->build_available_interest_groups( json_decode( $form[ 'fields' ], true ), $interest_groupings, $form[ 'list_id' ] ); |
|
308 | 308 | } else { |
309 | - echo '<p class="description">' . $interest_groupings['error'] . '</p>'; |
|
309 | + echo '<p class="description">' . $interest_groupings[ 'error' ] . '</p>'; |
|
310 | 310 | } |
311 | 311 | ?> |
312 | 312 | </div> |
@@ -339,19 +339,19 @@ discard block |
||
339 | 339 | <div id="post-body-content"> |
340 | 340 | <div class="meta-box-sortables ui-sortable"> |
341 | 341 | <div class="postbox yikes-easy-mc-postbox"> |
342 | - <h3 class="edit-form-title"><span><?php _e( "Additional Form Settings" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
342 | + <h3 class="edit-form-title"><span><?php _e( "Additional Form Settings", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
343 | 343 | |
344 | 344 | <div class="inside form-settings-container"> |
345 | 345 | |
346 | - <p class="edit-form-description"><?php _e( "Adjust some additional form settings below." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
346 | + <p class="edit-form-description"><?php _e( "Adjust some additional form settings below.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
347 | 347 | |
348 | 348 | <!-- begin form classes section --> |
349 | 349 | <strong class="section-title first"><?php _e( 'Overall Form Classes', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
350 | 350 | <section class="section-interior"> |
351 | 351 | |
352 | 352 | <!-- form classes --> |
353 | - <label for="yikes-easy-mc-form-class-names"><strong><?php _e( 'Form Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
354 | - <input type="text" class="widefat" name="yikes-easy-mc-form-class-names" id="yikes-easy-mc-form-class-names" value="<?php echo $form_settings['yikes-easy-mc-form-class-names']; ?>" placeholder="<?php _e( 'Add additional classes to this opt-in form.', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
353 | + <label for="yikes-easy-mc-form-class-names"><strong><?php _e( 'Form Classes', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
354 | + <input type="text" class="widefat" name="yikes-easy-mc-form-class-names" id="yikes-easy-mc-form-class-names" value="<?php echo $form_settings[ 'yikes-easy-mc-form-class-names' ]; ?>" placeholder="<?php _e( 'Add additional classes to this opt-in form.', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
355 | 355 | <p class="description"><?php printf( __( 'Add additional class names to the %s element.', 'yikes-inc-easy-mailchimp-extender' ), '<code>' . htmlentities( '<form>' ) . '</code>' ); ?></p> |
356 | 356 | </label> |
357 | 357 | |
@@ -364,12 +364,12 @@ discard block |
||
364 | 364 | |
365 | 365 | <!-- setup the checked state here --> |
366 | 366 | <!-- inline form --> |
367 | - <strong><?php _e( 'Inline Form' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
367 | + <strong><?php _e( 'Inline Form', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
368 | 368 | <label class="inline-form-label"> |
369 | - <input type="radio" name="yikes-easy-mc-inline-form[]" value="1" <?php checked( $form_settings['yikes-easy-mc-inline-form'], '1' ); ?>/><?php _e( 'Enable', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
369 | + <input type="radio" name="yikes-easy-mc-inline-form[]" value="1" <?php checked( $form_settings[ 'yikes-easy-mc-inline-form' ], '1' ); ?>/><?php _e( 'Enable', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
370 | 370 | </label> |
371 | 371 | <label class="inline-form-label"> |
372 | - <input type="radio" name="yikes-easy-mc-inline-form[]" value="0" <?php checked( $form_settings['yikes-easy-mc-inline-form'], '0' ); ?> /><?php _e( 'Disable', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
372 | + <input type="radio" name="yikes-easy-mc-inline-form[]" value="0" <?php checked( $form_settings[ 'yikes-easy-mc-inline-form' ], '0' ); ?> /><?php _e( 'Disable', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
373 | 373 | </label> |
374 | 374 | <p class="description"><?php _e( 'Programatically setup this form so that all fields are on the same line.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
375 | 375 | <p class="description"><?php printf( __( 'If you are having issues with your theme not displaying the inline form properly, please see the following %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a href="https://yikesplugins.com/support/knowledge-base/my-form-fields-are-not-fully-inline-after-enabling-the-inline-form-option-how-come/" target="_blank">' . __( 'knowledge base article', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></p> |
@@ -382,30 +382,30 @@ discard block |
||
382 | 382 | <section class="section-interior"> |
383 | 383 | |
384 | 384 | <!-- Submit button type --> |
385 | - <strong><?php _e( 'Submit Button Type' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
385 | + <strong><?php _e( 'Submit Button Type', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
386 | 386 | <label class="inline-form-label"> |
387 | - <input type="radio" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-submit-button-type[]" value="text" <?php checked( $form_settings['yikes-easy-mc-submit-button-type'], 'text' ); ?> /><?php _e( 'Text', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
387 | + <input type="radio" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-submit-button-type[]" value="text" <?php checked( $form_settings[ 'yikes-easy-mc-submit-button-type' ], 'text' ); ?> /><?php _e( 'Text', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
388 | 388 | </label> |
389 | 389 | <label class="inline-form-label"> |
390 | - <input type="radio" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-submit-button-type[]" value="image" <?php checked( $form_settings['yikes-easy-mc-submit-button-type'], 'image' ); ?> /><?php _e( 'Image', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
390 | + <input type="radio" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-submit-button-type[]" value="image" <?php checked( $form_settings[ 'yikes-easy-mc-submit-button-type' ], 'image' ); ?> /><?php _e( 'Image', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
391 | 391 | </label> |
392 | 392 | <p class="description"><?php _e( 'Select the submit button type for this form.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
393 | 393 | <!-- end submit button type --> |
394 | 394 | |
395 | 395 | <!-- Text submit button type --> |
396 | - <section class="submit-button-type-text nested-child<?php if( $form_settings['yikes-easy-mc-submit-button-type'] == 'image' ) { echo ' hidden'; } ?>"> |
|
396 | + <section class="submit-button-type-text nested-child<?php if ( $form_settings[ 'yikes-easy-mc-submit-button-type' ] == 'image' ) { echo ' hidden'; } ?>"> |
|
397 | 397 | <!-- submit button text --> |
398 | - <label for="yikes-easy-mc-submit-button-text"><strong><?php _e( 'Submit Button Text' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
399 | - <input type="text" class="widefat" name="yikes-easy-mc-submit-button-text" id="yikes-easy-mc-submit-button-text" value="<?php echo $form_settings['yikes-easy-mc-submit-button-text']; ?>" placeholder="<?php _e( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
398 | + <label for="yikes-easy-mc-submit-button-text"><strong><?php _e( 'Submit Button Text', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
399 | + <input type="text" class="widefat" name="yikes-easy-mc-submit-button-text" id="yikes-easy-mc-submit-button-text" value="<?php echo $form_settings[ 'yikes-easy-mc-submit-button-text' ]; ?>" placeholder="<?php _e( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
400 | 400 | <p class="description"><?php printf( __( 'Set the submit button text. Leaving this blank will default to %s.', 'yikes-inc-easy-mailchimp-extender' ), '"' . __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ) . '"' ); ?></p> |
401 | 401 | </label> |
402 | 402 | </section> |
403 | 403 | <!-- end text submit button type --> |
404 | 404 | |
405 | 405 | <!-- Image submit button type --> |
406 | - <section class="submit-button-type-image nested-child<?php if( $form_settings['yikes-easy-mc-submit-button-type'] == 'text' ) { echo ' hidden'; } ?>"> |
|
407 | - <label for="yikes-easy-mc-submit-button-image"><strong><?php _e( 'Submit Button URL' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
408 | - <input type="text" class="widefat" name="yikes-easy-mc-submit-button-image" id="yikes-easy-mc-submit-button-image" value="<?php echo $form_settings['yikes-easy-mc-submit-button-image']; ?>" placeholder="<?php _e( 'http://', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
406 | + <section class="submit-button-type-image nested-child<?php if ( $form_settings[ 'yikes-easy-mc-submit-button-type' ] == 'text' ) { echo ' hidden'; } ?>"> |
|
407 | + <label for="yikes-easy-mc-submit-button-image"><strong><?php _e( 'Submit Button URL', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
408 | + <input type="text" class="widefat" name="yikes-easy-mc-submit-button-image" id="yikes-easy-mc-submit-button-image" value="<?php echo $form_settings[ 'yikes-easy-mc-submit-button-image' ]; ?>" placeholder="<?php _e( 'http://', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
409 | 409 | <p class="description"><?php _e( 'Enter the URL of an image you would like to use as the submit button for this form.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
410 | 410 | </label> |
411 | 411 | </section> |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | |
414 | 414 | |
415 | 415 | <!-- submit button classes --> |
416 | - <label for="yikes-easy-mc-form-submit-button-classes"><strong style="float:left;"><?php _e( 'Submit Button Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
417 | - <input type="text" class="widefat" name="yikes-easy-mc-submit-button-classes" id="yikes-easy-mc-submit-button-classes" value="<?php echo $form_settings['yikes-easy-mc-submit-button-classes']; ?>" placeholder="<?php _e( 'Add additional classes to this submit button.', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
416 | + <label for="yikes-easy-mc-form-submit-button-classes"><strong style="float:left;"><?php _e( 'Submit Button Classes', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
417 | + <input type="text" class="widefat" name="yikes-easy-mc-submit-button-classes" id="yikes-easy-mc-submit-button-classes" value="<?php echo $form_settings[ 'yikes-easy-mc-submit-button-classes' ]; ?>" placeholder="<?php _e( 'Add additional classes to this submit button.', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
418 | 418 | <p class="description"><?php _e( 'Add custom classes to the submit button.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
419 | 419 | </label> |
420 | 420 | <!-- end submit button classes --> |
@@ -427,45 +427,45 @@ discard block |
||
427 | 427 | <section class="section-interior"> |
428 | 428 | <!-- Schedule form --> |
429 | 429 | <label class="inline-form-label"> |
430 | - <input type="checkbox" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-form-schedule" value="1" <?php checked( $form_settings['yikes-easy-mc-form-schedule'], '1' ); ?>/><?php _e( 'Schedule Form', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
430 | + <input type="checkbox" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-form-schedule" value="1" <?php checked( $form_settings[ 'yikes-easy-mc-form-schedule' ], '1' ); ?>/><?php _e( 'Schedule Form', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
431 | 431 | </label> |
432 | 432 | <p class="description" style="margin-bottom:0;"><?php _e( 'Set a time period that this form should be active on your site. (mm/dd/yyyy)', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
433 | 433 | <p class="description" style="margin: 0 0 .5em 0;"><?php _e( 'Once the end date & time have passed, users will no longer be able to signup for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
434 | 434 | <!-- Start Date Limitation Nested --> |
435 | - <section class="date-restirction-section nested-child<?php if( $form_settings['yikes-easy-mc-form-schedule'] == '0' ) { echo ' hidden'; } ?>"> |
|
435 | + <section class="date-restirction-section nested-child<?php if ( $form_settings[ 'yikes-easy-mc-form-schedule' ] == '0' ) { echo ' hidden'; } ?>"> |
|
436 | 436 | <!-- Start Date --> |
437 | - <label for="yikes-easy-mc-form-restriction-start-date"><strong><?php _e( 'Start Date' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
438 | - <input type="text" class="date-picker" name="yikes-easy-mc-form-restriction-start-date" id="yikes-easy-mc-form-restriction-start-date" value="<?php echo date( $this->yikes_jQuery_datepicker_date_format( get_option( 'date_format' ) ), $form_settings['yikes-easy-mc-form-restriction-start'] ); ?>" > |
|
437 | + <label for="yikes-easy-mc-form-restriction-start-date"><strong><?php _e( 'Start Date', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
438 | + <input type="text" class="date-picker" name="yikes-easy-mc-form-restriction-start-date" id="yikes-easy-mc-form-restriction-start-date" value="<?php echo date( $this->yikes_jQuery_datepicker_date_format( get_option( 'date_format' ) ), $form_settings[ 'yikes-easy-mc-form-restriction-start' ] ); ?>" > |
|
439 | 439 | <?php _e( 'at', 'yikes-inc-easy-mailchimp-extender' ); ?> |
440 | 440 | </label> |
441 | 441 | |
442 | 442 | <!-- Start Time --> |
443 | - <label for="yikes-easy-mc-form-restriction-start-time"><strong><?php _e( 'Start Time' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
444 | - <input type="text" class="time-picker" name="yikes-easy-mc-form-restriction-start-time" id="yikes-easy-mc-form-restriction-start-time" value="<?php echo date( 'g:iA', $form_settings['yikes-easy-mc-form-restriction-start'] ); ?>" > |
|
443 | + <label for="yikes-easy-mc-form-restriction-start-time"><strong><?php _e( 'Start Time', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
444 | + <input type="text" class="time-picker" name="yikes-easy-mc-form-restriction-start-time" id="yikes-easy-mc-form-restriction-start-time" value="<?php echo date( 'g:iA', $form_settings[ 'yikes-easy-mc-form-restriction-start' ] ); ?>" > |
|
445 | 445 | </label> |
446 | 446 | <p class="description"><?php _e( 'Set the dates that this form should display on your site.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
447 | 447 | </section> |
448 | 448 | <!-- end Start Date Limitation Nested --> |
449 | 449 | |
450 | 450 | <!-- End Date Limitation Nested --> |
451 | - <section class="date-restirction-section nested-child<?php if( $form_settings['yikes-easy-mc-form-schedule'] == '0' ) { echo ' hidden'; } ?> last"> |
|
451 | + <section class="date-restirction-section nested-child<?php if ( $form_settings[ 'yikes-easy-mc-form-schedule' ] == '0' ) { echo ' hidden'; } ?> last"> |
|
452 | 452 | <!-- End Date --> |
453 | - <label for="yikes-easy-mc-form-restriction-end-date"><strong><?php _e( 'End Date' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
454 | - <input type="text" class="date-picker" name="yikes-easy-mc-form-restriction-end-date" id="yikes-easy-mc-form-restriction-end-date" value="<?php echo date( $this->yikes_jQuery_datepicker_date_format( get_option( 'date_format' ) ), $form_settings['yikes-easy-mc-form-restriction-end'] ); ?>" > |
|
453 | + <label for="yikes-easy-mc-form-restriction-end-date"><strong><?php _e( 'End Date', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
454 | + <input type="text" class="date-picker" name="yikes-easy-mc-form-restriction-end-date" id="yikes-easy-mc-form-restriction-end-date" value="<?php echo date( $this->yikes_jQuery_datepicker_date_format( get_option( 'date_format' ) ), $form_settings[ 'yikes-easy-mc-form-restriction-end' ] ); ?>" > |
|
455 | 455 | <?php _e( 'at', 'yikes-inc-easy-mailchimp-extender' ); ?> |
456 | 456 | </label> |
457 | 457 | |
458 | 458 | <!-- End Time --> |
459 | - <label for="yikes-easy-mc-form-restriction-end-time"><strong><?php _e( 'End Time' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
460 | - <input type="text" class="time-picker" name="yikes-easy-mc-form-restriction-end-time" id="yikes-easy-mc-form-restriction-end-time" value="<?php echo date( 'g:iA', $form_settings['yikes-easy-mc-form-restriction-end'] ); ?>" > |
|
459 | + <label for="yikes-easy-mc-form-restriction-end-time"><strong><?php _e( 'End Time', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
460 | + <input type="text" class="time-picker" name="yikes-easy-mc-form-restriction-end-time" id="yikes-easy-mc-form-restriction-end-time" value="<?php echo date( 'g:iA', $form_settings[ 'yikes-easy-mc-form-restriction-end' ] ); ?>" > |
|
461 | 461 | </label> |
462 | 462 | <p class="description"><?php _e( 'Set the dates that this form should no longer display on your site.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
463 | 463 | |
464 | 464 | <!-- Form pending message --> |
465 | - <label for="yikes-easy-mc-form-restriction-pending-message"><strong><?php _e( 'Pending Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
465 | + <label for="yikes-easy-mc-form-restriction-pending-message"><strong><?php _e( 'Pending Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
466 | 466 | <?php |
467 | 467 | wp_editor( |
468 | - $form_settings['yikes-easy-mc-form-restriction-pending-message'], |
|
468 | + $form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ], |
|
469 | 469 | 'yikes-easy-mc-form-restriction-pending-message', |
470 | 470 | array( |
471 | 471 | 'editor_class' => 'yikes-easy-mc-form-restriction-pending-message', |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | <p class="description"><?php _e( 'Set the message that should display prior to the form being active.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
478 | 478 | |
479 | 479 | <!-- form expired message --> |
480 | - <label for="yikes-easy-mc-form-restriction-expired-message"><strong><?php _e( 'Expired Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
480 | + <label for="yikes-easy-mc-form-restriction-expired-message"><strong><?php _e( 'Expired Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
481 | 481 | <?php |
482 | 482 | wp_editor( |
483 | - $form_settings['yikes-easy-mc-form-restriction-expired-message'], |
|
483 | + $form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ], |
|
484 | 484 | 'yikes-easy-mc-form-restriction-expired-message', |
485 | 485 | array( |
486 | 486 | 'editor_class' => 'yikes-easy-mc-form-restriction-expired-message', |
@@ -495,16 +495,16 @@ discard block |
||
495 | 495 | |
496 | 496 | <!-- Require Users to be Logged In --> |
497 | 497 | <label class="inline-form-label"> |
498 | - <input type="checkbox" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-form-login-required" value="1" <?php checked( $form_settings['yikes-easy-mc-form-login-required'], '1' ); ?> /><?php _e( 'Require Login', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
498 | + <input type="checkbox" onclick="toggle_nested_section( jQuery(this) );" name="yikes-easy-mc-form-login-required" value="1" <?php checked( $form_settings[ 'yikes-easy-mc-form-login-required' ], '1' ); ?> /><?php _e( 'Require Login', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
499 | 499 | </label> |
500 | 500 | <p class="description"><?php _e( 'Require users to be logged in before they can view and submit this opt-in form.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
501 | 501 | |
502 | 502 | <!-- Require Login Message --> |
503 | - <section class="login-restirction-section nested-child<?php if( $form_settings['yikes-easy-mc-form-login-required'] == '0' ) { echo ' hidden'; } ?>"> |
|
504 | - <label for="yikes-easy-mc-form-restriction-login-message"><strong><?php _e( 'Required Login Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
503 | + <section class="login-restirction-section nested-child<?php if ( $form_settings[ 'yikes-easy-mc-form-login-required' ] == '0' ) { echo ' hidden'; } ?>"> |
|
504 | + <label for="yikes-easy-mc-form-restriction-login-message"><strong><?php _e( 'Required Login Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
505 | 505 | <?php |
506 | 506 | wp_editor( |
507 | - $form_settings['yikes-easy-mc-form-restriction-login-message'], |
|
507 | + $form_settings[ 'yikes-easy-mc-form-restriction-login-message' ], |
|
508 | 508 | 'yikes-easy-mc-form-restriction-login-message', |
509 | 509 | array( |
510 | 510 | 'editor_class' => 'yikes-easy-mc-form-restriction-login-message', |
@@ -533,14 +533,14 @@ discard block |
||
533 | 533 | <div id="postbox-container-1" class="postbox-container"> |
534 | 534 | <div class="meta-box-sortables"> |
535 | 535 | <div class="postbox yikes-easy-mc-postbox"> |
536 | - <h3 class="edit-form-title"><span><?php _e( "Form Settings Explained" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
536 | + <h3 class="edit-form-title"><span><?php _e( "Form Settings Explained", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
537 | 537 | <div class="inside"> |
538 | 538 | |
539 | 539 | <ul> |
540 | - <li><strong><?php _e( 'Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Add additional classes to this form, allowing you to target it more easily for customization via CSS.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
541 | - <li><strong><?php _e( 'Form Layout' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Toggle the layout of this form between single column and an inline layout. The inline layout places all of your form fields and the submit button on a single line.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
542 | - <li><strong><?php _e( 'Submit Button' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Adjust setting specific to the submit button. Change the submit button text, or set it to a specified image. Use the "Submit Button Classes" to assign additional classes to your submit button - ensuring it fits better into your theme.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
543 | - <li><strong><?php _e( 'Form Restrictions' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Adjust the restrictions for this form. Limit form visibility to a given time period, require users to be logged in to sign up or combine the two!' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
540 | + <li><strong><?php _e( 'Classes', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Add additional classes to this form, allowing you to target it more easily for customization via CSS.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
541 | + <li><strong><?php _e( 'Form Layout', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Toggle the layout of this form between single column and an inline layout. The inline layout places all of your form fields and the submit button on a single line.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
542 | + <li><strong><?php _e( 'Submit Button', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Adjust setting specific to the submit button. Change the submit button text, or set it to a specified image. Use the "Submit Button Classes" to assign additional classes to your submit button - ensuring it fits better into your theme.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
543 | + <li><strong><?php _e( 'Form Restrictions', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'Adjust the restrictions for this form. Limit form visibility to a given time period, require users to be logged in to sign up or combine the two!', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
544 | 544 | </ul> |
545 | 545 | |
546 | 546 | </div> |
@@ -568,41 +568,41 @@ discard block |
||
568 | 568 | <div id="post-body-content"> |
569 | 569 | <div class="meta-box-sortables ui-sortable"> |
570 | 570 | <div class="postbox yikes-easy-mc-postbox"> |
571 | - <h3 class="edit-form-title"><span><?php _e( "Custom Messages" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
571 | + <h3 class="edit-form-title"><span><?php _e( "Custom Messages", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
572 | 572 | |
573 | 573 | <div class="inside error-message-container"> |
574 | 574 | <?php |
575 | 575 | // build our default options |
576 | 576 | $error_message_array = array( |
577 | - 'success' => __( 'Thank You for subscribing! Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
578 | - 'general-error' => __( "Whoops! It looks like something went wrong. Please try again." , 'yikes-inc-easy-mailchimp-extender' ), |
|
579 | - 'invalid-email' => __( "Please provide a valid email address." , 'yikes-inc-easy-mailchimp-extender' ), |
|
580 | - 'email-exists-error' => __( "The provided email is already subscribed to this list." , 'yikes-inc-easy-mailchimp-extender' ), |
|
581 | - 'update-link' => __ ( "To update your MailChimp profile, please [link]click to send yourself an update link[/link].", 'yikes-inc-easy-mailchimp-extender' ), |
|
577 | + 'success' => __( 'Thank You for subscribing! Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ), |
|
578 | + 'general-error' => __( "Whoops! It looks like something went wrong. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), |
|
579 | + 'invalid-email' => __( "Please provide a valid email address.", 'yikes-inc-easy-mailchimp-extender' ), |
|
580 | + 'email-exists-error' => __( "The provided email is already subscribed to this list.", 'yikes-inc-easy-mailchimp-extender' ), |
|
581 | + 'update-link' => __( "To update your MailChimp profile, please [link]click to send yourself an update link[/link].", 'yikes-inc-easy-mailchimp-extender' ), |
|
582 | 582 | ); |
583 | - $global_error_messages = get_option( 'yikes-easy-mc-global-error-messages' , $error_message_array ); |
|
583 | + $global_error_messages = get_option( 'yikes-easy-mc-global-error-messages', $error_message_array ); |
|
584 | 584 | ?> |
585 | - <p class="edit-form-description"><?php _e( "Enter your custom messages for this form below. Leave the field blank to use the default global error message." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
585 | + <p class="edit-form-description"><?php _e( "Enter your custom messages for this form below. Leave the field blank to use the default global error message.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
586 | 586 | |
587 | 587 | <!-- Success Message --> |
588 | - <label for="yikes-easy-mc-success-message"><strong><?php _e( 'Success Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
589 | - <input type="text" class="widefat" name="yikes-easy-mc-success-message" id="yikes-easy-mc-success-message" value="<?php echo isset( $error_messages['success'] ) ? stripslashes( esc_html( $error_messages['success'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['success']; ?>" > |
|
588 | + <label for="yikes-easy-mc-success-message"><strong><?php _e( 'Success Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
589 | + <input type="text" class="widefat" name="yikes-easy-mc-success-message" id="yikes-easy-mc-success-message" value="<?php echo isset( $error_messages[ 'success' ] ) ? stripslashes( esc_html( $error_messages[ 'success' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'success' ]; ?>" > |
|
590 | 590 | </label> |
591 | 591 | <!-- General Error Message --> |
592 | - <label for="yikes-easy-mc-general-error-message"><strong><?php _e( 'General Error Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
593 | - <input type="text" class="widefat" name="yikes-easy-mc-general-error-message" id="yikes-easy-mc-general-error-message" value="<?php echo isset( $error_messages['general-error'] ) ? stripslashes( esc_html( $error_messages['general-error'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['general-error']; ?>" > |
|
592 | + <label for="yikes-easy-mc-general-error-message"><strong><?php _e( 'General Error Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
593 | + <input type="text" class="widefat" name="yikes-easy-mc-general-error-message" id="yikes-easy-mc-general-error-message" value="<?php echo isset( $error_messages[ 'general-error' ] ) ? stripslashes( esc_html( $error_messages[ 'general-error' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'general-error' ]; ?>" > |
|
594 | 594 | </label> |
595 | 595 | <!-- Invalid Email Address Message --> |
596 | - <label for="yikes-easy-mc-invalid-email-message"><strong><?php _e( 'Invalid Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
597 | - <input type="text" class="widefat" name="yikes-easy-mc-invalid-email-message" id="yikes-easy-mc-invalid-email-message" value="<?php echo isset( $error_messages['invalid-email'] ) ? stripslashes( esc_html( $error_messages['invalid-email'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['invalid-email']; ?>"> |
|
596 | + <label for="yikes-easy-mc-invalid-email-message"><strong><?php _e( 'Invalid Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
597 | + <input type="text" class="widefat" name="yikes-easy-mc-invalid-email-message" id="yikes-easy-mc-invalid-email-message" value="<?php echo isset( $error_messages[ 'invalid-email' ] ) ? stripslashes( esc_html( $error_messages[ 'invalid-email' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'invalid-email' ]; ?>"> |
|
598 | 598 | </label> |
599 | 599 | <!-- Email Address is already subscribed --> |
600 | - <label for="yikes-easy-mc-user-subscribed-message"><strong><?php _e( 'Email Already Subscribed' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
601 | - <input type="text" class="widefat" name="yikes-easy-mc-user-subscribed-message" id="yikes-easy-mc-user-subscribed-message" value="<?php echo isset( $error_messages['already-subscribed'] ) ? stripslashes( esc_html( $error_messages['already-subscribed'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['email-exists-error']; ?>"> |
|
600 | + <label for="yikes-easy-mc-user-subscribed-message"><strong><?php _e( 'Email Already Subscribed', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
601 | + <input type="text" class="widefat" name="yikes-easy-mc-user-subscribed-message" id="yikes-easy-mc-user-subscribed-message" value="<?php echo isset( $error_messages[ 'already-subscribed' ] ) ? stripslashes( esc_html( $error_messages[ 'already-subscribed' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'email-exists-error' ]; ?>"> |
|
602 | 602 | </label> |
603 | 603 | <!-- Click the link to update user profile etc. etc. --> |
604 | - <label for="yikes-easy-mc-user-subscribed-update-link"><strong><?php _e( 'Update Link' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
605 | - <input type="text" class="widefat" name="yikes-easy-mc-user-update-link" id="yikes-easy-mc-user-update-link" value="<?php echo isset( $error_messages['update-link'] ) ? stripslashes( esc_html( $error_messages['update-link'] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages['update-link']; ?>"> |
|
604 | + <label for="yikes-easy-mc-user-subscribed-update-link"><strong><?php _e( 'Update Link', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
605 | + <input type="text" class="widefat" name="yikes-easy-mc-user-update-link" id="yikes-easy-mc-user-update-link" value="<?php echo isset( $error_messages[ 'update-link' ] ) ? stripslashes( esc_html( $error_messages[ 'update-link' ] ) ) : ''; ?>" placeholder="<?php echo $global_error_messages[ 'update-link' ]; ?>"> |
|
606 | 606 | </label> |
607 | 607 | </div> |
608 | 608 | |
@@ -617,15 +617,15 @@ discard block |
||
617 | 617 | <div id="postbox-container-1" class="postbox-container"> |
618 | 618 | <div class="meta-box-sortables"> |
619 | 619 | <div class="postbox yikes-easy-mc-postbox"> |
620 | - <h3 class="edit-form-title"><span><?php _e( "Error Message Explanation" , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
620 | + <h3 class="edit-form-title"><span><?php _e( "Error Message Explanation", 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
621 | 621 | <div class="inside"> |
622 | 622 | |
623 | 623 | <ul> |
624 | - <li><strong><?php _e( 'Success Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The message displayed to the user after they have submitted the form and the data has been successfully sent to MailChimp.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
625 | - <li><strong><?php _e( 'General Error Message' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The message displayed to the user after a generic error has occurred.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
626 | - <li><strong><?php _e( 'Invalid Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The message displayed to the user after they have entered a non-valid email address.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
627 | - <li><strong><?php _e( 'Email Already Subscribed' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The message displayed to the user after they attempt to sign up for a mailing list using an email address that is already subscribed. You can display the user email back in the response by using an <code>[email]</code> tag. This will be replaced with the email entered by the user, in the response.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
628 | - <li><strong><?php _e( 'Update Link' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The update link is used when you allow users to generate an update email, when they are already subscribed to a list. Wrap the text you want to use as the link in <code>[link][/link]</code> tags.' , 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
624 | + <li><strong><?php _e( 'Success Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The message displayed to the user after they have submitted the form and the data has been successfully sent to MailChimp.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
625 | + <li><strong><?php _e( 'General Error Message', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The message displayed to the user after a generic error has occurred.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
626 | + <li><strong><?php _e( 'Invalid Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The message displayed to the user after they have entered a non-valid email address.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
627 | + <li><strong><?php _e( 'Email Already Subscribed', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The message displayed to the user after they attempt to sign up for a mailing list using an email address that is already subscribed. You can display the user email back in the response by using an <code>[email]</code> tag. This will be replaced with the email entered by the user, in the response.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
628 | + <li><strong><?php _e( 'Update Link', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> : <?php _e( 'The update link is used when you allow users to generate an update email, when they are already subscribed to a list. Wrap the text you want to use as the link in <code>[link][/link]</code> tags.', 'yikes-inc-easy-mailchimp-extender' ); ?></li> |
|
629 | 629 | </ul> |
630 | 630 | |
631 | 631 | </div> |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | </label> |
645 | 645 | <!-- End Error Messages --> |
646 | 646 | |
647 | - <?php do_action( 'yikes-mailchimp-edit-form-sections' , $form ); ?> |
|
647 | + <?php do_action( 'yikes-mailchimp-edit-form-sections', $form ); ?> |
|
648 | 648 | |
649 | 649 | </div> |
650 | 650 | <!-- .inside --> |
@@ -659,107 +659,107 @@ discard block |
||
659 | 659 | <div id="postbox-container-1" class="postbox-container yikes-easy-forms-sidebar"> |
660 | 660 | <div class="meta-box-sortables"> |
661 | 661 | <div class="postbox yikes-easy-mc-postbox"> |
662 | - <h3><span><?php _e( 'Form Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
662 | + <h3><span><?php _e( 'Form Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
663 | 663 | |
664 | 664 | <div class="inside"> |
665 | 665 | <p class="inside-section-1"> |
666 | - <label for="shortcode"><?php _e( 'Edit Another Form' , 'yikes-inc-easy-mailchimp-extender' ); ?><br /> |
|
666 | + <label for="shortcode"><?php _e( 'Edit Another Form', 'yikes-inc-easy-mailchimp-extender' ); ?><br /> |
|
667 | 667 | <select class="widefat" name="form_switcher" id="form_switcher" onchange="YIKES_Easy_MC_SwitchForm(jQuery(this).val());"> |
668 | - <?php foreach( $all_forms as $single_form ) { ?> |
|
669 | - <option <?php selected( $form_id , $single_form['id'] ); ?>value="<?php echo $single_form['id']; ?>"><?php echo $single_form['form_name']; ?></option> |
|
668 | + <?php foreach ( $all_forms as $single_form ) { ?> |
|
669 | + <option <?php selected( $form_id, $single_form[ 'id' ] ); ?>value="<?php echo $single_form[ 'id' ]; ?>"><?php echo $single_form[ 'form_name' ]; ?></option> |
|
670 | 670 | <?php } ?> |
671 | 671 | </select> |
672 | 672 | </label> |
673 | 673 | </p> |
674 | 674 | |
675 | 675 | <p class="inside-section-2"> |
676 | - <label for="shortcode"><?php _e( 'Shortcode' , 'yikes-inc-easy-mailchimp-extender' ); ?><br /> |
|
677 | - <input type="text" onclick="this.setSelectionRange(0, this.value.length)" class="widefat shortcode-input-field" readonly value='[yikes-mailchimp form="<?php echo $form['id']; ?>"]' /> |
|
676 | + <label for="shortcode"><?php _e( 'Shortcode', 'yikes-inc-easy-mailchimp-extender' ); ?><br /> |
|
677 | + <input type="text" onclick="this.setSelectionRange(0, this.value.length)" class="widefat shortcode-input-field" readonly value='[yikes-mailchimp form="<?php echo $form[ 'id' ]; ?>"]' /> |
|
678 | 678 | </label> |
679 | 679 | </p> |
680 | 680 | |
681 | 681 | |
682 | 682 | <a href="#" class="expansion-section-title settings-sidebar"> |
683 | - <span class="dashicons dashicons-plus"></span><?php _e( 'Associated List Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
683 | + <span class="dashicons dashicons-plus"></span><?php _e( 'Associated List Settings', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
684 | 684 | </a> |
685 | 685 | <div class="yikes-mc-settings-expansion-section"> |
686 | 686 | <!-- Associated List --> |
687 | - <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="associated-list"><strong><?php _e( 'Associated List' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
688 | - <select name="associated-list" id="associated-list" <?php if( empty( $list_data['data'] ) ) { echo 'disabled="disabled"'; } ?> onchange="jQuery('.view-list-link').attr( 'href', '<?php echo esc_url( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' ) ); ?>' + jQuery( this ).val() );"> |
|
687 | + <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="associated-list"><strong><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
688 | + <select name="associated-list" id="associated-list" <?php if ( empty( $list_data[ 'data' ] ) ) { echo 'disabled="disabled"'; } ?> onchange="jQuery('.view-list-link').attr( 'href', '<?php echo esc_url( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' ) ); ?>' + jQuery( this ).val() );"> |
|
689 | 689 | <?php |
690 | - if( !empty( $list_data['data'] ) ) { |
|
691 | - foreach( $list_data['data'] as $mailing_list ) { |
|
690 | + if ( ! empty( $list_data[ 'data' ] ) ) { |
|
691 | + foreach ( $list_data[ 'data' ] as $mailing_list ) { |
|
692 | 692 | ?> |
693 | - <option <?php selected( $form['list_id'] , $mailing_list['id'] ); ?> value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option> |
|
693 | + <option <?php selected( $form[ 'list_id' ], $mailing_list[ 'id' ] ); ?> value="<?php echo $mailing_list[ 'id' ]; ?>"><?php echo stripslashes( $mailing_list[ 'name' ] ) . ' (' . $mailing_list[ 'stats' ][ 'member_count' ] . ') '; ?></option> |
|
694 | 694 | <?php |
695 | 695 | } |
696 | 696 | } else { |
697 | 697 | ?> |
698 | - <option value="no-forms"><?php _e( 'No Lists Found' , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
698 | + <option value="no-forms"><?php _e( 'No Lists Found', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
699 | 699 | <?php |
700 | 700 | } |
701 | 701 | ?> |
702 | 702 | </select> |
703 | - <?php if( !empty( $list_data['data'] ) ) { ?> |
|
703 | + <?php if ( ! empty( $list_data[ 'data' ] ) ) { ?> |
|
704 | 704 | <p class="description view-list"> |
705 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $form['list_id'] ) ); ?>" class="view-list-link"><?php _e( 'View List', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
705 | + <a href="<?php echo esc_url( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $form[ 'list_id' ] ) ); ?>" class="view-list-link"><?php _e( 'View List', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
706 | 706 | </p> |
707 | 707 | <p class="description"> |
708 | - <?php _e( "Users who sign up via this form will be added to the list selected above." , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
708 | + <?php _e( "Users who sign up via this form will be added to the list selected above.", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
709 | 709 | </p> |
710 | 710 | <?php } else { ?> |
711 | 711 | <p class="description"> |
712 | - <?php _e( "It looks like you first need to create a list to assign this form to. Head over to" , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" title="<?php _e( 'Create a new list' , 'yikes-inc-easy-mailchimp-extender' ); ?>">MailChimp</a> <?php _e( 'to create your first list' , 'yikes-inc-easy-mailchimp-extender' ); ?>. |
|
712 | + <?php _e( "It looks like you first need to create a list to assign this form to. Head over to", 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" title="<?php _e( 'Create a new list', 'yikes-inc-easy-mailchimp-extender' ); ?>">MailChimp</a> <?php _e( 'to create your first list', 'yikes-inc-easy-mailchimp-extender' ); ?>. |
|
713 | 713 | </p> |
714 | 714 | <?php } ?> |
715 | 715 | </label></p> |
716 | 716 | </div> |
717 | 717 | |
718 | 718 | <a href="#" class="expansion-section-title settings-sidebar"> |
719 | - <span class="dashicons dashicons-plus"></span><?php _e( 'Opt-in Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
719 | + <span class="dashicons dashicons-plus"></span><?php _e( 'Opt-in Settings', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
720 | 720 | </a> |
721 | 721 | <div class="yikes-mc-settings-expansion-section"> |
722 | 722 | |
723 | 723 | <!-- Single or Double Opt-in --> |
724 | 724 | <?php |
725 | - if( !isset( $optin_settings['optin'] ) ) { |
|
726 | - $optin_settings['optin'] = '1'; |
|
725 | + if ( ! isset( $optin_settings[ 'optin' ] ) ) { |
|
726 | + $optin_settings[ 'optin' ] = '1'; |
|
727 | 727 | } |
728 | 728 | ?> |
729 | - <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="single-double-optin"><strong><?php _e( 'Single or Double Opt-in' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
729 | + <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="single-double-optin"><strong><?php _e( 'Single or Double Opt-in', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
730 | 730 | <span class="edit-form-field-container-span"> |
731 | - <label for="single"><input id="single" type="radio" name="single-double-optin" value="0" <?php checked( $optin_settings['optin'] , '0' ); ?>><?php _e( 'Single' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
732 | - <label for="double"><input id="double" type="radio" name="single-double-optin" value="1" <?php checked( $optin_settings['optin'] , '1' ); ?>><?php _e( 'Double' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
731 | + <label for="single"><input id="single" type="radio" name="single-double-optin" value="0" <?php checked( $optin_settings[ 'optin' ], '0' ); ?>><?php _e( 'Single', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
732 | + <label for="double"><input id="double" type="radio" name="single-double-optin" value="1" <?php checked( $optin_settings[ 'optin' ], '1' ); ?>><?php _e( 'Double', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
733 | 733 | </span> |
734 | - <p class="description"><?php _e( "Double opt-in requires users to confirm their email address before being added to a list (recommended)" , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
734 | + <p class="description"><?php _e( "Double opt-in requires users to confirm their email address before being added to a list (recommended)", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
735 | 735 | </label></p> |
736 | 736 | |
737 | 737 | <!-- Welcome Email --> |
738 | 738 | <?php |
739 | - if( !isset( $optin_settings['send_welcome_email'] ) ) { |
|
740 | - $optin_settings['send_welcome_email'] = '1'; |
|
739 | + if ( ! isset( $optin_settings[ 'send_welcome_email' ] ) ) { |
|
740 | + $optin_settings[ 'send_welcome_email' ] = '1'; |
|
741 | 741 | } |
742 | 742 | ?> |
743 | - <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="send-welcome-email"><strong><?php _e( 'Send Welcome Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
743 | + <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="send-welcome-email"><strong><?php _e( 'Send Welcome Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
744 | 744 | <span class="edit-form-field-container-span"> |
745 | - <label for="send-welcome"><input id="send-welcome" type="radio" name="send-welcome-email" value="1" <?php checked( $optin_settings['send_welcome_email'] , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
746 | - <label for="do-not-send-welcome"><input id="do-not-send-welcome" type="radio" name="send-welcome-email" value="0" <?php checked( $optin_settings['send_welcome_email'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
745 | + <label for="send-welcome"><input id="send-welcome" type="radio" name="send-welcome-email" value="1" <?php checked( $optin_settings[ 'send_welcome_email' ], '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
746 | + <label for="do-not-send-welcome"><input id="do-not-send-welcome" type="radio" name="send-welcome-email" value="0" <?php checked( $optin_settings[ 'send_welcome_email' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
747 | 747 | </span> |
748 | - <p class="description"><?php _e( "When a user signs up, should they receive the default welcome email?" , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
748 | + <p class="description"><?php _e( "When a user signs up, should they receive the default welcome email?", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
749 | 749 | </label></p> |
750 | 750 | |
751 | 751 | <!-- Update Existing Users --> |
752 | 752 | <?php |
753 | - if( !isset( $optin_settings['update_existing_user'] ) ) { |
|
754 | - $optin_settings['update_existing_user'] = '1'; |
|
753 | + if ( ! isset( $optin_settings[ 'update_existing_user' ] ) ) { |
|
754 | + $optin_settings[ 'update_existing_user' ] = '1'; |
|
755 | 755 | } |
756 | 756 | ?> |
757 | - <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="update-existing-user"><strong><?php _e( 'Update Existing Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
757 | + <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="update-existing-user"><strong><?php _e( 'Update Existing Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
758 | 758 | <span class="form-field-container-span"> |
759 | - <label for="update-user"><input type="radio" id="update-user" onchange="toggleUpdateEmailContainer(this);return false;" name="update-existing-user" value="1" <?php checked( $optin_settings['update_existing_user'] , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
760 | - <label for="do-not-update-user"><input type="radio" onchange="toggleUpdateEmailContainer(this);return false;" id="do-not-update-user" name="update-existing-user" value="0" <?php checked( $optin_settings['update_existing_user'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
759 | + <label for="update-user"><input type="radio" id="update-user" onchange="toggleUpdateEmailContainer(this);return false;" name="update-existing-user" value="1" <?php checked( $optin_settings[ 'update_existing_user' ], '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
760 | + <label for="do-not-update-user"><input type="radio" onchange="toggleUpdateEmailContainer(this);return false;" id="do-not-update-user" name="update-existing-user" value="0" <?php checked( $optin_settings[ 'update_existing_user' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
761 | 761 | </span> |
762 | - <p class="description"><?php printf( __( "Display an update link when a user is already subscribed to the list, allowing them to generate an email where they can update their subscribtion info - instead of displaying a %s message." , "yikes-inc-easy-mailchimp-extender" ), __( '"user already subscribed"', 'yikes-inc-easy-mailchimp-extender' ) ); ?></p> |
|
762 | + <p class="description"><?php printf( __( "Display an update link when a user is already subscribed to the list, allowing them to generate an email where they can update their subscribtion info - instead of displaying a %s message.", "yikes-inc-easy-mailchimp-extender" ), __( '"user already subscribed"', 'yikes-inc-easy-mailchimp-extender' ) ); ?></p> |
|
763 | 763 | </label></p> |
764 | 764 | |
765 | 765 | <!-- |
@@ -768,82 +768,82 @@ discard block |
||
768 | 768 | - No = Just update the user profile without an email |
769 | 769 | --> |
770 | 770 | <?php |
771 | - $send_update_email = ( isset( $optin_settings['send_update_email'] ) && '' !== $optin_settings['send_update_email'] ) ? $optin_settings['send_update_email'] : 0; |
|
771 | + $send_update_email = ( isset( $optin_settings[ 'send_update_email' ] ) && '' !== $optin_settings[ 'send_update_email' ] ) ? $optin_settings[ 'send_update_email' ] : 0; |
|
772 | 772 | ?> |
773 | - <p class="form-field-container send-update-email" <?php if ( 1 !== absint( $optin_settings['update_existing_user'] ) ) { ?>style="display:none;"<?php } ?>><!-- necessary to prevent skipping on slideToggle(); --><label for="update-existing-user"><strong><?php _e( 'Send Update Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
773 | + <p class="form-field-container send-update-email" <?php if ( 1 !== absint( $optin_settings[ 'update_existing_user' ] ) ) { ?>style="display:none;"<?php } ?>><!-- necessary to prevent skipping on slideToggle(); --><label for="update-existing-user"><strong><?php _e( 'Send Update Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
774 | 774 | <span class="form-field-container-span"> |
775 | - <label for="update-email"><input type="radio" id="update-email" name="update-existing-email" value="1" <?php checked( $send_update_email , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
776 | - <label for="do-not-update-email"><input type="radio" id="do-not-update-email" name="update-existing-email" value="0" <?php checked( $send_update_email , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
775 | + <label for="update-email"><input type="radio" id="update-email" name="update-existing-email" value="1" <?php checked( $send_update_email, '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
776 | + <label for="do-not-update-email"><input type="radio" id="do-not-update-email" name="update-existing-email" value="0" <?php checked( $send_update_email, '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
777 | 777 | </span> |
778 | - <em><?php printf( __( "Send an email allowing the user to update their profile, securely. Otherwise, when an existing subscriber re-subscribes to this form, their profile information will be updated without any further interaction." , "yikes-inc-easy-mailchimp-extender" ), __( '"user already subscribed"', 'yikes-inc-easy-mailchimp-extender' ) ); ?></em> |
|
778 | + <em><?php printf( __( "Send an email allowing the user to update their profile, securely. Otherwise, when an existing subscriber re-subscribes to this form, their profile information will be updated without any further interaction.", "yikes-inc-easy-mailchimp-extender" ), __( '"user already subscribed"', 'yikes-inc-easy-mailchimp-extender' ) ); ?></em> |
|
779 | 779 | </label></p> |
780 | 780 | |
781 | 781 | </div> |
782 | 782 | |
783 | 783 | <a href="#" class="expansion-section-title settings-sidebar"> |
784 | - <span class="dashicons dashicons-plus"></span><?php _e( 'Submission Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
784 | + <span class="dashicons dashicons-plus"></span><?php _e( 'Submission Settings', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
785 | 785 | </a> |
786 | 786 | <div class="yikes-mc-settings-expansion-section"> |
787 | 787 | <!-- AJAX form Submission --> |
788 | 788 | <?php |
789 | - if( !isset( $submission_settings['ajax'] ) ) { |
|
790 | - $submission_settings['ajax'] = '1'; |
|
789 | + if ( ! isset( $submission_settings[ 'ajax' ] ) ) { |
|
790 | + $submission_settings[ 'ajax' ] = '1'; |
|
791 | 791 | } |
792 | 792 | ?> |
793 | - <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="form-ajax-submission"><strong><?php _e( 'Enable AJAX Submission' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
793 | + <p class="form-field-container"><!-- necessary to prevent skipping on slideToggle(); --><label for="form-ajax-submission"><strong><?php _e( 'Enable AJAX Submission', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
794 | 794 | <span class="form-field-container-span"> |
795 | - <label for="enable-ajax"><input type="radio" id="enable-ajax" name="form-ajax-submission" value="1" <?php checked( $submission_settings['ajax'] , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
796 | - <label for="disable-ajax"><input type="radio" id="disable-ajax" name="form-ajax-submission" value="0" <?php checked( $submission_settings['ajax'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
795 | + <label for="enable-ajax"><input type="radio" id="enable-ajax" name="form-ajax-submission" value="1" <?php checked( $submission_settings[ 'ajax' ], '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
796 | + <label for="disable-ajax"><input type="radio" id="disable-ajax" name="form-ajax-submission" value="0" <?php checked( $submission_settings[ 'ajax' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
797 | 797 | </span> |
798 | - <p class="description"><?php _e( "AJAX form submissions transmit data without requiring the page to refresh." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
798 | + <p class="description"><?php _e( "AJAX form submissions transmit data without requiring the page to refresh.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
799 | 799 | </label></p> |
800 | 800 | |
801 | 801 | <!-- Redirect User On Submission --> |
802 | 802 | <?php |
803 | - if( !isset( $submission_settings['redirect_on_submission'] ) ) { |
|
804 | - $submission_settings['redirect_on_submission'] = '0'; |
|
805 | - $submission_settings['redirect_page'] = ''; |
|
803 | + if ( ! isset( $submission_settings[ 'redirect_on_submission' ] ) ) { |
|
804 | + $submission_settings[ 'redirect_on_submission' ] = '0'; |
|
805 | + $submission_settings[ 'redirect_page' ] = ''; |
|
806 | 806 | } |
807 | 807 | ?> |
808 | - <p><label for="redirect-user-on-submission"><strong><?php _e( 'Redirect On Submission' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
808 | + <p><label for="redirect-user-on-submission"><strong><?php _e( 'Redirect On Submission', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
809 | 809 | <span class="form-field-container-span"> |
810 | - <label for="redirect-user"><input type="radio" id="redirect-user" onclick="togglePageRedirection( this );" name="redirect-user-on-submission" value="1" <?php checked( $submission_settings['redirect_on_submission'] , '1' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
811 | - <label for="do-not-redirect-user"><input type="radio" id="do-not-redirect-user" onclick="togglePageRedirection( this );" name="redirect-user-on-submission" value="0" <?php checked( $submission_settings['redirect_on_submission'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
810 | + <label for="redirect-user"><input type="radio" id="redirect-user" onclick="togglePageRedirection( this );" name="redirect-user-on-submission" value="1" <?php checked( $submission_settings[ 'redirect_on_submission' ], '1' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
811 | + <label for="do-not-redirect-user"><input type="radio" id="do-not-redirect-user" onclick="togglePageRedirection( this );" name="redirect-user-on-submission" value="0" <?php checked( $submission_settings[ 'redirect_on_submission' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
812 | 812 | </span> |
813 | - <?php $this->generate_page_redirect_dropdown( $submission_settings['redirect_on_submission'] , $submission_settings['redirect_page'], ( isset( $submission_settings['custom_redirect_url'] ) ) ? esc_url( $submission_settings['custom_redirect_url'] ) : '' ); ?> |
|
814 | - <p class="description"><?php _e( "When the user signs up would you like to redirect them to another page?" , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
813 | + <?php $this->generate_page_redirect_dropdown( $submission_settings[ 'redirect_on_submission' ], $submission_settings[ 'redirect_page' ], ( isset( $submission_settings[ 'custom_redirect_url' ] ) ) ? esc_url( $submission_settings[ 'custom_redirect_url' ] ) : '' ); ?> |
|
814 | + <p class="description"><?php _e( "When the user signs up would you like to redirect them to another page?", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
815 | 815 | </label></p> |
816 | 816 | |
817 | 817 | <!-- Hide Form On Submission --> |
818 | 818 | <?php |
819 | - if( !isset( $submission_settings['hide_form_post_signup'] ) ) { |
|
820 | - $submission_settings['hide_form_post_signup'] = '0'; |
|
819 | + if ( ! isset( $submission_settings[ 'hide_form_post_signup' ] ) ) { |
|
820 | + $submission_settings[ 'hide_form_post_signup' ] = '0'; |
|
821 | 821 | } |
822 | 822 | ?> |
823 | - <p><label for="hide-form-post-signup"><strong><?php _e( 'Hide Form After Sign Up' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
823 | + <p><label for="hide-form-post-signup"><strong><?php _e( 'Hide Form After Sign Up', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
824 | 824 | <span class="form-field-container-span"> |
825 | - <label for="hide-form"><input type="radio" id="hide-form" name="hide-form-post-signup" value="1" <?php checked( $submission_settings['hide_form_post_signup'] , '1' ); ?> checked><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
826 | - <label for="do-not-hide-form"><input type="radio" id="do-not-hide-form" name="hide-form-post-signup" value="0" <?php checked( $submission_settings['hide_form_post_signup'] , '0' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
825 | + <label for="hide-form"><input type="radio" id="hide-form" name="hide-form-post-signup" value="1" <?php checked( $submission_settings[ 'hide_form_post_signup' ], '1' ); ?> checked><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
826 | + <label for="do-not-hide-form"><input type="radio" id="do-not-hide-form" name="hide-form-post-signup" value="0" <?php checked( $submission_settings[ 'hide_form_post_signup' ], '0' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
827 | 827 | </span> |
828 | - <p class="description"><?php _e( "Should the form be hidden after the user successfully signs up?" , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
828 | + <p class="description"><?php _e( "Should the form be hidden after the user successfully signs up?", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
829 | 829 | </label></p> |
830 | 830 | |
831 | 831 | <!-- Append or Replace Interest Groups --> |
832 | 832 | <?php |
833 | - if( !isset( $submission_settings['replace_interests'] ) ) { |
|
834 | - $submission_settings['replace_interests'] = '1'; // defaults to true |
|
833 | + if ( ! isset( $submission_settings[ 'replace_interests' ] ) ) { |
|
834 | + $submission_settings[ 'replace_interests' ] = '1'; // defaults to true |
|
835 | 835 | } |
836 | 836 | ?> |
837 | - <p><label for="replace-interest-groups"><strong><?php _e( 'Existing Interest Groups' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
837 | + <p><label for="replace-interest-groups"><strong><?php _e( 'Existing Interest Groups', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
838 | 838 | <span class="form-field-container-span"> |
839 | - <label for="replace-interest-groups"><input type="radio" id="replace-interest-groups" name="replace-interest-groups" value="1" <?php checked( $submission_settings['replace_interests'] , '1' ); ?> checked><?php _e( 'Replace' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
840 | - <label for="update-interest-groups"><input type="radio" id="update-interest-groups" name="replace-interest-groups" value="0" <?php checked( $submission_settings['replace_interests'] , '0' ); ?>><?php _e( 'Update' , 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
839 | + <label for="replace-interest-groups"><input type="radio" id="replace-interest-groups" name="replace-interest-groups" value="1" <?php checked( $submission_settings[ 'replace_interests' ], '1' ); ?> checked><?php _e( 'Replace', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
840 | + <label for="update-interest-groups"><input type="radio" id="update-interest-groups" name="replace-interest-groups" value="0" <?php checked( $submission_settings[ 'replace_interests' ], '0' ); ?>><?php _e( 'Update', 'yikes-inc-easy-mailchimp-extender' ); ?></label> |
|
841 | 841 | </span> |
842 | 842 | |
843 | - <p class="description"><small><?php _e( "<strong>Replace</strong>: Replace all interest groups with the new ones submitted." , 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
843 | + <p class="description"><small><?php _e( "<strong>Replace</strong>: Replace all interest groups with the new ones submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
844 | 844 | |
845 | 845 | |
846 | - <p class="description"><small><?php _e( "<strong>Update</strong>: Update <em>only</em> the ones submitted. Leave existing interest groups as is." , 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
846 | + <p class="description"><small><?php _e( "<strong>Update</strong>: Update <em>only</em> the ones submitted. Leave existing interest groups as is.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
847 | 847 | |
848 | 848 | </label></p> |
849 | 849 | |
@@ -856,9 +856,9 @@ discard block |
||
856 | 856 | |
857 | 857 | <span class="form-buttons-container" id="major-publishing-actions"> |
858 | 858 | <?php |
859 | - echo submit_button( __( 'Update Form' ) , 'primary' , '' , false , array( 'onclick' => 'jQuery(this).parent().prev().css({"display":"block","visibility":"inherit"});' ) ); |
|
860 | - $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $form['id'] , 'nonce' => wp_create_nonce( 'delete-mailchimp-form-'.$form['id'] ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); |
|
861 | - echo '<a href="' . $url . '" class="yikes-delete-mailchimp-form" onclick="return confirm(\'' . __( "Are you sure you want to delete this form? This cannot be undone." , 'yikes-inc-easy-mailchimp-extender' ) . '\');">' . __( "Delete Form" , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
859 | + echo submit_button( __( 'Update Form' ), 'primary', '', false, array( 'onclick' => 'jQuery(this).parent().prev().css({"display":"block","visibility":"inherit"});' ) ); |
|
860 | + $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $form[ 'id' ], 'nonce' => wp_create_nonce( 'delete-mailchimp-form-' . $form[ 'id' ] ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); |
|
861 | + echo '<a href="' . $url . '" class="yikes-delete-mailchimp-form" onclick="return confirm(\'' . __( "Are you sure you want to delete this form? This cannot be undone.", 'yikes-inc-easy-mailchimp-extender' ) . '\');">' . __( "Delete Form", 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
862 | 862 | ?> |
863 | 863 | </span> |
864 | 864 |