@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | $submission_handler = new Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler( $is_ajax = true ); |
9 | 9 | |
10 | 10 | // parse our form data |
11 | -parse_str( $_POST['form_data'], $data ); |
|
11 | +parse_str( $_POST[ 'form_data' ], $data ); |
|
12 | 12 | |
13 | 13 | // Get the form_id |
14 | -$form_id = absint( $_POST['form_id'] ); |
|
14 | +$form_id = absint( $_POST[ 'form_id' ] ); |
|
15 | 15 | |
16 | 16 | // Send an error if for some reason we can't find the $form_id |
17 | 17 | $submission_handler->handle_empty_form_id( $form_id ); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $submission_handler->set_form_id( $form_id ); |
21 | 21 | |
22 | 22 | // Check our nonce |
23 | -$submission_handler->handle_nonce( $_POST['ajax_security_nonce'], 'yikes_mc_form_submission_security_nonce' ); |
|
23 | +$submission_handler->handle_nonce( $_POST[ 'ajax_security_nonce' ], 'yikes_mc_form_submission_security_nonce' ); |
|
24 | 24 | |
25 | 25 | // Get the form data |
26 | 26 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $submission_handler->handle_empty_form( $form_data ); |
31 | 31 | |
32 | 32 | // Set up some variables from the form data -- these are required |
33 | -$list_id = isset( $form_data['list_id'] ) ? $form_data['list_id'] : null; |
|
34 | -$submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
35 | -$optin_settings = isset( $form_data['optin_settings'] ) ? $form_data['optin_settings'] : null; |
|
36 | -$form_fields = isset( $form_data['fields'] ) ? $form_data['fields'] : null; |
|
33 | +$list_id = isset( $form_data[ 'list_id' ] ) ? $form_data[ 'list_id' ] : null; |
|
34 | +$submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
35 | +$optin_settings = isset( $form_data[ 'optin_settings' ] ) ? $form_data[ 'optin_settings' ] : null; |
|
36 | +$form_fields = isset( $form_data[ 'fields' ] ) ? $form_data[ 'fields' ] : null; |
|
37 | 37 | |
38 | 38 | // Send an error if for some reason we can't find the required form data |
39 | 39 | $submission_handler->handle_empty_fields_generic( array( $list_id, $submission_settings, $optin_settings, $form_fields ) ); |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | $submission_handler->check_for_required_interest_groups( $data, $form_fields ); |
48 | 48 | |
49 | 49 | // Set up some variables from the form data -- these are not required |
50 | -$error_messages = isset( $form_data['error_messages'] ) ? $form_data['error_messages'] : array(); |
|
51 | -$notifications = isset( $form_data['custom_notifications'] ) ? $form_data['custom_notifications'] : array(); |
|
50 | +$error_messages = isset( $form_data[ 'error_messages' ] ) ? $form_data[ 'error_messages' ] : array(); |
|
51 | +$notifications = isset( $form_data[ 'custom_notifications' ] ) ? $form_data[ 'custom_notifications' ] : array(); |
|
52 | 52 | |
53 | 53 | // Set the error messages in our class |
54 | 54 | $submission_handler->set_error_messages( $error_messages ); |
55 | 55 | |
56 | 56 | // Some other variables we'll need. |
57 | -$page_data = isset( $_POST['page_data'] ) ? $_POST['page_data'] : ''; |
|
57 | +$page_data = isset( $_POST[ 'page_data' ] ) ? $_POST[ 'page_data' ] : ''; |
|
58 | 58 | $merge_variables = array(); |
59 | 59 | $error = 0; |
60 | 60 | $list_handler = yikes_get_mc_api_manager()->get_list_handler(); |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | // As of 6.4 we no longer pass the post object, only the ID. |
63 | 63 | // For any users relying on the $post object for their `yikes-mailchimp-redirect-url` filter we'll grab the post object here. |
64 | 64 | // Eventually we should just pass the $post_id into the filter instead of the whole object. |
65 | -$page_data = ! empty( $page_data ) ? get_post( $page_data ) : ''; |
|
65 | +$page_data = ! empty( $page_data ) ? get_post( $page_data ) : ''; |
|
66 | 66 | |
67 | 67 | // Send an error if for some reason we can't find the list_handler |
68 | 68 | $submission_handler->handle_empty_list_handler( $list_handler ); |
69 | 69 | |
70 | 70 | // Get, sanitize and lowercasify the email |
71 | -$submitted_email = isset( $data['EMAIL'] ) ? $data['EMAIL'] : ''; |
|
71 | +$submitted_email = isset( $data[ 'EMAIL' ] ) ? $data[ 'EMAIL' ] : ''; |
|
72 | 72 | $sanitized_email = $submission_handler->get_sanitized_email( $submitted_email ); |
73 | 73 | $submission_handler->set_email( $sanitized_email ); |
74 | 74 | |
@@ -76,26 +76,26 @@ discard block |
||
76 | 76 | $submission_handler->handle_empty_email( $sanitized_email ); |
77 | 77 | |
78 | 78 | // Check for Honeypot filled |
79 | -$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && '' !== $data['yikes-mailchimp-honeypot'] ) ? true : false; |
|
79 | +$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && '' !== $data[ 'yikes-mailchimp-honeypot' ] ) ? true : false; |
|
80 | 80 | |
81 | 81 | // Send an error if honey pot is not empty |
82 | 82 | $submission_handler->handle_non_empty_honeypot( $honey_pot_filled ); |
83 | 83 | |
84 | 84 | // Check if reCAPTCHA Response was submitted with the form data, and handle it if needed |
85 | -if ( isset( $data['g-recaptcha-response'] ) ) { |
|
86 | - $recaptcha_response = $data['g-recaptcha-response']; |
|
85 | +if ( isset( $data[ 'g-recaptcha-response' ] ) ) { |
|
86 | + $recaptcha_response = $data[ 'g-recaptcha-response' ]; |
|
87 | 87 | $submission_handler->handle_recaptcha( $recaptcha_response ); |
88 | 88 | } |
89 | 89 | |
90 | -if ( isset( $data['recaptcha_three_response'] ) ) { |
|
91 | - $submission_handler->handle_recaptcha( $data['recaptcha_three_response'], 3 ); |
|
90 | +if ( isset( $data[ 'recaptcha_three_response' ] ) ) { |
|
91 | + $submission_handler->handle_recaptcha( $data[ 'recaptcha_three_response' ], 3 ); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // Loop through the submitted data to sanitize and format values |
95 | 95 | $merge_variables = $submission_handler->get_submitted_merge_values( $data, $form_fields ); |
96 | 96 | |
97 | 97 | // Submission Setting: Replace interest groups or update interest groups |
98 | -$replace_interests = isset( $submission_settings['replace_interests'] ) ? (bool) $submission_settings['replace_interests'] : true; |
|
98 | +$replace_interests = isset( $submission_settings[ 'replace_interests' ] ) ? (bool) $submission_settings[ 'replace_interests' ] : true; |
|
99 | 99 | |
100 | 100 | // Get the default groups |
101 | 101 | $groups = $submission_handler->get_default_interest_groups( $replace_interests, $list_handler ); |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @param $merge_variables array Array of merge variable to use |
112 | 112 | */ |
113 | -do_action( 'yikes-mailchimp-before-submission', $merge_variables ); |
|
113 | +do_action( 'yikes-mailchimp-before-submission', $merge_variables ); |
|
114 | 114 | do_action( "yikes-mailchimp-before-submission-{$form_id}", $merge_variables ); |
115 | 115 | |
116 | 116 | // Allow users to check for form values (using the `yikes-mailchimp-filter-before-submission` filter hook in function `get_submitted_merge_values`) |
117 | 117 | // and pass back an error and message to the user |
118 | 118 | // If error is set and no message, default to our class variable's default error message |
119 | -if ( isset( $merge_variables['error'] ) ) { |
|
120 | - $merge_error_message = isset( $merge_variables['message'] ) ? $merge_variables['message'] : $submission_handler->default_error_response_message; |
|
121 | - $submission_handler->handle_merge_variables_error( $merge_variables['error'], $merge_error_message ); |
|
119 | +if ( isset( $merge_variables[ 'error' ] ) ) { |
|
120 | + $merge_error_message = isset( $merge_variables[ 'message' ] ) ? $merge_variables[ 'message' ] : $submission_handler->default_error_response_message; |
|
121 | + $submission_handler->handle_merge_variables_error( $merge_variables[ 'error' ], $merge_error_message ); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // This is the array we're going to pass through to the Mailchimp API |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | // Only add groups if they exist |
131 | 131 | if ( ! empty( $groups ) ) { |
132 | - $member_data['interests'] = $groups; |
|
132 | + $member_data[ 'interests' ] = $groups; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | // Check if this member already exists |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | // Likewise, if this member exists but their status is 'pending' it means we're dealing with a double opt-in list and they never confirmed |
141 | 141 | // Or, if this member but their status is 'unsubscribed' it means we're dealing with someone who unsubscribed and they need to re-subscribe |
142 | 142 | // Continue as if they're a new member to force another double opt-in email |
143 | -if ( is_array( $member_exists ) && isset( $member_exists['status'] ) ) { |
|
144 | - $double_optin_resubscribe = $member_exists['status'] === 'pending' || $member_exists['status'] === 'unsubscribed'; |
|
143 | +if ( is_array( $member_exists ) && isset( $member_exists[ 'status' ] ) ) { |
|
144 | + $double_optin_resubscribe = $member_exists[ 'status' ] === 'pending' || $member_exists[ 'status' ] === 'unsubscribed'; |
|
145 | 145 | } else { |
146 | 146 | |
147 | 147 | // If this member doesn't exist, set their timestamp signup to the current time. |
148 | - $member_data['timestamp_signup'] = current_time( 'Y-m-d H:i:s', 1 ); |
|
148 | + $member_data[ 'timestamp_signup' ] = current_time( 'Y-m-d H:i:s', 1 ); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if ( is_wp_error( $member_exists ) || $double_optin_resubscribe === true ) { |
@@ -154,24 +154,24 @@ discard block |
||
154 | 154 | |
155 | 155 | // Check the opt-in value - is it double or single? |
156 | 156 | // Double opt-in means 'status_if_new' => 'pending' |
157 | - $double_optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
157 | + $double_optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
158 | 158 | |
159 | 159 | // If the user was unsubscribed and is re-subscribing, we set the status to 'pending', which |
160 | 160 | // causes Mailchimp to send them a confirmation email. This is the only way Mailchimp will |
161 | 161 | // allow us to re-subscribe the user. |
162 | - $was_unsubscribed = is_array( $member_exists ) && isset( $member_exists['status'] ) && $member_exists['status'] === 'unsubscribed'; |
|
162 | + $was_unsubscribed = is_array( $member_exists ) && isset( $member_exists[ 'status' ] ) && $member_exists[ 'status' ] === 'unsubscribed'; |
|
163 | 163 | $was_unsubscribed = apply_filters( 'yikes_mailchimp_single_resubscribe', $was_unsubscribed ); |
164 | 164 | |
165 | 165 | if ( $double_optin === 1 || $was_unsubscribed === true ) { |
166 | 166 | |
167 | 167 | // Double opt-in |
168 | - $member_data['status_if_new'] = 'pending'; |
|
169 | - $member_data['status'] = 'pending'; |
|
168 | + $member_data[ 'status_if_new' ] = 'pending'; |
|
169 | + $member_data[ 'status' ] = 'pending'; |
|
170 | 170 | } else { |
171 | 171 | |
172 | 172 | // Single opt-in |
173 | - $member_data['status_if_new'] = 'subscribed'; |
|
174 | - $member_data['status'] = 'subscribed'; |
|
173 | + $member_data[ 'status_if_new' ] = 'subscribed'; |
|
174 | + $member_data[ 'status' ] = 'subscribed'; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | } else { |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | |
181 | 181 | // But first let's set our flag, and set the Mailchimp status flag |
182 | 182 | $new_subscriber = false; |
183 | - $member_data['status'] = 'subscribed'; |
|
183 | + $member_data[ 'status' ] = 'subscribed'; |
|
184 | 184 | |
185 | 185 | // Check our update_existing_user optin setting |
186 | - $update_existing_user = ( $optin_settings['update_existing_user'] === '1' ) ? true : false; |
|
186 | + $update_existing_user = ( $optin_settings[ 'update_existing_user' ] === '1' ) ? true : false; |
|
187 | 187 | |
188 | 188 | // If update_existing_user is false (not allowed) then simply fail and return a response message |
189 | 189 | if ( $update_existing_user === false ) { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | // If update_existing_user is true, we need to check our 'send_update_email' option |
194 | - $send_update_email = ( $optin_settings['send_update_email'] === '1' ) ? true : false; |
|
194 | + $send_update_email = ( $optin_settings[ 'send_update_email' ] === '1' ) ? true : false; |
|
195 | 195 | |
196 | 196 | // If $send_update_email is true (we send the email) then we need to fire off the 'send update email' logic |
197 | 197 | if ( $send_update_email === true ) { |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | |
215 | 215 | // If this is the first time subscriber add the tags along with the subscribe request. |
216 | 216 | // This allows for double opt-in forms submissions to be tagged. |
217 | -if ( ! empty( $form_data['tags'] ) && ! is_array( $member_exists ) ) { |
|
218 | - foreach( $form_data['tags'] as $tag ) { |
|
219 | - $member_data['tags'][] = $tag['name']; |
|
217 | +if ( ! empty( $form_data[ 'tags' ] ) && ! is_array( $member_exists ) ) { |
|
218 | + foreach ( $form_data[ 'tags' ] as $tag ) { |
|
219 | + $member_data[ 'tags' ][ ] = $tag[ 'name' ]; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | $error = 0; |
6 | 6 | |
7 | 7 | // Get our $_POST variables |
8 | -$list_id = isset( $_POST['list_id'] ) ? $_POST['list_id'] : ''; |
|
9 | -$interest_groups = isset( $_POST['interest_groups'] ) ? $_POST['interest_groups'] : array(); |
|
8 | +$list_id = isset( $_POST[ 'list_id' ] ) ? $_POST[ 'list_id' ] : ''; |
|
9 | +$interest_groups = isset( $_POST[ 'interest_groups' ] ) ? $_POST[ 'interest_groups' ] : array(); |
|
10 | 10 | |
11 | 11 | // Make sure our $_POST variables aren't empty |
12 | 12 | if ( empty( $list_id ) ) { |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | // Loop through the interest groups data (group_id, field_name, field_type) and add the fields to the form |
52 | -foreach( $interest_groups as $group ) { |
|
52 | +foreach ( $interest_groups as $group ) { |
|
53 | 53 | |
54 | 54 | // find and return the location of this merge field in the array |
55 | - $index = $this->findMCListIndex( $group['group_id'], $interest_groupings, 'id' ); |
|
55 | + $index = $this->findMCListIndex( $group[ 'group_id' ], $interest_groupings, 'id' ); |
|
56 | 56 | $field_data = $interest_groupings[ $index ]; |
57 | - $groups = wp_list_pluck( $field_data['items'], 'name' ); |
|
57 | + $groups = wp_list_pluck( $field_data[ 'items' ], 'name' ); |
|
58 | 58 | |
59 | 59 | ?> |
60 | - <section class="draggable" id="<?php echo $group['group_id']; ?>"> |
|
60 | + <section class="draggable" id="<?php echo $group[ 'group_id' ]; ?>"> |
|
61 | 61 | <!-- top --> |
62 | 62 | <a href="#" class="expansion-section-title settings-sidebar"> |
63 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field' , 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
64 | - <?php echo stripslashes( $group['field_name'] ); ?> |
|
65 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $group['field_type']; ?></small></span> |
|
63 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
64 | + <?php echo stripslashes( $group[ 'field_name' ] ); ?> |
|
65 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $group[ 'field_type' ]; ?></small></span> |
|
66 | 66 | </a> |
67 | 67 | <!-- expansion section --> |
68 | 68 | <div class="yikes-mc-settings-expansion-section"> |
@@ -70,37 +70,37 @@ discard block |
||
70 | 70 | <!-- Single or Double Opt-in --> |
71 | 71 | <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); --> |
72 | 72 | <!-- store the label --> |
73 | - <input type="hidden" name="field[<?php echo $group['group_id']; ?>][label]" value="<?php echo htmlspecialchars( $group['field_name'] ); ?>" /> |
|
74 | - <input type="hidden" name="field[<?php echo $group['group_id']; ?>][type]" value="<?php echo $group['field_type']; ?>" /> |
|
75 | - <input type="hidden" name="field[<?php echo $group['group_id']; ?>][group_id]" value="<?php echo $group['group_id']; ?>" /> |
|
76 | - <input type="hidden" name="field[<?php echo $group['group_id']; ?>][groups]" value='<?php echo esc_attr( json_encode( $groups, true ) ); ?>' /> |
|
73 | + <input type="hidden" name="field[<?php echo $group[ 'group_id' ]; ?>][label]" value="<?php echo htmlspecialchars( $group[ 'field_name' ] ); ?>" /> |
|
74 | + <input type="hidden" name="field[<?php echo $group[ 'group_id' ]; ?>][type]" value="<?php echo $group[ 'field_type' ]; ?>" /> |
|
75 | + <input type="hidden" name="field[<?php echo $group[ 'group_id' ]; ?>][group_id]" value="<?php echo $group[ 'group_id' ]; ?>" /> |
|
76 | + <input type="hidden" name="field[<?php echo $group[ 'group_id' ]; ?>][groups]" value='<?php echo esc_attr( json_encode( $groups, true ) ); ?>' /> |
|
77 | 77 | |
78 | 78 | |
79 | 79 | <table class="form-table form-field-container"> |
80 | 80 | |
81 | 81 | <!-- Default Value --> |
82 | - <?php switch( $group['field_type'] ) { |
|
82 | + <?php switch ( $group[ 'field_type' ] ) { |
|
83 | 83 | |
84 | 84 | case 'radio': |
85 | 85 | ?> |
86 | 86 | <tr valign="top"> |
87 | 87 | <td scope="row"> |
88 | 88 | <label for="placeholder"> |
89 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
89 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
90 | 90 | </label> |
91 | 91 | </td> |
92 | 92 | <td> |
93 | 93 | |
94 | - <?php $pre_selected = ! empty( $field_data['default_choice'] ) ? $field_data['default_choice'] : 'no-default'; ?> |
|
94 | + <?php $pre_selected = ! empty( $field_data[ 'default_choice' ] ) ? $field_data[ 'default_choice' ] : 'no-default'; ?> |
|
95 | 95 | |
96 | 96 | <!-- No Default option for radio buttons --> |
97 | - <input type="radio" name="field[<?php echo $group['group_id']; ?>][default_choice][]" value="no-default" <?php checked( $pre_selected, 'no-default' ); ?>>No Default |
|
97 | + <input type="radio" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice][]" value="no-default" <?php checked( $pre_selected, 'no-default' ); ?>>No Default |
|
98 | 98 | |
99 | - <?php foreach ( $field_data['items'] as $id => $interest_group ) { ?> |
|
100 | - <input type="radio" name="field[<?php echo $group['group_id']; ?>][default_choice][]" value="<?php echo esc_attr( $id ); ?>" <?php checked( $pre_selected, $id ); ?>><?php echo stripslashes( $interest_group['name'] ); |
|
99 | + <?php foreach ( $field_data[ 'items' ] as $id => $interest_group ) { ?> |
|
100 | + <input type="radio" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice][]" value="<?php echo esc_attr( $id ); ?>" <?php checked( $pre_selected, $id ); ?>><?php echo stripslashes( $interest_group[ 'name' ] ); |
|
101 | 101 | } ?> |
102 | 102 | |
103 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
103 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
104 | 104 | </td> |
105 | 105 | </tr> |
106 | 106 | |
@@ -114,22 +114,22 @@ discard block |
||
114 | 114 | <tr valign="top" class="yikes-checkbox-container"> |
115 | 115 | <td scope="row"> |
116 | 116 | <label for="placeholder"> |
117 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
117 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
118 | 118 | </label> |
119 | 119 | </td> |
120 | 120 | <td> |
121 | 121 | <?php |
122 | - foreach ( $field_data['items'] as $id => $interest_group ) { |
|
123 | - $pre_selected = ! empty( $field_data['default_choice'] ) ? $field_data['default_choice'] : '0'; |
|
122 | + foreach ( $field_data[ 'items' ] as $id => $interest_group ) { |
|
123 | + $pre_selected = ! empty( $field_data[ 'default_choice' ] ) ? $field_data[ 'default_choice' ] : '0'; |
|
124 | 124 | ?> |
125 | 125 | <label> |
126 | - <input type="checkbox" name="field[<?php echo $group['group_id']; ?>][default_choice][]" value="<?php echo $id; ?>" <?php checked( $pre_selected, $id ); ?>> |
|
127 | - <?php echo stripslashes( $interest_group['name'] ); ?> |
|
126 | + <input type="checkbox" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice][]" value="<?php echo $id; ?>" <?php checked( $pre_selected, $id ); ?>> |
|
127 | + <?php echo stripslashes( $interest_group[ 'name' ] ); ?> |
|
128 | 128 | </label> |
129 | 129 | <?php |
130 | 130 | } |
131 | 131 | ?> |
132 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
132 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
133 | 133 | </td> |
134 | 134 | </tr> |
135 | 135 | |
@@ -141,30 +141,30 @@ discard block |
||
141 | 141 | <!-- Placeholder --> |
142 | 142 | <tr valign="top"> |
143 | 143 | <td scope="row"> |
144 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
144 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
145 | 145 | <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
146 | 146 | </label> |
147 | 147 | </td> |
148 | 148 | <td> |
149 | - <input type="text" id="placeholder_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="<?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : '' ; ?>" /> |
|
150 | - <p class="description"><small><?php _e( "Assign a placeholder value for the select option.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
149 | + <input type="text" id="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="<?php echo isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : ''; ?>" /> |
|
150 | + <p class="description"><small><?php _e( "Assign a placeholder value for the select option.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
151 | 151 | </td> |
152 | 152 | </tr> |
153 | 153 | <tr valign="top"> |
154 | 154 | <td scope="row"> |
155 | 155 | <label for="placeholder"> |
156 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
156 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
157 | 157 | </label> |
158 | 158 | </td> |
159 | 159 | <td> |
160 | - <select type="default" name="field[<?php echo $group['group_id']; ?>][default_choice]"> |
|
161 | - <?php $pre_selected = ! empty( $field_data['default_choice'] ) ? $field_data['default_choice'] : 'no-default'; ?> |
|
160 | + <select type="default" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice]"> |
|
161 | + <?php $pre_selected = ! empty( $field_data[ 'default_choice' ] ) ? $field_data[ 'default_choice' ] : 'no-default'; ?> |
|
162 | 162 | <option value="no-default">No Default</option> |
163 | - <?php foreach ( $field_data['items'] as $id => $interest_group ) { ?> |
|
164 | - <option value="<?php echo $id; ?>" <?php selected( $pre_selected, $id ); ?>><?php echo $interest_group['name']; ?></option> |
|
163 | + <?php foreach ( $field_data[ 'items' ] as $id => $interest_group ) { ?> |
|
164 | + <option value="<?php echo $id; ?>" <?php selected( $pre_selected, $id ); ?>><?php echo $interest_group[ 'name' ]; ?></option> |
|
165 | 165 | <?php } ?> |
166 | 166 | </select> |
167 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
167 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
168 | 168 | </td> |
169 | 169 | </tr> |
170 | 170 | |
@@ -176,25 +176,25 @@ discard block |
||
176 | 176 | <tr valign="top"> |
177 | 177 | <td scope="row"> |
178 | 178 | <label for="placeholder"> |
179 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
179 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
180 | 180 | </label> |
181 | 181 | </td> |
182 | 182 | <td> |
183 | - <textarea class="widefat field-description-input" name="field[<?php echo $group['group_id']; ?>][description]"></textarea> |
|
184 | - <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> |
|
183 | + <textarea class="widefat field-description-input" name="field[<?php echo $group[ 'group_id' ]; ?>][description]"></textarea> |
|
184 | + <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> |
|
185 | 185 | </td> |
186 | 186 | </tr> |
187 | 187 | |
188 | 188 | <!-- Description Above Field --> |
189 | 189 | <tr valign="top" class="yikes-checkbox-container"> |
190 | 190 | <td scope="row"> |
191 | - <label for="description_above_<?php echo esc_attr( $group['group_id'] ); ?>"> |
|
192 | - <?php _e( 'Description Above Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
191 | + <label for="description_above_<?php echo esc_attr( $group[ 'group_id' ] ); ?>"> |
|
192 | + <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
193 | 193 | </label> |
194 | 194 | </td> |
195 | 195 | <td> |
196 | - <input type="checkbox" id="description_above_<?php echo esc_attr( $group['group_id'] ); ?>" class="widefat field-description-input" name="field[<?php echo $group['group_id']; ?>][description_above]" value="1" /> |
|
197 | - <p class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
196 | + <input type="checkbox" id="description_above_<?php echo esc_attr( $group[ 'group_id' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $group[ 'group_id' ]; ?>][description_above]" value="1" /> |
|
197 | + <p class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
198 | 198 | </td> |
199 | 199 | </tr> |
200 | 200 | |
@@ -202,48 +202,48 @@ discard block |
||
202 | 202 | <tr valign="top"> |
203 | 203 | <td scope="row"> |
204 | 204 | <label for="placeholder"> |
205 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
205 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
206 | 206 | </label> |
207 | 207 | </td> |
208 | 208 | <td> |
209 | - <input type="text" class="widefat" name="field[<?php echo $group['group_id']; ?>][additional-classes]" value="<?php echo isset( $group['classes'] ) ? stripslashes( wp_strip_all_tags( $group['classes'] ) ) : '' ; ?>" /> |
|
210 | - <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> |
|
209 | + <input type="text" class="widefat" name="field[<?php echo $group[ 'group_id' ]; ?>][additional-classes]" value="<?php echo isset( $group[ 'classes' ] ) ? stripslashes( wp_strip_all_tags( $group[ 'classes' ] ) ) : ''; ?>" /> |
|
210 | + <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> |
|
211 | 211 | </td> |
212 | 212 | </tr> |
213 | 213 | <!-- Required Toggle --> |
214 | 214 | <tr valign="top" class="yikes-checkbox-container"> |
215 | 215 | <td scope="row"> |
216 | 216 | <label for="field-required"> |
217 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
217 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
218 | 218 | </label> |
219 | 219 | </td> |
220 | 220 | <td> |
221 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group['group_id']; ?>][require]"> |
|
222 | - <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> |
|
221 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group[ 'group_id' ]; ?>][require]"> |
|
222 | + <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> |
|
223 | 223 | </td> |
224 | 224 | </tr> |
225 | 225 | <!-- Visible Toggle --> |
226 | 226 | <tr valign="top" class="yikes-checkbox-container"> |
227 | 227 | <td scope="row"> |
228 | 228 | <label for="hide-field"> |
229 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
229 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
230 | 230 | </label> |
231 | 231 | </td> |
232 | 232 | <td> |
233 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group['group_id']; ?>][hide]"> |
|
234 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
233 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group[ 'group_id' ]; ?>][hide]"> |
|
234 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
235 | 235 | </td> |
236 | 236 | </tr> |
237 | 237 | <!-- Toggle Field Label Visibility --> |
238 | 238 | <tr valign="top" class="yikes-checkbox-container"> |
239 | 239 | <td scope="row"> |
240 | 240 | <label for="placeholder"> |
241 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
241 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
242 | 242 | </label> |
243 | 243 | </td> |
244 | 244 | <td> |
245 | - <input type="checkbox" name="field[<?php echo $group['group_id']; ?>][hide-label]" value="1" /> |
|
246 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
245 | + <input type="checkbox" name="field[<?php echo $group[ 'group_id' ]; ?>][hide-label]" value="1" /> |
|
246 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
247 | 247 | </td> |
248 | 248 | </tr> |
249 | 249 | <!-- Toggle Buttons --> |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | </td> |
254 | 254 | <td> |
255 | 255 | <span class="toggle-container"> |
256 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
257 | - <a href="#" class="remove-field" alt="<?php echo $group['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
256 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
257 | + <a href="#" class="remove-field" alt="<?php echo $group[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
258 | 258 | </span> |
259 | 259 | </td> |
260 | 260 | </tr> |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $form_data = array( |
3 | - 'field_name' => $_POST['field_name'], |
|
4 | - 'merge_tag' => $_POST['merge_tag'], |
|
5 | - 'field_type' => $_POST['field_type'], |
|
6 | - 'list_id' => $_POST['list_id'], |
|
3 | + 'field_name' => $_POST[ 'field_name' ], |
|
4 | + 'merge_tag' => $_POST[ 'merge_tag' ], |
|
5 | + 'field_type' => $_POST[ 'field_type' ], |
|
6 | + 'list_id' => $_POST[ 'list_id' ], |
|
7 | 7 | ); |
8 | 8 | |
9 | 9 | // Grab our list handler. |
10 | 10 | $list_handler = yikes_get_mc_api_manager()->get_list_handler(); |
11 | 11 | |
12 | -$available_merge_variables = $list_handler->get_merge_fields( $form_data['list_id'] ); |
|
12 | +$available_merge_variables = $list_handler->get_merge_fields( $form_data[ 'list_id' ] ); |
|
13 | 13 | if ( is_wp_error( $available_merge_variables ) ) { |
14 | 14 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
15 | 15 | $error_logging->maybe_write_to_log( |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | // find and return the location of this merge field in the array |
31 | -$index = $this->findMCListIndex( $form_data['merge_tag'], $available_merge_variables['merge_fields'], 'tag' ); |
|
31 | +$index = $this->findMCListIndex( $form_data[ 'merge_tag' ], $available_merge_variables[ 'merge_fields' ], 'tag' ); |
|
32 | 32 | |
33 | 33 | // store it and use it to pre-populate field data (only on initial add to form) |
34 | -$merge_field_data = $available_merge_variables['merge_fields'][ $index ]; |
|
34 | +$merge_field_data = $available_merge_variables[ 'merge_fields' ][ $index ]; |
|
35 | 35 | ?> |
36 | -<section class="draggable" id="<?php echo $form_data['field_name']; ?>"> |
|
36 | +<section class="draggable" id="<?php echo $form_data[ 'field_name' ]; ?>"> |
|
37 | 37 | <!-- top --> |
38 | 38 | <a href="#" class="expansion-section-title settings-sidebar"> |
39 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field' , 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
40 | - <?php echo stripslashes( $form_data['field_name'] ); ?> |
|
41 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data['field_type']; ?></small></span> |
|
39 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
40 | + <?php echo stripslashes( $form_data[ 'field_name' ] ); ?> |
|
41 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data[ 'field_type' ]; ?></small></span> |
|
42 | 42 | </a> |
43 | 43 | <!-- expansion section --> |
44 | 44 | <div class="yikes-mc-settings-expansion-section"> |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | <!-- Single or Double Opt-in --> |
47 | 47 | <p class="type-container form-field-container"><!-- necessary to prevent skipping on slideToggle(); --> |
48 | 48 | <!-- store the label --> |
49 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][label]" value="<?php echo htmlspecialchars( $form_data['field_name'] ); ?>" /> |
|
50 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][type]" value="<?php echo $form_data['field_type']; ?>" /> |
|
51 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][merge]" value="<?php echo $merge_field_data['tag']; ?>" /> |
|
52 | - <input type="hidden" class="field-<?php echo $merge_field_data['tag']; ?>-position position-input" name="field[<?php echo $merge_field_data['tag']; ?>][position]" value="" /> |
|
49 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][label]" value="<?php echo htmlspecialchars( $form_data[ 'field_name' ] ); ?>" /> |
|
50 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][type]" value="<?php echo $form_data[ 'field_type' ]; ?>" /> |
|
51 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][merge]" value="<?php echo $merge_field_data[ 'tag' ]; ?>" /> |
|
52 | + <input type="hidden" class="field-<?php echo $merge_field_data[ 'tag' ]; ?>-position position-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][position]" value="" /> |
|
53 | 53 | |
54 | - <?php if ( $form_data['field_type'] == 'radio' || $form_data['field_type'] == 'dropdown' ) { ?> |
|
55 | - <?php $choices = ( isset( $merge_field_data['options']['choices'] ) ) ? esc_attr( json_encode( $merge_field_data['options']['choices'] ) ) : ''; ?> |
|
56 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][choices]" value='<?php echo $choices; ?>' /> |
|
54 | + <?php if ( $form_data[ 'field_type' ] == 'radio' || $form_data[ 'field_type' ] == 'dropdown' ) { ?> |
|
55 | + <?php $choices = ( isset( $merge_field_data[ 'options' ][ 'choices' ] ) ) ? esc_attr( json_encode( $merge_field_data[ 'options' ][ 'choices' ] ) ) : ''; ?> |
|
56 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][choices]" value='<?php echo $choices; ?>' /> |
|
57 | 57 | <?php } ?> |
58 | 58 | |
59 | 59 | <table class="form-table form-field-container"> |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | <tr valign="top"> |
63 | 63 | <td scope="row"> |
64 | 64 | <label for="merge-tag"> |
65 | - <?php _e( 'Merge Tag' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
65 | + <?php _e( 'Merge Tag', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
66 | 66 | </label> |
67 | 67 | </td> |
68 | 68 | <td> |
69 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $merge_field_data['tag']; ?>"> |
|
69 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $merge_field_data[ 'tag' ]; ?>"> |
|
70 | 70 | </td> |
71 | 71 | </tr> |
72 | 72 | |
73 | - <?php switch( $form_data['field_type'] ) { |
|
73 | + <?php switch ( $form_data[ 'field_type' ] ) { |
|
74 | 74 | |
75 | 75 | default: |
76 | 76 | break; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | <tr valign="top"> |
88 | 88 | <td scope="row"> |
89 | 89 | <label for="placeholder"> |
90 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
90 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
91 | 91 | </label> |
92 | 92 | </td> |
93 | 93 | <td> |
94 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][placeholder]" value="<?php echo isset( $merge_field_data['placeholder'] ) ? stripslashes( wp_strip_all_tags( $merge_field_data['placeholder'] ) ): '' ; ?>" /> |
|
95 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
94 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][placeholder]" value="<?php echo isset( $merge_field_data[ 'placeholder' ] ) ? stripslashes( wp_strip_all_tags( $merge_field_data[ 'placeholder' ] ) ) : ''; ?>" /> |
|
95 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
96 | 96 | </td> |
97 | 97 | </tr> |
98 | 98 | |
@@ -101,27 +101,27 @@ discard block |
||
101 | 101 | * Loop over field types and store necessary formats |
102 | 102 | * ( date, birthday - dateformat ; phone - phoneformat ) |
103 | 103 | */ |
104 | - switch( $form_data['field_type'] ) { |
|
104 | + switch ( $form_data[ 'field_type' ] ) { |
|
105 | 105 | |
106 | 106 | /* Store the date format, for properly rendering dates on the front end */ |
107 | 107 | case 'date': |
108 | - $date_format = isset( $merge_field_data['options']['dateformat'] ) ? $merge_field_data['options']['dateformat'] : 'MM/DD/YYYY'; |
|
108 | + $date_format = isset( $merge_field_data[ 'options' ][ 'dateformat' ] ) ? $merge_field_data[ 'options' ][ 'dateformat' ] : 'MM/DD/YYYY'; |
|
109 | 109 | ?> |
110 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
110 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
111 | 111 | <?php |
112 | 112 | break; |
113 | 113 | |
114 | 114 | case 'birthday': |
115 | - $date_format = isset( $merge_field_data['options']['dateformat'] ) ? $merge_field_data['options']['dateformat'] : 'MM/DD'; |
|
115 | + $date_format = isset( $merge_field_data[ 'options' ][ 'dateformat' ] ) ? $merge_field_data[ 'options' ][ 'dateformat' ] : 'MM/DD'; |
|
116 | 116 | ?> |
117 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
117 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
118 | 118 | <?php |
119 | 119 | break; |
120 | 120 | |
121 | 121 | /* Store the phone format, for properly regex pattern */ |
122 | 122 | case 'phone': |
123 | 123 | ?> |
124 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][phone_format]" value="<?php echo $merge_field_data['options']['phone_format']; ?>" /> |
|
124 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][phone_format]" value="<?php echo $merge_field_data[ 'options' ][ 'phone_format' ]; ?>" /> |
|
125 | 125 | <?php |
126 | 126 | break; |
127 | 127 | } |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | ?> |
133 | 133 | <tr valign="top"> |
134 | 134 | <td scope="row"> |
135 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
136 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
135 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
136 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
137 | 137 | </label> |
138 | 138 | </td> |
139 | 139 | <td> |
140 | - <input type="checkbox" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][placeholder]" value="1" /> |
|
141 | - <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
140 | + <input type="checkbox" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][placeholder]" value="1" /> |
|
141 | + <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | 144 | <?php |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ?> |
149 | 149 | |
150 | 150 | <!-- Default Value --> |
151 | - <?php switch( $form_data['field_type'] ) { |
|
151 | + <?php switch ( $form_data[ 'field_type' ] ) { |
|
152 | 152 | |
153 | 153 | default: |
154 | 154 | case 'text': |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | <tr valign="top"> |
157 | 157 | <td scope="row"> |
158 | 158 | <label for="placeholder"> |
159 | - <?php _e( 'Default Value' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
159 | + <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
160 | 160 | </label> |
161 | 161 | </td> |
162 | 162 | <td> |
163 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][default]" <?php if( $form_data['field_type'] != 'url' ) { ?> value="<?php echo isset( $merge_field_data['default_value'] ) ? stripslashes( wp_strip_all_tags( $merge_field_data['default_value'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data['default_value'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data['default_value'] ) ) ) : ''; } ?>" /> |
|
164 | - <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> |
|
163 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default]" <?php if ( $form_data[ 'field_type' ] != 'url' ) { ?> value="<?php echo isset( $merge_field_data[ 'default_value' ] ) ? stripslashes( wp_strip_all_tags( $merge_field_data[ 'default_value' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data[ 'default_value' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data[ 'default_value' ] ) ) ) : ''; } ?>" /> |
|
164 | + <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> |
|
165 | 165 | <?php |
166 | - switch ( $form_data['field_type'] ) { |
|
166 | + switch ( $form_data[ 'field_type' ] ) { |
|
167 | 167 | case 'text': |
168 | 168 | ?> |
169 | - <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" class="thickbox" onclick="storeGlobalClicked( jQuery( this ) );"><?php _e( 'View Pre-Defined Tags' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
169 | + <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" class="thickbox" onclick="storeGlobalClicked( jQuery( this ) );"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
170 | 170 | <?php |
171 | 171 | break; |
172 | 172 | } ?> |
@@ -180,28 +180,28 @@ discard block |
||
180 | 180 | <tr valign="top"> |
181 | 181 | <td scope="row"> |
182 | 182 | <label for="placeholder"> |
183 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
183 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
184 | 184 | </label> |
185 | 185 | </td> |
186 | 186 | <td> |
187 | - <?php $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : 'no-default'; ?> |
|
188 | - <label for="<?php echo $merge_field_data['tag'] . '-no-default'; ?>"> |
|
189 | - <input id="<?php echo $merge_field_data['tag'] . '-no-default'; ?>" |
|
187 | + <?php $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : 'no-default'; ?> |
|
188 | + <label for="<?php echo $merge_field_data[ 'tag' ] . '-no-default'; ?>"> |
|
189 | + <input id="<?php echo $merge_field_data[ 'tag' ] . '-no-default'; ?>" |
|
190 | 190 | type="radio" |
191 | - name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" |
|
191 | + name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]" |
|
192 | 192 | value="no-default" <?php checked( $pre_selected, 'no-default' ); ?> |
193 | 193 | > |
194 | 194 | No Default |
195 | 195 | </label> |
196 | 196 | <?php |
197 | 197 | $x = 0; |
198 | - foreach ( $merge_field_data['options']['choices'] as $choice => $value ) { ?> |
|
198 | + foreach ( $merge_field_data[ 'options' ][ 'choices' ] as $choice => $value ) { ?> |
|
199 | 199 | <label> |
200 | - <input type="radio" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $pre_selected, $choice ); ?>><?php echo $value; ?> |
|
200 | + <input type="radio" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $pre_selected, $choice ); ?>><?php echo $value; ?> |
|
201 | 201 | </label> |
202 | 202 | <?php $x++; |
203 | 203 | } ?> |
204 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
204 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
205 | 205 | </td> |
206 | 206 | </tr> |
207 | 207 | |
@@ -214,30 +214,30 @@ discard block |
||
214 | 214 | <tr valign="top"> |
215 | 215 | <td scope="row"> |
216 | 216 | <label for="placeholder"> |
217 | - <?php _e( 'Default Value' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
217 | + <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
218 | 218 | </label> |
219 | 219 | </td> |
220 | 220 | <td> |
221 | - <input type="text" id="placeholder_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="<?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : '' ; ?>" /> |
|
222 | - <p class="description"><small><?php _e( "Assign a default value to populate a placeholder for selection drop-down", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
221 | + <input type="text" id="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="<?php echo isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : ''; ?>" /> |
|
222 | + <p class="description"><small><?php _e( "Assign a default value to populate a placeholder for selection drop-down", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
223 | 223 | </td> |
224 | 224 | </tr> |
225 | 225 | |
226 | 226 | <tr valign="top"> |
227 | 227 | <td scope="row"> |
228 | 228 | <label for="placeholder"> |
229 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
229 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
230 | 230 | </label> |
231 | 231 | </td> |
232 | 232 | <td> |
233 | - <select type="default" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]"> |
|
234 | - <?php $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : 'no-default'; ?> |
|
233 | + <select type="default" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]"> |
|
234 | + <?php $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : 'no-default'; ?> |
|
235 | 235 | <option value="no-default" <?php selected( $pre_selected, $choice ); ?>>No Default</option> |
236 | - <?php foreach ( $merge_field_data['options']['choices'] as $choice => $value ) { ?> |
|
236 | + <?php foreach ( $merge_field_data[ 'options' ][ 'choices' ] as $choice => $value ) { ?> |
|
237 | 237 | <option value="<?php echo $choice; ?>" <?php selected( $pre_selected, $choice ); ?>><?php echo stripslashes( $value ); ?></option> |
238 | 238 | <?php } ?> |
239 | 239 | </select> |
240 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
240 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
241 | 241 | </td> |
242 | 242 | </tr> |
243 | 243 | |
@@ -250,77 +250,77 @@ discard block |
||
250 | 250 | <tr valign="top"> |
251 | 251 | <td scope="row"> |
252 | 252 | <label for="placeholder"> |
253 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
253 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
254 | 254 | </label> |
255 | 255 | </td> |
256 | 256 | <td> |
257 | - <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data['tag']; ?>][description]"></textarea> |
|
258 | - <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> |
|
257 | + <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][description]"></textarea> |
|
258 | + <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> |
|
259 | 259 | </td> |
260 | 260 | </tr> |
261 | 261 | <!-- Description Above Field --> |
262 | 262 | <tr valign="top" class="yikes-checkbox-container"> |
263 | 263 | <td scope="row"> |
264 | - <label for="description_above_<?php echo esc_attr( $merge_field_data['tag'] ); ?>"> |
|
265 | - <?php _e( 'Description Above Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
264 | + <label for="description_above_<?php echo esc_attr( $merge_field_data[ 'tag' ] ); ?>"> |
|
265 | + <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
266 | 266 | </label> |
267 | 267 | </td> |
268 | 268 | <td> |
269 | - <input type="checkbox" id="description_above_<?php echo esc_attr( $merge_field_data['tag'] ); ?>" class="widefat field-description-input" name="field[<?php echo $merge_field_data['tag']; ?>][description_above]" value="1" /> |
|
270 | - <p class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
269 | + <input type="checkbox" id="description_above_<?php echo esc_attr( $merge_field_data[ 'tag' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][description_above]" value="1" /> |
|
270 | + <p class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
271 | 271 | </td> |
272 | 272 | </tr> |
273 | 273 | <!-- Additional Classes --> |
274 | 274 | <tr valign="top"> |
275 | 275 | <td scope="row"> |
276 | 276 | <label for="placeholder"> |
277 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
277 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
278 | 278 | </label> |
279 | 279 | </td> |
280 | 280 | <td> |
281 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][additional-classes]" value="<?php echo isset( $form_data['classes'] ) ? stripslashes( wp_strip_all_tags( $form_data['classes'] ) ) : '' ; ?>" /> |
|
282 | - <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> |
|
281 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][additional-classes]" value="<?php echo isset( $form_data[ 'classes' ] ) ? stripslashes( wp_strip_all_tags( $form_data[ 'classes' ] ) ) : ''; ?>" /> |
|
282 | + <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> |
|
283 | 283 | </td> |
284 | 284 | </tr> |
285 | 285 | <!-- Required Toggle --> |
286 | 286 | <tr valign="top" class="yikes-checkbox-container"> |
287 | 287 | <td scope="row"> |
288 | 288 | <label for="field-required"> |
289 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
289 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
290 | 290 | </label> |
291 | 291 | </td> |
292 | 292 | <td> |
293 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][require]" <?php checked( $merge_field_data['required'], 1 ); ?> <?php if( $merge_field_data['tag'] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
294 | - <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> |
|
293 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][require]" <?php checked( $merge_field_data[ 'required' ], 1 ); ?> <?php if ( $merge_field_data[ 'tag' ] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
294 | + <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> |
|
295 | 295 | </td> |
296 | 296 | </tr> |
297 | 297 | <!-- Visible Toggle --> |
298 | 298 | <tr valign="top" class="yikes-checkbox-container"> |
299 | 299 | <td scope="row"> |
300 | 300 | <label for="hide-field"> |
301 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
301 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
302 | 302 | </label> |
303 | 303 | </td> |
304 | 304 | <td> |
305 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][hide]" <?php checked( $merge_field_data['public'], '' ); ?> <?php if( $merge_field_data['tag'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
306 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
305 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide]" <?php checked( $merge_field_data[ 'public' ], '' ); ?> <?php if ( $merge_field_data[ 'tag' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
306 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
307 | 307 | </td> |
308 | 308 | </tr> |
309 | 309 | <!-- Toggle Field Label Visibility --> |
310 | 310 | <tr valign="top" class="yikes-checkbox-container"> |
311 | 311 | <td scope="row"> |
312 | 312 | <label for="placeholder"> |
313 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
313 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
314 | 314 | </label> |
315 | 315 | </td> |
316 | 316 | <td> |
317 | - <input type="checkbox" name="field[<?php echo $merge_field_data['tag']; ?>][hide-label]" value="1" /> |
|
318 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
317 | + <input type="checkbox" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide-label]" value="1" /> |
|
318 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
319 | 319 | </td> |
320 | 320 | </tr> |
321 | 321 | <!-- Display Phone/Date Formats back to the user --> |
322 | 322 | <?php |
323 | - switch( $form_data['field_type'] ) { |
|
323 | + switch ( $form_data[ 'field_type' ] ) { |
|
324 | 324 | |
325 | 325 | /* Store the phone format, for properly regex pattern */ |
326 | 326 | case 'phone': |
@@ -331,23 +331,23 @@ discard block |
||
331 | 331 | <td scope="row"> |
332 | 332 | <label for="placeholder"> |
333 | 333 | <?php |
334 | - switch( $form_data['field_type'] ) { |
|
334 | + switch ( $form_data[ 'field_type' ] ) { |
|
335 | 335 | default: |
336 | 336 | case 'birthday': |
337 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
338 | - $format = $merge_field_data['options']['date_format']; |
|
337 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
338 | + $format = $merge_field_data[ 'options' ][ 'date_format' ]; |
|
339 | 339 | $format_name = 'date_format'; |
340 | 340 | break; |
341 | 341 | |
342 | 342 | case 'date': |
343 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
344 | - $format = $merge_field_data['options']['date_format']; |
|
343 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
344 | + $format = $merge_field_data[ 'options' ][ 'date_format' ]; |
|
345 | 345 | $format_name = 'date_format'; |
346 | 346 | break; |
347 | 347 | |
348 | 348 | case 'phone': |
349 | - $type = __( 'Phone Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
350 | - $format = ( ( $merge_field_data['options']['phone_format'] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data['options']['phone_format'] ); |
|
349 | + $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
350 | + $format = ( ( $merge_field_data[ 'options' ][ 'phone_format' ] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data[ 'options' ][ 'phone_format' ] ); |
|
351 | 351 | $format_name = 'phone_format'; |
352 | 352 | break; |
353 | 353 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | </td> |
358 | 358 | <td> |
359 | 359 | <strong><?php echo $format; ?></strong> |
360 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
360 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
361 | 361 | <p class="description"><small> |
362 | 362 | <?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' ) ); ?> |
363 | 363 | </small></p> |
@@ -378,8 +378,8 @@ discard block |
||
378 | 378 | </td> |
379 | 379 | <td> |
380 | 380 | <span class="toggle-container"> |
381 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
382 | - <a href="#" class="remove-field" alt="<?php echo $merge_field_data['tag']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
381 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
382 | + <a href="#" class="remove-field" alt="<?php echo $merge_field_data[ 'tag' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
383 | 383 | </span> |
384 | 384 | </td> |
385 | 385 | </tr> |
@@ -5,26 +5,26 @@ |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
10 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
11 | - $field_data = $form_data['custom_fields']; |
|
8 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
10 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
11 | + $field_data = $form_data[ 'custom_fields' ]; |
|
12 | 12 | } |
13 | 13 | ?> |
14 | 14 | <div class="custom-field-section"> |
15 | 15 | <!-- title --> |
16 | - <strong><?php echo $field['label']; ?></strong> |
|
16 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
17 | 17 | |
18 | 18 | <!-- Dropdown --> |
19 | - <select class="custom-select-field" name="custom-field[<?php echo $field['id']; ?>]"> |
|
20 | - <option value="" disabled selected><?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : 'Select...'; ?></option> |
|
21 | - <?php foreach( $field['options'] as $value => $label ) { ?> |
|
22 | - <option value="<?php echo $value; ?>" <?php if( isset( $field_data[$field['id']] ) ) { selected( $field_data[$field['id']] , $value ); } ?>><?php echo $label; ?></option> |
|
19 | + <select class="custom-select-field" name="custom-field[<?php echo $field[ 'id' ]; ?>]"> |
|
20 | + <option value="" disabled selected><?php echo isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : 'Select...'; ?></option> |
|
21 | + <?php foreach ( $field[ 'options' ] as $value => $label ) { ?> |
|
22 | + <option value="<?php echo $value; ?>" <?php if ( isset( $field_data[ $field[ 'id' ] ] ) ) { selected( $field_data[ $field[ 'id' ] ], $value ); } ?>><?php echo $label; ?></option> |
|
23 | 23 | <?php } ?> |
24 | 24 | </select> |
25 | 25 | |
26 | 26 | <!-- description --> |
27 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
28 | - <p class="description"><?php echo $field['description']; ?></p> |
|
27 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
28 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
29 | 29 | <?php } ?> |
30 | 30 | </div> |
31 | 31 | \ No newline at end of file |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | // Convert the integration type to a list ID. |
48 | 48 | $checkbox_options = get_option( 'optin-checkbox-init', '' ); |
49 | - if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) { |
|
49 | + if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ][ 'associated-list' ] ) ) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $list_ids = $checkbox_options[ $type ]['associated-list']; |
|
53 | + $list_ids = $checkbox_options[ $type ][ 'associated-list' ]; |
|
54 | 54 | $list_ids = is_array( $list_ids ) ? $list_ids : array( $list_ids ); |
55 | 55 | |
56 | 56 | // Go through each list... |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $data = $response->get_error_data(); |
85 | 85 | |
86 | 86 | // If the error response is a 404, they are not subscribed. |
87 | - if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) { |
|
87 | + if ( isset( $data[ 'status' ] ) && 404 === (int) $data[ 'status' ] ) { |
|
88 | 88 | return false; |
89 | 89 | } else { |
90 | 90 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | // Look at the status from the API. |
103 | - $subscribed = 'subscribed' === $response['status']; |
|
103 | + $subscribed = 'subscribed' === $response[ 'status' ]; |
|
104 | 104 | |
105 | 105 | return apply_filters( 'yikes-mailchimp-integration-is-user-subscribed', $subscribed, $type ); |
106 | 106 | } |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | |
115 | 115 | // Get our options. |
116 | 116 | $checkbox_options = get_option( 'optin-checkbox-init', array() ); |
117 | - $has_list_ids = isset( $checkbox_options[ $this->type ]['associated-list'] ) && '-' !== $checkbox_options[ $this->type ]['associated-list'] && is_array( $checkbox_options[ $this->type ]['associated-list'] ); |
|
118 | - $has_list_ids = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ]['associated-list'], true ); |
|
117 | + $has_list_ids = isset( $checkbox_options[ $this->type ][ 'associated-list' ] ) && '-' !== $checkbox_options[ $this->type ][ 'associated-list' ] && is_array( $checkbox_options[ $this->type ][ 'associated-list' ] ); |
|
118 | + $has_list_ids = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ][ 'associated-list' ], true ); |
|
119 | 119 | |
120 | 120 | if ( $has_list_ids ) { |
121 | - $label = isset( $checkbox_options[ $this->type ]['label'] ) && ! empty( $checkbox_options[ $this->type ]['label'] ) ? trim( $checkbox_options[ $this->type ]['label'] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); |
|
122 | - $checked = 'true' === $checkbox_options[ $this->type ]['precheck'] ? 'checked="checked"' : ''; |
|
121 | + $label = isset( $checkbox_options[ $this->type ][ 'label' ] ) && ! empty( $checkbox_options[ $this->type ][ 'label' ] ) ? trim( $checkbox_options[ $this->type ][ 'label' ] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); |
|
122 | + $checked = 'true' === $checkbox_options[ $this->type ][ 'precheck' ] ? 'checked="checked"' : ''; |
|
123 | 123 | $before = apply_filters( 'yikes-mailchimp-before-checkbox-html', '' ); |
124 | 124 | $content = '<p id="yikes-easy-mailchimp-' . esc_attr( $this->type ) . '-checkbox" class="yikes-easy-mailchimp-' . esc_attr( $this->type ) . '-checkbox">'; |
125 | 125 | $content .= '<label>'; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $options = get_option( 'optin-checkbox-init', '' ); |
150 | 150 | |
151 | 151 | // Make sure we have a list ID. |
152 | - if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) { |
|
152 | + if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ][ 'associated-list' ] ) ) { |
|
153 | 153 | // @todo: Throw some kind of error? |
154 | 154 | return; |
155 | 155 | } |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | $email = sanitize_email( $email ); |
158 | 158 | |
159 | 159 | // Check for an IP address. |
160 | - $user_ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); |
|
161 | - if ( isset( $merge_vars['OPTIN_IP'] ) ) { |
|
162 | - $user_ip = sanitize_text_field( $merge_vars['OPTIN_IP'] ); |
|
160 | + $user_ip = sanitize_text_field( $_SERVER[ 'REMOTE_ADDR' ] ); |
|
161 | + if ( isset( $merge_vars[ 'OPTIN_IP' ] ) ) { |
|
162 | + $user_ip = sanitize_text_field( $merge_vars[ 'OPTIN_IP' ] ); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | // Build our request data. |
166 | - $list_ids = $options[ $type ]['associated-list']; |
|
167 | - $list_ids = is_array( $options[ $type ]['associated-list'] ) ? $options[ $type ]['associated-list'] : array( $options[ $type ]['associated-list'] ); |
|
166 | + $list_ids = $options[ $type ][ 'associated-list' ]; |
|
167 | + $list_ids = is_array( $options[ $type ][ 'associated-list' ] ) ? $options[ $type ][ 'associated-list' ] : array( $options[ $type ][ 'associated-list' ] ); |
|
168 | 168 | $id = md5( $email ); |
169 | 169 | $data = array( |
170 | 170 | 'email_address' => $email, |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | foreach ( $list_ids as $list_id ) { |
178 | 178 | |
179 | - $interests = isset( $options[ $type ]['interest-groups'] ) ? $options[ $type ]['interest-groups'] : array(); |
|
179 | + $interests = isset( $options[ $type ][ 'interest-groups' ] ) ? $options[ $type ][ 'interest-groups' ] : array(); |
|
180 | 180 | $interests = isset( $interests[ $list_id ] ) ? $interests[ $list_id ] : $interests; |
181 | 181 | |
182 | 182 | // Only re-format and add interest groups if not empty. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - $data['interests'] = $groups; |
|
195 | + $data[ 'interests' ] = $groups; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | $list_id = apply_filters( 'yikes-mailchimp-checkbox-integration-list-id', $list_id, $data, $type, $integration_vars ); |
219 | 219 | |
220 | 220 | // Don't send an empty merge fields array. |
221 | - if ( empty( $data['merge_fields'] ) ) { |
|
222 | - unset( $data['merge_fields'] ); |
|
221 | + if ( empty( $data[ 'merge_fields' ] ) ) { |
|
222 | + unset( $data[ 'merge_fields' ] ); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | // Subscribe the user to the list via the API. |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | $merge_vars = array(); |
250 | 250 | |
251 | 251 | if ( ! empty( $user->first_name ) ) { |
252 | - $merge_vars['FNAME'] = $user->first_name; |
|
252 | + $merge_vars[ 'FNAME' ] = $user->first_name; |
|
253 | 253 | } |
254 | 254 | if ( ! empty( $user->last_name ) ) { |
255 | - $merge_vars['LNAME'] = $user->last_name; |
|
255 | + $merge_vars[ 'LNAME' ] = $user->last_name; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * Main Checkbox Integration class. |
11 | 11 | */ |
12 | -class Yikes_Easy_MC_Checkbox_Integration_Class { |
|
12 | +class Yikes_Easy_MC_Checkbox_Integration_Class { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * The integration type. |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return bool Whether the current user is subscribed to a list. |
30 | 30 | */ |
31 | - public function is_user_already_subscribed( $type, $email = '' ) { |
|
31 | + public function is_user_already_subscribed( $type, $email = '' ) { |
|
32 | 32 | // Make sure we have an email address to use. |
33 | - if ( empty( $email ) ) { |
|
34 | - if ( ! is_user_logged_in() ) { |
|
33 | + if ( empty( $email ) ) { |
|
34 | + if ( ! is_user_logged_in() ) { |
|
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | // Ensure we have a valid email. |
43 | - if ( ! is_email( $email ) ) { |
|
43 | + if ( ! is_email( $email ) ) { |
|
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Convert the integration type to a list ID. |
48 | 48 | $checkbox_options = get_option( 'optin-checkbox-init', '' ); |
49 | - if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) { |
|
49 | + if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | $list_ids = is_array( $list_ids ) ? $list_ids : array( $list_ids ); |
55 | 55 | |
56 | 56 | // Go through each list... |
57 | - foreach ( $list_ids as $list_id ) { |
|
58 | - if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) { |
|
57 | + foreach ( $list_ids as $list_id ) { |
|
58 | + if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | } |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return bool Whether the email is subscribed to the list. |
76 | 76 | */ |
77 | - public function is_user_subscribed( $email, $list_id, $type ) { |
|
77 | + public function is_user_subscribed( $email, $list_id, $type ) { |
|
78 | 78 | $email = sanitize_email( $email ); |
79 | 79 | $email_hash = md5( $email ); |
80 | 80 | |
81 | 81 | // Check the API to see the status. |
82 | 82 | $response = yikes_get_mc_api_manager()->get_list_handler()->get_member( $list_id, $email_hash, false ); |
83 | - if ( is_wp_error( $response ) ) { |
|
83 | + if ( is_wp_error( $response ) ) { |
|
84 | 84 | $data = $response->get_error_data(); |
85 | 85 | |
86 | 86 | // If the error response is a 404, they are not subscribed. |
87 | - if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) { |
|
87 | + if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) { |
|
88 | 88 | return false; |
89 | - } else { |
|
89 | + } else { |
|
90 | 90 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
91 | 91 | $error_logging->maybe_write_to_log( |
92 | 92 | $response->get_error_code(), |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string The HTML for the checkbox. |
112 | 112 | */ |
113 | - public function yikes_get_checkbox() { |
|
113 | + public function yikes_get_checkbox() { |
|
114 | 114 | |
115 | 115 | // Get our options. |
116 | 116 | $checkbox_options = get_option( 'optin-checkbox-init', array() ); |
117 | 117 | $has_list_ids = isset( $checkbox_options[ $this->type ]['associated-list'] ) && '-' !== $checkbox_options[ $this->type ]['associated-list'] && is_array( $checkbox_options[ $this->type ]['associated-list'] ); |
118 | 118 | $has_list_ids = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ]['associated-list'], true ); |
119 | 119 | |
120 | - if ( $has_list_ids ) { |
|
120 | + if ( $has_list_ids ) { |
|
121 | 121 | $label = isset( $checkbox_options[ $this->type ]['label'] ) && ! empty( $checkbox_options[ $this->type ]['label'] ) ? trim( $checkbox_options[ $this->type ]['label'] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' ); |
122 | 122 | $checked = 'true' === $checkbox_options[ $this->type ]['precheck'] ? 'checked="checked"' : ''; |
123 | 123 | $before = apply_filters( 'yikes-mailchimp-before-checkbox-html', '' ); |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | * @param array $merge_vars The array of form data to send. |
146 | 146 | * @param array $integration_vars An array of additional information that can be used to filter the subscribe request. |
147 | 147 | */ |
148 | - public function subscribe_user_integration( $email, $type, $merge_vars, $integration_vars = array() ) { |
|
148 | + public function subscribe_user_integration( $email, $type, $merge_vars, $integration_vars = array() ) { |
|
149 | 149 | $options = get_option( 'optin-checkbox-init', '' ); |
150 | 150 | |
151 | 151 | // Make sure we have a list ID. |
152 | - if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) { |
|
152 | + if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) { |
|
153 | 153 | // @todo: Throw some kind of error? |
154 | 154 | return; |
155 | 155 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | // Check for an IP address. |
160 | 160 | $user_ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); |
161 | - if ( isset( $merge_vars['OPTIN_IP'] ) ) { |
|
161 | + if ( isset( $merge_vars['OPTIN_IP'] ) ) { |
|
162 | 162 | $user_ip = sanitize_text_field( $merge_vars['OPTIN_IP'] ); |
163 | 163 | } |
164 | 164 | |
@@ -174,19 +174,19 @@ discard block |
||
174 | 174 | 'ip_signup' => $user_ip, |
175 | 175 | ); |
176 | 176 | |
177 | - foreach ( $list_ids as $list_id ) { |
|
177 | + foreach ( $list_ids as $list_id ) { |
|
178 | 178 | |
179 | 179 | $interests = isset( $options[ $type ]['interest-groups'] ) ? $options[ $type ]['interest-groups'] : array(); |
180 | 180 | $interests = isset( $interests[ $list_id ] ) ? $interests[ $list_id ] : $interests; |
181 | 181 | |
182 | 182 | // Only re-format and add interest groups if not empty. |
183 | - if ( ! empty( $interests ) ) { |
|
183 | + if ( ! empty( $interests ) ) { |
|
184 | 184 | $groups = array(); |
185 | 185 | |
186 | 186 | // Need to reformat interest groups array as $interest_group_ID => true. |
187 | - foreach ( $interests as $interest ) { |
|
188 | - if ( is_array( $interest ) ) { |
|
189 | - foreach ( $interest as $group_id ) { |
|
187 | + foreach ( $interests as $interest ) { |
|
188 | + if ( is_array( $interest ) ) { |
|
189 | + foreach ( $interest as $group_id ) { |
|
190 | 190 | $groups[ $group_id ] = true; |
191 | 191 | } |
192 | 192 | } |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | $list_id = apply_filters( 'yikes-mailchimp-checkbox-integration-list-id', $list_id, $data, $type, $integration_vars ); |
219 | 219 | |
220 | 220 | // Don't send an empty merge fields array. |
221 | - if ( empty( $data['merge_fields'] ) ) { |
|
221 | + if ( empty( $data['merge_fields'] ) ) { |
|
222 | 222 | unset( $data['merge_fields'] ); |
223 | 223 | } |
224 | 224 | |
225 | 225 | // Subscribe the user to the list via the API. |
226 | 226 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, $id, $data ); |
227 | 227 | |
228 | - if ( is_wp_error( $response ) ) { |
|
228 | + if ( is_wp_error( $response ) ) { |
|
229 | 229 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
230 | 230 | $error_logging->maybe_write_to_log( |
231 | 231 | $response->get_error_code(), |
@@ -243,15 +243,15 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @param WP_User $user A WP User. |
245 | 245 | */ |
246 | - public function user_merge_vars( WP_User $user ) { |
|
246 | + public function user_merge_vars( WP_User $user ) { |
|
247 | 247 | |
248 | 248 | // Setup our array. |
249 | 249 | $merge_vars = array(); |
250 | 250 | |
251 | - if ( ! empty( $user->first_name ) ) { |
|
251 | + if ( ! empty( $user->first_name ) ) { |
|
252 | 252 | $merge_vars['FNAME'] = $user->first_name; |
253 | 253 | } |
254 | - if ( ! empty( $user->last_name ) ) { |
|
254 | + if ( ! empty( $user->last_name ) ) { |
|
255 | 255 | $merge_vars['LNAME'] = $user->last_name; |
256 | 256 | } |
257 | 257 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return bool True if the checkbox was checked. |
277 | 277 | */ |
278 | - public function was_checkbox_checked( $type ) { |
|
278 | + public function was_checkbox_checked( $type ) { |
|
279 | 279 | return isset( $_POST[ 'yikes_mailchimp_checkbox_' . $type ] ) && '1' === filter_var( $_POST[ 'yikes_mailchimp_checkbox_' . $type ], FILTER_SANITIZE_STRING ); |
280 | 280 | } |
281 | 281 | } |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | $all_forms = $form_interface->get_all_forms(); |
7 | 7 | |
8 | 8 | /* Store Data if User is Authorized */ |
9 | -if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
9 | +if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
10 | 10 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_lists(); |
11 | 11 | if ( is_wp_error( $list_data ) ) { |
12 | 12 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
13 | 13 | $error_logging->maybe_write_to_log( |
14 | 14 | $list_data->get_error_code(), |
15 | - __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), |
|
15 | + __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), |
|
16 | 16 | "Manage Forms Page" |
17 | 17 | ); |
18 | 18 | $list_data = array(); |
@@ -23,24 +23,24 @@ discard block |
||
23 | 23 | ?> |
24 | 24 | <div class="wrap yikes-easy-mc-wrap"> |
25 | 25 | <!-- Freddie Logo --> |
26 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - Mailchimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
26 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - Mailchimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
27 | 27 | |
28 | - <h1>Easy Forms for Mailchimp | <?php _e( 'Manage Forms' , 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
28 | + <h1>Easy Forms for Mailchimp | <?php _e( 'Manage Forms', 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
29 | 29 | |
30 | 30 | <!-- Settings Page Description --> |
31 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Create and manage your Mailchimp forms.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
31 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Create and manage your Mailchimp forms.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
32 | 32 | |
33 | 33 | <!-- Action Notices --> |
34 | 34 | <?php |
35 | 35 | |
36 | 36 | /* If the user hasn't authenticated yet, lets kill off */ |
37 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
38 | - wp_die( '<div class="error"><p>' . sprintf( __( 'You need to connect to Mailchimp before you can start creating forms. Head over to the <a href="%s" title="Settings Page">Settings Page</a> and enter your API key.' , 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) ) . '</p></div>' , 500 ); |
|
37 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
38 | + wp_die( '<div class="error"><p>' . sprintf( __( 'You need to connect to Mailchimp before you can start creating forms. Head over to the <a href="%s" title="Settings Page">Settings Page</a> and enter your API key.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) ) . '</p></div>', 500 ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /* Display our admin notices here */ |
42 | 42 | // delete form success |
43 | - if( isset( $_REQUEST['deleted-form'] ) && $_REQUEST['deleted-form'] == 'true' ) { |
|
43 | + if ( isset( $_REQUEST[ 'deleted-form' ] ) && $_REQUEST[ 'deleted-form' ] == 'true' ) { |
|
44 | 44 | ?> |
45 | 45 | <div class="updated manage-form-admin-notice"> |
46 | 46 | <p><?php _e( 'Opt-in form successfully deleted.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | <?php |
49 | 49 | } |
50 | 50 | // duplicate form success |
51 | - if( isset( $_REQUEST['duplicated-form'] ) && $_REQUEST['duplicated-form'] == 'true' ) { |
|
51 | + if ( isset( $_REQUEST[ 'duplicated-form' ] ) && $_REQUEST[ 'duplicated-form' ] == 'true' ) { |
|
52 | 52 | ?> |
53 | 53 | <div class="updated manage-form-admin-notice"> |
54 | 54 | <p><?php _e( 'Mailchimp Form successfully cloned.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | <?php |
57 | 57 | } |
58 | 58 | // duplicate form error |
59 | - if( isset( $_REQUEST['duplicated-form'] ) && $_REQUEST['duplicated-form'] == 'false' ) { |
|
59 | + if ( isset( $_REQUEST[ 'duplicated-form' ] ) && $_REQUEST[ 'duplicated-form' ] == 'false' ) { |
|
60 | 60 | ?> |
61 | 61 | <div class="error manage-form-admin-notice"> |
62 | 62 | <p><?php _e( 'There was an error trying to clone your form. Please try again. If this error persists, please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <?php |
65 | 65 | } |
66 | 66 | // reset form submission stats success |
67 | - if( isset( $_REQUEST['reset-stats'] ) && $_REQUEST['reset-stats'] == 'true' ) { |
|
67 | + if ( isset( $_REQUEST[ 'reset-stats' ] ) && $_REQUEST[ 'reset-stats' ] == 'true' ) { |
|
68 | 68 | ?> |
69 | 69 | <div class="updated manage-form-admin-notice"> |
70 | 70 | <p><?php _e( 'Form submission stats/rates successfully reset.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | <?php |
73 | 73 | } |
74 | 74 | // reset form submission stats error |
75 | - if( isset( $_REQUEST['reset-stats'] ) && $_REQUEST['reset-stats'] == 'false' ) { |
|
75 | + if ( isset( $_REQUEST[ 'reset-stats' ] ) && $_REQUEST[ 'reset-stats' ] == 'false' ) { |
|
76 | 76 | ?> |
77 | 77 | <div class="error manage-form-admin-notice"> |
78 | 78 | <p><?php _e( 'There was an error trying to reset the form submission stats/rates. Please try again. If this error persists, please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | <thead> |
100 | 100 | <tr> |
101 | 101 | <th id="cb" class="manage-column column-cb check-column num" scope="col"><input type="checkbox" /></th> |
102 | - <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
103 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
104 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
105 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
106 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
107 | - <th id="columnname" class="manage-column column-columnname num" scope="col" ><?php _e( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
108 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
102 | + <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
103 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
104 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
105 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
106 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
107 | + <th id="columnname" class="manage-column column-columnname num" scope="col" ><?php _e( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
108 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
109 | 109 | </tr> |
110 | 110 | </thead> |
111 | 111 | <!-- end header --> |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | <tfoot> |
115 | 115 | <tr> |
116 | 116 | <th class="manage-column column-cb check-column num" scope="col"><input type="checkbox" /></th> |
117 | - <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
118 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
119 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
120 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'List' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
121 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
122 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
123 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
117 | + <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
118 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
119 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
120 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'List', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
121 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
122 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
123 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
124 | 124 | </tr> |
125 | 125 | </tfoot> |
126 | 126 | <!-- end footer --> |
@@ -130,40 +130,40 @@ discard block |
||
130 | 130 | <?php |
131 | 131 | if ( count( $all_forms ) > 0 ) { |
132 | 132 | $i = 1; |
133 | - foreach( $all_forms as $id => $form ) { |
|
133 | + foreach ( $all_forms as $id => $form ) { |
|
134 | 134 | ?> |
135 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
135 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
136 | 136 | <th class="check-column num" scope="row"><input type="checkbox" /></th> |
137 | 137 | <td class="column-columnname num"><span class="form-id-container"><?php echo intval( $id ); ?></span></td> |
138 | 138 | <td class="column-columnname"> |
139 | 139 | <!-- row title/link --> |
140 | - <a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $id ) , admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>" class="row-title"> |
|
141 | - <?php echo stripslashes( $form['form_name'] ); ?> |
|
140 | + <a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $id ), admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>" class="row-title"> |
|
141 | + <?php echo stripslashes( $form[ 'form_name' ] ); ?> |
|
142 | 142 | </a> |
143 | 143 | <div class="row-actions"> |
144 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $id ) , admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>"><?php _e( "Edit" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
145 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-duplicate-form', 'mailchimp-form' => $id , 'nonce' => wp_create_nonce( 'duplicate-mailchimp-form-'.$id ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Duplicate" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
146 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-reset-stats', 'mailchimp-form' => $id , 'nonce' => wp_create_nonce( 'reset-stats-mailchimp-form-'.$id ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Reset Stats" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
147 | - <span><a href="#" class="view-yikes-mc-form-shortcode" data-alt-text="<?php _e( 'Stats' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( "Shortcode" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
144 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $id ), admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>"><?php _e( "Edit", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
145 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-duplicate-form', 'mailchimp-form' => $id, 'nonce' => wp_create_nonce( 'duplicate-mailchimp-form-' . $id ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Duplicate", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
146 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-reset-stats', 'mailchimp-form' => $id, 'nonce' => wp_create_nonce( 'reset-stats-mailchimp-form-' . $id ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Reset Stats", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
147 | + <span><a href="#" class="view-yikes-mc-form-shortcode" data-alt-text="<?php _e( 'Stats', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( "Shortcode", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
148 | 148 | <?php |
149 | 149 | /* |
150 | 150 | * Custom action to allow users to add additional action links |
151 | 151 | * to each form. We use this in our add-ons. |
152 | 152 | * - Delete should remain last |
153 | 153 | */ |
154 | - do_action( 'yikes-mailchimp-custom-form-actions' , $id ); |
|
154 | + do_action( 'yikes-mailchimp-custom-form-actions', $id ); |
|
155 | 155 | ?> |
156 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $id , 'nonce' => wp_create_nonce( 'delete-mailchimp-form-'.$id ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>" class="yikes-delete-mailchimp-form" onclick="return confirm('<?php printf( __( 'Are you sure you want to delete the %s form? This cannot be undone.' , 'yikes-inc-easy-mailchimp-extender' ), stripslashes( $form['form_name'] ) ); ?>');"><?php _e( "Delete" , 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
156 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $id, 'nonce' => wp_create_nonce( 'delete-mailchimp-form-' . $id ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>" class="yikes-delete-mailchimp-form" onclick="return confirm('<?php printf( __( 'Are you sure you want to delete the %s form? This cannot be undone.', 'yikes-inc-easy-mailchimp-extender' ), stripslashes( $form[ 'form_name' ] ) ); ?>');"><?php _e( "Delete", 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
157 | 157 | </div> |
158 | 158 | </td> |
159 | 159 | |
160 | - <td class="column-columnname"><?php echo isset( $form['form_description'] ) ? str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $id . '"]' ), $form['form_description'] ) : ''; ?></td> |
|
160 | + <td class="column-columnname"><?php echo isset( $form[ 'form_description' ] ) ? str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $id . '"]' ), $form[ 'form_description' ] ) : ''; ?></td> |
|
161 | 161 | <td class="column-columnname"> |
162 | 162 | <?php |
163 | 163 | if ( $list_data && count( $list_data ) > 0 ) { |
164 | 164 | $parsed = wp_list_pluck( $list_data, 'name', 'id' ); |
165 | - if ( isset( $parsed[ $form['list_id'] ] ) ) { |
|
166 | - echo esc_textarea( $parsed[ $form['list_id'] ] ); |
|
165 | + if ( isset( $parsed[ $form[ 'list_id' ] ] ) ) { |
|
166 | + echo esc_textarea( $parsed[ $form[ 'list_id' ] ] ); |
|
167 | 167 | } else { |
168 | 168 | echo '<strong>' . __( 'List Not Found', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>'; |
169 | 169 | } |
@@ -172,25 +172,25 @@ discard block |
||
172 | 172 | |
173 | 173 | <td class="column-columnname num stat-container"> |
174 | 174 | <?php |
175 | - $impressions = number_format( $form['impressions'] ); |
|
176 | - echo '<span title="' . __( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $impressions . '</span>'; |
|
175 | + $impressions = number_format( $form[ 'impressions' ] ); |
|
176 | + echo '<span title="' . __( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $impressions . '</span>'; |
|
177 | 177 | ?> |
178 | 178 | </td> |
179 | 179 | <td class="column-columnname num stat-container"> |
180 | 180 | <?php |
181 | - $submissions = number_format( $form['submissions'] ); |
|
182 | - echo '<span title="' . __( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $submissions . '</span>'; |
|
181 | + $submissions = number_format( $form[ 'submissions' ] ); |
|
182 | + echo '<span title="' . __( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $submissions . '</span>'; |
|
183 | 183 | ?> |
184 | 184 | </td> |
185 | 185 | <td class="column-columnname num stat-container"> |
186 | 186 | <?php |
187 | - if( $impressions != 0 ) { |
|
188 | - $conversion_rate = ( round( 100 * $form['submissions'] / $form['impressions'] , 3 ) ); |
|
189 | - if( $conversion_rate >= '15' ) { |
|
187 | + if ( $impressions != 0 ) { |
|
188 | + $conversion_rate = ( round( 100 * $form[ 'submissions' ] / $form[ 'impressions' ], 3 ) ); |
|
189 | + if ( $conversion_rate >= '15' ) { |
|
190 | 190 | $conversion_color = '#00cc00'; // green (unicorn!) |
191 | - } else if( $conversion_rate < '15' && $conversion_rate >= '10' ) { |
|
191 | + } else if ( $conversion_rate < '15' && $conversion_rate >= '10' ) { |
|
192 | 192 | $conversion_color = '#0080FF'; // light blue (good) |
193 | - } else if( $conversion_rate < '10' && $conversion_rate >= '5' ) { |
|
193 | + } else if ( $conversion_rate < '10' && $conversion_rate >= '5' ) { |
|
194 | 194 | $conversion_color = '#FFFF32'; // yellow (ok) |
195 | 195 | } else { |
196 | 196 | $conversion_color = '#FF0000'; // red (no bueno) |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $conversion_rate = '0'; |
200 | 200 | $conversion_color = '#333333'; |
201 | 201 | } |
202 | - echo '<span style="color:' . esc_attr( $conversion_color ) . ';" title="' . esc_attr__( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $conversion_rate . '%</span>'; |
|
202 | + echo '<span style="color:' . esc_attr( $conversion_color ) . ';" title="' . esc_attr__( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $conversion_rate . '%</span>'; |
|
203 | 203 | ?> |
204 | 204 | </td> |
205 | 205 | <!-- shortcode --> |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | } else { ?> |
214 | 214 | <tr class="no-items"> |
215 | - <td class="colspanchange no-mailchimp-forms-found" colspan="8"><em><?php _e( 'No Mailchimp forms found. Use the form to the right to create a new one.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
215 | + <td class="colspanchange no-mailchimp-forms-found" colspan="8"><em><?php _e( 'No Mailchimp forms found. Use the form to the right to create a new one.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
216 | 216 | </tr> |
217 | 217 | <?php } ?> |
218 | 218 | </tbody> |
@@ -9,21 +9,21 @@ |
||
9 | 9 | <div class="wrap yikes-easy-mc-support-wrap yikes-easy-mc-wrap"> |
10 | 10 | |
11 | 11 | <!-- Freddie Logo --> |
12 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - Mailchimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
12 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - Mailchimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
13 | 13 | |
14 | - <h1>Easy Forms for Mailchimp | <?php _e( 'Support' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
14 | + <h1>Easy Forms for Mailchimp | <?php _e( 'Support', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
15 | 15 | <!-- Support Page Description --> |
16 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'If you have questions, we have answers!' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
16 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'If you have questions, we have answers!', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
17 | 17 | |
18 | - <?php if( get_option( 'yikes-easy-mc-active-addons' , array() ) == array() ) { ?> |
|
19 | - <p><?php _e( 'Users of the free version of Easy Forms for Mailchimp can post questions to our support forum on the WordPress Plugin Directory. We aim to respond to support requests for the free version of the plugin within a week.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
20 | - <p><?php printf( __( 'Purchasers of our paid add-ons qualify for premium support. <a href="%s" target="_blank" title="' . __( 'Check out our paid add-ons', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Check out our paid add-ons', 'yikes-inc-easy-mailchimp-extender' ) . '</a>!' , 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'https://yikesplugins.com/' ) ); ?></p> |
|
18 | + <?php if ( get_option( 'yikes-easy-mc-active-addons', array() ) == array() ) { ?> |
|
19 | + <p><?php _e( 'Users of the free version of Easy Forms for Mailchimp can post questions to our support forum on the WordPress Plugin Directory. We aim to respond to support requests for the free version of the plugin within a week.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
20 | + <p><?php printf( __( 'Purchasers of our paid add-ons qualify for premium support. <a href="%s" target="_blank" title="' . __( 'Check out our paid add-ons', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Check out our paid add-ons', 'yikes-inc-easy-mailchimp-extender' ) . '</a>!', 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'https://yikesplugins.com/' ) ); ?></p> |
|
21 | 21 | <?php } else { ?> |
22 | - <p><?php _e( "It looks like you are one of our premium users! Fill out the form below to submit a priority support request." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
23 | - <p><?php _e( "If you have any problems with the form, send an email to <a href='mailto:[email protected]'>[email protected]</a> and a ticket will be created." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
22 | + <p><?php _e( "It looks like you are one of our premium users! Fill out the form below to submit a priority support request.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
23 | + <p><?php _e( "If you have any problems with the form, send an email to <a href='mailto:[email protected]'>[email protected]</a> and a ticket will be created.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
24 | 24 | <?php } ?> |
25 | 25 | |
26 | - <p><?php printf( __( 'Before submitting a support request, please visit our %s.' , 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/' ) . '" title="' . __( 'Knowledge Base', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'knowledge base', 'yikes-inc-easy-mailchimp-extender' ) . '</a> where we have step-by-step guides and troubleshooting help' ); ?></p> |
|
26 | + <p><?php printf( __( 'Before submitting a support request, please visit our %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/' ) . '" title="' . __( 'Knowledge Base', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'knowledge base', 'yikes-inc-easy-mailchimp-extender' ) . '</a> where we have step-by-step guides and troubleshooting help' ); ?></p> |
|
27 | 27 | |
28 | 28 | <hr /> |
29 | 29 |
@@ -7,12 +7,12 @@ |
||
7 | 7 | <div class="wrap yikes-easy-mc-wrap"> |
8 | 8 | |
9 | 9 | <!-- Freddie Logo --> |
10 | - <img src="<?php echo esc_url( YIKES_MC_URL . 'includes/images/Mailchimp_Assets/Freddie_60px.png' ); ?>" alt="<?php esc_attr_e( 'Freddie - Mailchimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
10 | + <img src="<?php echo esc_url( YIKES_MC_URL . 'includes/images/Mailchimp_Assets/Freddie_60px.png' ); ?>" alt="<?php esc_attr_e( 'Freddie - Mailchimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
11 | 11 | |
12 | - <h1>Easy Forms for Mailchimp | <?php echo esc_attr__( 'Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="https://yikesplugins.com/plugins/?plugins=Mailchimp" target="_blank" class="button-primary coming-soon-button" title="<?php esc_attr_e( 'View All Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php esc_attr_e( 'View All Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?> <span class="dashicons dashicons-external"></span></a></h1> |
|
12 | + <h1>Easy Forms for Mailchimp | <?php echo esc_attr__( 'Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="https://yikesplugins.com/plugins/?plugins=Mailchimp" target="_blank" class="button-primary coming-soon-button" title="<?php esc_attr_e( 'View All Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php esc_attr_e( 'View All Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class="dashicons dashicons-external"></span></a></h1> |
|
13 | 13 | |
14 | 14 | <!-- Addons Page Description --> |
15 | - <p class="yikes-easy-mc-about-text about-text"><?php esc_attr_e( "Below you'll find all free and paid add-ons available for Easy Forms for Mailchimp. Each add-on extends the functionality of the free plugin." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
15 | + <p class="yikes-easy-mc-about-text about-text"><?php esc_attr_e( "Below you'll find all free and paid add-ons available for Easy Forms for Mailchimp. Each add-on extends the functionality of the free plugin.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
16 | 16 | |
17 | 17 | <!-- Add-On Container --> |
18 | 18 | <section id="add-ons"> |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | ?> |
37 | 37 | <div class="wrap yikes-easy-mc-wrap"> |
38 | 38 | <!-- Freddie Logo --> |
39 | - <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" /> |
|
39 | + <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" /> |
|
40 | 40 | |
41 | - <h1>Easy Forms for Mailchimp | <?php _e( 'Manage Mailing Lists' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
41 | + <h1>Easy Forms for Mailchimp | <?php _e( 'Manage Mailing Lists', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
42 | 42 | |
43 | 43 | <!-- Settings Page Description --> |
44 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your Mailchimp lists.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
44 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your Mailchimp lists.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
45 | 45 | |
46 | 46 | <?php |
47 | 47 | /* If the user hasn't authenticated yet, lets kill off */ |
48 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
48 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
49 | 49 | |
50 | 50 | $error_string = sprintf( |
51 | 51 | esc_html__( 'You need to connect to Mailchimp before you can start creating forms. Head over to the %s and enter your API key.', 'yikes-inc-easy-mailchimp-extender' ), |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | <!-- TABLE HEAD --> |
82 | 82 | <thead> |
83 | 83 | <tr> |
84 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
85 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
84 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
85 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
86 | 86 | </tr> |
87 | 87 | </thead> |
88 | 88 | <!-- end header --> |
@@ -90,25 +90,25 @@ discard block |
||
90 | 90 | <!-- FOOTER --> |
91 | 91 | <tfoot> |
92 | 92 | <tr> |
93 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
94 | - <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
93 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
94 | + <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
95 | 95 | </tr> |
96 | 96 | </tfoot> |
97 | 97 | <!-- end footer --> |
98 | 98 | |
99 | 99 | <!-- TABLE BODY --> |
100 | 100 | <tbody> |
101 | - <?php if( count( $list_data ) > 0 ) { |
|
101 | + <?php if ( count( $list_data ) > 0 ) { |
|
102 | 102 | $i = 1; |
103 | - foreach( $list_data as $list ) { |
|
103 | + foreach ( $list_data as $list ) { |
|
104 | 104 | ?> |
105 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
105 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
106 | 106 | <td class="column-columnname"> |
107 | - <a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>" class="row-title"> |
|
108 | - <?php echo stripslashes( $list['name'] ); ?> |
|
107 | + <a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>" class="row-title"> |
|
108 | + <?php echo stripslashes( $list[ 'name' ] ); ?> |
|
109 | 109 | </a> |
110 | 110 | <div class="row-actions"> |
111 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>"><?php _e( "View" , 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
111 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>"><?php _e( "View", 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
112 | 112 | <?php |
113 | 113 | /* |
114 | 114 | * Custom action to allow users to add additional action links |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | ?> |
119 | 119 | </div> |
120 | 120 | </td> |
121 | - <td class="column-columnname num"><?php echo $list['stats']['member_count']; ?></td> |
|
121 | + <td class="column-columnname num"><?php echo $list[ 'stats' ][ 'member_count' ]; ?></td> |
|
122 | 122 | </tr> |
123 | 123 | <?php |
124 | 124 | $i++; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } else { |
127 | 127 | ?> |
128 | 128 | <tr class="no-items"> |
129 | - <td class="colspanchange no-mailchimp-lists-found" colspan="3"><em><?php printf( __( 'No Mailchimp lists found. Head over to <a href="%s" title="Mailchimp.com">Mailchimp.com</a> to setup your first mailing list. Once thats done you can head back here to customize it!' , 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'http://mailchimp.com/' ) ); ?></em></td> |
|
129 | + <td class="colspanchange no-mailchimp-lists-found" colspan="3"><em><?php printf( __( 'No Mailchimp lists found. Head over to <a href="%s" title="Mailchimp.com">Mailchimp.com</a> to setup your first mailing list. Once thats done you can head back here to customize it!', 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'http://mailchimp.com/' ) ); ?></em></td> |
|
130 | 130 | </tr> |
131 | 131 | <?php } ?> |
132 | 132 | </tbody> |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | <div class="postbox yikes-easy-mc-postbox"> |
147 | 147 | <div class="inside"> |
148 | 148 | |
149 | - <a href="https://us3.admin.mailchimp.com/" title="<?php _e( 'Mailchimp Site' , 'yikes-inc-easy-mailchimp-extender' ); ?>" target="_blank"> |
|
150 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/mailchimp-logo.png'; ?>" title="<?php _e( 'Mailchimp Site' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="list-page-mailchimp-logo"> |
|
149 | + <a href="https://us3.admin.mailchimp.com/" title="<?php _e( 'Mailchimp Site', 'yikes-inc-easy-mailchimp-extender' ); ?>" target="_blank"> |
|
150 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/Mailchimp_Assets/mailchimp-logo.png'; ?>" title="<?php _e( 'Mailchimp Site', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="list-page-mailchimp-logo"> |
|
151 | 151 | </a> |
152 | 152 | |
153 | 153 | </div> |
@@ -157,42 +157,42 @@ discard block |
||
157 | 157 | <div class="postbox yikes-easy-mc-postbox list-page-sidebar"> |
158 | 158 | <div class="inside"> |
159 | 159 | |
160 | - <h2 class="account-status"><?php echo $account_details['username']; ?> <small>(<?php echo $account_details['role']; ?>)</small></h2> |
|
160 | + <h2 class="account-status"><?php echo $account_details[ 'username' ]; ?> <small>(<?php echo $account_details[ 'role' ]; ?>)</small></h2> |
|
161 | 161 | |
162 | - <img class="mailchimp-avatar" src="<?php echo esc_url_raw( $account_details['avatar_url'] ); ?>" title="<?php echo $account_details['username'] . ' ' . __( "Mailchimp avatar" , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
162 | + <img class="mailchimp-avatar" src="<?php echo esc_url_raw( $account_details[ 'avatar_url' ] ); ?>" title="<?php echo $account_details[ 'username' ] . ' ' . __( "Mailchimp avatar", 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
163 | 163 | |
164 | 164 | <table class="form-table" id="account-details-table"> |
165 | 165 | <tr valign="top"> |
166 | 166 | <td scope="row"> |
167 | 167 | <label for="tablecell"> |
168 | - <strong><?php _e( 'Company' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
168 | + <strong><?php _e( 'Company', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
169 | 169 | </label> |
170 | 170 | </td> |
171 | - <td><?php echo $account_details['contact']['company']; ?><br /><?php echo $account_details['contact']['city'] . ', ' . $account_details['contact']['state']; ?></td> |
|
171 | + <td><?php echo $account_details[ 'contact' ][ 'company' ]; ?><br /><?php echo $account_details[ 'contact' ][ 'city' ] . ', ' . $account_details[ 'contact' ][ 'state' ]; ?></td> |
|
172 | 172 | </tr> |
173 | 173 | <tr valign="top"> |
174 | 174 | <td scope="row"> |
175 | 175 | <label for="tablecell"> |
176 | - <strong><?php _e( 'Industry' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
176 | + <strong><?php _e( 'Industry', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
177 | 177 | </label> |
178 | 178 | </td> |
179 | - <td><?php echo $account_details['account_industry']; ?></td> |
|
179 | + <td><?php echo $account_details[ 'account_industry' ]; ?></td> |
|
180 | 180 | </tr> |
181 | 181 | <tr valign="top"> |
182 | 182 | <td scope="row"> |
183 | 183 | <label for="tablecell"> |
184 | - <strong><?php _e( 'Member Since' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
184 | + <strong><?php _e( 'Member Since', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
185 | 185 | </label> |
186 | 186 | </td> |
187 | - <td><?php echo date( get_option('date_format') , strtotime( $account_details['member_since'] ) ); ?></td> |
|
187 | + <td><?php echo date( get_option( 'date_format' ), strtotime( $account_details[ 'member_since' ] ) ); ?></td> |
|
188 | 188 | </tr> |
189 | 189 | <tr valign="top"> |
190 | 190 | <td scope="row"> |
191 | 191 | <label for="tablecell"> |
192 | - <strong><?php _e( 'Plan Type' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
192 | + <strong><?php _e( 'Plan Type', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
193 | 193 | </label> |
194 | 194 | </td> |
195 | - <td><?php echo ucwords( $account_details['pricing_plan_type'] ); ?></td> |
|
195 | + <td><?php echo ucwords( $account_details[ 'pricing_plan_type' ] ); ?></td> |
|
196 | 196 | </tr> |
197 | 197 | </table> |
198 | 198 |