@@ -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 |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | **/ |
99 | 99 | public function load_checkbox_integration_classes() { |
100 | 100 | // store our options |
101 | - $integrations = get_option( 'optin-checkbox-init' , '' ); |
|
102 | - if( !empty( $integrations ) ) { |
|
101 | + $integrations = get_option( 'optin-checkbox-init', '' ); |
|
102 | + if ( ! empty( $integrations ) ) { |
|
103 | 103 | // load our mail integrations class |
104 | 104 | require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php'; |
105 | 105 | // loop over selected classes and load them up! |
106 | - foreach( $integrations as $integration => $value ) { |
|
107 | - if( isset( $value['value'] ) && $value['value'] == 'on' ) { |
|
106 | + foreach ( $integrations as $integration => $value ) { |
|
107 | + if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) { |
|
108 | 108 | // load our class extensions |
109 | - require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php'; |
|
109 | + require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php'; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @since 6.0.0 |
121 | 121 | */ |
122 | 122 | public function load_error_logging_class() { |
123 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
123 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
124 | 124 | // if error logging is enabled we should include our error logging class |
125 | 125 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
126 | 126 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging; |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | * @since 6.0.3.4 |
134 | 134 | */ |
135 | 135 | public function yikes_process_non_ajax_forms( $form_submitted ) { |
136 | - global $wpdb,$post; |
|
137 | - $form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id |
|
138 | - if( $form_id ) { |
|
136 | + global $wpdb, $post; |
|
137 | + $form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id |
|
138 | + if ( $form_id ) { |
|
139 | 139 | $form_settings = self::yikes_retrieve_form_settings( $form_id ); |
140 | - if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) { |
|
141 | - if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted |
|
140 | + if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) { |
|
141 | + if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted |
|
142 | 142 | // lets include our form processing file |
143 | 143 | include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' ); |
144 | - if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) { |
|
145 | - if( $form_submitted == 1 ) { |
|
144 | + if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) { |
|
145 | + if ( $form_submitted == 1 ) { |
|
146 | 146 | // decode our settings |
147 | - $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']; |
|
147 | + $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' ]; |
|
148 | 148 | wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) ); |
149 | 149 | exit; |
150 | 150 | } |
@@ -160,27 +160,27 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public static function yikes_retrieve_form_settings( $form_id ) { |
162 | 162 | // if no form id, abort |
163 | - if( ! $form_id ) { |
|
163 | + if ( ! $form_id ) { |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | global $wpdb; |
167 | 167 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form_id . '', ARRAY_A ); // query for our form data |
168 | - if( $form_results ) { |
|
168 | + if ( $form_results ) { |
|
169 | 169 | // empty array, to populate with form settings |
170 | 170 | $form_settings = array(); |
171 | - $form_data = $form_results[0]; // store the results |
|
171 | + $form_data = $form_results[ 0 ]; // store the results |
|
172 | 172 | // store the settings in our array |
173 | - $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) |
|
174 | - $form_settings['form_name'] = esc_attr( $form_data['form_name'] ); // form name |
|
175 | - $form_settings['form_description'] = esc_attr( stripslashes( $form_data['form_description'] ) ); |
|
176 | - $form_settings['fields'] = json_decode( $form_data['fields'] , true ); |
|
177 | - $form_settings['styles'] = json_decode( stripslashes( $form_data['custom_styles'] ) , true ); |
|
178 | - $form_settings['send_welcome'] = $form_data['send_welcome_email']; |
|
179 | - $form_settings['submission_settings'] = json_decode( stripslashes( $form_data['submission_settings'] ) , true ); |
|
180 | - $form_settings['optin_settings'] = json_decode( stripslashes( $form_data['optin_settings'] ) , true ); |
|
181 | - $form_settings['error_messages'] = json_decode( $form_data['error_messages'] , true ); |
|
182 | - $form_settings['notifications'] = isset( $form_data['custom_notifications'] ) ? json_decode( stripslashes( $form_data['custom_notifications'] ) , true ) : ''; |
|
183 | - $form_settings['submissions'] = $form_data['submissions']; |
|
173 | + $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) |
|
174 | + $form_settings[ 'form_name' ] = esc_attr( $form_data[ 'form_name' ] ); // form name |
|
175 | + $form_settings[ 'form_description' ] = esc_attr( stripslashes( $form_data[ 'form_description' ] ) ); |
|
176 | + $form_settings[ 'fields' ] = json_decode( $form_data[ 'fields' ], true ); |
|
177 | + $form_settings[ 'styles' ] = json_decode( stripslashes( $form_data[ 'custom_styles' ] ), true ); |
|
178 | + $form_settings[ 'send_welcome' ] = $form_data[ 'send_welcome_email' ]; |
|
179 | + $form_settings[ 'submission_settings' ] = json_decode( stripslashes( $form_data[ 'submission_settings' ] ), true ); |
|
180 | + $form_settings[ 'optin_settings' ] = json_decode( stripslashes( $form_data[ 'optin_settings' ] ), true ); |
|
181 | + $form_settings[ 'error_messages' ] = json_decode( $form_data[ 'error_messages' ], true ); |
|
182 | + $form_settings[ 'notifications' ] = isset( $form_data[ 'custom_notifications' ] ) ? json_decode( stripslashes( $form_data[ 'custom_notifications' ] ), true ) : ''; |
|
183 | + $form_settings[ 'submissions' ] = $form_data[ 'submissions' ]; |
|
184 | 184 | // return the given form settings in an array |
185 | 185 | return $form_settings; |
186 | 186 | } |
@@ -199,13 +199,13 @@ discard block |
||
199 | 199 | return; |
200 | 200 | } |
201 | 201 | // trim trailing period |
202 | - if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) { |
|
203 | - $response_text = $form_settings['error_messages']['update-link']; |
|
202 | + if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) { |
|
203 | + $response_text = $form_settings[ 'error_messages' ][ 'update-link' ]; |
|
204 | 204 | // extract the link text |
205 | 205 | preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text ); |
206 | 206 | if ( $link_text && ! empty( $link_text ) ) { |
207 | 207 | // Extract the custom link text ([link]*[/link]) |
208 | - $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) ); |
|
208 | + $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) ); |
|
209 | 209 | // Replace the link text, with our custom link text |
210 | 210 | $response_text = str_replace( $link_text, $custom_link_text, $response_text ); |
211 | 211 | } |
@@ -138,7 +138,8 @@ |
||
138 | 138 | if( $form_id ) { |
139 | 139 | $form_settings = self::yikes_retrieve_form_settings( $form_id ); |
140 | 140 | if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) { |
141 | - if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted |
|
141 | + if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { |
|
142 | +// ensure we only process the form that was submitted |
|
142 | 143 | // lets include our form processing file |
143 | 144 | include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' ); |
144 | 145 | if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) { |
@@ -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">' . $form_settings['error_messages']['already-subscribed'] . ' ' . $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">' . $form_settings[ 'error_messages' ][ 'already-subscribed' ] . ' ' . $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( $_POST['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 = $error_messages['already-subscribed'] . ' ' . $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( $_POST[ '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 = $error_messages[ 'already-subscribed' ] . ' ' . $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.' , '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.', '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 |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | $this->yikes_inc_easy_mailchimp_extender = $yikes_inc_easy_mailchimp_extender; |
39 | 39 | $this->version = $version; |
40 | 40 | // check for old plugin options and migrate if exist |
41 | - add_action( 'admin_menu' , array( $this , 'register_admin_pages' ) , 11 ); |
|
41 | + add_action( 'admin_menu', array( $this, 'register_admin_pages' ), 11 ); |
|
42 | 42 | // check for old plugin options and migrate if exist |
43 | - add_action( 'admin_init' , array( $this , 'check_for_old_yks_mc_options' ) ); |
|
43 | + add_action( 'admin_init', array( $this, 'check_for_old_yks_mc_options' ) ); |
|
44 | 44 | // Ajax function to update new options... |
45 | - add_action( 'wp_ajax_migrate_old_plugin_settings', array( $this , 'migrate_archived_options' ) ); |
|
45 | + add_action( 'wp_ajax_migrate_old_plugin_settings', array( $this, 'migrate_archived_options' ) ); |
|
46 | 46 | // Ajax function to migrate our forms |
47 | - add_action( 'wp_ajax_migrate_prevoious_forms', array( $this , 'migrate_previously_setup_forms' ) ); |
|
47 | + add_action( 'wp_ajax_migrate_prevoious_forms', array( $this, 'migrate_previously_setup_forms' ) ); |
|
48 | 48 | // fix menu icon spacing |
49 | - add_action( 'admin_head' , array( $this , 'fix_menu_icon_spacing' ) ); |
|
49 | + add_action( 'admin_head', array( $this, 'fix_menu_icon_spacing' ) ); |
|
50 | 50 | // register our plugin settings |
51 | - add_action( 'admin_init', array( $this , 'yikes_easy_mc_settings_init' ) ); |
|
51 | + add_action( 'admin_init', array( $this, 'yikes_easy_mc_settings_init' ) ); |
|
52 | 52 | // plugin redirect on activation |
53 | - add_action( 'admin_init' , array( $this , 'yikes_easy_mc_activation_redirect' ) ); |
|
53 | + add_action( 'admin_init', array( $this, 'yikes_easy_mc_activation_redirect' ) ); |
|
54 | 54 | // Include Third Party Extensions |
55 | 55 | include_once( YIKES_MC_PATH . 'includes/third-party-integrations/third-party-init.php' ); |
56 | 56 | // Include our dashboard widget class |
@@ -60,111 +60,111 @@ discard block |
||
60 | 60 | // Include our ajax processing class |
61 | 61 | include_once( YIKES_MC_PATH . 'admin/partials/ajax/class.ajax.php' ); |
62 | 62 | // load up our helper class |
63 | - add_action( 'admin_init' , array( $this , 'yikes_mailchimp_load_helper_class' ) ); |
|
63 | + add_action( 'admin_init', array( $this, 'yikes_mailchimp_load_helper_class' ) ); |
|
64 | 64 | // process the subscriber count shortcode in form descriptions |
65 | 65 | add_action( 'yikes-mailchimp-form-description', array( $this, 'process_subscriber_count_shortcode_in_form_descriptions' ), 10, 2 ); |
66 | 66 | /***********************/ |
67 | 67 | /** Create A Form **/ |
68 | 68 | /**********************/ |
69 | 69 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-form' ) { |
70 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_create_form' ) ); |
|
70 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_form' ) ); |
|
71 | 71 | } |
72 | 72 | /***********************/ |
73 | 73 | /** Delete A Form **/ |
74 | 74 | /**********************/ |
75 | 75 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-delete-form' ) { |
76 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_delete_form' ) ); |
|
76 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_delete_form' ) ); |
|
77 | 77 | } |
78 | 78 | /**********************************/ |
79 | 79 | /** Duplicate/Clone A Form **/ |
80 | 80 | /********************************/ |
81 | 81 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-duplicate-form' ) { |
82 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_duplicate_form' ) ); |
|
82 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_duplicate_form' ) ); |
|
83 | 83 | } |
84 | 84 | /*************************************/ |
85 | 85 | /** Reset Form Impression Stats **/ |
86 | 86 | /***********************************/ |
87 | 87 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-reset-stats' ) { |
88 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_reset_impression_stats' ) ); |
|
88 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_reset_impression_stats' ) ); |
|
89 | 89 | } |
90 | 90 | /**********************************/ |
91 | 91 | /** Update A Form **/ |
92 | 92 | /********************************/ |
93 | 93 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-update-form' ) { |
94 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_update_form' ) ); |
|
94 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_update_form' ) ); |
|
95 | 95 | } |
96 | 96 | /**************************************************/ |
97 | 97 | /** Clear Store MailChimp Transient Data **/ |
98 | 98 | /*************************************************/ |
99 | 99 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-transient-data' ) { |
100 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_clear_transient_data' ) ); |
|
100 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_transient_data' ) ); |
|
101 | 101 | } |
102 | 102 | /*******************************************/ |
103 | 103 | /** Remove a user from a mailing list **/ |
104 | 104 | /*****************************************/ |
105 | 105 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-unsubscribe-user' ) { |
106 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_unsubscribe_user' ) ); |
|
106 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_unsubscribe_user' ) ); |
|
107 | 107 | } |
108 | 108 | /*******************************************/ |
109 | 109 | /** Create misisng error log file **/ |
110 | 110 | /*****************************************/ |
111 | 111 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-error-log' ) { |
112 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_create_missing_error_log' ) ); |
|
112 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_missing_error_log' ) ); |
|
113 | 113 | } |
114 | 114 | /*******************************************/ |
115 | 115 | /** TinyMCE Initialization Functions **/ |
116 | 116 | /*****************************************/ |
117 | - add_action( 'admin_head' , array( $this, 'add_tinyMCE_buttons' ) ); |
|
117 | + add_action( 'admin_head', array( $this, 'add_tinyMCE_buttons' ) ); |
|
118 | 118 | // pass our lists data to tinyMCE button for use |
119 | - foreach ( array('post.php','post-new.php') as $hook ) { |
|
119 | + foreach ( array( 'post.php', 'post-new.php' ) as $hook ) { |
|
120 | 120 | add_action( "admin_head-$hook", array( $this, 'tinymce_yikes_easy_mc' ) ); |
121 | 121 | } |
122 | 122 | // display an admin notice for users on PHP < 5.3 |
123 | - if( phpversion() < '5.3' ) { |
|
123 | + if ( phpversion() < '5.3' ) { |
|
124 | 124 | add_action( "admin_notices", array( $this, 'display_php_warning' ), 999 ); |
125 | 125 | } |
126 | 126 | // two week , dismissable notification - check the users plugin installation date |
127 | - add_action( 'admin_init', array( $this , 'yikes_easy_mailchimp_check_installation_date' ) ); |
|
127 | + add_action( 'admin_init', array( $this, 'yikes_easy_mailchimp_check_installation_date' ) ); |
|
128 | 128 | // dismissable notice admin side |
129 | - add_action( 'admin_init', array( $this , 'yikes_easy_mailchimp_stop_bugging_me' ), 5 ); |
|
129 | + add_action( 'admin_init', array( $this, 'yikes_easy_mailchimp_stop_bugging_me' ), 5 ); |
|
130 | 130 | /**************************************************/ |
131 | 131 | /** Clear MailChimp Error Log Data **/ |
132 | 132 | /*************************************************/ |
133 | 133 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-error-log' ) { |
134 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_clear_error_log' ) ); |
|
134 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_error_log' ) ); |
|
135 | 135 | } |
136 | 136 | /*********************************************/ |
137 | 137 | /** Export MailChimp Opt-in Forms **/ |
138 | 138 | /*******************************************/ |
139 | 139 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-forms' ) { |
140 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_export_forms' ) ); |
|
140 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_forms' ) ); |
|
141 | 141 | } |
142 | 142 | /*********************************************/ |
143 | 143 | /** Export Plugin Settings **/ |
144 | 144 | /*******************************************/ |
145 | 145 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-settings' ) { |
146 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_export_plugin_settings' ) ); |
|
146 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_plugin_settings' ) ); |
|
147 | 147 | } |
148 | 148 | /*******************************************/ |
149 | 149 | /** Import Class Inclusion **/ |
150 | 150 | /*****************************************/ |
151 | 151 | if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-import-forms' ) { |
152 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_import_forms' ) ); |
|
152 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_import_forms' ) ); |
|
153 | 153 | } |
154 | 154 | /*******************************************/ |
155 | 155 | /** Premium Support Request **/ |
156 | 156 | /*****************************************/ |
157 | 157 | if ( isset( $_POST[ 'submit-premium-support-request' ] ) ) { |
158 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_premium_support_request' ) ); |
|
158 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_premium_support_request' ) ); |
|
159 | 159 | } |
160 | 160 | /****************************************/ |
161 | 161 | /** Dismiss Options Migrations **/ |
162 | 162 | /****************************************/ |
163 | - if( isset( $_REQUEST['dismiss_migration_nonce'] ) ) { |
|
164 | - add_action( 'init' , array( $this , 'yikes_easy_mailchimp_dismiss_option_migrate' ) ); |
|
163 | + if ( isset( $_REQUEST[ 'dismiss_migration_nonce' ] ) ) { |
|
164 | + add_action( 'init', array( $this, 'yikes_easy_mailchimp_dismiss_option_migrate' ) ); |
|
165 | 165 | } |
166 | 166 | /** Parse default value into usable dynamic data **/ |
167 | - add_filter( 'yikes-mailchimp-process-default-tag' , array( $this , 'parse_mailchimp_default_tag' ) ); |
|
167 | + add_filter( 'yikes-mailchimp-process-default-tag', array( $this, 'parse_mailchimp_default_tag' ) ); |
|
168 | 168 | /** Add a disclaimer to ensure that we let people know we are not endorsed/backed by MailChimp at all **/ |
169 | 169 | add_filter( 'admin_footer_text', array( $this, 'yikes_easy_forms_admin_disclaimer' ) ); |
170 | 170 | /** Add custom plugin action links **/ |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | * @ return array $links New array of plugin actions |
185 | 185 | */ |
186 | 186 | public function easy_forms_plugin_action_links( $links ) { |
187 | - $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=yikes-inc-easy-mailchimp-settings') ) .'">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
188 | - $links[] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
187 | + $links[ ] = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) . '">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
188 | + $links[ ] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
189 | 189 | return $links; |
190 | 190 | } |
191 | 191 | |
@@ -218,29 +218,29 @@ discard block |
||
218 | 218 | * @return parsed tag content |
219 | 219 | */ |
220 | 220 | public function parse_mailchimp_default_tag( $default_tag ) { |
221 | - if( ! $default_tag || $default_tag == '' ) { |
|
221 | + if ( ! $default_tag || $default_tag == '' ) { |
|
222 | 222 | return $default_tag; |
223 | 223 | } |
224 | 224 | global $post; |
225 | 225 | // page title |
226 | - if( $default_tag == '{page_title}' ) { |
|
226 | + if ( $default_tag == '{page_title}' ) { |
|
227 | 227 | $default_tag = get_the_title( $post->ID ); |
228 | 228 | } |
229 | 229 | // page id |
230 | - if( $default_tag == '{page_title}' ) { |
|
230 | + if ( $default_tag == '{page_title}' ) { |
|
231 | 231 | $default_tag = $post->ID; |
232 | 232 | } |
233 | 233 | // page url |
234 | - if( $default_tag == '{page_url}' ) { |
|
234 | + if ( $default_tag == '{page_url}' ) { |
|
235 | 235 | $default_tag = get_permalink( $post->ID ); |
236 | 236 | } |
237 | 237 | // blog name |
238 | - if( $default_tag == '{blog_name}' ) { |
|
238 | + if ( $default_tag == '{blog_name}' ) { |
|
239 | 239 | $default_tag = get_bloginfo( 'name' ); |
240 | 240 | } |
241 | 241 | // is user logged in |
242 | - if( $default_tag == '{user_logged_in}' ) { |
|
243 | - if( is_user_logged_in() ) { |
|
242 | + if ( $default_tag == '{user_logged_in}' ) { |
|
243 | + if ( is_user_logged_in() ) { |
|
244 | 244 | $default_tag = 'Registered User'; |
245 | 245 | } else { |
246 | 246 | $default_tag = 'Guest User'; |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function yikes_easy_mailchimp_clear_error_log() { |
260 | 260 | // file put contents $returned error + other data |
261 | - if( file_exists( YIKES_MC_PATH . 'includes/error_log/yikes-easy-mailchimp-error-log.php' ) ) { |
|
261 | + if ( file_exists( YIKES_MC_PATH . 'includes/error_log/yikes-easy-mailchimp-error-log.php' ) ) { |
|
262 | 262 | $clear_log = file_put_contents( |
263 | 263 | YIKES_MC_PATH . 'includes/error_log/yikes-easy-mailchimp-error-log.php', |
264 | 264 | '' |
265 | 265 | ); |
266 | - if( $clear_log === false ) { |
|
266 | + if ( $clear_log === false ) { |
|
267 | 267 | // redirect the user to the manage forms page, display error message |
268 | 268 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error-log-cleared=false' ) ) ); |
269 | 269 | } else { |
@@ -281,20 +281,20 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function yikes_easy_mailchimp_export_forms() { |
283 | 283 | // grab our nonce |
284 | - $nonce = $_REQUEST['nonce']; |
|
284 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
285 | 285 | // grab the forms |
286 | - $forms = isset( $_REQUEST['export_forms'] ) ? $_REQUEST['export_forms'] : 'all'; |
|
286 | + $forms = isset( $_REQUEST[ 'export_forms' ] ) ? $_REQUEST[ 'export_forms' ] : 'all'; |
|
287 | 287 | // validate nonce |
288 | - if( ! wp_verify_nonce( $nonce, 'export-forms' ) ) { |
|
289 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
288 | + if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) { |
|
289 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
290 | 290 | } |
291 | 291 | // include the export class |
292 | - if( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Export_Class' ) ) { |
|
292 | + if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Export_Class' ) ) { |
|
293 | 293 | include_once( YIKES_MC_PATH . 'includes/import-export/yikes-easy-mailchimp-export.class.php' ); |
294 | 294 | } |
295 | 295 | // run the export function |
296 | 296 | // parameters: ( $table_name, $form_ids, $file_name ) |
297 | - Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export( 'yikes_easy_mc_forms' , $forms, 'Yikes-Inc-Easy-MailChimp-Forms-Export' ); |
|
297 | + Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export( 'yikes_easy_mc_forms', $forms, 'Yikes-Inc-Easy-MailChimp-Forms-Export' ); |
|
298 | 298 | // re-direct the user back to the page |
299 | 299 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); |
300 | 300 | die(); |
@@ -308,13 +308,13 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function yikes_easy_mailchimp_export_plugin_settings() { |
310 | 310 | // grab our nonce |
311 | - $nonce = $_REQUEST['nonce']; |
|
311 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
312 | 312 | // validate nonce |
313 | - if( ! wp_verify_nonce( $nonce, 'export-settings' ) ) { |
|
314 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
313 | + if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) { |
|
314 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
315 | 315 | } |
316 | 316 | // include the export class |
317 | - if( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Export_Class' ) ) { |
|
317 | + if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Export_Class' ) ) { |
|
318 | 318 | include_once( YIKES_MC_PATH . 'includes/import-export/yikes-easy-mailchimp-export.class.php' ); |
319 | 319 | } |
320 | 320 | // run the export function |
@@ -331,13 +331,13 @@ discard block |
||
331 | 331 | */ |
332 | 332 | public function yikes_easy_mailchimp_import_forms() { |
333 | 333 | // grab our nonce |
334 | - $nonce = $_REQUEST['nonce']; |
|
334 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
335 | 335 | // validate nonce |
336 | - if( ! wp_verify_nonce( $nonce, 'import-forms' ) ) { |
|
337 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
336 | + if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) { |
|
337 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
338 | 338 | } |
339 | 339 | // include the export class |
340 | - if( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) { |
|
340 | + if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) { |
|
341 | 341 | include_once( YIKES_MC_PATH . 'includes/import-export/yikes-easy-mailchimp-import.class.php' ); |
342 | 342 | } |
343 | 343 | // run the import function |
@@ -355,15 +355,15 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function yikes_easy_mailchimp_premium_support_request() { |
357 | 357 | |
358 | - if( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) { |
|
359 | - return __( 'We encountered an error. Please contact the YIKES Inc. support team.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
358 | + if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] != 'yikes-support-request' ) { |
|
359 | + return __( 'We encountered an error. Please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); |
|
360 | 360 | } |
361 | 361 | |
362 | - $license = $_POST['license_key']; |
|
363 | - $user_email = $_POST['user-email']; |
|
364 | - $support_topic = $_POST['support-topic']; |
|
365 | - $support_priority = $_POST['support-priority']; |
|
366 | - $support_content = $_POST['support-content']; |
|
362 | + $license = $_POST[ 'license_key' ]; |
|
363 | + $user_email = $_POST[ 'user-email' ]; |
|
364 | + $support_topic = $_POST[ 'support-topic' ]; |
|
365 | + $support_priority = $_POST[ 'support-priority' ]; |
|
366 | + $support_content = $_POST[ 'support-content' ]; |
|
367 | 367 | |
368 | 368 | // wp_die( print_r( $support_content) ); |
369 | 369 | |
@@ -379,18 +379,18 @@ discard block |
||
379 | 379 | |
380 | 380 | $yikes_plugin_support_url = 'https://yikesplugins.com'; |
381 | 381 | |
382 | - if( $license != 'plugin-core' ) { |
|
382 | + if ( $license != 'plugin-core' ) { |
|
383 | 383 | $split_license = explode( '|', $license ); |
384 | 384 | // first let's check that the license key is actually active |
385 | 385 | $is_license_key_active = wp_remote_post( esc_url( $yikes_plugin_support_url ), array( |
386 | 386 | 'action' => 'check_license', |
387 | - 'product_name' => urlencode( str_replace( '-', '', $split_license[1] ) . 'for Easy MailChimp' ), |
|
388 | - 'license' => $split_license[0], |
|
387 | + 'product_name' => urlencode( str_replace( '-', '', $split_license[ 1 ] ) . 'for Easy MailChimp' ), |
|
388 | + 'license' => $split_license[ 0 ], |
|
389 | 389 | ) ); |
390 | 390 | |
391 | - $response_body = wp_remote_retrieve_body( $is_license_key_active ); |
|
392 | - if( $response_body ) { |
|
393 | - if( $response_body->status != 'valid' ) { |
|
391 | + $response_body = wp_remote_retrieve_body( $is_license_key_active ); |
|
392 | + if ( $response_body ) { |
|
393 | + if ( $response_body->status != 'valid' ) { |
|
394 | 394 | wp_die( 'Invalid License Key...' ); |
395 | 395 | } |
396 | 396 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | ) ); |
405 | 405 | |
406 | 406 | // catch the error |
407 | - if( is_wp_error( $response ) ) { |
|
407 | + if ( is_wp_error( $response ) ) { |
|
408 | 408 | wp_die( $create_ticket_request->getMessage() ); |
409 | 409 | return; |
410 | 410 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $create_ticket_response = wp_remote_retrieve_body( $response ); |
414 | 414 | |
415 | 415 | // display it |
416 | - if( $create_ticket_response ) |
|
416 | + if ( $create_ticket_response ) |
|
417 | 417 | echo $create_ticket_response; |
418 | 418 | |
419 | 419 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | // delete the options and allow the user to manually updadte things |
428 | 428 | |
429 | 429 | // Verify the NONCE is valid |
430 | - check_admin_referer( 'yikes-mc-dismiss-migration' , 'dismiss_migration_nonce' ); |
|
430 | + check_admin_referer( 'yikes-mc-dismiss-migration', 'dismiss_migration_nonce' ); |
|
431 | 431 | |
432 | 432 | // re-direct the user back to the page |
433 | 433 | wp_redirect( esc_url_raw( admin_url( 'index.php?yikes-mc-options-migration-dismissed="true"' ) ) ); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @since 6.0.0 |
443 | 443 | */ |
444 | 444 | public function load_error_logging_class() { |
445 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
445 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
446 | 446 | // if error logging is enabled we should include our error logging class |
447 | 447 | /* Generate oure error logging table */ |
448 | 448 | require_once YIKES_MC_PATH . '/includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
@@ -461,17 +461,17 @@ discard block |
||
461 | 461 | // add a new option to store the plugin activation date/time |
462 | 462 | // @since v6.0.0 |
463 | 463 | // this is used to notify the user that they should review after 2 weeks |
464 | - if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) { |
|
464 | + if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) ) { |
|
465 | 465 | add_option( 'yikes_easy_mailchimp_activation_date', strtotime( "now" ) ); |
466 | 466 | } |
467 | 467 | |
468 | 468 | $stop_bugging_me = get_option( 'yikes_easy_mailchimp_review_stop_bugging_me' ); |
469 | 469 | |
470 | - if( !$stop_bugging_me ) { |
|
470 | + if ( ! $stop_bugging_me ) { |
|
471 | 471 | $install_date = get_option( 'yikes_easy_mailchimp_activation_date' ); |
472 | 472 | $past_date = strtotime( '-14 days' ); |
473 | 473 | if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) { |
474 | - add_action( 'admin_notices', array( $this , 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
474 | + add_action( 'admin_notices', array( $this, 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
@@ -484,13 +484,13 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function yikes_easy_mailchimp_display_review_us_notice() { |
486 | 486 | /* Lets only display our admin notice on YT4WP pages to not annoy the hell out of people :) */ |
487 | - if ( in_array( get_current_screen()->base , array( 'dashboard' , 'post' , 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) { |
|
487 | + if ( in_array( get_current_screen()->base, array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base, 'yikes-inc-easy-mailchimp' ) !== false ) { |
|
488 | 488 | // Review URL - Change to the URL of your plugin on WordPress.org |
489 | 489 | $reviewurl = 'https://wordpress.org/support/view/plugin-reviews/yikes-inc-easy-mailchimp-extender'; |
490 | 490 | $addons_url = esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); |
491 | 491 | $nobugurl = esc_url_raw( add_query_arg( 'yikes_easy_mc_icons_nobug', '1', admin_url() ) ); |
492 | 492 | $review_message = '<div id="yikes-mailchimp-logo"></div>'; |
493 | - $review_message .= sprintf( __( "It looks like you've been using %s for 2 weeks now. We hope you're enjoying the features included with the free version. If so, please consider leaving us a review. Reviews only help to catch other users attention as well as provide us with feedback to grow and improve upon. If you're really enjoying the plugin, consider buying an add-on or developer license for some really awesome features and premium support." , 'yikes-inc-easy-mailchimp-extender' ) . "<span class='button-container'> <a href='%s' target='_blank' class='button-secondary'><span class='dashicons dashicons-star-filled'></span>" . __( "Leave A Review" , 'yikes-inc-easy-mailchimp-extender' ) . "</a> <a href='%s' class='button-secondary'><span class='dashicons dashicons-upload'></span>" . __( "View Addons" , 'yikes-inc-easy-mailchimp-extender' ) . "</a> <a href='%s' class='button-secondary'><span class='dashicons dashicons-no-alt'></span>" . __( "Dismiss" , 'yikes-inc-easy-mailchimp-extender' ) . "</a> </span>", '<strong>Easy Forms for MailChimp by YIKES Inc.</strong>', $reviewurl, $addons_url, $nobugurl ) . ''; |
|
493 | + $review_message .= sprintf( __( "It looks like you've been using %s for 2 weeks now. We hope you're enjoying the features included with the free version. If so, please consider leaving us a review. Reviews only help to catch other users attention as well as provide us with feedback to grow and improve upon. If you're really enjoying the plugin, consider buying an add-on or developer license for some really awesome features and premium support.", 'yikes-inc-easy-mailchimp-extender' ) . "<span class='button-container'> <a href='%s' target='_blank' class='button-secondary'><span class='dashicons dashicons-star-filled'></span>" . __( "Leave A Review", 'yikes-inc-easy-mailchimp-extender' ) . "</a> <a href='%s' class='button-secondary'><span class='dashicons dashicons-upload'></span>" . __( "View Addons", 'yikes-inc-easy-mailchimp-extender' ) . "</a> <a href='%s' class='button-secondary'><span class='dashicons dashicons-no-alt'></span>" . __( "Dismiss", 'yikes-inc-easy-mailchimp-extender' ) . "</a> </span>", '<strong>Easy Forms for MailChimp by YIKES Inc.</strong>', $reviewurl, $addons_url, $nobugurl ) . ''; |
|
494 | 494 | ?> |
495 | 495 | <div id="review-yikes-easy-mailchimp-notice"> |
496 | 496 | <?php echo $review_message; ?> |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | */ |
507 | 507 | public function yikes_easy_mailchimp_stop_bugging_me() { |
508 | 508 | $nobug = ""; |
509 | - if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) ) { |
|
510 | - $nobug = (int) esc_attr( $_GET['yikes_easy_mc_icons_nobug'] ); |
|
509 | + if ( isset( $_GET[ 'yikes_easy_mc_icons_nobug' ] ) ) { |
|
510 | + $nobug = (int) esc_attr( $_GET[ 'yikes_easy_mc_icons_nobug' ] ); |
|
511 | 511 | } |
512 | 512 | if ( 1 == $nobug ) { |
513 | 513 | add_option( 'yikes_easy_mailchimp_review_stop_bugging_me', TRUE ); |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | /* Display a warning users who are using PHP < 5.3 */ |
520 | 520 | public function display_php_warning() { |
521 | - $message = __( 'YIKES Inc. Easy Forms for MailChimp requires a minimum of PHP 5.3. The plugin will not function properly until you update. Reach out to your host provider for assistance.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
521 | + $message = __( 'YIKES Inc. Easy Forms for MailChimp requires a minimum of PHP 5.3. The plugin will not function properly until you update. Reach out to your host provider for assistance.', 'yikes-inc-easy-mailchimp-extender' ); |
|
522 | 522 | echo "<div class='error'> <p><span class='dashicons dashicons-no-alt' style='color:rgb(231, 98, 98)'></span> $message</p></div>"; |
523 | 523 | } |
524 | 524 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | public function add_tinyMCE_buttons() { |
530 | 530 | global $typenow; |
531 | 531 | // only on Post Type: post and page |
532 | - if( ! in_array( $typenow, array( 'post', 'page' ) ) ) { |
|
532 | + if ( ! in_array( $typenow, array( 'post', 'page' ) ) ) { |
|
533 | 533 | return; |
534 | 534 | } |
535 | 535 | add_filter( 'mce_buttons', array( $this, 'yks_mc_add_tinymce_button' ) ); |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | |
546 | 546 | // inlcude the js for tinymce |
547 | 547 | public function yks_mc_add_tinymce_plugin( $plugin_array ) { |
548 | - $plugin_array['yks_mc_tinymce_button'] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
548 | + $plugin_array[ 'yks_mc_tinymce_button' ] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
549 | 549 | // Print all plugin js path |
550 | 550 | // var_dump( $plugin_array ); |
551 | 551 | return $plugin_array; |
@@ -558,25 +558,25 @@ discard block |
||
558 | 558 | */ |
559 | 559 | public function tinymce_yikes_easy_mc() { |
560 | 560 | // check capabilities |
561 | - if( ! current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
561 | + if ( ! current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
562 | 562 | return; |
563 | 563 | } |
564 | 564 | global $wpdb; |
565 | 565 | $list_data = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms', ARRAY_A ); |
566 | 566 | $lists = array(); |
567 | 567 | $i = 0; |
568 | - if( !empty( $list_data ) ) { |
|
568 | + if ( ! empty( $list_data ) ) { |
|
569 | 569 | // build an array to pass to our javascript |
570 | - foreach( $list_data as $form ) { |
|
571 | - $lists[$i] = array( |
|
572 | - 'text' => urlencode( $form['form_name'] ), |
|
573 | - 'value' => $form['id'] |
|
570 | + foreach ( $list_data as $form ) { |
|
571 | + $lists[ $i ] = array( |
|
572 | + 'text' => urlencode( $form[ 'form_name' ] ), |
|
573 | + 'value' => $form[ 'id' ] |
|
574 | 574 | ); |
575 | 575 | $i++; |
576 | 576 | } |
577 | 577 | } else { |
578 | - $lists[0] = array( |
|
579 | - 'text' => __( 'Please Import Some MailChimp Lists' , 'yikes-inc-easy-mailchimp-extender' ), |
|
578 | + $lists[ 0 ] = array( |
|
579 | + 'text' => __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ), |
|
580 | 580 | 'value' => '-' |
581 | 581 | ); |
582 | 582 | } |
@@ -589,10 +589,10 @@ discard block |
||
589 | 589 | var localized_data = { |
590 | 590 | 'button_title' : '<?php _e( 'Easy Forms for MailChimp by YIKES', 'yikes-inc-easy-mailchimp-extender' ); ?>', |
591 | 591 | 'popup_title' : '<?php _e( 'Easy Forms for MailChimp by YIKES', 'yikes-inc-easy-mailchimp-extender' ); ?>', |
592 | - 'list_id_label' : '<?php _e( 'MailChimp Opt-In Form' , 'yikes-inc-easy-mailchimp-extender' ); ?>', |
|
593 | - 'show_title_label' : '<?php _e( 'Display Form Title' , 'yikes-inc-easy-mailchimp-extender' ); ?>', |
|
594 | - 'show_description_label' : '<?php _e( 'Display Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?>', |
|
595 | - 'submit_button_text_label' : '<?php _e( 'Submit Button Text' , 'yikes-inc-easy-mailchimp-extender' ); ?>', |
|
592 | + 'list_id_label' : '<?php _e( 'MailChimp Opt-In Form', 'yikes-inc-easy-mailchimp-extender' ); ?>', |
|
593 | + 'show_title_label' : '<?php _e( 'Display Form Title', 'yikes-inc-easy-mailchimp-extender' ); ?>', |
|
594 | + 'show_description_label' : '<?php _e( 'Display Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?>', |
|
595 | + 'submit_button_text_label' : '<?php _e( 'Submit Button Text', 'yikes-inc-easy-mailchimp-extender' ); ?>', |
|
596 | 596 | }; |
597 | 597 | <?php |
598 | 598 | $link = sprintf( __( 'You need to <a href="%s" title="%s">create a form</a> before you can add one to a page or post.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ), __( 'Create a form', 'yikes-inc-easy-mailchimp-extender' ) ); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | if ( get_option( 'yikes_mailchimp_activation_redirect', 'true' ) == 'true' ) { |
612 | 612 | update_option( 'yikes_mailchimp_activation_redirect', 'false' ); |
613 | 613 | /* If the user had this plugin activated prior to today, redirect to 'Whats New' */ |
614 | - if( get_option( 'yikes_easy_mailchimp_activation_date', strtotime( 'now' ) ) == strtotime( 'now' ) ) { |
|
614 | + if ( get_option( 'yikes_easy_mailchimp_activation_date', strtotime( 'now' ) ) == strtotime( 'now' ) ) { |
|
615 | 615 | wp_redirect( esc_url( admin_url( 'admin.php?page=yikes-mailchimp-welcome' ) ) ); |
616 | 616 | } else { |
617 | 617 | /* Else redirect the user over to the 'Getting Started' tab */ |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | /** |
668 | 668 | * Enqueue our scripts across the dashboard as needed |
669 | 669 | */ |
670 | - wp_register_script( 'yikes-inc-easy-mailchimp-extender-admin-js', plugin_dir_url( __FILE__ ) . 'js/min/yikes-inc-easy-mailchimp-extender-admin.min.js', array( 'jquery' , 'jquery-ui-sortable' ), $this->version, false ); |
|
670 | + wp_register_script( 'yikes-inc-easy-mailchimp-extender-admin-js', plugin_dir_url( __FILE__ ) . 'js/min/yikes-inc-easy-mailchimp-extender-admin.min.js', array( 'jquery', 'jquery-ui-sortable' ), $this->version, false ); |
|
671 | 671 | $localized_data = array( |
672 | 672 | 'admin_url' => esc_url_raw( admin_url() ), |
673 | 673 | 'ajax_url' => esc_url_raw( admin_url( 'admin-ajax.php' ) ), |
@@ -675,19 +675,19 @@ discard block |
||
675 | 675 | 'search_preloader_url' => YIKES_MC_URL . 'includes/images/search-interest-group-preloader.gif', |
676 | 676 | 'preloader_url' => esc_url_raw( admin_url( '/images/wpspin_light.gif' ) ) |
677 | 677 | ); |
678 | - wp_localize_script( 'yikes-inc-easy-mailchimp-extender-admin-js' , 'object_data' , $localized_data ); |
|
678 | + wp_localize_script( 'yikes-inc-easy-mailchimp-extender-admin-js', 'object_data', $localized_data ); |
|
679 | 679 | wp_enqueue_script( 'yikes-inc-easy-mailchimp-extender-admin-js' ); |
680 | 680 | |
681 | 681 | |
682 | 682 | /* |
683 | 683 | * Enqueue required scripts for the form editor |
684 | 684 | */ |
685 | - if( get_current_screen()->base == 'admin_page_yikes-mailchimp-edit-form' ) { |
|
685 | + if ( get_current_screen()->base == 'admin_page_yikes-mailchimp-edit-form' ) { |
|
686 | 686 | global $wp_locale; |
687 | 687 | wp_enqueue_style( 'wp-color-picker' ); |
688 | 688 | wp_enqueue_script( 'wp-color-picker' ); |
689 | - wp_enqueue_script( 'jquery.timepicker.js',YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js' , array( 'jquery' ) , $this->version, false ); |
|
690 | - wp_register_script( 'edit-form-js' , YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js' , array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ) , $this->version, false ); |
|
689 | + wp_enqueue_script( 'jquery.timepicker.js', YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js', array( 'jquery' ), $this->version, false ); |
|
690 | + wp_register_script( 'edit-form-js', YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js', array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ), $this->version, false ); |
|
691 | 691 | $localized_data = array( |
692 | 692 | 'ajax_url' => esc_url_raw( admin_url( 'admin-ajax.php' ) ), |
693 | 693 | 'no_fields_assigned' => __( 'No fields assigned to this form. Select some fields to add to this form from the right hand column.', 'yikes-inc-easy-mailchimp-extender' ), |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | 'isRTL' => $wp_locale->is_rtl(), |
709 | 709 | 'start_date_exceeds_end_date_error' => __( 'Error: The start date and time cannot occur after the end date and time. Chosen date reverted to previous selection.', 'yikes-inc-easy-mailchimp-extender' ), |
710 | 710 | ); |
711 | - wp_localize_script( 'edit-form-js' , 'object' , $localized_data ); |
|
711 | + wp_localize_script( 'edit-form-js', 'object', $localized_data ); |
|
712 | 712 | wp_enqueue_script( 'edit-form-js' ); |
713 | 713 | } |
714 | 714 | |
@@ -728,8 +728,8 @@ discard block |
||
728 | 728 | * the datepicker wants a numerical index. This function replaces the index with a number |
729 | 729 | */ |
730 | 730 | public function yikes_jQuery_datepicker_strip_array_indices( $ArrayToStrip ) { |
731 | - foreach( $ArrayToStrip as $objArrayItem) { |
|
732 | - $NewArray[] = $objArrayItem; |
|
731 | + foreach ( $ArrayToStrip as $objArrayItem ) { |
|
732 | + $NewArray[ ] = $objArrayItem; |
|
733 | 733 | } |
734 | 734 | return( $NewArray ); |
735 | 735 | } |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * Convert the php date format string to a js date format |
739 | 739 | */ |
740 | 740 | public function yikes_jQuery_datepicker_date_format_php_to_js( $sFormat ) { |
741 | - switch( $sFormat ) { |
|
741 | + switch ( $sFormat ) { |
|
742 | 742 | //Predefined WP date formats |
743 | 743 | case 'F j, Y': |
744 | 744 | case 'j F Y': |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | * Convert the php date format string to a js date format |
765 | 765 | */ |
766 | 766 | public function yikes_jQuery_datepicker_date_format( $site_option ) { |
767 | - switch( $site_option ) { |
|
767 | + switch ( $site_option ) { |
|
768 | 768 | //Predefined WP date formats |
769 | 769 | default: |
770 | 770 | case 'F j, Y': |
@@ -791,9 +791,9 @@ discard block |
||
791 | 791 | |
792 | 792 | /* Top Level Menu 'Easy MailChimp' */ |
793 | 793 | add_menu_page( |
794 | - __( 'Easy Forms' , 'yikes-inc-easy-mailchimp-extender' ), |
|
794 | + __( 'Easy Forms', 'yikes-inc-easy-mailchimp-extender' ), |
|
795 | 795 | 'Easy Forms', |
796 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
796 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
797 | 797 | 'yikes-inc-easy-mailchimp', |
798 | 798 | '', // no callback, |
799 | 799 | YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_wink_icon.png' |
@@ -807,9 +807,9 @@ discard block |
||
807 | 807 | /* YIKES Inc. Easy MailChimp Manage Forms */ |
808 | 808 | add_submenu_page( |
809 | 809 | 'yikes-inc-easy-mailchimp', |
810 | - __( 'Opt-in Forms' , 'yikes-inc-easy-mailchimp-extender' ), |
|
811 | - __( 'Opt-in Forms' , 'yikes-inc-easy-mailchimp-extender' ), |
|
812 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
810 | + __( 'Opt-in Forms', 'yikes-inc-easy-mailchimp-extender' ), |
|
811 | + __( 'Opt-in Forms', 'yikes-inc-easy-mailchimp-extender' ), |
|
812 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
813 | 813 | 'yikes-inc-easy-mailchimp', |
814 | 814 | array( $this, 'generateManageFormsPage' ) |
815 | 815 | ); |
@@ -817,9 +817,9 @@ discard block |
||
817 | 817 | /* YIKES Inc. Easy MailChimp Manage Lists */ |
818 | 818 | add_submenu_page( |
819 | 819 | 'yikes-inc-easy-mailchimp', |
820 | - __( 'Mailing Lists' , 'yikes-inc-easy-mailchimp-extender' ), |
|
821 | - __( 'Mailing Lists' , 'yikes-inc-easy-mailchimp-extender' ), |
|
822 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
820 | + __( 'Mailing Lists', 'yikes-inc-easy-mailchimp-extender' ), |
|
821 | + __( 'Mailing Lists', 'yikes-inc-easy-mailchimp-extender' ), |
|
822 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
823 | 823 | 'yikes-inc-easy-mailchimp-lists', |
824 | 824 | array( $this, 'generateManageListsPage' ) |
825 | 825 | ); |
@@ -833,13 +833,13 @@ discard block |
||
833 | 833 | |
834 | 834 | |
835 | 835 | /* YIKES Inc. Easy MailChimp Account Overview */ |
836 | - if ( get_option('yikes-mc-api-validation') == 'valid_api_key' ) { |
|
836 | + if ( get_option( 'yikes-mc-api-validation' ) == 'valid_api_key' ) { |
|
837 | 837 | /* YIKES Inc. Easy MailChimp Settings */ |
838 | 838 | add_submenu_page( |
839 | 839 | 'yikes-inc-easy-mailchimp', |
840 | - __( 'Account' , 'yikes-inc-easy-mailchimp-extender' ), |
|
841 | - __( 'Account' , 'yikes-inc-easy-mailchimp-extender' ), |
|
842 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
840 | + __( 'Account', 'yikes-inc-easy-mailchimp-extender' ), |
|
841 | + __( 'Account', 'yikes-inc-easy-mailchimp-extender' ), |
|
842 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
843 | 843 | 'yikes-inc-easy-mailchimp-account-overview', |
844 | 844 | array( $this, 'generateAccountDetailsPage' ) |
845 | 845 | ); |
@@ -849,9 +849,9 @@ discard block |
||
849 | 849 | /* YIKES Inc. Easy MailChimp Settings */ |
850 | 850 | add_submenu_page( |
851 | 851 | 'yikes-inc-easy-mailchimp', |
852 | - __( 'Settings.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
853 | - __( 'Settings' , 'yikes-inc-easy-mailchimp-extender' ), |
|
854 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
852 | + __( 'Settings.', 'yikes-inc-easy-mailchimp-extender' ), |
|
853 | + __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ), |
|
854 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
855 | 855 | 'yikes-inc-easy-mailchimp-settings', |
856 | 856 | array( $this, 'generatePageOptions' ) |
857 | 857 | ); |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | /* Support Page */ |
860 | 860 | add_submenu_page( |
861 | 861 | 'yikes-inc-easy-mailchimp', |
862 | - __( 'Support' , 'yikes-inc-easy-mailchimp-extender' ), |
|
863 | - __( 'Support' , 'yikes-inc-easy-mailchimp-extender' ), |
|
864 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
862 | + __( 'Support', 'yikes-inc-easy-mailchimp-extender' ), |
|
863 | + __( 'Support', 'yikes-inc-easy-mailchimp-extender' ), |
|
864 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
865 | 865 | 'yikes-inc-easy-mailchimp-support', |
866 | 866 | array( $this, 'generateSupportPage' ) |
867 | 867 | ); |
@@ -869,11 +869,11 @@ discard block |
||
869 | 869 | /* Add-Ons Page */ |
870 | 870 | add_submenu_page( |
871 | 871 | 'yikes-inc-easy-mailchimp', |
872 | - __( 'Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ), |
|
873 | - __( 'Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ), |
|
874 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
872 | + __( 'Add-Ons', 'yikes-inc-easy-mailchimp-extender' ), |
|
873 | + __( 'Add-Ons', 'yikes-inc-easy-mailchimp-extender' ), |
|
874 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
875 | 875 | 'yikes-inc-easy-mailchimp-addons', |
876 | - array( $this , 'generateAddOnsPage' ) |
|
876 | + array( $this, 'generateAddOnsPage' ) |
|
877 | 877 | ); |
878 | 878 | |
879 | 879 | /** Hidden Pages **/ |
@@ -881,9 +881,9 @@ discard block |
||
881 | 881 | /* Add Hidden Edit Form Page */ |
882 | 882 | add_submenu_page( |
883 | 883 | 'options.php', |
884 | - __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ), |
|
885 | - __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ), |
|
886 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
884 | + __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ), |
|
885 | + __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ), |
|
886 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
887 | 887 | 'yikes-mailchimp-edit-form', |
888 | 888 | array( $this, 'generateEditFormPage' ) |
889 | 889 | ); |
@@ -891,19 +891,19 @@ discard block |
||
891 | 891 | /* Add Hidden Migrate Options Page */ |
892 | 892 | add_submenu_page( |
893 | 893 | 'options-writing.php', |
894 | - __( 'YIKES Inc. Easy Forms for MailChimp Upgrade Options Structure' , 'yikes-inc-easy-mailchimp-extender' ), |
|
894 | + __( 'YIKES Inc. Easy Forms for MailChimp Upgrade Options Structure', 'yikes-inc-easy-mailchimp-extender' ), |
|
895 | 895 | 'YIKES Inc. Easy Forms for MailChimp Upgrade Options Structure', |
896 | 896 | 'manage_options', |
897 | - 'yikes-inc-easy-mailchimp-update' , |
|
898 | - array( $this , 'migrate_old_yks_mc_options' ) |
|
897 | + 'yikes-inc-easy-mailchimp-update', |
|
898 | + array( $this, 'migrate_old_yks_mc_options' ) |
|
899 | 899 | ); |
900 | 900 | |
901 | 901 | /* Add Hidden Welcome Page */ |
902 | 902 | add_submenu_page( |
903 | 903 | 'options.php', |
904 | - __( 'Welcome' , 'yikes-inc-easy-mailchimp-extender' ), |
|
905 | - __( 'Welcome' , 'yikes-inc-easy-mailchimp-extender' ), |
|
906 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
904 | + __( 'Welcome', 'yikes-inc-easy-mailchimp-extender' ), |
|
905 | + __( 'Welcome', 'yikes-inc-easy-mailchimp-extender' ), |
|
906 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
907 | 907 | 'yikes-mailchimp-welcome', |
908 | 908 | array( $this, 'generateWelcomePage' ) |
909 | 909 | ); |
@@ -911,9 +911,9 @@ discard block |
||
911 | 911 | /* Add Hidden 'View List' Page */ |
912 | 912 | add_submenu_page( |
913 | 913 | 'options.php', |
914 | - __( 'View List' , 'yikes-inc-easy-mailchimp-extender' ), |
|
915 | - __( 'View List' , 'yikes-inc-easy-mailchimp-extender' ), |
|
916 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
914 | + __( 'View List', 'yikes-inc-easy-mailchimp-extender' ), |
|
915 | + __( 'View List', 'yikes-inc-easy-mailchimp-extender' ), |
|
916 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
917 | 917 | 'yikes-mailchimp-view-list', |
918 | 918 | array( $this, 'generateViewListPage' ) |
919 | 919 | ); |
@@ -921,9 +921,9 @@ discard block |
||
921 | 921 | /* Add Hidden View User Page */ |
922 | 922 | add_submenu_page( |
923 | 923 | 'options.php', |
924 | - __( 'View User' , 'yikes-inc-easy-mailchimp-extender' ), |
|
925 | - __( 'View User' , 'yikes-inc-easy-mailchimp-extender' ), |
|
926 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ), |
|
924 | + __( 'View User', 'yikes-inc-easy-mailchimp-extender' ), |
|
925 | + __( 'View User', 'yikes-inc-easy-mailchimp-extender' ), |
|
926 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ), |
|
927 | 927 | 'yikes-mailchimp-view-user', |
928 | 928 | array( $this, 'generateViewUserPage' ) |
929 | 929 | ); |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | |
1021 | 1021 | /* Register General Settings Section */ |
1022 | 1022 | |
1023 | - register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this , 'yikes_mc_validate_api_key' ) ); |
|
1023 | + register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this, 'yikes_mc_validate_api_key' ) ); |
|
1024 | 1024 | |
1025 | 1025 | add_settings_section( |
1026 | 1026 | 'yikes_easy_mc_settings_general_section_callback', |
@@ -1063,16 +1063,16 @@ discard block |
||
1063 | 1063 | add_settings_field( |
1064 | 1064 | 'optin-checkbox-init', |
1065 | 1065 | __( 'Select Checkboxes to Generate', 'yikes-inc-easy-mailchimp-extender' ), |
1066 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1066 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1067 | 1067 | 'yikes_inc_easy_mc_checkbox_settings' |
1068 | 1068 | ); |
1069 | 1069 | /* End Checkbox Settings */ |
1070 | 1070 | |
1071 | 1071 | /* reCAPTCHA Settings */ |
1072 | 1072 | |
1073 | - register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page' , 'yikes-mc-recaptcha-status' ); |
|
1074 | - register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page' , 'yikes-mc-recaptcha-site-key' ); |
|
1075 | - register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page' , 'yikes-mc-recaptcha-secret-key' ); |
|
1073 | + register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page', 'yikes-mc-recaptcha-status' ); |
|
1074 | + register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page', 'yikes-mc-recaptcha-site-key' ); |
|
1075 | + register_setting( 'yikes_inc_easy_mc_recaptcha_settings_page', 'yikes-mc-recaptcha-secret-key' ); |
|
1076 | 1076 | |
1077 | 1077 | /* Register reCAPTCHA Settings Section */ |
1078 | 1078 | add_settings_section( |
@@ -1085,28 +1085,28 @@ discard block |
||
1085 | 1085 | add_settings_field( |
1086 | 1086 | 'yikes-mc-recaptcha-site-key', |
1087 | 1087 | __( 'Enter reCAPTCHA Site Key', 'yikes-inc-easy-mailchimp-extender' ), |
1088 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1088 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1089 | 1089 | 'yikes_easy_mc_settings_recpatcha_section' |
1090 | 1090 | ); |
1091 | 1091 | |
1092 | 1092 | add_settings_field( |
1093 | 1093 | 'yikes-mc-recaptcha-secret-key', |
1094 | 1094 | __( 'Enter reCAPTCHA Secret Key', 'yikes-inc-easy-mailchimp-extender' ), |
1095 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1095 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1096 | 1096 | 'yikes_easy_mc_settings_recpatcha_section' |
1097 | 1097 | ); |
1098 | 1098 | |
1099 | 1099 | add_settings_field( |
1100 | 1100 | 'yikes-mc-recaptcha-status', |
1101 | 1101 | __( 'Enable ReCaptcha', 'yikes-inc-easy-mailchimp-extender' ), |
1102 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1102 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1103 | 1103 | 'yikes_easy_mc_settings_recpatcha_section' |
1104 | 1104 | ); |
1105 | 1105 | |
1106 | 1106 | /* End reCAPTCHA Settings */ |
1107 | 1107 | |
1108 | 1108 | /* Debug Settings */ |
1109 | - register_setting( 'yikes_inc_easy_mc_debug_settings_page' , 'yikes-mailchimp-debug-status' ); |
|
1109 | + register_setting( 'yikes_inc_easy_mc_debug_settings_page', 'yikes-mailchimp-debug-status' ); |
|
1110 | 1110 | |
1111 | 1111 | /* Register Debug Settings Section */ |
1112 | 1112 | add_settings_section( |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | add_settings_field( |
1120 | 1120 | 'yikes-mailchimp-debug-status', |
1121 | 1121 | __( 'Enable Debugging', 'yikes-inc-easy-mailchimp-extender' ), |
1122 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
1122 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
1123 | 1123 | 'yikes_easy_mc_settings_debug_section' |
1124 | 1124 | ); |
1125 | 1125 | |
@@ -1135,16 +1135,16 @@ discard block |
||
1135 | 1135 | * @since complete re-write |
1136 | 1136 | **/ |
1137 | 1137 | function yikes_mc_validate_api_key( $input ) { |
1138 | - if( $input == '' ) { |
|
1138 | + if ( $input == '' ) { |
|
1139 | 1139 | return; |
1140 | 1140 | } |
1141 | 1141 | $api_key = trim( $input ); |
1142 | 1142 | $dash_position = strpos( trim( $input ), '-' ); |
1143 | - if( $dash_position !== false ) { |
|
1143 | + if ( $dash_position !== false ) { |
|
1144 | 1144 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/helper/ping.json'; |
1145 | 1145 | } else { |
1146 | 1146 | update_option( 'yikes-mc-api-invalid-key-response', __( 'Your API key appears to be invalid.', 'yikes-inc-easy-mailchimp-extender' ) ); |
1147 | - update_option( 'yikes-mc-api-validation' , 'invalid_api_key' ); |
|
1147 | + update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
|
1148 | 1148 | return $api_key; |
1149 | 1149 | } |
1150 | 1150 | $request_args = array( |
@@ -1155,17 +1155,17 @@ discard block |
||
1155 | 1155 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ), |
1156 | 1156 | ); |
1157 | 1157 | $api_key_response = wp_remote_post( $api_endpoint, $request_args ); |
1158 | - if( ! is_wp_error( $api_key_response ) ) { |
|
1158 | + if ( ! is_wp_error( $api_key_response ) ) { |
|
1159 | 1159 | $body = json_decode( wp_remote_retrieve_body( $api_key_response ), true ); |
1160 | - if( isset( $body['msg'] ) && $body['msg'] == "Everything's Chimpy!" ) { |
|
1161 | - update_option( 'yikes-mc-api-validation' , 'valid_api_key' ); |
|
1160 | + if ( isset( $body[ 'msg' ] ) && $body[ 'msg' ] == "Everything's Chimpy!" ) { |
|
1161 | + update_option( 'yikes-mc-api-validation', 'valid_api_key' ); |
|
1162 | 1162 | } |
1163 | - } else { |
|
1163 | + } else { |
|
1164 | 1164 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
1165 | 1165 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
1166 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $api_key_response->get_error_message() , __( "Connecting to MailChimp" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Settings Page/General Settings" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1167 | - update_option( 'yikes-mc-api-invalid-key-response' , $api_key_response->get_error_message() ); |
|
1168 | - update_option( 'yikes-mc-api-validation' , 'invalid_api_key' ); |
|
1166 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $api_key_response->get_error_message(), __( "Connecting to MailChimp", 'yikes-inc-easy-mailchimp-extender' ), __( "Settings Page/General Settings", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1167 | + update_option( 'yikes-mc-api-invalid-key-response', $api_key_response->get_error_message() ); |
|
1168 | + update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
|
1169 | 1169 | } |
1170 | 1170 | // returned the api key |
1171 | 1171 | return $api_key; |
@@ -1186,13 +1186,13 @@ discard block |
||
1186 | 1186 | * to form fields. (input, dropdowns, buttons etc.) |
1187 | 1187 | * @since v5.5 re-write |
1188 | 1188 | **/ |
1189 | - public function is_user_mc_api_valid_form( $echo=true ) { |
|
1190 | - if( $echo == true ) { |
|
1191 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1189 | + public function is_user_mc_api_valid_form( $echo = true ) { |
|
1190 | + if ( $echo == true ) { |
|
1191 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1192 | 1192 | echo 'disabled="disabled"'; |
1193 | 1193 | } |
1194 | 1194 | } else { |
1195 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1195 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1196 | 1196 | return false; |
1197 | 1197 | } else { |
1198 | 1198 | return true; |
@@ -1212,11 +1212,11 @@ discard block |
||
1212 | 1212 | public function check_for_old_yks_mc_options() { |
1213 | 1213 | $old_plugin_options = get_option( 'ykseme_storage' ); |
1214 | 1214 | // only perform options migrations if the site is not a multi-site setup |
1215 | - if ( !is_multisite() ) { |
|
1216 | - if( apply_filters( 'yikes_mc_old_options_filter' , $old_plugin_options ) ) { |
|
1215 | + if ( ! is_multisite() ) { |
|
1216 | + if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) { |
|
1217 | 1217 | // display a notice to the user that they should 'migrate' |
1218 | 1218 | // from the old plugin settings to the new ones |
1219 | - add_action( 'admin_notices', array( $this , 'display_options_migrate_notice' ) , 11 ); |
|
1219 | + add_action( 'admin_notices', array( $this, 'display_options_migrate_notice' ), 11 ); |
|
1220 | 1220 | } |
1221 | 1221 | } |
1222 | 1222 | } |
@@ -1249,11 +1249,11 @@ discard block |
||
1249 | 1249 | |
1250 | 1250 | // Confirm that the necessary forms table in the database exists, else bail |
1251 | 1251 | global $wpdb; |
1252 | - if( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) { |
|
1252 | + if ( $wpdb->get_var( "show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'" ) != $wpdb->prefix . "yikes_easy_mc_forms" ) { |
|
1253 | 1253 | return; |
1254 | 1254 | } |
1255 | 1255 | |
1256 | - if( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) { |
|
1256 | + if ( isset( $_GET[ 'yikes-mc-options-migration-dismissed' ] ) && $_GET[ 'yikes-mc-options-migration-dismissed' ] == 'true' ) { |
|
1257 | 1257 | // Delete the options, start a-new! (this will disable the migration notice altogether) |
1258 | 1258 | delete_option( 'widget_yikes_mc_widget' ); |
1259 | 1259 | delete_option( 'api_validation' ); |
@@ -1267,18 +1267,18 @@ discard block |
||
1267 | 1267 | } else { |
1268 | 1268 | ?> |
1269 | 1269 | <div class="yikes-easy-mc-updated migrate-options-notice"> |
1270 | - <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>YIKES Inc. Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list." , 'yikes-inc-easy-mailchimp-extender' ), '<strong>YIKES Inc. Easy Forms for MailChimp</strong>' ); ?></p> |
|
1270 | + <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>YIKES Inc. Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>YIKES Inc. Easy Forms for MailChimp</strong>' ); ?></p> |
|
1271 | 1271 | <p><?php _e( "Before you continue, it's strongly recommended you the perform the migration to ensure the plugin continues to function properly.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
1272 | 1272 | <p><em><?php _e( "It's also strongly recommended that you take a backup of your database.", 'yikes-inc-easy-mailchimp-extender' ); ?></em></p> |
1273 | 1273 | <section id="migration-buttons"> |
1274 | 1274 | <!-- migrate button --> |
1275 | 1275 | <form> |
1276 | 1276 | <input type="hidden" name="yikes-mc-update-option-structure" value="yikes-mc-update-option-structure" /> |
1277 | - <a href="<?php echo wp_nonce_url( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-update' ) ), 'yikes-mc-migrate-options' , 'migrate_options_nonce' ); ?>" class="button-secondary"><?php _e( 'Perform Migration' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1277 | + <a href="<?php echo wp_nonce_url( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-update' ) ), 'yikes-mc-migrate-options', 'migrate_options_nonce' ); ?>" class="button-secondary"><?php _e( 'Perform Migration', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1278 | 1278 | </form> |
1279 | 1279 | <!-- dismiss button --> |
1280 | 1280 | <form> |
1281 | - <a href="<?php echo wp_nonce_url( esc_url_raw( admin_url() ), 'yikes-mc-dismiss-migration' , 'dismiss_migration_nonce' ); ?>" class="button-secondary"><?php _e( 'Dismiss Notice' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1281 | + <a href="<?php echo wp_nonce_url( esc_url_raw( admin_url() ), 'yikes-mc-dismiss-migration', 'dismiss_migration_nonce' ); ?>" class="button-secondary"><?php _e( 'Dismiss Notice', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1282 | 1282 | </form> |
1283 | 1283 | </section> |
1284 | 1284 | |
@@ -1292,9 +1292,9 @@ discard block |
||
1292 | 1292 | * and return the index ( used to find the list name assigned to a form ) |
1293 | 1293 | * - http://stackoverflow.com/questions/6661530/php-multi-dimensional-array-search |
1294 | 1294 | */ |
1295 | - function findMCListID($id, $array) { |
|
1296 | - foreach ($array as $key => $val) { |
|
1297 | - if ($val['id'] === $id) { |
|
1295 | + function findMCListID( $id, $array ) { |
|
1296 | + foreach ( $array as $key => $val ) { |
|
1297 | + if ( $val[ 'id' ] === $id ) { |
|
1298 | 1298 | return $key; |
1299 | 1299 | } |
1300 | 1300 | } |
@@ -1304,9 +1304,9 @@ discard block |
||
1304 | 1304 | /* Ajax Migrate Options */ |
1305 | 1305 | function migrate_archived_options() { |
1306 | 1306 | // all options prefixed with 'yikes-mc-' |
1307 | - $option_name = 'yikes-mc-'.$_POST['option_name']; |
|
1308 | - $option_value = $_POST['option_value']; |
|
1309 | - if( json_decode( $option_value ) ) { |
|
1307 | + $option_name = 'yikes-mc-' . $_POST[ 'option_name' ]; |
|
1308 | + $option_value = $_POST[ 'option_value' ]; |
|
1309 | + if ( json_decode( $option_value ) ) { |
|
1310 | 1310 | // decode our lists() array, and store it |
1311 | 1311 | $opt_value = json_decode( $option_value, true ); |
1312 | 1312 | } else { |
@@ -1319,24 +1319,24 @@ discard block |
||
1319 | 1319 | |
1320 | 1320 | /* Ajax Migrate Forms */ |
1321 | 1321 | function migrate_previously_setup_forms() { |
1322 | - $option_name = $_POST['option_name']; |
|
1323 | - $done = $_POST['done_import']; |
|
1322 | + $option_name = $_POST[ 'option_name' ]; |
|
1323 | + $done = $_POST[ 'done_import' ]; |
|
1324 | 1324 | // Create some starter forms for the user |
1325 | 1325 | // based on previously imported lists (to our old version) |
1326 | - if( $option_name == 'yikes-mc-lists' ) { |
|
1326 | + if ( $option_name == 'yikes-mc-lists' ) { |
|
1327 | 1327 | global $wpdb; |
1328 | - $option_value = $_POST['option_value']; |
|
1329 | - $new_options = json_decode( stripslashes_deep( $option_value ) , true ); |
|
1328 | + $option_value = $_POST[ 'option_value' ]; |
|
1329 | + $new_options = json_decode( stripslashes_deep( $option_value ), true ); |
|
1330 | 1330 | |
1331 | - $list_id = $new_options['id']; |
|
1332 | - $form_name = $new_options['name']; |
|
1333 | - $fields = $new_options['fields']; // our fields array |
|
1331 | + $list_id = $new_options[ 'id' ]; |
|
1332 | + $form_name = $new_options[ 'name' ]; |
|
1333 | + $fields = $new_options[ 'fields' ]; // our fields array |
|
1334 | 1334 | |
1335 | - $custom_styles = isset( $new_options['custom_styles'] ) ? json_encode( $new_options['custom_styles'] ) : '0'; // store as an array with all of our styles |
|
1336 | - $custom_template = isset( $new_options['custom_template'] ) ? json_encode( $new_options['custom_template'] ) : '0'; // store template data as an array ( active , template used ) |
|
1337 | - $send_welcome_email = isset( $new_options['yks_mailchimp_send_welcome_'.$list_id] ) ? '0' : '1'; |
|
1338 | - $redirect_user_on_submit = isset( $new_options['yks_mailchimp_redirect_'.$list_id] ) ? '1' : '0'; |
|
1339 | - $redirect_page = isset( $new_options['page_id_'.$list_id] ) ? $new_options['page_id_'.$list_id] : ''; |
|
1335 | + $custom_styles = isset( $new_options[ 'custom_styles' ] ) ? json_encode( $new_options[ 'custom_styles' ] ) : '0'; // store as an array with all of our styles |
|
1336 | + $custom_template = isset( $new_options[ 'custom_template' ] ) ? json_encode( $new_options[ 'custom_template' ] ) : '0'; // store template data as an array ( active , template used ) |
|
1337 | + $send_welcome_email = isset( $new_options[ 'yks_mailchimp_send_welcome_' . $list_id ] ) ? '0' : '1'; |
|
1338 | + $redirect_user_on_submit = isset( $new_options[ 'yks_mailchimp_redirect_' . $list_id ] ) ? '1' : '0'; |
|
1339 | + $redirect_page = isset( $new_options[ 'page_id_' . $list_id ] ) ? $new_options[ 'page_id_' . $list_id ] : ''; |
|
1340 | 1340 | |
1341 | 1341 | /* Insert Forms Function */ |
1342 | 1342 | $wpdb->insert( |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | ) |
1362 | 1362 | ); |
1363 | 1363 | } |
1364 | - if( $done == 'done' ) { |
|
1364 | + if ( $done == 'done' ) { |
|
1365 | 1365 | wp_send_json( array( 'form_name' => $form_name, 'completed_import' => true ) ); |
1366 | 1366 | } else { |
1367 | 1367 | wp_send_json( array( 'form_name' => $form_name, 'completed_import' => false ) ); |
@@ -1376,35 +1376,35 @@ discard block |
||
1376 | 1376 | * @since v5.6 - complete re-write |
1377 | 1377 | */ |
1378 | 1378 | public function generate_options_pages_sidebar_menu() { |
1379 | - if( isset( $_REQUEST['section'] ) ) { |
|
1380 | - $selected = $_REQUEST['section']; |
|
1379 | + if ( isset( $_REQUEST[ 'section' ] ) ) { |
|
1380 | + $selected = $_REQUEST[ 'section' ]; |
|
1381 | 1381 | } |
1382 | - $installed_addons = get_option( 'yikes-easy-mc-active-addons' , array() ); |
|
1382 | + $installed_addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
|
1383 | 1383 | // sort our addons array alphabetically so they appear in similar orders across all sites |
1384 | 1384 | asort( $installed_addons ); |
1385 | 1385 | ?> |
1386 | - <h3><span><?php _e( 'Additional Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
1386 | + <h3><span><?php _e( 'Additional Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
1387 | 1387 | <div class="inside"> |
1388 | 1388 | <ul id="settings-nav"> |
1389 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'general-settings' || !isset( $_REQUEST['section'] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1390 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1391 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1392 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1393 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1394 | - <li><?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1389 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'general-settings' || ! isset( $_REQUEST[ 'section' ] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1390 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1391 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1392 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1393 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1394 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li> |
|
1395 | 1395 | </ul> |
1396 | 1396 | <?php |
1397 | 1397 | // create our add-on settings pages |
1398 | - if( !empty( $installed_addons ) ) { |
|
1398 | + if ( ! empty( $installed_addons ) ) { |
|
1399 | 1399 | ?> |
1400 | 1400 | <hr class="add-on-settings-divider" /> |
1401 | - <strong><?php _e( 'Addon Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1401 | + <strong><?php _e( 'Addon Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1402 | 1402 | <ul id="addon-settings-nav"> |
1403 | 1403 | <?php |
1404 | - foreach( $installed_addons as $addon_name ) { |
|
1404 | + foreach ( $installed_addons as $addon_name ) { |
|
1405 | 1405 | ?> |
1406 | 1406 | <li> |
1407 | - <?php if( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion='.$addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-' , ' ' , $addon_name ) ); ?></a></li> |
|
1407 | + <?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=' . $addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li> |
|
1408 | 1408 | <?php |
1409 | 1409 | } |
1410 | 1410 | ?> |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | ) |
1433 | 1433 | ); |
1434 | 1434 | ?> |
1435 | - <h3><?php _e( 'Create a New Signup Form' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1435 | + <h3><?php _e( 'Create a New Signup Form', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1436 | 1436 | |
1437 | 1437 | <div class="inside"> |
1438 | 1438 | |
@@ -1441,31 +1441,31 @@ discard block |
||
1441 | 1441 | <form id="import-list-to-site" method="POST" action="<?php echo $url; ?>"> |
1442 | 1442 | <input type="hidden" name="import-list-to-site" value="1" /> |
1443 | 1443 | <!-- Name your new form --> |
1444 | - <label for="form-name"><strong><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1445 | - <input type="text" class="widefat input-field" placeholder="<?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?>" name="form-name" id="form-name" <?php $this->is_user_mc_api_valid_form( true ); ?> required> |
|
1444 | + <label for="form-name"><strong><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1445 | + <input type="text" class="widefat input-field" placeholder="<?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?>" name="form-name" id="form-name" <?php $this->is_user_mc_api_valid_form( true ); ?> required> |
|
1446 | 1446 | </label> |
1447 | 1447 | <!-- Name your new form --> |
1448 | - <label for="form-description"><strong><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1449 | - <textarea class="widefat input-field form-description" placeholder="<?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?>" name="form-description" id="form-description" <?php $this->is_user_mc_api_valid_form( true ); ?>></textarea> |
|
1448 | + <label for="form-description"><strong><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1449 | + <textarea class="widefat input-field form-description" placeholder="<?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?>" name="form-description" id="form-description" <?php $this->is_user_mc_api_valid_form( true ); ?>></textarea> |
|
1450 | 1450 | </label> |
1451 | 1451 | <!-- Associate this form with a list! --> |
1452 | - <label for="associated-list"><strong><?php _e( 'Associated List' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1453 | - <select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); if( isset( $lists ) && empty( $lists ) ) { echo 'disabled="disabled"'; } ?>> |
|
1452 | + <label for="associated-list"><strong><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
1453 | + <select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); if ( isset( $lists ) && empty( $lists ) ) { echo 'disabled="disabled"'; } ?>> |
|
1454 | 1454 | <?php |
1455 | - if( isset( $lists ) && !empty( $lists ) ) { |
|
1456 | - foreach( $lists as $mailing_list ) { |
|
1455 | + if ( isset( $lists ) && ! empty( $lists ) ) { |
|
1456 | + foreach ( $lists as $mailing_list ) { |
|
1457 | 1457 | ?> |
1458 | - <option value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option> |
|
1458 | + <option value="<?php echo $mailing_list[ 'id' ]; ?>"><?php echo stripslashes( $mailing_list[ 'name' ] ) . ' (' . $mailing_list[ 'stats' ][ 'member_count' ] . ') '; ?></option> |
|
1459 | 1459 | <?php |
1460 | 1460 | } |
1461 | 1461 | } else { |
1462 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1462 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
1463 | 1463 | ?> |
1464 | - <option><?php echo __( "Please enter a valid API key." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
1464 | + <option><?php echo __( "Please enter a valid API key.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
1465 | 1465 | <?php |
1466 | 1466 | } else { |
1467 | 1467 | ?> |
1468 | - <option><?php echo __( "No lists were found on the account." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
1468 | + <option><?php echo __( "No lists were found on the account.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
1469 | 1469 | <?php |
1470 | 1470 | |
1471 | 1471 | } |
@@ -1474,8 +1474,8 @@ discard block |
||
1474 | 1474 | </select> |
1475 | 1475 | |
1476 | 1476 | <?php |
1477 | - if ( isset( $_GET['transient-cleared'] ) ) { |
|
1478 | - if ( 'true' === $_GET['transient-cleared'] ) { |
|
1477 | + if ( isset( $_GET[ 'transient-cleared' ] ) ) { |
|
1478 | + if ( 'true' === $_GET[ 'transient-cleared' ] ) { |
|
1479 | 1479 | ?> |
1480 | 1480 | <div class="yikes-list-refreshed-notice"> |
1481 | 1481 | <p><?php esc_attr_e( 'MailChimp list data has been succesfully refreshed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -1484,11 +1484,11 @@ discard block |
||
1484 | 1484 | } |
1485 | 1485 | } |
1486 | 1486 | |
1487 | - if( isset( $lists ) && empty( $lists ) ) { |
|
1488 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'invalid_api_key' ) { |
|
1487 | + if ( isset( $lists ) && empty( $lists ) ) { |
|
1488 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) { |
|
1489 | 1489 | ?> |
1490 | 1490 | <p class="description"> |
1491 | - <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ) , __( 'Create a list' , 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
1491 | + <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ), __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
1492 | 1492 | </p> |
1493 | 1493 | <?php |
1494 | 1494 | } |
@@ -1496,12 +1496,12 @@ discard block |
||
1496 | 1496 | ?> |
1497 | 1497 | </label> |
1498 | 1498 | <?php |
1499 | - if( $this->is_user_mc_api_valid_form( false ) ) { |
|
1500 | - echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ) , 'primary' , '' , false , array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
1499 | + if ( $this->is_user_mc_api_valid_form( false ) ) { |
|
1500 | + echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ), 'primary', '', false, array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
1501 | 1501 | } else { |
1502 | - echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
1502 | + echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
1503 | 1503 | ?> |
1504 | - <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1504 | + <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1505 | 1505 | <?php |
1506 | 1506 | } |
1507 | 1507 | ?> |
@@ -1509,10 +1509,10 @@ discard block |
||
1509 | 1509 | |
1510 | 1510 | <!-- Clear API CACHE --> |
1511 | 1511 | <?php |
1512 | - if( isset( $lists ) && ! empty( $lists ) ) { |
|
1512 | + if ( isset( $lists ) && ! empty( $lists ) ) { |
|
1513 | 1513 | if ( false !== get_transient( 'yikes-easy-mailchimp-list-data' ) ) { ?> |
1514 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data' , 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" method="post"> |
|
1515 | - <input type="submit" class="button-secondary clear-mailchimp-api-cache" value="<?php _e( 'Refresh Lists' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /> |
|
1514 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data', 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" method="post"> |
|
1515 | + <input type="submit" class="button-secondary clear-mailchimp-api-cache" value="<?php _e( 'Refresh Lists', 'yikes-inc-easy-mailchimp-extender' ); ?>" /> |
|
1516 | 1516 | </form> |
1517 | 1517 | <?php } |
1518 | 1518 | } |
@@ -1528,14 +1528,14 @@ discard block |
||
1528 | 1528 | public function generate_page_redirect_dropdown( $redirect, $redirect_page, $custom_redirect_url ) { |
1529 | 1529 | $post_types = get_post_types(); |
1530 | 1530 | ?> |
1531 | - <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>"> |
|
1532 | - <?php _e( "Select A Page or Post" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1531 | + <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if ( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>"> |
|
1532 | + <?php _e( "Select A Page or Post", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1533 | 1533 | <select id="redirect-user-to-selection" name="redirect-user-to-selection" onchange="shouldWeDisplayCustomURL( this );return;"> |
1534 | 1534 | <?php |
1535 | 1535 | // loop over registered post types, and query! |
1536 | - foreach( $post_types as $registered_post_type ) { |
|
1536 | + foreach ( $post_types as $registered_post_type ) { |
|
1537 | 1537 | // exclude a few built in custom post types |
1538 | - if( ! in_array( $registered_post_type , array( 'attachment' , 'revision' , 'nav_menu_item' ) ) ) { |
|
1538 | + if ( ! in_array( $registered_post_type, array( 'attachment', 'revision', 'nav_menu_item' ) ) ) { |
|
1539 | 1539 | // run our query, to retreive the posts |
1540 | 1540 | $pages = get_posts( array( |
1541 | 1541 | 'order' => 'ASC', |
@@ -1545,12 +1545,12 @@ discard block |
||
1545 | 1545 | 'numberposts' => -1 |
1546 | 1546 | ) ); |
1547 | 1547 | // only show cpt's that have posts assigned |
1548 | - if( !empty( $pages ) ) { |
|
1548 | + if ( ! empty( $pages ) ) { |
|
1549 | 1549 | ?> |
1550 | - <optgroup label="<?php echo ucwords( str_replace( '_' , ' ' , $registered_post_type ) ); ?>"> |
|
1550 | + <optgroup label="<?php echo ucwords( str_replace( '_', ' ', $registered_post_type ) ); ?>"> |
|
1551 | 1551 | <?php |
1552 | - foreach( $pages as $page ) { |
|
1553 | - ?><option <?php selected( $redirect_page , $page->ID ); ?> value="<?php echo $page->ID; ?>"><?php echo $page->post_title; ?></option><?php |
|
1552 | + foreach ( $pages as $page ) { |
|
1553 | + ?><option <?php selected( $redirect_page, $page->ID ); ?> value="<?php echo $page->ID; ?>"><?php echo $page->post_title; ?></option><?php |
|
1554 | 1554 | } |
1555 | 1555 | ?> |
1556 | 1556 | <option <?php selected( $redirect_page, 'custom_url' ); ?> value="custom_url"><?php echo __( 'Custom URL', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
@@ -1562,8 +1562,8 @@ discard block |
||
1562 | 1562 | ?> |
1563 | 1563 | </select> |
1564 | 1564 | |
1565 | - <label name="custom-redirect-url" class="custom_redirect_url_label" <?php if( ! isset( $redirect_page ) || $redirect_page != 'custom_url' ) { echo 'style="display:none;"'; } ?>> |
|
1566 | - <?php _e( "Enter Custom URL" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1565 | + <label name="custom-redirect-url" class="custom_redirect_url_label" <?php if ( ! isset( $redirect_page ) || $redirect_page != 'custom_url' ) { echo 'style="display:none;"'; } ?>> |
|
1566 | + <?php _e( "Enter Custom URL", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1567 | 1567 | <input type="text" class="widefat custom-redirect-url" name="custom-redirect-url" value="<?php echo $custom_redirect_url; ?>" /> |
1568 | 1568 | </label> |
1569 | 1569 | |
@@ -1580,11 +1580,11 @@ discard block |
||
1580 | 1580 | public function generate_show_some_love_container() { |
1581 | 1581 | // if no active add-ons are installed, |
1582 | 1582 | // lets display our branding and add-on sidebar |
1583 | - if( get_option( 'yikes-easy-mc-active-addons' , array() ) == array() ) { |
|
1583 | + if ( get_option( 'yikes-easy-mc-active-addons', array() ) == array() ) { |
|
1584 | 1584 | |
1585 | 1585 | /* On Edit Forms Page Display Upsell to Customizer */ |
1586 | 1586 | $screen = get_current_screen(); |
1587 | - if( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) { |
|
1587 | + if ( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) { |
|
1588 | 1588 | ?> |
1589 | 1589 | |
1590 | 1590 | <div class="postbox yikes-easy-mc-postbox show-some-love-container"> |
@@ -1598,11 +1598,11 @@ discard block |
||
1598 | 1598 | <div class="postbox yikes-easy-mc-postbox show-some-love-container"> |
1599 | 1599 | |
1600 | 1600 | <!-- review us container --> |
1601 | - <h3 data-alt-text="<?php _e( 'About YIKES Inc.', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Show YIKES Inc. Some Love' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1601 | + <h3 data-alt-text="<?php _e( 'About YIKES Inc.', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Show YIKES Inc. Some Love', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1602 | 1602 | <div id="review-yikes-easy-mc" class="inside"> |
1603 | 1603 | |
1604 | 1604 | <p> |
1605 | - <?php _e( 'Leave a review' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1605 | + <?php _e( 'Leave a review', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1606 | 1606 | <p class="star-container"> |
1607 | 1607 | <a href="https://wordpress.org/support/view/plugin-reviews/yikes-inc-easy-mailchimp-extender" target="_blank"> |
1608 | 1608 | <b class="dashicons dashicons-star-filled"></b> |
@@ -1614,21 +1614,21 @@ discard block |
||
1614 | 1614 | </p> |
1615 | 1615 | </p> |
1616 | 1616 | |
1617 | - <?php _e( 'Tweet about it' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1617 | + <?php _e( 'Tweet about it', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1618 | 1618 | <p class="sidebar-container"> |
1619 | 1619 | <a href="https://twitter.com/share" class="twitter-share-button" data-url="https://wordpress.org/plugins/yikes-inc-easy-mailchimp-extender/" data-text="I'm using the Easy Forms for MailChimp plugin by @YikesInc to grow my mailing list - it's awesome! -" data-hashtags="MailChimp">Tweet</a> |
1620 | 1620 | <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> |
1621 | 1621 | </p> |
1622 | 1622 | |
1623 | - <?php _e( 'Vote that the plugin works' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1623 | + <?php _e( 'Vote that the plugin works', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1624 | 1624 | <p class="sidebar-container"> |
1625 | 1625 | <a href="https://wordpress.org/plugins/yikes-inc-easy-mailchimp-extender/" target="_blank"> |
1626 | - <?php _e( 'Vote for Compatibility' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1626 | + <?php _e( 'Vote for Compatibility', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1627 | 1627 | </a> |
1628 | 1628 | </p> |
1629 | 1629 | </div> |
1630 | 1630 | |
1631 | - <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s" , 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
1631 | + <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s", 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
1632 | 1632 | |
1633 | 1633 | <section id="about-yikes-inc" class="inside"> |
1634 | 1634 | <a href="https://www.yikesinc.com" target="_blank" title="YIKES Inc."> |
@@ -1644,10 +1644,10 @@ discard block |
||
1644 | 1644 | <div class="postbox yikes-easy-mc-postbox"> |
1645 | 1645 | |
1646 | 1646 | <!-- review us container --> |
1647 | - <h3><?php _e( 'Easy Forms for MailChimp Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1647 | + <h3><?php _e( 'Easy Forms for MailChimp Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
1648 | 1648 | <div id="review-yikes-easy-mc" class="inside"> |
1649 | - <p><?php _e( "Check out available add-ons for some seriously enhanced features." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
1650 | - <p><a class="button-secondary" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); ?>" title="<?php _e( 'View Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'View Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
1649 | + <p><?php _e( "Check out available add-ons for some seriously enhanced features.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
1650 | + <p><a class="button-secondary" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); ?>" title="<?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
1651 | 1651 | </div> |
1652 | 1652 | |
1653 | 1653 | </div> |
@@ -1672,76 +1672,76 @@ discard block |
||
1672 | 1672 | public function generate_form_editor( $form_fields, $list_id, $merge_variables, $interest_groups ) { |
1673 | 1673 | |
1674 | 1674 | // if no list id, die! |
1675 | - if( ! $list_id ) { |
|
1676 | - die( __( "We've encountered an error. No list ID was sent." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1675 | + if ( ! $list_id ) { |
|
1676 | + die( __( "We've encountered an error. No list ID was sent.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1677 | 1677 | } |
1678 | 1678 | |
1679 | - if( ! $merge_variables ) { |
|
1680 | - die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1679 | + if ( ! $merge_variables ) { |
|
1680 | + die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
1681 | 1681 | } |
1682 | 1682 | |
1683 | - if( ! empty( $form_fields ) ) { |
|
1683 | + if ( ! empty( $form_fields ) ) { |
|
1684 | 1684 | |
1685 | 1685 | // find any fields that are assigned to this form, that don't exist in MailChimp |
1686 | 1686 | // or else were going to run into issues when we submit the form |
1687 | 1687 | $available_merge_variables = array(); |
1688 | 1688 | $available_interest_groups = array(); |
1689 | 1689 | |
1690 | - $assigned_fields= array(); |
|
1690 | + $assigned_fields = array(); |
|
1691 | 1691 | |
1692 | 1692 | // loop over merge variables |
1693 | - if( ! empty( $merge_variables['data'][0]['merge_vars'] ) ) { |
|
1694 | - foreach( $merge_variables['data'][0]['merge_vars'] as $merge_tag ) { |
|
1695 | - $available_merge_variables[] = $merge_tag['tag']; |
|
1693 | + if ( ! empty( $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ] ) ) { |
|
1694 | + foreach ( $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ] as $merge_tag ) { |
|
1695 | + $available_merge_variables[ ] = $merge_tag[ 'tag' ]; |
|
1696 | 1696 | } |
1697 | 1697 | } |
1698 | 1698 | |
1699 | 1699 | // loop over interest groups |
1700 | - if( ! empty( $interest_groups ) && ! isset( $interest_groups['error'] ) ) { |
|
1701 | - foreach( $interest_groups as $interest_group ) { |
|
1702 | - $available_interest_groups[] = $interest_group['id']; |
|
1700 | + if ( ! empty( $interest_groups ) && ! isset( $interest_groups[ 'error' ] ) ) { |
|
1701 | + foreach ( $interest_groups as $interest_group ) { |
|
1702 | + $available_interest_groups[ ] = $interest_group[ 'id' ]; |
|
1703 | 1703 | } |
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | // build our assigned fields |
1707 | - foreach( $form_fields as $field => $value ) { |
|
1708 | - $assigned_fields[] = $field; |
|
1707 | + foreach ( $form_fields as $field => $value ) { |
|
1708 | + $assigned_fields[ ] = $field; |
|
1709 | 1709 | } |
1710 | 1710 | |
1711 | - $merged_fields = array_merge( $available_merge_variables , $available_interest_groups ); |
|
1712 | - $excluded_fields = array_diff( $assigned_fields , $merged_fields ); |
|
1711 | + $merged_fields = array_merge( $available_merge_variables, $available_interest_groups ); |
|
1712 | + $excluded_fields = array_diff( $assigned_fields, $merged_fields ); |
|
1713 | 1713 | |
1714 | 1714 | $i = 1; |
1715 | - foreach( $form_fields as $field ) { |
|
1715 | + foreach ( $form_fields as $field ) { |
|
1716 | 1716 | |
1717 | - if( isset( $field['merge'] ) ) { |
|
1717 | + if ( isset( $field[ 'merge' ] ) ) { |
|
1718 | 1718 | ?> |
1719 | - <section class="draggable" id="<?php echo $field['merge']; ?>"> |
|
1719 | + <section class="draggable" id="<?php echo $field[ 'merge' ]; ?>"> |
|
1720 | 1720 | <!-- top --> |
1721 | 1721 | <a href="#" class="expansion-section-title settings-sidebar"> |
1722 | - <span class="dashicons dashicons-plus"></span><?php echo stripslashes( $field['label'] ); ?> |
|
1723 | - <?php if( in_array( $field['merge'] , $excluded_fields ) ) { ?> |
|
1724 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-doesnt-exist-notice" title="<?php _e( 'Field no longer exists.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
1722 | + <span class="dashicons dashicons-plus"></span><?php echo stripslashes( $field[ 'label' ] ); ?> |
|
1723 | + <?php if ( in_array( $field[ 'merge' ], $excluded_fields ) ) { ?> |
|
1724 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-doesnt-exist-notice" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
1725 | 1725 | <?php } ?> |
1726 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
1726 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
1727 | 1727 | </a> |
1728 | 1728 | <!-- expansion section --> |
1729 | 1729 | <div class="yikes-mc-settings-expansion-section"> |
1730 | 1730 | |
1731 | - <?php if( in_array( $field['merge'] , $excluded_fields ) ) { ?> |
|
1732 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
1731 | + <?php if ( in_array( $field[ 'merge' ], $excluded_fields ) ) { ?> |
|
1732 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
1733 | 1733 | <?php } ?> |
1734 | 1734 | |
1735 | 1735 | <!-- store the label --> |
1736 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][label]" value="<?php echo $field['label']; ?>" /> |
|
1737 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
1738 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][merge]" value="<?php echo $field['merge']; ?>" /> |
|
1739 | - <input type="hidden" class="field-<?php echo $field['merge']; ?>-position position-input" name="field[<?php echo $field['merge']; ?>][position]" value="<?php echo $i++; ?>" /> |
|
1736 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][label]" value="<?php echo $field[ 'label' ]; ?>" /> |
|
1737 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
1738 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][merge]" value="<?php echo $field[ 'merge' ]; ?>" /> |
|
1739 | + <input type="hidden" class="field-<?php echo $field[ 'merge' ]; ?>-position position-input" name="field[<?php echo $field[ 'merge' ]; ?>][position]" value="<?php echo $i++; ?>" /> |
|
1740 | 1740 | |
1741 | - <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) { |
|
1742 | - $choices = json_decode( $field['choices'], true ); |
|
1741 | + <?php if ( $field[ 'type' ] == 'radio' || $field[ 'type' ] == 'dropdown' || $field[ 'type' ] == 'select' ) { |
|
1742 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
1743 | 1743 | ?> |
1744 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
1744 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
1745 | 1745 | <?php } ?> |
1746 | 1746 | |
1747 | 1747 | <!-- Single or Double Opt-in --> |
@@ -1753,16 +1753,16 @@ discard block |
||
1753 | 1753 | <tr valign="top"> |
1754 | 1754 | <td scope="row"> |
1755 | 1755 | <label for="merge-tag"> |
1756 | - <?php _e( 'Merge Tag' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1756 | + <?php _e( 'Merge Tag', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1757 | 1757 | </label> |
1758 | 1758 | </td> |
1759 | 1759 | <td> |
1760 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field['merge']; ?>"> |
|
1760 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field[ 'merge' ]; ?>"> |
|
1761 | 1761 | </td> |
1762 | 1762 | </tr> |
1763 | 1763 | |
1764 | 1764 | <!-- Placeholder Value --> |
1765 | - <?php switch( $field['type'] ) { |
|
1765 | + <?php switch ( $field[ 'type' ] ) { |
|
1766 | 1766 | |
1767 | 1767 | case 'text': |
1768 | 1768 | case 'email': |
@@ -1777,12 +1777,12 @@ discard block |
||
1777 | 1777 | <tr valign="top"> |
1778 | 1778 | <td scope="row"> |
1779 | 1779 | <label for="placeholder"> |
1780 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1780 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1781 | 1781 | </label> |
1782 | 1782 | </td> |
1783 | 1783 | <td> |
1784 | - <input type="text" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="<?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : '' ; ?>" /> |
|
1785 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1784 | + <input type="text" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="<?php echo isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : ''; ?>" /> |
|
1785 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1786 | 1786 | </td> |
1787 | 1787 | </tr> |
1788 | 1788 | <?php |
@@ -1791,7 +1791,7 @@ discard block |
||
1791 | 1791 | ?> |
1792 | 1792 | |
1793 | 1793 | <!-- Default Value --> |
1794 | - <?php switch( $field['type'] ) { |
|
1794 | + <?php switch ( $field[ 'type' ] ) { |
|
1795 | 1795 | default: |
1796 | 1796 | case 'text': |
1797 | 1797 | case 'number': |
@@ -1800,17 +1800,17 @@ discard block |
||
1800 | 1800 | <tr valign="top"> |
1801 | 1801 | <td scope="row"> |
1802 | 1802 | <label for="placeholder"> |
1803 | - <?php _e( 'Default Value' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1803 | + <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1804 | 1804 | </label> |
1805 | 1805 | </td> |
1806 | 1806 | <td> |
1807 | - <input <?php if( $field['type'] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field['merge']; ?>][default]" <?php if( $field['type'] != 'url' ) { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( $field['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field['default'] ) ) ) : ''; ?>" <?php } ?> /> |
|
1808 | - <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1807 | + <input <?php if ( $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][default]" <?php if ( $field[ 'type' ] != 'url' ) { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'default' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field[ 'default' ] ) ) ) : ''; ?>" <?php } ?> /> |
|
1808 | + <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1809 | 1809 | <?php |
1810 | - switch( $field['type'] ) { |
|
1810 | + switch ( $field[ 'type' ] ) { |
|
1811 | 1811 | case 'text': |
1812 | 1812 | ?> |
1813 | - <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
1813 | + <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
1814 | 1814 | <?php |
1815 | 1815 | break; |
1816 | 1816 | } ?> |
@@ -1824,18 +1824,18 @@ discard block |
||
1824 | 1824 | <tr valign="top"> |
1825 | 1825 | <td scope="row"> |
1826 | 1826 | <label for="placeholder"> |
1827 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1827 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1828 | 1828 | </label> |
1829 | 1829 | </td> |
1830 | 1830 | <td> |
1831 | - <?php if( ! isset( $field['default_choice'] ) || empty( $field['default_choice'] ) ) { $decode = json_decode( $field['choices'], true ); $field['default_choice'] = $decode[0]; } |
|
1831 | + <?php if ( ! isset( $field[ 'default_choice' ] ) || empty( $field[ 'default_choice' ] ) ) { $decode = json_decode( $field[ 'choices' ], true ); $field[ 'default_choice' ] = $decode[ 0 ]; } |
|
1832 | 1832 | $x = 0; |
1833 | - foreach( json_decode( $field['choices'], true ) as $choice => $value ) { ?> |
|
1834 | - <label for="<?php echo $field['merge'].'-'.$x; ?>"> |
|
1835 | - <input id="<?php echo $field['merge'].'-'.$x; ?>" type="radio" name="field[<?php echo $field['merge']; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $field['default_choice'], $x ); ?>><?php echo $value; ?> |
|
1833 | + foreach ( json_decode( $field[ 'choices' ], true ) as $choice => $value ) { ?> |
|
1834 | + <label for="<?php echo $field[ 'merge' ] . '-' . $x; ?>"> |
|
1835 | + <input id="<?php echo $field[ 'merge' ] . '-' . $x; ?>" type="radio" name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $field[ 'default_choice' ], $x ); ?>><?php echo $value; ?> |
|
1836 | 1836 | </label> |
1837 | 1837 | <?php $x++; } ?> |
1838 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1838 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1839 | 1839 | </td> |
1840 | 1840 | </tr> |
1841 | 1841 | |
@@ -1847,16 +1847,16 @@ discard block |
||
1847 | 1847 | <tr valign="top"> |
1848 | 1848 | <td scope="row"> |
1849 | 1849 | <label for="placeholder"> |
1850 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1850 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1851 | 1851 | </label> |
1852 | 1852 | </td> |
1853 | 1853 | <td> |
1854 | - <select type="default" name="field[<?php echo $field['merge']; ?>][default_choice]"> |
|
1855 | - <?php foreach( json_decode( $field['choices'], true ) as $choice => $value ) { ?> |
|
1856 | - <option value="<?php echo $choice; ?>" <?php selected( $field['default_choice'] , $choice ); ?>><?php echo $value; ?></option> |
|
1854 | + <select type="default" name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]"> |
|
1855 | + <?php foreach ( json_decode( $field[ 'choices' ], true ) as $choice => $value ) { ?> |
|
1856 | + <option value="<?php echo $choice; ?>" <?php selected( $field[ 'default_choice' ], $choice ); ?>><?php echo $value; ?></option> |
|
1857 | 1857 | <?php } ?> |
1858 | 1858 | </select> |
1859 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1859 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1860 | 1860 | </td> |
1861 | 1861 | </tr> |
1862 | 1862 | |
@@ -1876,69 +1876,69 @@ discard block |
||
1876 | 1876 | <tr valign="top"> |
1877 | 1877 | <td scope="row"> |
1878 | 1878 | <label for="placeholder"> |
1879 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1879 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1880 | 1880 | </label> |
1881 | 1881 | </td> |
1882 | 1882 | <td> |
1883 | - <textarea class="widefat field-description-input" name="field[<?php echo $field['merge']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
1884 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1883 | + <textarea class="widefat field-description-input" name="field[<?php echo $field[ 'merge' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
1884 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1885 | 1885 | </td> |
1886 | 1886 | </tr> |
1887 | 1887 | <!-- Additional Classes --> |
1888 | 1888 | <tr valign="top"> |
1889 | 1889 | <td scope="row"> |
1890 | 1890 | <label for="placeholder"> |
1891 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1891 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1892 | 1892 | </label> |
1893 | 1893 | </td> |
1894 | 1894 | <td> |
1895 | - <input type="text" class="widefat" name="field[<?php echo $field['merge']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
1896 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
1895 | + <input type="text" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
1896 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
1897 | 1897 | </td> |
1898 | 1898 | </tr> |
1899 | 1899 | <!-- Required Toggle --> |
1900 | 1900 | <tr valign="top"> |
1901 | 1901 | <td scope="row"> |
1902 | 1902 | <label for="field-required"> |
1903 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1903 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1904 | 1904 | </label> |
1905 | 1905 | </td> |
1906 | 1906 | <td> |
1907 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
1908 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][require]" <?php checked( $checked , 1 ); ?> <?php if( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
1909 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1907 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
1908 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][require]" <?php checked( $checked, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
1909 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1910 | 1910 | </td> |
1911 | 1911 | </tr> |
1912 | 1912 | <!-- Visible Toggle --> |
1913 | 1913 | <tr valign="top"> |
1914 | 1914 | <td scope="row"> |
1915 | 1915 | <label for="hide-field"> |
1916 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1916 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1917 | 1917 | </label> |
1918 | 1918 | </td> |
1919 | 1919 | <td> |
1920 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
1921 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][hide]" <?php checked( $hide , 1 ); ?> <?php if( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
1922 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1920 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
1921 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][hide]" <?php checked( $hide, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
1922 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1923 | 1923 | </td> |
1924 | 1924 | </tr> |
1925 | 1925 | <!-- Toggle Field Label Visibility --> |
1926 | 1926 | <tr valign="top"> |
1927 | 1927 | <td scope="row"> |
1928 | 1928 | <label for="placeholder"> |
1929 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1929 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
1930 | 1930 | </label> |
1931 | 1931 | </td> |
1932 | 1932 | <td> |
1933 | - <?php $hide_label = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
1934 | - <input type="checkbox" name="field[<?php echo $field['merge']; ?>][hide-label]" value="1" <?php checked( $hide_label , 1 ); ?>/> |
|
1935 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
1933 | + <?php $hide_label = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
1934 | + <input type="checkbox" name="field[<?php echo $field[ 'merge' ]; ?>][hide-label]" value="1" <?php checked( $hide_label, 1 ); ?>/> |
|
1935 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
1936 | 1936 | </td> |
1937 | 1937 | </tr> |
1938 | 1938 | <!-- Display Phone/Date Formats back to the user --> |
1939 | 1939 | <!-- Phone Format Initial Load --> |
1940 | 1940 | <?php |
1941 | - switch( $field['type'] ) { |
|
1941 | + switch ( $field[ 'type' ] ) { |
|
1942 | 1942 | /* Store the phone format, for properly regex pattern */ |
1943 | 1943 | case 'phone': |
1944 | 1944 | case 'birthday': |
@@ -1948,23 +1948,23 @@ discard block |
||
1948 | 1948 | <td scope="row"> |
1949 | 1949 | <label for="placeholder"> |
1950 | 1950 | <?php |
1951 | - switch( $field['type'] ) { |
|
1951 | + switch ( $field[ 'type' ] ) { |
|
1952 | 1952 | default: |
1953 | 1953 | case 'birthday': |
1954 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
1955 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD'; |
|
1954 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
1955 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD'; |
|
1956 | 1956 | $format_name = 'date_format'; |
1957 | 1957 | break; |
1958 | 1958 | |
1959 | 1959 | case 'date': |
1960 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
1961 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD/YYYY'; |
|
1960 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
1961 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD/YYYY'; |
|
1962 | 1962 | $format_name = 'date_format'; |
1963 | 1963 | break; |
1964 | 1964 | |
1965 | 1965 | case 'phone': |
1966 | - $type = __( 'Phone Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
1967 | - $format = ( ( $field['phone_format'] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $field['phone_format'] . ' - (###) ### - ####' ); |
|
1966 | + $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
1967 | + $format = ( ( $field[ 'phone_format' ] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $field[ 'phone_format' ] . ' - (###) ### - ####' ); |
|
1968 | 1968 | $format_name = 'phone_format'; |
1969 | 1969 | break; |
1970 | 1970 | } |
@@ -1974,7 +1974,7 @@ discard block |
||
1974 | 1974 | </td> |
1975 | 1975 | <td> |
1976 | 1976 | <strong><?php echo $format; ?></strong> |
1977 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
1977 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
1978 | 1978 | <p class="description"><small> |
1979 | 1979 | <?php printf( __( 'To change the %s please head over to <a href="%s" title="MailChimp" target="_blank">MailChimp</a>. If you alter the format, you should re-import this field.', 'yikes-inc-easy-mailchimp-extender' ), strtolower( $type ), esc_url( 'http://www.mailchimp.com' ) ); ?> |
1980 | 1980 | </small></p> |
@@ -1995,8 +1995,8 @@ discard block |
||
1995 | 1995 | </td> |
1996 | 1996 | <td> |
1997 | 1997 | <span class="toggle-container"> |
1998 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
1999 | - <a href="#" class="remove-field" alt="<?php echo $field['merge']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
1998 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
1999 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'merge' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
2000 | 2000 | </span> |
2001 | 2001 | </td> |
2002 | 2002 | </tr> |
@@ -2012,35 +2012,35 @@ discard block |
||
2012 | 2012 | } else { // THIS IS AN INTEREST GROUP! |
2013 | 2013 | |
2014 | 2014 | ?> |
2015 | - <section class="draggable" id="<?php echo $field['group_id']; ?>"> |
|
2015 | + <section class="draggable" id="<?php echo $field[ 'group_id' ]; ?>"> |
|
2016 | 2016 | <!-- top --> |
2017 | 2017 | <a href="#" class="expansion-section-title settings-sidebar"> |
2018 | - <span class="dashicons dashicons-plus"></span><?php echo stripslashes( $field['label'] ); ?> |
|
2019 | - <?php if( in_array( $field['group_id'] , $excluded_fields ) ) { ?> |
|
2020 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-no-longer-exists-warning" title="<?php _e( 'Field no longer exists.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
2018 | + <span class="dashicons dashicons-plus"></span><?php echo stripslashes( $field[ 'label' ] ); ?> |
|
2019 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?> |
|
2020 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-no-longer-exists-warning" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
2021 | 2021 | <?php } ?> |
2022 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
2022 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
2023 | 2023 | </a> |
2024 | 2024 | <!-- expansion section --> |
2025 | 2025 | <div class="yikes-mc-settings-expansion-section"> |
2026 | 2026 | |
2027 | 2027 | <!-- check if this field exists in the available interest group array --> |
2028 | - <?php if( in_array( $field['group_id'] , $excluded_fields ) ) { ?> |
|
2029 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
2028 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?> |
|
2029 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
2030 | 2030 | <?php } ?> |
2031 | 2031 | |
2032 | 2032 | <!-- store the label --> |
2033 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][label]" value="<?php echo $field['label']; ?>" /> |
|
2034 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
2035 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][group_id]" value="<?php echo $field['group_id']; ?>" /> |
|
2036 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field['groups'], true ) ) ); ?>' /> |
|
2033 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][label]" value="<?php echo $field[ 'label' ]; ?>" /> |
|
2034 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
2035 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][group_id]" value="<?php echo $field[ 'group_id' ]; ?>" /> |
|
2036 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field[ 'groups' ], true ) ) ); ?>' /> |
|
2037 | 2037 | |
2038 | 2038 | <!-- Single or Double Opt-in --> |
2039 | 2039 | <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); --> |
2040 | 2040 | |
2041 | 2041 | <table class="form-table form-field-container"> |
2042 | 2042 | <!-- Default Value --> |
2043 | - <?php switch( $field['type'] ) { |
|
2043 | + <?php switch ( $field[ 'type' ] ) { |
|
2044 | 2044 | |
2045 | 2045 | default: |
2046 | 2046 | case 'radio': |
@@ -2049,26 +2049,26 @@ discard block |
||
2049 | 2049 | <tr valign="top"> |
2050 | 2050 | <td scope="row"> |
2051 | 2051 | <label for="placeholder"> |
2052 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2052 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2053 | 2053 | </label> |
2054 | 2054 | </td> |
2055 | 2055 | <td> |
2056 | 2056 | <?php |
2057 | - if( $field['type'] != 'checkboxes' ) { |
|
2058 | - if( !isset( $field['default_choice'] ) ) { $field['default_choice'] = json_decode( stripslashes( $field['groups'] ) , true ); } |
|
2057 | + if ( $field[ 'type' ] != 'checkboxes' ) { |
|
2058 | + if ( ! isset( $field[ 'default_choice' ] ) ) { $field[ 'default_choice' ] = json_decode( stripslashes( $field[ 'groups' ] ), true ); } |
|
2059 | 2059 | } else { |
2060 | - if( !isset( $field['default_choice'] ) ) { $field['default_choice'] = array(); } |
|
2060 | + if ( ! isset( $field[ 'default_choice' ] ) ) { $field[ 'default_choice' ] = array(); } |
|
2061 | 2061 | } |
2062 | 2062 | $i = 0; |
2063 | - foreach( json_decode( $field['groups'], true ) as $group ) { ?> |
|
2064 | - <label for="<?php echo $field['group_id'].'-'.$i; ?>"> |
|
2065 | - <input id="<?php echo $field['group_id'].'-'.$i; ?>" type="<?php if( $field['type'] == 'radio' || $field['type'] == 'hidden' ) { ?>radio<?php } else if( $field['type'] == 'checkboxes' ) { ?>checkbox<?php } ?>" name="field[<?php echo $field['group_id']; ?>][default_choice]<?php if( $field['type'] == 'checkboxes' ) {echo '[]';}?>" value="<?php echo $i; ?>" <?php if( $field['type'] == 'radio' || $field['type'] == 'hidden' ) { checked( $field['default_choice'][0] , $i ); } else if( $field['type'] == 'checkboxes' ) { if( in_array( $i , $field['default_choice'] ) ) { echo 'checked="checked"'; } }?>><?php echo stripslashes( str_replace( '' , '\'' , $group['name'] ) ); ?> |
|
2063 | + foreach ( json_decode( $field[ 'groups' ], true ) as $group ) { ?> |
|
2064 | + <label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>"> |
|
2065 | + <input id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" type="<?php if ( $field[ 'type' ] == 'radio' || $field[ 'type' ] == 'hidden' ) { ?>radio<?php } else if ( $field[ 'type' ] == 'checkboxes' ) { ?>checkbox<?php } ?>" name="field[<?php echo $field[ 'group_id' ]; ?>][default_choice]<?php if ( $field[ 'type' ] == 'checkboxes' ) {echo '[]'; }?>" value="<?php echo $i; ?>" <?php if ( $field[ 'type' ] == 'radio' || $field[ 'type' ] == 'hidden' ) { checked( $field[ 'default_choice' ][ 0 ], $i ); } else if ( $field[ 'type' ] == 'checkboxes' ) { if ( in_array( $i, $field[ 'default_choice' ] ) ) { echo 'checked="checked"'; } }?>><?php echo stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ); ?> |
|
2066 | 2066 | </label> |
2067 | 2067 | <?php |
2068 | 2068 | $i++; |
2069 | 2069 | } |
2070 | 2070 | ?> |
2071 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2071 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2072 | 2072 | </td> |
2073 | 2073 | </tr> |
2074 | 2074 | |
@@ -2080,16 +2080,16 @@ discard block |
||
2080 | 2080 | <tr valign="top"> |
2081 | 2081 | <td scope="row"> |
2082 | 2082 | <label for="placeholder"> |
2083 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2083 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2084 | 2084 | </label> |
2085 | 2085 | </td> |
2086 | 2086 | <td> |
2087 | - <select type="default" name="field[<?php echo $field['group_id']; ?>][default_choice]"> |
|
2088 | - <?php $i = 0; foreach( json_decode( stripslashes_deep( $field['groups'] ) , true ) as $group ) { ?> |
|
2089 | - <option value="<?php echo $i; ?>" <?php selected( $field['default_choice'] , $i ); ?>><?php echo stripslashes( $group['name'] ); ?></option> |
|
2087 | + <select type="default" name="field[<?php echo $field[ 'group_id' ]; ?>][default_choice]"> |
|
2088 | + <?php $i = 0; foreach ( json_decode( stripslashes_deep( $field[ 'groups' ] ), true ) as $group ) { ?> |
|
2089 | + <option value="<?php echo $i; ?>" <?php selected( $field[ 'default_choice' ], $i ); ?>><?php echo stripslashes( $group[ 'name' ] ); ?></option> |
|
2090 | 2090 | <?php $i++; } ?> |
2091 | 2091 | </select> |
2092 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2092 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2093 | 2093 | </td> |
2094 | 2094 | </tr> |
2095 | 2095 | |
@@ -2103,12 +2103,12 @@ discard block |
||
2103 | 2103 | <tr valign="top"> |
2104 | 2104 | <td scope="row"> |
2105 | 2105 | <label for="placeholder"> |
2106 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2106 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2107 | 2107 | </label> |
2108 | 2108 | </td> |
2109 | 2109 | <td> |
2110 | - <textarea class="widefat field-description-input" name="field[<?php echo $field['group_id']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
2111 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2110 | + <textarea class="widefat field-description-input" name="field[<?php echo $field[ 'group_id' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
2111 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2112 | 2112 | </td> |
2113 | 2113 | </tr> |
2114 | 2114 | |
@@ -2116,51 +2116,51 @@ discard block |
||
2116 | 2116 | <tr valign="top"> |
2117 | 2117 | <td scope="row"> |
2118 | 2118 | <label for="placeholder"> |
2119 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2119 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2120 | 2120 | </label> |
2121 | 2121 | </td> |
2122 | 2122 | <td> |
2123 | - <input type="text" class="widefat" name="field[<?php echo $field['group_id']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
2124 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
2123 | + <input type="text" class="widefat" name="field[<?php echo $field[ 'group_id' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
2124 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
2125 | 2125 | </td> |
2126 | 2126 | </tr> |
2127 | 2127 | <!-- Required Toggle --> |
2128 | 2128 | <tr valign="top"> |
2129 | 2129 | <td scope="row"> |
2130 | 2130 | <label for="field-required"> |
2131 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2131 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2132 | 2132 | </label> |
2133 | 2133 | </td> |
2134 | 2134 | <td> |
2135 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
2136 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][require]" <?php checked( $checked , 1 ); ?>> |
|
2137 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2135 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
2136 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][require]" <?php checked( $checked, 1 ); ?>> |
|
2137 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2138 | 2138 | </td> |
2139 | 2139 | </tr> |
2140 | 2140 | <!-- Visible Toggle --> |
2141 | 2141 | <tr valign="top"> |
2142 | 2142 | <td scope="row"> |
2143 | 2143 | <label for="hide-field"> |
2144 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2144 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2145 | 2145 | </label> |
2146 | 2146 | </td> |
2147 | 2147 | <td> |
2148 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
2149 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][hide]" <?php checked( $hide , 1 ); ?>> |
|
2150 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2148 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
2149 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][hide]" <?php checked( $hide, 1 ); ?>> |
|
2150 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2151 | 2151 | </td> |
2152 | 2152 | </tr> |
2153 | 2153 | <!-- Toggle Field Label Visibility --> |
2154 | 2154 | <tr valign="top"> |
2155 | 2155 | <td scope="row"> |
2156 | 2156 | <label for="placeholder"> |
2157 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2157 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
2158 | 2158 | </label> |
2159 | 2159 | </td> |
2160 | 2160 | <td> |
2161 | - <?php $hide = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
2162 | - <input type="checkbox" name="field[<?php echo $field['group_id']; ?>][hide-label]" value="1" <?php checked( $hide , 1 ); ?>/> |
|
2163 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
2161 | + <?php $hide = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
2162 | + <input type="checkbox" name="field[<?php echo $field[ 'group_id' ]; ?>][hide-label]" value="1" <?php checked( $hide, 1 ); ?>/> |
|
2163 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
2164 | 2164 | </td> |
2165 | 2165 | </tr> |
2166 | 2166 | <!-- Toggle Buttons --> |
@@ -2170,8 +2170,8 @@ discard block |
||
2170 | 2170 | </td> |
2171 | 2171 | <td> |
2172 | 2172 | <span class="toggle-container"> |
2173 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
2174 | - <a href="#" class="remove-field" alt="<?php echo $field['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
2173 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
2174 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
2175 | 2175 | </span> |
2176 | 2176 | </td> |
2177 | 2177 | </tr> |
@@ -2185,38 +2185,38 @@ discard block |
||
2185 | 2185 | } |
2186 | 2186 | } else { |
2187 | 2187 | ?> |
2188 | - <h4 class="no-fields-assigned-notice non-draggable-yikes"><em><?php _e( 'No fields are assigned to this form. Select fields from the right hand column to add to this form.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></h4> |
|
2188 | + <h4 class="no-fields-assigned-notice non-draggable-yikes"><em><?php _e( 'No fields are assigned to this form. Select fields from the right hand column to add to this form.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></h4> |
|
2189 | 2189 | <?php |
2190 | 2190 | } |
2191 | 2191 | /* Pre Defined Merge Tag Container - Always rendered so the modal appears and links are clickable on initial page load */ |
2192 | 2192 | add_thickbox(); |
2193 | 2193 | // enqueue jquery qtip for our tooltip |
2194 | - wp_enqueue_script( 'jquery-qtip-tooltip' , YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js' , array( 'jquery' ) ); |
|
2195 | - wp_enqueue_style( 'jquery-qtip-style' , YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
2194 | + wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js', array( 'jquery' ) ); |
|
2195 | + wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
2196 | 2196 | $available_tags = array( |
2197 | 2197 | array( |
2198 | 2198 | 'tag' => '{page_title}', |
2199 | - 'description' => '<h4 class="tooltip-title">' . __( 'Page Title', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_title}</small></h4><hr />' . __( 'Pre-populate the field with the current page or post title that the user is on when opting in to your mailing list.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2199 | + 'description' => '<h4 class="tooltip-title">' . __( 'Page Title', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_title}</small></h4><hr />' . __( 'Pre-populate the field with the current page or post title that the user is on when opting in to your mailing list.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2200 | 2200 | 'title' => __( 'Page Title', 'yikes-inc-easy-mailchimp-extender' ) |
2201 | 2201 | ), |
2202 | 2202 | array( |
2203 | 2203 | 'tag' => '{page_id}', |
2204 | - 'description' => '<h4 class="tooltip-title">' . __( 'Page ID', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_id}</small></h4><hr />' . __( 'Pre-populate the field with the current page or post ID that the user is on when opting in to your mailing list.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2204 | + 'description' => '<h4 class="tooltip-title">' . __( 'Page ID', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_id}</small></h4><hr />' . __( 'Pre-populate the field with the current page or post ID that the user is on when opting in to your mailing list.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2205 | 2205 | 'title' => __( 'Page ID', 'yikes-inc-easy-mailchimp-extender' ) |
2206 | 2206 | ), |
2207 | 2207 | array( |
2208 | 2208 | 'tag' => '{page_url}', |
2209 | - 'description' => '<h4 class="tooltip-title">' . __( 'Page URL', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_url}</small></h4><hr />' . __( 'Pre-populate the field with the current page URL that the user is on when opting in to your mailing list.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2209 | + 'description' => '<h4 class="tooltip-title">' . __( 'Page URL', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{page_url}</small></h4><hr />' . __( 'Pre-populate the field with the current page URL that the user is on when opting in to your mailing list.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2210 | 2210 | 'title' => __( 'Page URL', 'yikes-inc-easy-mailchimp-extender' ) |
2211 | 2211 | ), |
2212 | 2212 | array( |
2213 | 2213 | 'tag' => '{blog_name}', |
2214 | - 'description' => '<h4 class="tooltip-title">' . __( 'Blog Name', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{blog_name}</small></h4><hr />' . __( 'Pre-populate the field with the current blog name that the user is on when opting in to your mailing list. This is especially helpful for multi-site networks.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2214 | + 'description' => '<h4 class="tooltip-title">' . __( 'Blog Name', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{blog_name}</small></h4><hr />' . __( 'Pre-populate the field with the current blog name that the user is on when opting in to your mailing list. This is especially helpful for multi-site networks.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2215 | 2215 | 'title' => __( 'Blog Name', 'yikes-inc-easy-mailchimp-extender' ) |
2216 | 2216 | ), |
2217 | 2217 | array( |
2218 | 2218 | 'tag' => '{user_logged_in}', |
2219 | - 'description' => '<h4 class="tooltip-title">' . __( 'User Logged In', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{user_logged_in}</small></h4><hr />' . __( 'Detects if a user is logged in and pre-populates the field with an appropriate value.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
2219 | + 'description' => '<h4 class="tooltip-title">' . __( 'User Logged In', 'yikes-inc-easy-mailchimp-extender' ) . ' | <small>{user_logged_in}</small></h4><hr />' . __( 'Detects if a user is logged in and pre-populates the field with an appropriate value.', 'yikes-inc-easy-mailchimp-extender' ), |
|
2220 | 2220 | 'title' => __( 'User Logged In', 'yikes-inc-easy-mailchimp-extender' ) |
2221 | 2221 | ), |
2222 | 2222 | ); |
@@ -2244,17 +2244,17 @@ discard block |
||
2244 | 2244 | <div id="pre-defined-tag-container"> |
2245 | 2245 | <input type="hidden" value="" class="clicked-input"> |
2246 | 2246 | <div id="pre-defined-tag-interior-container"> |
2247 | - <h3><?php _e( 'Pre Defined Tags' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
2248 | - <p class="description"><?php _e( 'You can use any of the following tags to populate a MailChimp text field with dynamic content. This can be used to determine which page the user signed up on, if the user was logged in and more.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
2247 | + <h3><?php _e( 'Pre Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
|
2248 | + <p class="description"><?php _e( 'You can use any of the following tags to populate a MailChimp text field with dynamic content. This can be used to determine which page the user signed up on, if the user was logged in and more.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
2249 | 2249 | <ul> |
2250 | - <?php foreach( apply_filters( 'yikes-mailchimp-custom-default-value-tags' , $available_tags ) as $tag ) { ?> |
|
2250 | + <?php foreach ( apply_filters( 'yikes-mailchimp-custom-default-value-tags', $available_tags ) as $tag ) { ?> |
|
2251 | 2251 | <li class="tooltop-tag"> |
2252 | 2252 | <!-- link/tag --> |
2253 | - <a href="#" onclick="populateDefaultValue( '<?php echo $tag['tag']; ?>' );return false;" data-attr-tag="<?php echo $tag['tag']; ?>" title="<?php echo $tag['title']; ?>"><?php echo $tag['title']; ?></a> |
|
2253 | + <a href="#" onclick="populateDefaultValue( '<?php echo $tag[ 'tag' ]; ?>' );return false;" data-attr-tag="<?php echo $tag[ 'tag' ]; ?>" title="<?php echo $tag[ 'title' ]; ?>"><?php echo $tag[ 'title' ]; ?></a> |
|
2254 | 2254 | <!-- help icon --> |
2255 | 2255 | <span class="dashicons dashicons-editor-help"></span> |
2256 | 2256 | <!-- tooltip --> |
2257 | - <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag['description']; ?></div> |
|
2257 | + <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag[ 'description' ]; ?></div> |
|
2258 | 2258 | </li> |
2259 | 2259 | <?php } ?> |
2260 | 2260 | </ul> |
@@ -2270,32 +2270,32 @@ discard block |
||
2270 | 2270 | * - |
2271 | 2271 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
2272 | 2272 | */ |
2273 | - public function build_available_merge_vars( $form_fields , $available_merge_variables ) { |
|
2273 | + public function build_available_merge_vars( $form_fields, $available_merge_variables ) { |
|
2274 | 2274 | $fields_assigned_to_form = array(); |
2275 | - if( !empty( $form_fields ) ) { |
|
2276 | - foreach( $form_fields as $assigned_field ) { |
|
2275 | + if ( ! empty( $form_fields ) ) { |
|
2276 | + foreach ( $form_fields as $assigned_field ) { |
|
2277 | 2277 | // print_r( $assigned_field) ; |
2278 | 2278 | // switch between merge variables and interest groups |
2279 | - if( isset( $assigned_field['merge'] ) ) { |
|
2280 | - $fields_assigned_to_form[] = $assigned_field['merge']; |
|
2279 | + if ( isset( $assigned_field[ 'merge' ] ) ) { |
|
2280 | + $fields_assigned_to_form[ ] = $assigned_field[ 'merge' ]; |
|
2281 | 2281 | } |
2282 | 2282 | } |
2283 | 2283 | } |
2284 | - if( !empty( $available_merge_variables['data'][0] ) ) { |
|
2284 | + if ( ! empty( $available_merge_variables[ 'data' ][ 0 ] ) ) { |
|
2285 | 2285 | ?><ul id="available-fields"><?php |
2286 | - foreach( $available_merge_variables['data'][0]['merge_vars'] as $merge_var ) { |
|
2287 | - if( in_array( $merge_var['tag'] , $fields_assigned_to_form ) ) { |
|
2286 | + foreach ( $available_merge_variables[ 'data' ][ 0 ][ 'merge_vars' ] as $merge_var ) { |
|
2287 | + if ( in_array( $merge_var[ 'tag' ], $fields_assigned_to_form ) ) { |
|
2288 | 2288 | ?> |
2289 | - <li class="available-form-field not-available" alt="<?php echo $merge_var['tag']; ?>" data-attr-field-type="<?php echo $merge_var['field_type']; ?>" data-attr-field-name="<?php echo $merge_var['name']; ?>" data-attr-form-id="<?php echo $available_merge_variables['data'][0]['id']; ?>" title="<?php _e( 'Already assigned to your form' , 'yikes-inc-easy-mailchimp-extender' ); ?>" disabled="disabled"><?php echo stripslashes( $merge_var['name'] ); if( $merge_var['req'] == '1' ) { echo ' <span class="field-required" title="' . __( 'required field' , 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; } ?> <small class="field-type-text"><?php echo $merge_var['field_type']; ?></small></li> |
|
2289 | + <li class="available-form-field not-available" alt="<?php echo $merge_var[ 'tag' ]; ?>" data-attr-field-type="<?php echo $merge_var[ 'field_type' ]; ?>" data-attr-field-name="<?php echo $merge_var[ 'name' ]; ?>" data-attr-form-id="<?php echo $available_merge_variables[ 'data' ][ 0 ][ 'id' ]; ?>" title="<?php _e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" disabled="disabled"><?php echo stripslashes( $merge_var[ 'name' ] ); if ( $merge_var[ 'req' ] == '1' ) { echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; } ?> <small class="field-type-text"><?php echo $merge_var[ 'field_type' ]; ?></small></li> |
|
2290 | 2290 | <?php |
2291 | 2291 | } else { |
2292 | 2292 | ?> |
2293 | - <li class="available-form-field" alt="<?php echo $merge_var['tag']; ?>" data-attr-field-type="<?php echo $merge_var['field_type']; ?>" data-attr-field-name="<?php echo $merge_var['name']; ?>" data-attr-form-id="<?php echo $available_merge_variables['data'][0]['id']; ?>"><?php echo stripslashes( $merge_var['name'] ); if( $merge_var['req'] == '1' ) { echo ' <span class="field-required" title="' . __( 'required field' , 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; } ?> <small class="field-type-text"><?php echo $merge_var['field_type']; ?></small></li> |
|
2293 | + <li class="available-form-field" alt="<?php echo $merge_var[ 'tag' ]; ?>" data-attr-field-type="<?php echo $merge_var[ 'field_type' ]; ?>" data-attr-field-name="<?php echo $merge_var[ 'name' ]; ?>" data-attr-form-id="<?php echo $available_merge_variables[ 'data' ][ 0 ][ 'id' ]; ?>"><?php echo stripslashes( $merge_var[ 'name' ] ); if ( $merge_var[ 'req' ] == '1' ) { echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; } ?> <small class="field-type-text"><?php echo $merge_var[ 'field_type' ]; ?></small></li> |
|
2294 | 2294 | <?php |
2295 | 2295 | } |
2296 | 2296 | } |
2297 | 2297 | ?></ul> |
2298 | - <a href="#" class="add-field-to-editor button-secondary yikes-easy-mc-hidden" style="display:none;"><small><span class="dashicons dashicons-arrow-left-alt add-to-form-builder-arrow"></span> <?php _e( 'Add to Form Builder' , 'yikes-inc-easy-mailchimp-extender' ); ?></small></a> |
|
2298 | + <a href="#" class="add-field-to-editor button-secondary yikes-easy-mc-hidden" style="display:none;"><small><span class="dashicons dashicons-arrow-left-alt add-to-form-builder-arrow"></span> <?php _e( 'Add to Form Builder', 'yikes-inc-easy-mailchimp-extender' ); ?></small></a> |
|
2299 | 2299 | <?php |
2300 | 2300 | } |
2301 | 2301 | } |
@@ -2307,30 +2307,30 @@ discard block |
||
2307 | 2307 | * - |
2308 | 2308 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
2309 | 2309 | */ |
2310 | - public function build_available_interest_groups( $form_fields , $available_interest_groups , $list_id ) { |
|
2310 | + public function build_available_interest_groups( $form_fields, $available_interest_groups, $list_id ) { |
|
2311 | 2311 | $fields_assigned_to_form = array(); |
2312 | - if( !empty( $form_fields ) ) { |
|
2313 | - foreach( $form_fields as $assigned_interest_group ) { |
|
2314 | - if( isset( $assigned_interest_group['group_id'] ) ) { |
|
2315 | - $fields_assigned_to_form[] = $assigned_interest_group['group_id']; |
|
2312 | + if ( ! empty( $form_fields ) ) { |
|
2313 | + foreach ( $form_fields as $assigned_interest_group ) { |
|
2314 | + if ( isset( $assigned_interest_group[ 'group_id' ] ) ) { |
|
2315 | + $fields_assigned_to_form[ ] = $assigned_interest_group[ 'group_id' ]; |
|
2316 | 2316 | } |
2317 | 2317 | } |
2318 | 2318 | } |
2319 | - if( !empty( $available_interest_groups) ) { |
|
2319 | + if ( ! empty( $available_interest_groups ) ) { |
|
2320 | 2320 | ?><ul id="available-interest-groups"><?php |
2321 | - foreach( $available_interest_groups as $interest_group ) { |
|
2322 | - if( in_array( $interest_group['id'] , $fields_assigned_to_form ) ) { |
|
2321 | + foreach ( $available_interest_groups as $interest_group ) { |
|
2322 | + if ( in_array( $interest_group[ 'id' ], $fields_assigned_to_form ) ) { |
|
2323 | 2323 | ?> |
2324 | - <li class="available-interest-group not-available" alt="<?php echo $interest_group['id']; ?>" data-attr-field-name="<?php echo stripslashes( $interest_group['name'] ); ?>" data-attr-field-type="<?php echo $interest_group['form_field']; ?>" data-attr-form-id="<?php echo $list_id; ?>" title="<?php _e( 'Already assigned to your form' , 'yikes-inc-easy-mailchimp-extender' ); ?>" disabled="disabled"><?php echo stripslashes( $interest_group['name'] ); ?> <small class="field-type-text"><?php echo $interest_group['form_field']; ?></small></li> |
|
2324 | + <li class="available-interest-group not-available" alt="<?php echo $interest_group[ 'id' ]; ?>" data-attr-field-name="<?php echo stripslashes( $interest_group[ 'name' ] ); ?>" data-attr-field-type="<?php echo $interest_group[ 'form_field' ]; ?>" data-attr-form-id="<?php echo $list_id; ?>" title="<?php _e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>" disabled="disabled"><?php echo stripslashes( $interest_group[ 'name' ] ); ?> <small class="field-type-text"><?php echo $interest_group[ 'form_field' ]; ?></small></li> |
|
2325 | 2325 | <?php |
2326 | 2326 | } else { |
2327 | 2327 | ?> |
2328 | - <li class="available-interest-group" alt="<?php echo $interest_group['id']; ?>" data-attr-field-name="<?php echo stripslashes( $interest_group['name'] ); ?>" data-attr-field-type="<?php echo $interest_group['form_field']; ?>" data-attr-form-id="<?php echo $list_id; ?>"><?php echo stripslashes( $interest_group['name'] ); ?> <small class="field-type-text"><?php echo $interest_group['form_field']; ?></small></li> |
|
2328 | + <li class="available-interest-group" alt="<?php echo $interest_group[ 'id' ]; ?>" data-attr-field-name="<?php echo stripslashes( $interest_group[ 'name' ] ); ?>" data-attr-field-type="<?php echo $interest_group[ 'form_field' ]; ?>" data-attr-form-id="<?php echo $list_id; ?>"><?php echo stripslashes( $interest_group[ 'name' ] ); ?> <small class="field-type-text"><?php echo $interest_group[ 'form_field' ]; ?></small></li> |
|
2329 | 2329 | <?php |
2330 | 2330 | } |
2331 | 2331 | } |
2332 | 2332 | ?></ul> |
2333 | - <a href="#" class="add-interest-group-to-editor button-secondary yikes-easy-mc-hidden" style="display:none;"><small><span class="dashicons dashicons-arrow-left-alt add-to-form-builder-arrow"></span> <?php _e( 'Add to Form Builder' , 'yikes-inc-easy-mailchimp-extender' ); ?></small></a> |
|
2333 | + <a href="#" class="add-interest-group-to-editor button-secondary yikes-easy-mc-hidden" style="display:none;"><small><span class="dashicons dashicons-arrow-left-alt add-to-form-builder-arrow"></span> <?php _e( 'Add to Form Builder', 'yikes-inc-easy-mailchimp-extender' ); ?></small></a> |
|
2334 | 2334 | <?php |
2335 | 2335 | } |
2336 | 2336 | } |
@@ -2342,9 +2342,9 @@ discard block |
||
2342 | 2342 | * - must clean up db tables , ensure what data is going in and what is needed... |
2343 | 2343 | */ |
2344 | 2344 | public function yikes_easy_mailchimp_create_form() { |
2345 | - $nonce = $_REQUEST['nonce']; |
|
2346 | - if( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) { |
|
2347 | - die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2345 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2346 | + if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) { |
|
2347 | + die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2348 | 2348 | } |
2349 | 2349 | global $wpdb; |
2350 | 2350 | /* Default values */ |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | ) |
2368 | 2368 | ); |
2369 | 2369 | // setup our default error message array |
2370 | - $error_settings= json_encode( |
|
2370 | + $error_settings = json_encode( |
|
2371 | 2371 | array( |
2372 | 2372 | 'success' => '', |
2373 | 2373 | 'general-error' => '', |
@@ -2381,9 +2381,9 @@ discard block |
||
2381 | 2381 | $wpdb->insert( |
2382 | 2382 | $wpdb->prefix . 'yikes_easy_mc_forms', |
2383 | 2383 | array( |
2384 | - 'list_id' => $_POST['associated-list'], |
|
2385 | - 'form_name' => stripslashes( $_POST['form-name'] ), |
|
2386 | - 'form_description' => stripslashes( $_POST['form-description'] ), |
|
2384 | + 'list_id' => $_POST[ 'associated-list' ], |
|
2385 | + 'form_name' => stripslashes( $_POST[ 'form-name' ] ), |
|
2386 | + 'form_description' => stripslashes( $_POST[ 'form-description' ] ), |
|
2387 | 2387 | 'fields' => '', |
2388 | 2388 | 'custom_styles' => 0, |
2389 | 2389 | 'custom_template' => 0, |
@@ -2404,33 +2404,33 @@ discard block |
||
2404 | 2404 | '%s', // form description |
2405 | 2405 | '%s', // fields |
2406 | 2406 | '%s', // custom styles |
2407 | - '%d', // custom template |
|
2408 | - '%d', // send welcome email |
|
2409 | - '%s', // redirect user |
|
2410 | - '%s', // redirect page |
|
2411 | - '%s', // submission |
|
2412 | - '%s', // optin |
|
2407 | + '%d', // custom template |
|
2408 | + '%d', // send welcome email |
|
2409 | + '%s', // redirect user |
|
2410 | + '%s', // redirect page |
|
2411 | + '%s', // submission |
|
2412 | + '%s', // optin |
|
2413 | 2413 | '%s', // error |
2414 | 2414 | '%s', // custom notifications |
2415 | - '%d', // impressions # |
|
2416 | - '%d', // submissions # |
|
2415 | + '%d', // impressions # |
|
2416 | + '%d', // submissions # |
|
2417 | 2417 | '%s', // custom fields |
2418 | 2418 | ) |
2419 | 2419 | ); |
2420 | 2420 | |
2421 | 2421 | // if an error occurs during the form creation process |
2422 | - if( $wpdb->insert_id == '0' ) { |
|
2422 | + if ( $wpdb->insert_id == '0' ) { |
|
2423 | 2423 | // write it to the error log |
2424 | 2424 | // if the form was not created successfully |
2425 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
2425 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
2426 | 2426 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
2427 | 2427 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
2428 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $wpdb->last_error , __( "Creating a new form" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Forms" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2428 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $wpdb->last_error, __( "Creating a new form", 'yikes-inc-easy-mailchimp-extender' ), __( "Forms", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2429 | 2429 | } |
2430 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&sql_error='.urlencode( $wpdb->last_error ) ) ) ); |
|
2430 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&sql_error=' . urlencode( $wpdb->last_error ) ) ) ); |
|
2431 | 2431 | } else { |
2432 | 2432 | // redirect the user to the new form edit page |
2433 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id='.$wpdb->insert_id ) ) ); |
|
2433 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $wpdb->insert_id ) ) ); |
|
2434 | 2434 | } |
2435 | 2435 | exit(); |
2436 | 2436 | die(); |
@@ -2444,11 +2444,11 @@ discard block |
||
2444 | 2444 | */ |
2445 | 2445 | public function yikes_easy_mailchimp_delete_form() { |
2446 | 2446 | // grab & store our variables ( associated list & form name ) |
2447 | - $nonce = $_REQUEST['nonce']; |
|
2448 | - $post_id_to_delete = $_REQUEST['mailchimp-form']; |
|
2447 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2448 | + $post_id_to_delete = $_REQUEST[ 'mailchimp-form' ]; |
|
2449 | 2449 | // verify our nonce |
2450 | - if( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) { |
|
2451 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2450 | + if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-' . $post_id_to_delete ) ) { |
|
2451 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2452 | 2452 | } |
2453 | 2453 | global $wpdb; |
2454 | 2454 | /* Working Insert Function */ |
@@ -2473,39 +2473,39 @@ discard block |
||
2473 | 2473 | */ |
2474 | 2474 | public function yikes_easy_mailchimp_duplicate_form() { |
2475 | 2475 | // grab & store our variables ( associated list & form name ) |
2476 | - $nonce = $_REQUEST['nonce']; |
|
2477 | - $post_id_to_clone = $_REQUEST['mailchimp-form']; |
|
2476 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2477 | + $post_id_to_clone = $_REQUEST[ 'mailchimp-form' ]; |
|
2478 | 2478 | // verify our nonce |
2479 | - if( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) { |
|
2480 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2479 | + if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-' . $post_id_to_clone ) ) { |
|
2480 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2481 | 2481 | } |
2482 | 2482 | global $wpdb; |
2483 | 2483 | /* Working Insert Function */ |
2484 | - $form_data = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "yikes_easy_mc_forms WHERE id = ".$post_id_to_clone.""); |
|
2484 | + $form_data = $wpdb->get_row( "SELECT * FROM " . $wpdb->prefix . "yikes_easy_mc_forms WHERE id = " . $post_id_to_clone . "" ); |
|
2485 | 2485 | // create empty array to populate with row data |
2486 | 2486 | $data = array(); |
2487 | 2487 | // build a data array to duplicate |
2488 | - foreach( $form_data as $id => $value ) { |
|
2488 | + foreach ( $form_data as $id => $value ) { |
|
2489 | 2489 | // skip the ID field this is unique |
2490 | - if( $id != 'id' ) { |
|
2490 | + if ( $id != 'id' ) { |
|
2491 | 2491 | // append -Copy- to our new form |
2492 | - if( $id == 'form_name' ) { |
|
2492 | + if ( $id == 'form_name' ) { |
|
2493 | 2493 | $value = $value . ' - Copy -'; |
2494 | 2494 | } |
2495 | 2495 | // reset the impressions and submissions back to 0 |
2496 | - if( $id == 'impressions' || $id == 'submissions' ) { |
|
2496 | + if ( $id == 'impressions' || $id == 'submissions' ) { |
|
2497 | 2497 | $value = '0'; |
2498 | 2498 | } |
2499 | 2499 | |
2500 | 2500 | // add data to our array |
2501 | - $data[$id] = $value; |
|
2501 | + $data[ $id ] = $value; |
|
2502 | 2502 | } |
2503 | 2503 | } |
2504 | 2504 | // insert our new data |
2505 | - if( $wpdb->insert( |
|
2505 | + if ( $wpdb->insert( |
|
2506 | 2506 | $wpdb->prefix . 'yikes_easy_mc_forms', |
2507 | 2507 | apply_filters( 'yikes-mailchimp-duplicate-form-data', $data ) |
2508 | - ) === FALSE ) { |
|
2508 | + ) === FALSE ) { |
|
2509 | 2509 | // redirect the user to the manage forms page, display error |
2510 | 2510 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&duplicated-form=false' ) ) ); |
2511 | 2511 | } else { |
@@ -2521,15 +2521,15 @@ discard block |
||
2521 | 2521 | */ |
2522 | 2522 | public function yikes_easy_mailchimp_reset_impression_stats() { |
2523 | 2523 | // grab & store our variables ( associated list & form name ) |
2524 | - $nonce = $_REQUEST['nonce']; |
|
2525 | - $form_id_to_reset = $_REQUEST['mailchimp-form']; |
|
2524 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2525 | + $form_id_to_reset = $_REQUEST[ 'mailchimp-form' ]; |
|
2526 | 2526 | // verify our nonce |
2527 | - if( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) { |
|
2528 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2527 | + if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-' . $form_id_to_reset ) ) { |
|
2528 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2529 | 2529 | } |
2530 | 2530 | global $wpdb; |
2531 | 2531 | /* Update 'Impressions/Submissions' */ |
2532 | - if( $wpdb->update( |
|
2532 | + if ( $wpdb->update( |
|
2533 | 2533 | $wpdb->prefix . 'yikes_easy_mc_forms', |
2534 | 2534 | array( |
2535 | 2535 | 'impressions' => 0, |
@@ -2553,35 +2553,35 @@ discard block |
||
2553 | 2553 | */ |
2554 | 2554 | public function yikes_easy_mailchimp_update_form() { |
2555 | 2555 | // grab & store our variables ( associated list & form name ) |
2556 | - $nonce = $_REQUEST['nonce']; |
|
2557 | - $form_id = $_REQUEST['id']; |
|
2556 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2557 | + $form_id = $_REQUEST[ 'id' ]; |
|
2558 | 2558 | |
2559 | 2559 | // store our values! |
2560 | - $list_id = $_POST['associated-list']; |
|
2561 | - $form_name = stripslashes( $_POST['form-name'] ); |
|
2562 | - $form_description = sanitize_text_field( stripslashes( $_POST['form-description'] ) ); |
|
2563 | - $send_welcome_email = $_POST['send-welcome-email']; |
|
2564 | - $redirect_user_on_submit = $_POST['redirect-user-on-submission']; |
|
2565 | - $redirect_page = $_POST['redirect-user-to-selection']; |
|
2566 | - if( isset( $_POST['custom-styles'] ) ) { |
|
2567 | - $custom_styles = $_POST['custom-styles']; |
|
2560 | + $list_id = $_POST[ 'associated-list' ]; |
|
2561 | + $form_name = stripslashes( $_POST[ 'form-name' ] ); |
|
2562 | + $form_description = sanitize_text_field( stripslashes( $_POST[ 'form-description' ] ) ); |
|
2563 | + $send_welcome_email = $_POST[ 'send-welcome-email' ]; |
|
2564 | + $redirect_user_on_submit = $_POST[ 'redirect-user-on-submission' ]; |
|
2565 | + $redirect_page = $_POST[ 'redirect-user-to-selection' ]; |
|
2566 | + if ( isset( $_POST[ 'custom-styles' ] ) ) { |
|
2567 | + $custom_styles = $_POST[ 'custom-styles' ]; |
|
2568 | 2568 | } |
2569 | 2569 | |
2570 | 2570 | // stripslashes_deep on save, to prevent foreign languages from added excessive backslashes |
2571 | - $assigned_fields = isset( $_POST['field'] ) ? json_encode( stripslashes_deep( $_POST['field'] ) ) : ''; |
|
2571 | + $assigned_fields = isset( $_POST[ 'field' ] ) ? json_encode( stripslashes_deep( $_POST[ 'field' ] ) ) : ''; |
|
2572 | 2572 | |
2573 | 2573 | // setup our custom styles serialized array |
2574 | - if( isset( $custom_styles ) ) { |
|
2574 | + if ( isset( $custom_styles ) ) { |
|
2575 | 2575 | $custom_styles = json_encode( array( |
2576 | - 'active' => $_POST['custom-styles'], |
|
2577 | - 'background_color' => $_POST['form-background-color'], |
|
2578 | - 'font_color' => $_POST['form-font-color'], |
|
2579 | - 'submit_button_color' => $_POST['form-submit-button-color'], |
|
2580 | - 'submit_button_text_color' => $_POST['form-submit-button-text-color'], |
|
2581 | - 'form_padding' => $_POST['form-padding'], |
|
2582 | - 'form_width' => $_POST['form-width'], |
|
2583 | - 'form_alignment' => $_POST['form-alignment'], |
|
2584 | - 'label_visible' => $_POST['label-visible'] |
|
2576 | + 'active' => $_POST[ 'custom-styles' ], |
|
2577 | + 'background_color' => $_POST[ 'form-background-color' ], |
|
2578 | + 'font_color' => $_POST[ 'form-font-color' ], |
|
2579 | + 'submit_button_color' => $_POST[ 'form-submit-button-color' ], |
|
2580 | + 'submit_button_text_color' => $_POST[ 'form-submit-button-text-color' ], |
|
2581 | + 'form_padding' => $_POST[ 'form-padding' ], |
|
2582 | + 'form_width' => $_POST[ 'form-width' ], |
|
2583 | + 'form_alignment' => $_POST[ 'form-alignment' ], |
|
2584 | + 'label_visible' => $_POST[ 'label-visible' ] |
|
2585 | 2585 | ) ); |
2586 | 2586 | } else { |
2587 | 2587 | $custom_styles = 0; |
@@ -2590,33 +2590,33 @@ discard block |
||
2590 | 2590 | // setup our submission settings serialized array |
2591 | 2591 | $submission_settings = json_encode( |
2592 | 2592 | array( |
2593 | - 'ajax' => $_POST['form-ajax-submission'], |
|
2594 | - 'redirect_on_submission' => $_POST['redirect-user-on-submission'], |
|
2595 | - 'redirect_page' => $_POST['redirect-user-to-selection'], |
|
2596 | - 'custom_redirect_url' => esc_url( $_POST['custom-redirect-url'] ), |
|
2597 | - 'hide_form_post_signup' => $_POST['hide-form-post-signup'], |
|
2598 | - 'replace_interests' => $_POST['replace-interest-groups'], |
|
2593 | + 'ajax' => $_POST[ 'form-ajax-submission' ], |
|
2594 | + 'redirect_on_submission' => $_POST[ 'redirect-user-on-submission' ], |
|
2595 | + 'redirect_page' => $_POST[ 'redirect-user-to-selection' ], |
|
2596 | + 'custom_redirect_url' => esc_url( $_POST[ 'custom-redirect-url' ] ), |
|
2597 | + 'hide_form_post_signup' => $_POST[ 'hide-form-post-signup' ], |
|
2598 | + 'replace_interests' => $_POST[ 'replace-interest-groups' ], |
|
2599 | 2599 | ) |
2600 | 2600 | ); |
2601 | 2601 | |
2602 | 2602 | // setup our opt-in settings serialized array |
2603 | 2603 | $optin_settings = json_encode( |
2604 | 2604 | array( |
2605 | - 'optin' => $_POST['single-double-optin'], |
|
2606 | - 'update_existing_user' => $_POST['update-existing-user'], |
|
2607 | - 'send_update_email' => $_POST['update-existing-email'], |
|
2608 | - 'send_welcome_email' => $_POST['send-welcome-email'], |
|
2605 | + 'optin' => $_POST[ 'single-double-optin' ], |
|
2606 | + 'update_existing_user' => $_POST[ 'update-existing-user' ], |
|
2607 | + 'send_update_email' => $_POST[ 'update-existing-email' ], |
|
2608 | + 'send_welcome_email' => $_POST[ 'send-welcome-email' ], |
|
2609 | 2609 | ) |
2610 | 2610 | ); |
2611 | 2611 | |
2612 | 2612 | // setup our error settings serialized array |
2613 | 2613 | $error_settings = json_encode( |
2614 | 2614 | array( |
2615 | - 'success' => trim( $_POST['yikes-easy-mc-success-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-success-message'] ) ) : '', |
|
2616 | - 'general-error' => trim( $_POST['yikes-easy-mc-general-error-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-general-error-message'] ) ) : '', |
|
2617 | - 'invalid-email' => trim( $_POST['yikes-easy-mc-invalid-email-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-invalid-email-message'] ) ) : '', |
|
2618 | - 'already-subscribed' => trim( $_POST['yikes-easy-mc-user-subscribed-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-subscribed-message'] ) ) : '', |
|
2619 | - 'update-link' => trim( $_POST['yikes-easy-mc-user-update-link'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-update-link'] ) ) : '', |
|
2615 | + 'success' => trim( $_POST[ 'yikes-easy-mc-success-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-success-message' ] ) ) : '', |
|
2616 | + 'general-error' => trim( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ) : '', |
|
2617 | + 'invalid-email' => trim( $_POST[ 'yikes-easy-mc-invalid-email-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-invalid-email-message' ] ) ) : '', |
|
2618 | + 'already-subscribed' => trim( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ) : '', |
|
2619 | + 'update-link' => trim( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ) : '', |
|
2620 | 2620 | ) |
2621 | 2621 | ); |
2622 | 2622 | |
@@ -2625,33 +2625,33 @@ discard block |
||
2625 | 2625 | // To Do: Combine date & time so it's a single unix timestamp |
2626 | 2626 | $form_settings = json_encode( |
2627 | 2627 | array( |
2628 | - 'yikes-easy-mc-form-class-names' => trim( $_POST['yikes-easy-mc-form-class-names'] ), |
|
2629 | - 'yikes-easy-mc-inline-form' => $_POST['yikes-easy-mc-inline-form'][0], |
|
2630 | - 'yikes-easy-mc-submit-button-type' => $_POST['yikes-easy-mc-submit-button-type'][0], |
|
2631 | - 'yikes-easy-mc-submit-button-text' => trim( $_POST['yikes-easy-mc-submit-button-text'] ), |
|
2632 | - 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST['yikes-easy-mc-submit-button-image'] ) ), |
|
2633 | - 'yikes-easy-mc-submit-button-classes' => trim( $_POST['yikes-easy-mc-submit-button-classes'] ), |
|
2634 | - 'yikes-easy-mc-form-schedule' => ( isset( $_POST['yikes-easy-mc-form-schedule'] ) ) ? '1' : '0', |
|
2635 | - 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST['yikes-easy-mc-form-restriction-start-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-start-time'] ), |
|
2636 | - 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST['yikes-easy-mc-form-restriction-end-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-end-time'] ), |
|
2637 | - 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST['yikes-easy-mc-form-restriction-pending-message'] ), |
|
2638 | - 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST['yikes-easy-mc-form-restriction-expired-message'] ), |
|
2639 | - 'yikes-easy-mc-form-login-required' => ( isset( $_POST['yikes-easy-mc-form-login-required'] ) ) ? '1' : '0', |
|
2640 | - 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST['yikes-easy-mc-form-restriction-login-message'] ), |
|
2628 | + 'yikes-easy-mc-form-class-names' => trim( $_POST[ 'yikes-easy-mc-form-class-names' ] ), |
|
2629 | + 'yikes-easy-mc-inline-form' => $_POST[ 'yikes-easy-mc-inline-form' ][ 0 ], |
|
2630 | + 'yikes-easy-mc-submit-button-type' => $_POST[ 'yikes-easy-mc-submit-button-type' ][ 0 ], |
|
2631 | + 'yikes-easy-mc-submit-button-text' => trim( $_POST[ 'yikes-easy-mc-submit-button-text' ] ), |
|
2632 | + 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST[ 'yikes-easy-mc-submit-button-image' ] ) ), |
|
2633 | + 'yikes-easy-mc-submit-button-classes' => trim( $_POST[ 'yikes-easy-mc-submit-button-classes' ] ), |
|
2634 | + 'yikes-easy-mc-form-schedule' => ( isset( $_POST[ 'yikes-easy-mc-form-schedule' ] ) ) ? '1' : '0', |
|
2635 | + 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-start-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-start-time' ] ), |
|
2636 | + 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-end-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-end-time' ] ), |
|
2637 | + 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-pending-message' ] ), |
|
2638 | + 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-expired-message' ] ), |
|
2639 | + 'yikes-easy-mc-form-login-required' => ( isset( $_POST[ 'yikes-easy-mc-form-login-required' ] ) ) ? '1' : '0', |
|
2640 | + 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-login-message' ] ), |
|
2641 | 2641 | ) |
2642 | 2642 | ); |
2643 | 2643 | |
2644 | 2644 | // setup and store our notification array |
2645 | - $custom_notifications = isset( $_POST['custom-notification'] ) ? stripslashes( json_encode( $_POST['custom-notification'] ) ) : ''; |
|
2645 | + $custom_notifications = isset( $_POST[ 'custom-notification' ] ) ? stripslashes( json_encode( $_POST[ 'custom-notification' ] ) ) : ''; |
|
2646 | 2646 | |
2647 | 2647 | // additional custom fields (extensions / user defined fields) |
2648 | - if( isset( $_POST['custom-field'] ) ) { |
|
2648 | + if ( isset( $_POST[ 'custom-field' ] ) ) { |
|
2649 | 2649 | $custom_field_array = array(); |
2650 | - foreach( $_POST['custom-field'] as $custom_field => $custom_value ) { |
|
2651 | - if( is_array( $custom_value ) ) { |
|
2652 | - $custom_field_array[$custom_field] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!) |
|
2650 | + foreach ( $_POST[ 'custom-field' ] as $custom_field => $custom_value ) { |
|
2651 | + if ( is_array( $custom_value ) ) { |
|
2652 | + $custom_field_array[ $custom_field ] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!) |
|
2653 | 2653 | } else { |
2654 | - $custom_field_array[$custom_field] = stripslashes( $custom_value ); |
|
2654 | + $custom_field_array[ $custom_field ] = stripslashes( $custom_value ); |
|
2655 | 2655 | } |
2656 | 2656 | } |
2657 | 2657 | $custom_fields = json_encode( $custom_field_array ); |
@@ -2660,8 +2660,8 @@ discard block |
||
2660 | 2660 | } |
2661 | 2661 | |
2662 | 2662 | // verify our nonce |
2663 | - if( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-'.$form_id ) ) { |
|
2664 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2663 | + if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) { |
|
2664 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2665 | 2665 | } |
2666 | 2666 | |
2667 | 2667 | global $wpdb; |
@@ -2693,12 +2693,12 @@ discard block |
||
2693 | 2693 | '%s', // form description |
2694 | 2694 | '%s', // fields |
2695 | 2695 | '%s', // custom styles |
2696 | - '%d', //custom template |
|
2697 | - '%d', // send welcome email |
|
2698 | - '%s', // redirect user |
|
2699 | - '%s', // redirect page |
|
2700 | - '%s', // submission |
|
2701 | - '%s', // opt-in |
|
2696 | + '%d', //custom template |
|
2697 | + '%d', // send welcome email |
|
2698 | + '%s', // redirect user |
|
2699 | + '%s', // redirect page |
|
2700 | + '%s', // submission |
|
2701 | + '%s', // opt-in |
|
2702 | 2702 | '%s', // error |
2703 | 2703 | '%s', // custom notifications |
2704 | 2704 | '%s', // custom fields |
@@ -2707,7 +2707,7 @@ discard block |
||
2707 | 2707 | ); |
2708 | 2708 | |
2709 | 2709 | /* Custom action hook which allows users to update specific options when a form is updated - used in add ons */ |
2710 | - do_action( 'yikes-mailchimp-save-form', $form_id, json_decode( $custom_fields, true ) ); |
|
2710 | + do_action( 'yikes-mailchimp-save-form', $form_id, json_decode( $custom_fields, true ) ); |
|
2711 | 2711 | |
2712 | 2712 | // redirect the user to the manage forms page, display confirmation |
2713 | 2713 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form_id . '&updated-form=true' ) ) ); |
@@ -2717,18 +2717,18 @@ discard block |
||
2717 | 2717 | |
2718 | 2718 | /* Unsubscribe a given user from our list */ |
2719 | 2719 | public function yikes_easy_mailchimp_unsubscribe_user() { |
2720 | - $nonce = $_REQUEST['nonce']; |
|
2721 | - $list_id = $_REQUEST['mailchimp-list']; |
|
2722 | - $email_id = $_REQUEST['email_id']; |
|
2720 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2721 | + $list_id = $_REQUEST[ 'mailchimp-list' ]; |
|
2722 | + $email_id = $_REQUEST[ 'email_id' ]; |
|
2723 | 2723 | // verify our nonce |
2724 | - if( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) { |
|
2725 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2724 | + if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) { |
|
2725 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2726 | 2726 | } |
2727 | 2727 | // only re-run the API request if our API key has changed |
2728 | 2728 | // initialize MailChimp Class |
2729 | - $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
2729 | + $api_key = trim( get_option( 'yikes-mc-api-key', '' ) ); |
|
2730 | 2730 | $dash_position = strpos( $api_key, '-' ); |
2731 | - if( $dash_position !== false ) { |
|
2731 | + if ( $dash_position !== false ) { |
|
2732 | 2732 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/unsubscribe.json'; |
2733 | 2733 | } |
2734 | 2734 | $response = wp_remote_post( $api_endpoint, array( |
@@ -2742,13 +2742,13 @@ discard block |
||
2742 | 2742 | 'timeout' => 10, |
2743 | 2743 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
2744 | 2744 | ) ); |
2745 | - if( ! is_wp_error( $response ) ) { |
|
2745 | + if ( ! is_wp_error( $response ) ) { |
|
2746 | 2746 | $response_body = json_decode( wp_remote_retrieve_body( $response ), true ); |
2747 | - if( isset( $response_body['error'] ) ) { |
|
2748 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
2747 | + if ( isset( $response_body[ 'error' ] ) ) { |
|
2748 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
2749 | 2749 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
2750 | 2750 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
2751 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $response_body['error'], __( "Unsubscribe User" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Manage List Page" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2751 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $response_body[ 'error' ], __( "Unsubscribe User", 'yikes-inc-easy-mailchimp-extender' ), __( "Manage List Page", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2752 | 2752 | } |
2753 | 2753 | } |
2754 | 2754 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $list_id . '&user-unsubscribed=true' ) ) ); |
@@ -2759,21 +2759,21 @@ discard block |
||
2759 | 2759 | |
2760 | 2760 | public function yikes_easy_mailchimp_create_missing_error_log() { |
2761 | 2761 | // grab our nonnce |
2762 | - $nonce = $_REQUEST['nonce']; |
|
2762 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2763 | 2763 | // validate nonce |
2764 | - if( !wp_verify_nonce( $nonce, 'create_error_log' ) ) { |
|
2765 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2764 | + if ( ! wp_verify_nonce( $nonce, 'create_error_log' ) ) { |
|
2765 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2766 | 2766 | } |
2767 | 2767 | // setup the path to the error log |
2768 | - $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php' , 'w' ); |
|
2768 | + $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' ); |
|
2769 | 2769 | try { |
2770 | 2770 | // create the file |
2771 | - fwrite( $error_log , '' ); |
|
2771 | + fwrite( $error_log, '' ); |
|
2772 | 2772 | // close out |
2773 | 2773 | fclose( $error_log ); |
2774 | 2774 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=true' ) ) ); |
2775 | 2775 | } catch ( Exception $e ) { |
2776 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message='.urlencode( $e->getMessage() ) ) ) ); |
|
2776 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message=' . urlencode( $e->getMessage() ) ) ) ); |
|
2777 | 2777 | } |
2778 | 2778 | } |
2779 | 2779 | |
@@ -2784,16 +2784,16 @@ discard block |
||
2784 | 2784 | public function yikes_easy_mailchimp_clear_transient_data() { |
2785 | 2785 | $referer = wp_get_referer(); |
2786 | 2786 | // grab & store our variables ( associated list & form name ) |
2787 | - $nonce = $_REQUEST['nonce']; |
|
2787 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
2788 | 2788 | // verify our nonce |
2789 | - if( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) { |
|
2790 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
2789 | + if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) { |
|
2790 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
2791 | 2791 | } |
2792 | 2792 | // delete all of the integration settings list data in the cache |
2793 | 2793 | $list_ids = $this->get_mailchimp_list_ids_on_account(); |
2794 | 2794 | // confirm the list IDs was returned and is not empty |
2795 | - if( isset( $list_ids ) && ! empty( $list_ids ) ) { |
|
2796 | - foreach( $list_ids as $id ) { |
|
2795 | + if ( isset( $list_ids ) && ! empty( $list_ids ) ) { |
|
2796 | + foreach ( $list_ids as $id ) { |
|
2797 | 2797 | // loop over each interest group and delete the transient associated with it |
2798 | 2798 | // this is created & stored on the integration list page |
2799 | 2799 | // id = groupID_interest_group |
@@ -2825,13 +2825,13 @@ discard block |
||
2825 | 2825 | * @return $list_id_array - array of list id's to loop over |
2826 | 2826 | */ |
2827 | 2827 | public function get_mailchimp_list_ids_on_account() { |
2828 | - $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
2829 | - if( ! $api_key ) { |
|
2828 | + $api_key = trim( get_option( 'yikes-mc-api-key', '' ) ); |
|
2829 | + if ( ! $api_key ) { |
|
2830 | 2830 | // if no api key is set/site is not connected, return an empty array |
2831 | 2831 | return array(); |
2832 | 2832 | } |
2833 | 2833 | $dash_position = strpos( $api_key, '-' ); |
2834 | - if( $dash_position !== false ) { |
|
2834 | + if ( $dash_position !== false ) { |
|
2835 | 2835 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
2836 | 2836 | } |
2837 | 2837 | $mailchimp_lists = wp_remote_post( $api_endpoint, array( |
@@ -2842,19 +2842,19 @@ discard block |
||
2842 | 2842 | 'timeout' => 10, |
2843 | 2843 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
2844 | 2844 | ) ); |
2845 | - if( ! is_wp_error( $mailchimp_lists ) ) { |
|
2845 | + if ( ! is_wp_error( $mailchimp_lists ) ) { |
|
2846 | 2846 | $list_data = json_decode( wp_remote_retrieve_body( $mailchimp_lists ), true ); |
2847 | - if( isset( $list_data['error'] ) ) { |
|
2848 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
2847 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
2848 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
2849 | 2849 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
2850 | 2850 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
2851 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get List IDs" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Clear API Cache" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2851 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get List IDs", 'yikes-inc-easy-mailchimp-extender' ), __( "Clear API Cache", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
2852 | 2852 | } |
2853 | 2853 | } |
2854 | 2854 | $mail_chimp_list_ids = array(); |
2855 | - if( $mailchimp_lists ) { |
|
2856 | - foreach( $list_data as $list ) { |
|
2857 | - $mail_chimp_list_ids[] = $list['id']; |
|
2855 | + if ( $mailchimp_lists ) { |
|
2856 | + foreach ( $list_data as $list ) { |
|
2857 | + $mail_chimp_list_ids[ ] = $list[ 'id' ]; |
|
2858 | 2858 | } |
2859 | 2859 | return $mail_chimp_list_ids; |
2860 | 2860 | } else { |
@@ -2870,7 +2870,7 @@ discard block |
||
2870 | 2870 | */ |
2871 | 2871 | public function yikes_mailchimp_load_helper_class() { |
2872 | 2872 | // check to see if it's already loaded up |
2873 | - if( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) { |
|
2873 | + if ( ! class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) { |
|
2874 | 2874 | // Include our main helper class file |
2875 | 2875 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/init.php' ); |
2876 | 2876 | } |
@@ -2947,7 +2947,7 @@ discard block |
||
2947 | 2947 | * @since 6.0.4 |
2948 | 2948 | */ |
2949 | 2949 | public function check_yikes_mc_table_version() { |
2950 | - if( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) { |
|
2950 | + if ( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) { |
|
2951 | 2951 | require_once YIKES_MC_PATH . 'includes/class-yikes-inc-easy-mailchimp-extender-activator.php'; |
2952 | 2952 | global $wpdb; |
2953 | 2953 | Yikes_Inc_Easy_Mailchimp_Extender_Activator::_activate_yikes_easy_mailchimp( $wpdb ); |