@@ -3,234 +3,234 @@ discard block |
||
| 3 | 3 | class Yikes_Inc_Easy_MailChimp_Extender_Process_Submission_Handler { |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
| 7 | - * |
|
| 8 | - * @since 6.3.0 |
|
| 9 | - * @access protected |
|
| 10 | - * @var bool | $is_ajax |
|
| 11 | - */ |
|
| 6 | + * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
| 7 | + * |
|
| 8 | + * @since 6.3.0 |
|
| 9 | + * @access protected |
|
| 10 | + * @var bool | $is_ajax |
|
| 11 | + */ |
|
| 12 | 12 | protected $is_ajax; |
| 13 | 13 | |
| 14 | 14 | /**** Hardcoded Internal Variables ****/ |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * An array of form fields we don't process |
|
| 18 | - * |
|
| 19 | - * @since 6.3.0 |
|
| 20 | - * @access protected |
|
| 21 | - * @var array | $skipped_form_fields |
|
| 22 | - */ |
|
| 17 | + * An array of form fields we don't process |
|
| 18 | + * |
|
| 19 | + * @since 6.3.0 |
|
| 20 | + * @access protected |
|
| 21 | + * @var array | $skipped_form_fields |
|
| 22 | + */ |
|
| 23 | 23 | protected $skipped_form_fields; |
| 24 | 24 | |
| 25 | 25 | /**** Form Variables ****/ |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * The ID of the corresponding YIKES MailChimp form |
|
| 29 | - * |
|
| 30 | - * @since 6.3.0 |
|
| 31 | - * @access public |
|
| 32 | - * @var int | $form_id |
|
| 33 | - */ |
|
| 28 | + * The ID of the corresponding YIKES MailChimp form |
|
| 29 | + * |
|
| 30 | + * @since 6.3.0 |
|
| 31 | + * @access public |
|
| 32 | + * @var int | $form_id |
|
| 33 | + */ |
|
| 34 | 34 | public $form_id; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * The ID of the corresponding MailChimp list |
|
| 38 | - * |
|
| 39 | - * @since 6.3.0 |
|
| 40 | - * @access public |
|
| 41 | - * @var int | $list_id |
|
| 42 | - */ |
|
| 37 | + * The ID of the corresponding MailChimp list |
|
| 38 | + * |
|
| 39 | + * @since 6.3.0 |
|
| 40 | + * @access public |
|
| 41 | + * @var int | $list_id |
|
| 42 | + */ |
|
| 43 | 43 | public $list_id; |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * The submitted email |
|
| 47 | - * |
|
| 48 | - * @since 6.3.0 |
|
| 49 | - * @access public |
|
| 50 | - * @var string | $email |
|
| 51 | - */ |
|
| 46 | + * The submitted email |
|
| 47 | + * |
|
| 48 | + * @since 6.3.0 |
|
| 49 | + * @access public |
|
| 50 | + * @var string | $email |
|
| 51 | + */ |
|
| 52 | 52 | public $email; |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * The array of error messages defined by the user and attached to this form |
|
| 56 | - * |
|
| 57 | - * @since 6.3.0 |
|
| 58 | - * @access public |
|
| 59 | - * @var array | $error_messages |
|
| 60 | - */ |
|
| 55 | + * The array of error messages defined by the user and attached to this form |
|
| 56 | + * |
|
| 57 | + * @since 6.3.0 |
|
| 58 | + * @access public |
|
| 59 | + * @var array | $error_messages |
|
| 60 | + */ |
|
| 61 | 61 | public $error_messages; |
| 62 | 62 | |
| 63 | 63 | /**** Default Error Messages ****/ |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * The error message for no form ID |
|
| 67 | - * |
|
| 68 | - * @since 6.3.0 |
|
| 69 | - * @access public |
|
| 70 | - * @var string | $handle_empty_form_id_message |
|
| 71 | - */ |
|
| 66 | + * The error message for no form ID |
|
| 67 | + * |
|
| 68 | + * @since 6.3.0 |
|
| 69 | + * @access public |
|
| 70 | + * @var string | $handle_empty_form_id_message |
|
| 71 | + */ |
|
| 72 | 72 | public $handle_empty_form_id_message; |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * The error message for no form found |
|
| 76 | - * |
|
| 77 | - * @since 6.3.0 |
|
| 78 | - * @access public |
|
| 79 | - * @var string | $handle_empty_form_message |
|
| 80 | - */ |
|
| 75 | + * The error message for no form found |
|
| 76 | + * |
|
| 77 | + * @since 6.3.0 |
|
| 78 | + * @access public |
|
| 79 | + * @var string | $handle_empty_form_message |
|
| 80 | + */ |
|
| 81 | 81 | public $handle_empty_form_message; |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * The error message for missing form fields |
|
| 85 | - * |
|
| 86 | - * @since 6.3.0 |
|
| 87 | - * @access public |
|
| 88 | - * @var string | $handle_empty_fields_generic_message |
|
| 89 | - */ |
|
| 84 | + * The error message for missing form fields |
|
| 85 | + * |
|
| 86 | + * @since 6.3.0 |
|
| 87 | + * @access public |
|
| 88 | + * @var string | $handle_empty_fields_generic_message |
|
| 89 | + */ |
|
| 90 | 90 | public $handle_empty_fields_generic_message; |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * The error message for missing $list_handler class |
|
| 94 | - * |
|
| 95 | - * @since 6.3.0 |
|
| 96 | - * @access public |
|
| 97 | - * @var string | $handle_empty_list_handler_message |
|
| 98 | - */ |
|
| 93 | + * The error message for missing $list_handler class |
|
| 94 | + * |
|
| 95 | + * @since 6.3.0 |
|
| 96 | + * @access public |
|
| 97 | + * @var string | $handle_empty_list_handler_message |
|
| 98 | + */ |
|
| 99 | 99 | public $handle_empty_list_handler_message; |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * The error message for no email |
|
| 103 | - * |
|
| 104 | - * @since 6.3.0 |
|
| 105 | - * @access public |
|
| 106 | - * @var string | $handle_empty_email_message |
|
| 107 | - */ |
|
| 102 | + * The error message for no email |
|
| 103 | + * |
|
| 104 | + * @since 6.3.0 |
|
| 105 | + * @access public |
|
| 106 | + * @var string | $handle_empty_email_message |
|
| 107 | + */ |
|
| 108 | 108 | public $handle_empty_email_message; |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * The error message for a filled in honeypot |
|
| 112 | - * |
|
| 113 | - * @since 6.3.0 |
|
| 114 | - * @access public |
|
| 115 | - * @var string | $handle_non_empty_honeypot_message |
|
| 116 | - */ |
|
| 111 | + * The error message for a filled in honeypot |
|
| 112 | + * |
|
| 113 | + * @since 6.3.0 |
|
| 114 | + * @access public |
|
| 115 | + * @var string | $handle_non_empty_honeypot_message |
|
| 116 | + */ |
|
| 117 | 117 | public $handle_non_empty_honeypot_message; |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * The error message for existing users trying to update when it's disallowed |
|
| 121 | - * |
|
| 122 | - * @since 6.3.0 |
|
| 123 | - * @access public |
|
| 124 | - * @var string | $handle_disallowed_existing_user_update_message |
|
| 125 | - */ |
|
| 120 | + * The error message for existing users trying to update when it's disallowed |
|
| 121 | + * |
|
| 122 | + * @since 6.3.0 |
|
| 123 | + * @access public |
|
| 124 | + * @var string | $handle_disallowed_existing_user_update_message |
|
| 125 | + */ |
|
| 126 | 126 | public $handle_disallowed_existing_user_update_message; |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | - * The first half of the error message for updating an existing user when it's done via a profile link |
|
| 130 | - * |
|
| 131 | - * @since 6.3.0 |
|
| 132 | - * @access public |
|
| 133 | - * @var string | $handle_updating_existing_user_message |
|
| 134 | - */ |
|
| 129 | + * The first half of the error message for updating an existing user when it's done via a profile link |
|
| 130 | + * |
|
| 131 | + * @since 6.3.0 |
|
| 132 | + * @access public |
|
| 133 | + * @var string | $handle_updating_existing_user_message |
|
| 134 | + */ |
|
| 135 | 135 | public $handle_updating_existing_user_message; |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
| 139 | - * |
|
| 140 | - * @since 6.3.0 |
|
| 141 | - * @access public |
|
| 142 | - * @var string | $handle_updating_existing_user_link_message |
|
| 143 | - */ |
|
| 138 | + * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
| 139 | + * |
|
| 140 | + * @since 6.3.0 |
|
| 141 | + * @access public |
|
| 142 | + * @var string | $handle_updating_existing_user_link_message |
|
| 143 | + */ |
|
| 144 | 144 | public $handle_updating_existing_user_link_message; |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * A default, generic error message |
|
| 148 | - * |
|
| 149 | - * @since 6.3.0 |
|
| 150 | - * @access public |
|
| 151 | - * @var string | $default_error_response_message |
|
| 152 | - */ |
|
| 147 | + * A default, generic error message |
|
| 148 | + * |
|
| 149 | + * @since 6.3.0 |
|
| 150 | + * @access public |
|
| 151 | + * @var string | $default_error_response_message |
|
| 152 | + */ |
|
| 153 | 153 | public $default_error_response_message; |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * The error message for not filling out a required form field |
|
| 157 | - * |
|
| 158 | - * @since 6.3.0 |
|
| 159 | - * @access public |
|
| 160 | - * @var string | $handle_empty_required_field_message |
|
| 161 | - */ |
|
| 156 | + * The error message for not filling out a required form field |
|
| 157 | + * |
|
| 158 | + * @since 6.3.0 |
|
| 159 | + * @access public |
|
| 160 | + * @var string | $handle_empty_required_field_message |
|
| 161 | + */ |
|
| 162 | 162 | public $handle_empty_required_field_message; |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | - * The error message for not filling out a required interest group |
|
| 166 | - * |
|
| 167 | - * @since 6.3.0 |
|
| 168 | - * @access public |
|
| 169 | - * @var string | $handle_empty_required_interest_group_message |
|
| 170 | - */ |
|
| 165 | + * The error message for not filling out a required interest group |
|
| 166 | + * |
|
| 167 | + * @since 6.3.0 |
|
| 168 | + * @access public |
|
| 169 | + * @var string | $handle_empty_required_interest_group_message |
|
| 170 | + */ |
|
| 171 | 171 | public $handle_empty_required_interest_group_message; |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * The error message for nonce failures |
|
| 175 | - * |
|
| 176 | - * @since 6.3.0 |
|
| 177 | - * @access public |
|
| 178 | - * @var string | $handle_nonce_message |
|
| 179 | - */ |
|
| 174 | + * The error message for nonce failures |
|
| 175 | + * |
|
| 176 | + * @since 6.3.0 |
|
| 177 | + * @access public |
|
| 178 | + * @var string | $handle_nonce_message |
|
| 179 | + */ |
|
| 180 | 180 | public $handle_nonce_message; |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * The error message for a recaptcha that is not checked/filled out |
|
| 184 | - * |
|
| 185 | - * @since 6.3.0 |
|
| 186 | - * @access public |
|
| 187 | - * @var string | $handle_nonce_message |
|
| 188 | - */ |
|
| 183 | + * The error message for a recaptcha that is not checked/filled out |
|
| 184 | + * |
|
| 185 | + * @since 6.3.0 |
|
| 186 | + * @access public |
|
| 187 | + * @var string | $handle_nonce_message |
|
| 188 | + */ |
|
| 189 | 189 | public $handle_non_filled_recaptcha_message_message; |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * The error message for recaptcha errors that we're not sure of |
|
| 193 | - * |
|
| 194 | - * @since 6.3.0 |
|
| 195 | - * @access public |
|
| 196 | - * @var string | $handle_nonce_message |
|
| 197 | - */ |
|
| 192 | + * The error message for recaptcha errors that we're not sure of |
|
| 193 | + * |
|
| 194 | + * @since 6.3.0 |
|
| 195 | + * @access public |
|
| 196 | + * @var string | $handle_nonce_message |
|
| 197 | + */ |
|
| 198 | 198 | public $generic_recaptcha_error_message; |
| 199 | 199 | |
| 200 | 200 | /**** Default Success Messages ****/ |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | - * The success message for single-optin forms |
|
| 204 | - * |
|
| 205 | - * @since 6.3.0 |
|
| 206 | - * @access public |
|
| 207 | - * @var string | $default_response_single_optin_success_message |
|
| 208 | - */ |
|
| 203 | + * The success message for single-optin forms |
|
| 204 | + * |
|
| 205 | + * @since 6.3.0 |
|
| 206 | + * @access public |
|
| 207 | + * @var string | $default_response_single_optin_success_message |
|
| 208 | + */ |
|
| 209 | 209 | public $default_response_single_optin_success_message; |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | - * The default success message for double-optin forms |
|
| 213 | - * |
|
| 214 | - * @since 6.3.0 |
|
| 215 | - * @access public |
|
| 216 | - * @var string | $default_response_double_optin_success_message |
|
| 217 | - */ |
|
| 212 | + * The default success message for double-optin forms |
|
| 213 | + * |
|
| 214 | + * @since 6.3.0 |
|
| 215 | + * @access public |
|
| 216 | + * @var string | $default_response_double_optin_success_message |
|
| 217 | + */ |
|
| 218 | 218 | public $default_response_double_optin_success_message; |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * The default success message for already subscribed users re-subscribing |
|
| 222 | - * |
|
| 223 | - * @since 6.3.0 |
|
| 224 | - * @access public |
|
| 225 | - * @var string | $existing_subscriber_profile_update_message |
|
| 226 | - */ |
|
| 221 | + * The default success message for already subscribed users re-subscribing |
|
| 222 | + * |
|
| 223 | + * @since 6.3.0 |
|
| 224 | + * @access public |
|
| 225 | + * @var string | $existing_subscriber_profile_update_message |
|
| 226 | + */ |
|
| 227 | 227 | public $existing_subscriber_profile_update_message; |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * The construct function - sets all of our hardcoded variables |
|
| 231 | - * |
|
| 232 | - * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
| 233 | - */ |
|
| 230 | + * The construct function - sets all of our hardcoded variables |
|
| 231 | + * |
|
| 232 | + * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
| 233 | + */ |
|
| 234 | 234 | public function __construct( $is_ajax ) { |
| 235 | 235 | |
| 236 | 236 | // Set up our variables |
@@ -268,45 +268,45 @@ discard block |
||
| 268 | 268 | /**** Setters for our Form Variables ****/ |
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | - * Set the form ID class property |
|
| 272 | - * |
|
| 273 | - * @since 6.3.0 |
|
| 274 | - * |
|
| 275 | - * @param int | $form_id | ID of the corresponding YIKES MailChimp form |
|
| 276 | - */ |
|
| 271 | + * Set the form ID class property |
|
| 272 | + * |
|
| 273 | + * @since 6.3.0 |
|
| 274 | + * |
|
| 275 | + * @param int | $form_id | ID of the corresponding YIKES MailChimp form |
|
| 276 | + */ |
|
| 277 | 277 | public function set_form_id( $form_id ) { |
| 278 | 278 | $this->form_id = $form_id; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | - * Set the list ID class property |
|
| 283 | - * |
|
| 284 | - * @since 6.3.0 |
|
| 285 | - * |
|
| 286 | - * @param int | $list_id | ID of the corresponding MailChimp list |
|
| 287 | - */ |
|
| 282 | + * Set the list ID class property |
|
| 283 | + * |
|
| 284 | + * @since 6.3.0 |
|
| 285 | + * |
|
| 286 | + * @param int | $list_id | ID of the corresponding MailChimp list |
|
| 287 | + */ |
|
| 288 | 288 | public function set_list_id( $list_id ) { |
| 289 | 289 | $this->list_id = $list_id; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
| 293 | - * Set the email class property |
|
| 294 | - * |
|
| 295 | - * @since 6.3.0 |
|
| 296 | - * |
|
| 297 | - * @param string | $sanitized_email | The sanitized email |
|
| 298 | - */ |
|
| 293 | + * Set the email class property |
|
| 294 | + * |
|
| 295 | + * @since 6.3.0 |
|
| 296 | + * |
|
| 297 | + * @param string | $sanitized_email | The sanitized email |
|
| 298 | + */ |
|
| 299 | 299 | public function set_email( $sanitized_email ) { |
| 300 | 300 | $this->email = $sanitized_email; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
| 304 | - * Set the $error_messages class property |
|
| 305 | - * |
|
| 306 | - * @since 6.3.0 |
|
| 307 | - * |
|
| 308 | - * @param array | $error_messages | The array of user-defined error messages for this form |
|
| 309 | - */ |
|
| 304 | + * Set the $error_messages class property |
|
| 305 | + * |
|
| 306 | + * @since 6.3.0 |
|
| 307 | + * |
|
| 308 | + * @param array | $error_messages | The array of user-defined error messages for this form |
|
| 309 | + */ |
|
| 310 | 310 | public function set_error_messages( $error_messages ) { |
| 311 | 311 | $this->error_messages = $error_messages; |
| 312 | 312 | } |
@@ -315,24 +315,24 @@ discard block |
||
| 315 | 315 | /**** Simple Return Functions ****/ |
| 316 | 316 | |
| 317 | 317 | /** |
| 318 | - * Return a sanitized email |
|
| 319 | - * |
|
| 320 | - * @since 6.3.0 |
|
| 321 | - * |
|
| 322 | - * @param string | $email | The user's email |
|
| 323 | - * @return string| $email | The user's email, lowercased and sanitized |
|
| 324 | - */ |
|
| 318 | + * Return a sanitized email |
|
| 319 | + * |
|
| 320 | + * @since 6.3.0 |
|
| 321 | + * |
|
| 322 | + * @param string | $email | The user's email |
|
| 323 | + * @return string| $email | The user's email, lowercased and sanitized |
|
| 324 | + */ |
|
| 325 | 325 | public function get_sanitized_email( $email ) { |
| 326 | 326 | return sanitize_email( strtolower( $email ) ); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | - * Return the class property $skipped_form_fields |
|
| 331 | - * |
|
| 332 | - * @since 6.3.0 |
|
| 333 | - * |
|
| 334 | - * @return array | $skipped_form_fields |
|
| 335 | - */ |
|
| 330 | + * Return the class property $skipped_form_fields |
|
| 331 | + * |
|
| 332 | + * @since 6.3.0 |
|
| 333 | + * |
|
| 334 | + * @return array | $skipped_form_fields |
|
| 335 | + */ |
|
| 336 | 336 | protected function get_skipped_merge_tags() { |
| 337 | 337 | return $this->skipped_form_fields; |
| 338 | 338 | } |
@@ -341,14 +341,14 @@ discard block |
||
| 341 | 341 | /**** Collection of functions handling the incoming form and interest group data ****/ |
| 342 | 342 | |
| 343 | 343 | /** |
| 344 | - * Loop through form data to sanitize, format, filter, and return. |
|
| 345 | - * |
|
| 346 | - * @since 6.3.0 |
|
| 347 | - * |
|
| 348 | - * @param array | $data | The array of user-submitted form values |
|
| 349 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 350 | - * @return array| $merge_variables| The array of sanitized and formatted form values |
|
| 351 | - */ |
|
| 344 | + * Loop through form data to sanitize, format, filter, and return. |
|
| 345 | + * |
|
| 346 | + * @since 6.3.0 |
|
| 347 | + * |
|
| 348 | + * @param array | $data | The array of user-submitted form values |
|
| 349 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 350 | + * @return array| $merge_variables| The array of sanitized and formatted form values |
|
| 351 | + */ |
|
| 352 | 352 | public function get_submitted_merge_values( $data, $form_fields ) { |
| 353 | 353 | |
| 354 | 354 | // Array to return |
@@ -400,14 +400,14 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
| 403 | - * Sanitize form values and return them |
|
| 404 | - * |
|
| 405 | - * @since 6.3.0 |
|
| 406 | - * |
|
| 407 | - * @param string | $key | The MERGE/Field-name for this value |
|
| 408 | - * @param mixed | $value | The form value - this could be an array or a string |
|
| 409 | - * @return mixed | $sanitized | The $value sanitized |
|
| 410 | - */ |
|
| 403 | + * Sanitize form values and return them |
|
| 404 | + * |
|
| 405 | + * @since 6.3.0 |
|
| 406 | + * |
|
| 407 | + * @param string | $key | The MERGE/Field-name for this value |
|
| 408 | + * @param mixed | $value | The form value - this could be an array or a string |
|
| 409 | + * @return mixed | $sanitized | The $value sanitized |
|
| 410 | + */ |
|
| 411 | 411 | protected function sanitize_form_values( $key, $value ) { |
| 412 | 412 | if ( is_scalar( $value ) ) { |
| 413 | 413 | $sanitized = sanitize_text_field( $value ); |
@@ -421,14 +421,14 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
| 424 | - * Check a date field's date format and pass it along to the appropriate function |
|
| 425 | - * |
|
| 426 | - * @since 6.3.0 |
|
| 427 | - * |
|
| 428 | - * @param string | $date | The unformatted date value |
|
| 429 | - * @param string | $date_format | The date format |
|
| 430 | - * @return string| $date | The date formatted according to the $date_format |
|
| 431 | - */ |
|
| 424 | + * Check a date field's date format and pass it along to the appropriate function |
|
| 425 | + * |
|
| 426 | + * @since 6.3.0 |
|
| 427 | + * |
|
| 428 | + * @param string | $date | The unformatted date value |
|
| 429 | + * @param string | $date_format | The date format |
|
| 430 | + * @return string| $date | The date formatted according to the $date_format |
|
| 431 | + */ |
|
| 432 | 432 | protected function handle_date_format_merge_values( $date, $date_format ) { |
| 433 | 433 | // Check if EU date format (for dates: 'DD/MM/YYYY', for birthdays: 'DD/MM') |
| 434 | 434 | if ( 'DD/MM/YYYY' === $date_format ) { |
@@ -441,13 +441,13 @@ discard block |
||
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | /** |
| 444 | - * Format a date field whose date format is dd/mm/yyyy |
|
| 445 | - * |
|
| 446 | - * @since 6.3.0 |
|
| 447 | - * |
|
| 448 | - * @param string | $date | A date in the format dd/mm/yyyy |
|
| 449 | - * @return string| $date | A date in the format mm/dd/yyyy |
|
| 450 | - */ |
|
| 444 | + * Format a date field whose date format is dd/mm/yyyy |
|
| 445 | + * |
|
| 446 | + * @since 6.3.0 |
|
| 447 | + * |
|
| 448 | + * @param string | $date | A date in the format dd/mm/yyyy |
|
| 449 | + * @return string| $date | A date in the format mm/dd/yyyy |
|
| 450 | + */ |
|
| 451 | 451 | protected function handle_dd_mm_yyyy_date( $date ) { |
| 452 | 452 | |
| 453 | 453 | // MailChimp wants the dates as 'MM/DD/YYYY' regardless of user-specified format, so convert |
@@ -466,13 +466,13 @@ discard block |
||
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | - * Format a birthday field whose date format is dd/mm |
|
| 470 | - * |
|
| 471 | - * @since 6.3.0 |
|
| 472 | - * |
|
| 473 | - * @param string | $birthday | A date in the format dd/mm |
|
| 474 | - * @return string| $birthday | A date in the format mm/dd |
|
| 475 | - */ |
|
| 469 | + * Format a birthday field whose date format is dd/mm |
|
| 470 | + * |
|
| 471 | + * @since 6.3.0 |
|
| 472 | + * |
|
| 473 | + * @param string | $birthday | A date in the format dd/mm |
|
| 474 | + * @return string| $birthday | A date in the format mm/dd |
|
| 475 | + */ |
|
| 476 | 476 | protected function handle_dd_mm_birthday( $birthday ) { |
| 477 | 477 | |
| 478 | 478 | // MailChimp wants the birthdays as 'MM/DD' regardless of user-specified format, so convert |
@@ -492,14 +492,14 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | |
| 494 | 494 | /** |
| 495 | - * Create an array of available interest groups based on the $replace_interests flag |
|
| 496 | - * |
|
| 497 | - * @since 6.3.0 |
|
| 498 | - * |
|
| 499 | - * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
| 500 | - * @param class | $list_class | Class for interacting with the current list |
|
| 501 | - * @return array | $groups | Array of interest groups |
|
| 502 | - */ |
|
| 495 | + * Create an array of available interest groups based on the $replace_interests flag |
|
| 496 | + * |
|
| 497 | + * @since 6.3.0 |
|
| 498 | + * |
|
| 499 | + * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
| 500 | + * @param class | $list_class | Class for interacting with the current list |
|
| 501 | + * @return array | $groups | Array of interest groups |
|
| 502 | + */ |
|
| 503 | 503 | public function get_default_interest_groups( $replace_interests, $list_class ) { |
| 504 | 504 | |
| 505 | 505 | // If $replace_interests flag is true then loop through interest groups and set them all to false to start. |
@@ -537,15 +537,15 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | |
| 539 | 539 | /** |
| 540 | - * Loop through the interest group form data to sanitize, format, filter, and return. |
|
| 541 | - * |
|
| 542 | - * @since 6.3.0 |
|
| 543 | - * |
|
| 544 | - * @param array | $data | The array of user-submitted form values |
|
| 545 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 546 | - * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
| 547 | - * @return array| $groups | The array of sanitized and formatted form values |
|
| 548 | - */ |
|
| 540 | + * Loop through the interest group form data to sanitize, format, filter, and return. |
|
| 541 | + * |
|
| 542 | + * @since 6.3.0 |
|
| 543 | + * |
|
| 544 | + * @param array | $data | The array of user-submitted form values |
|
| 545 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 546 | + * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
| 547 | + * @return array| $groups | The array of sanitized and formatted form values |
|
| 548 | + */ |
|
| 549 | 549 | public function get_submitted_interest_groups( $data, $form_fields, $groups ) { |
| 550 | 550 | |
| 551 | 551 | // loop to push variables to our array |
@@ -574,13 +574,13 @@ discard block |
||
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /** |
| 577 | - * yikes-mailchimp-filter-groups-before-submission |
|
| 578 | - * |
|
| 579 | - * Catch the interest groups before they get sent over to MailChimp |
|
| 580 | - * @param array | $groups | User submitted interest group data |
|
| 581 | - * @optional int| $form_id| the ID of the form to filter |
|
| 582 | - * @since 6.3.0 |
|
| 583 | - */ |
|
| 577 | + * yikes-mailchimp-filter-groups-before-submission |
|
| 578 | + * |
|
| 579 | + * Catch the interest groups before they get sent over to MailChimp |
|
| 580 | + * @param array | $groups | User submitted interest group data |
|
| 581 | + * @optional int| $form_id| the ID of the form to filter |
|
| 582 | + * @since 6.3.0 |
|
| 583 | + */ |
|
| 584 | 584 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission', $groups, $this->form_id ); |
| 585 | 585 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission-{$this->form_id}', $groups, $this->form_id ); |
| 586 | 586 | |
@@ -591,17 +591,17 @@ discard block |
||
| 591 | 591 | /**** Functions to Handle Subscribe API Response ****/ |
| 592 | 592 | |
| 593 | 593 | /** |
| 594 | - * Handle the response to a successful subscribe request |
|
| 595 | - * |
|
| 596 | - * @since 6.3.0 |
|
| 597 | - * |
|
| 598 | - * @param array | $submission_settings | Array of the form's submission settings |
|
| 599 | - * @param array | $page_data | Array of the page data |
|
| 600 | - * @param array | $merge_variables | Array of the submitted form variables |
|
| 601 | - * @param array | $notifications | Literally don't know what this is yet. |
|
| 602 | - * @param array | $optin_settings | Array of the form's optin settings |
|
| 603 | - * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
| 604 | - */ |
|
| 594 | + * Handle the response to a successful subscribe request |
|
| 595 | + * |
|
| 596 | + * @since 6.3.0 |
|
| 597 | + * |
|
| 598 | + * @param array | $submission_settings | Array of the form's submission settings |
|
| 599 | + * @param array | $page_data | Array of the page data |
|
| 600 | + * @param array | $merge_variables | Array of the submitted form variables |
|
| 601 | + * @param array | $notifications | Literally don't know what this is yet. |
|
| 602 | + * @param array | $optin_settings | Array of the form's optin settings |
|
| 603 | + * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
| 604 | + */ |
|
| 605 | 605 | public function handle_submission_response_success( $submission_settings, $page_data, $merge_variables, $notifications, $optin_settings, $new_subscriber ) { |
| 606 | 606 | |
| 607 | 607 | // Check if we should redirect, and collect the redirect info in an array |
@@ -610,27 +610,27 @@ discard block |
||
| 610 | 610 | // Fire off our actions |
| 611 | 611 | |
| 612 | 612 | /** |
| 613 | - * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
| 614 | - * |
|
| 615 | - * Catch the merge variables after they've been sent over to MailChimp |
|
| 616 | - * @since 6.0.0 |
|
| 617 | - * |
|
| 618 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 619 | - */ |
|
| 613 | + * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
| 614 | + * |
|
| 615 | + * Catch the merge variables after they've been sent over to MailChimp |
|
| 616 | + * @since 6.0.0 |
|
| 617 | + * |
|
| 618 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 619 | + */ |
|
| 620 | 620 | do_action( 'yikes-mailchimp-after-submission', $merge_variables, $this->form_id ); |
| 621 | 621 | do_action( "yikes-mailchimp-after-submission-{$this->form_id}", $merge_variables, $this->form_id ); |
| 622 | 622 | |
| 623 | 623 | /** |
| 624 | - * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
| 625 | - * |
|
| 626 | - * Catch our notifications and other form data |
|
| 627 | - * |
|
| 628 | - * @param string | $email | The user's email |
|
| 629 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 630 | - * @param string | $form_id | The form ID |
|
| 631 | - * @param array | $notifications | Array of notification messages |
|
| 632 | - * |
|
| 633 | - */ |
|
| 624 | + * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
| 625 | + * |
|
| 626 | + * Catch our notifications and other form data |
|
| 627 | + * |
|
| 628 | + * @param string | $email | The user's email |
|
| 629 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 630 | + * @param string | $form_id | The form ID |
|
| 631 | + * @param array | $notifications | Array of notification messages |
|
| 632 | + * |
|
| 633 | + */ |
|
| 634 | 634 | do_action( 'yikes-mailchimp-form-submission', $this->email, $merge_variables, $this->form_id, $notifications ); |
| 635 | 635 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
| 636 | 636 | |
@@ -652,15 +652,15 @@ discard block |
||
| 652 | 652 | $default_response = ( $new_subscriber === false ) ? $this->check_for_user_defined_response_message( 'success-resubscribed', $this->existing_subscriber_profile_update_message ) : $default_response; |
| 653 | 653 | |
| 654 | 654 | /** |
| 655 | - * yikes-mailchimp-success-response |
|
| 656 | - * |
|
| 657 | - * Filter the success message displayed to the user |
|
| 658 | - * |
|
| 659 | - * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
| 660 | - * @param string | $form_id | The form ID |
|
| 661 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 662 | - * |
|
| 663 | - */ |
|
| 655 | + * yikes-mailchimp-success-response |
|
| 656 | + * |
|
| 657 | + * Filter the success message displayed to the user |
|
| 658 | + * |
|
| 659 | + * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
| 660 | + * @param string | $form_id | The form ID |
|
| 661 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 662 | + * |
|
| 663 | + */ |
|
| 664 | 664 | $response_message = apply_filters( 'yikes-mailchimp-success-response', $default_response, $this->form_id, $merge_variables ); |
| 665 | 665 | |
| 666 | 666 | // Construct our success array variables |
@@ -679,13 +679,13 @@ discard block |
||
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | /** |
| 682 | - * Handle an unsuccessful/error subscribe request |
|
| 683 | - * |
|
| 684 | - * @since 6.3.0 |
|
| 685 | - * |
|
| 686 | - * @param object | $subscribe_response | The response from the API |
|
| 687 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 688 | - */ |
|
| 682 | + * Handle an unsuccessful/error subscribe request |
|
| 683 | + * |
|
| 684 | + * @since 6.3.0 |
|
| 685 | + * |
|
| 686 | + * @param object | $subscribe_response | The response from the API |
|
| 687 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 688 | + */ |
|
| 689 | 689 | public function handle_submission_response_error( $subscribe_response, $form_fields ) { |
| 690 | 690 | |
| 691 | 691 | // Get the error data |
@@ -727,13 +727,13 @@ discard block |
||
| 727 | 727 | // Note: All of these functions return `return $this->yikes_fail()`. Check function for more info. |
| 728 | 728 | |
| 729 | 729 | /** |
| 730 | - * Check if the submitted form data is missing any required fields |
|
| 731 | - * |
|
| 732 | - * @since 6.3.0 |
|
| 733 | - * |
|
| 734 | - * @param array | $data | The array of user-submitted form values |
|
| 735 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 736 | - */ |
|
| 730 | + * Check if the submitted form data is missing any required fields |
|
| 731 | + * |
|
| 732 | + * @since 6.3.0 |
|
| 733 | + * |
|
| 734 | + * @param array | $data | The array of user-submitted form values |
|
| 735 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 736 | + */ |
|
| 737 | 737 | public function check_for_required_form_fields( $data, $form_fields ) { |
| 738 | 738 | |
| 739 | 739 | // Set up our defaults |
@@ -758,15 +758,15 @@ discard block |
||
| 758 | 758 | foreach( $value as $field => $val ) { |
| 759 | 759 | |
| 760 | 760 | /** |
| 761 | - * 'yikes-mailchimp-ignore-required-array-field' |
|
| 762 | - * |
|
| 763 | - * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
| 764 | - * |
|
| 765 | - * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
| 766 | - * @param int | $form_id |
|
| 767 | - * |
|
| 768 | - * @return Array of fields to ignore. |
|
| 769 | - */ |
|
| 761 | + * 'yikes-mailchimp-ignore-required-array-field' |
|
| 762 | + * |
|
| 763 | + * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
| 764 | + * |
|
| 765 | + * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
| 766 | + * @param int | $form_id |
|
| 767 | + * |
|
| 768 | + * @return Array of fields to ignore. |
|
| 769 | + */ |
|
| 770 | 770 | $ignored_fields = apply_filters( 'yikes-mailchimp-ignore-required-array-field', array( 'addr2' => true ), $this->form_id ); |
| 771 | 771 | |
| 772 | 772 | if ( empty( $val ) && ! isset( $ignored_fields[ $field ] ) ) { |
@@ -797,14 +797,14 @@ discard block |
||
| 797 | 797 | ); |
| 798 | 798 | |
| 799 | 799 | /** |
| 800 | - * yikes-mailchimp-required-form-field-missing |
|
| 801 | - * |
|
| 802 | - * Alter the response message shown to the user for missing required form fields |
|
| 803 | - * |
|
| 804 | - * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
| 805 | - * @param int | $form_id | The ID of the form |
|
| 806 | - * @param array | $missing_fields | Array of the missing required fields |
|
| 807 | - */ |
|
| 800 | + * yikes-mailchimp-required-form-field-missing |
|
| 801 | + * |
|
| 802 | + * Alter the response message shown to the user for missing required form fields |
|
| 803 | + * |
|
| 804 | + * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
| 805 | + * @param int | $form_id | The ID of the form |
|
| 806 | + * @param array | $missing_fields | Array of the missing required fields |
|
| 807 | + */ |
|
| 808 | 808 | $default_response = apply_filters( 'yikes-mailchimp-required-form-field-missing', $this->handle_empty_required_field_message, $this->form_id, $missing_fields ); |
| 809 | 809 | |
| 810 | 810 | // If we've found a missing field, return the array of field data |
@@ -813,13 +813,13 @@ discard block |
||
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | /** |
| 816 | - * Check if the submitted form interest group data is missing any required fields |
|
| 817 | - * |
|
| 818 | - * @since 6.3.0 |
|
| 819 | - * |
|
| 820 | - * @param array | $data | The array of user-submitted form values |
|
| 821 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 822 | - */ |
|
| 816 | + * Check if the submitted form interest group data is missing any required fields |
|
| 817 | + * |
|
| 818 | + * @since 6.3.0 |
|
| 819 | + * |
|
| 820 | + * @param array | $data | The array of user-submitted form values |
|
| 821 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 822 | + */ |
|
| 823 | 823 | public function check_for_required_interest_groups( $data, $form_fields ) { |
| 824 | 824 | |
| 825 | 825 | // Set up our defaults |
@@ -853,14 +853,14 @@ discard block |
||
| 853 | 853 | ); |
| 854 | 854 | |
| 855 | 855 | /** |
| 856 | - * yikes-mailchimp-required-interest-group-missing |
|
| 857 | - * |
|
| 858 | - * Alter the response message shown to the user for missing required form fields |
|
| 859 | - * |
|
| 860 | - * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
| 861 | - * @param int | $form_id | The ID of the form |
|
| 862 | - * @param array | $missing_fields | Array of the missing required fields |
|
| 863 | - */ |
|
| 856 | + * yikes-mailchimp-required-interest-group-missing |
|
| 857 | + * |
|
| 858 | + * Alter the response message shown to the user for missing required form fields |
|
| 859 | + * |
|
| 860 | + * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
| 861 | + * @param int | $form_id | The ID of the form |
|
| 862 | + * @param array | $missing_fields | Array of the missing required fields |
|
| 863 | + */ |
|
| 864 | 864 | $default_response = apply_filters( 'yikes-mailchimp-required-interest-group-missing', $this->handle_empty_required_interest_group_message, $this->form_id, $missing_fields ); |
| 865 | 865 | |
| 866 | 866 | // If we find a required interest group with an empty value, send an error |
@@ -869,12 +869,12 @@ discard block |
||
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | /** |
| 872 | - * Handle the reCAPTCHA |
|
| 873 | - * |
|
| 874 | - * @since 6.3.0 |
|
| 875 | - * |
|
| 876 | - * @param string | $recaptcha_response | The form value of the recaptcha field |
|
| 877 | - */ |
|
| 872 | + * Handle the reCAPTCHA |
|
| 873 | + * |
|
| 874 | + * @since 6.3.0 |
|
| 875 | + * |
|
| 876 | + * @param string | $recaptcha_response | The form value of the recaptcha field |
|
| 877 | + */ |
|
| 878 | 878 | public function handle_recaptcha( $recaptcha_response ) { |
| 879 | 879 | |
| 880 | 880 | // Before we the hit the API, let's check that we actually got a response. |
@@ -882,11 +882,11 @@ discard block |
||
| 882 | 882 | if ( empty( $recaptcha_response ) ) { |
| 883 | 883 | |
| 884 | 884 | /** |
| 885 | - * yikes-mailchimp-recaptcha-required-error |
|
| 886 | - * |
|
| 887 | - * Catch the recaptcha errors before they're returned to the user |
|
| 888 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 889 | - */ |
|
| 885 | + * yikes-mailchimp-recaptcha-required-error |
|
| 886 | + * |
|
| 887 | + * Catch the recaptcha errors before they're returned to the user |
|
| 888 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 889 | + */ |
|
| 890 | 890 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', $this->handle_non_filled_recaptcha_message_message, $this->form_id ); |
| 891 | 891 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
| 892 | 892 | } |
@@ -919,40 +919,40 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | /** |
| 922 | - * yikes-mailchimp-recaptcha-required-error |
|
| 923 | - * |
|
| 924 | - * Catch the recaptcha errors before they're returned to the user |
|
| 925 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 926 | - */ |
|
| 922 | + * yikes-mailchimp-recaptcha-required-error |
|
| 923 | + * |
|
| 924 | + * Catch the recaptcha errors before they're returned to the user |
|
| 925 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 926 | + */ |
|
| 927 | 927 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $recaptcha_errors ), $this->form_id ); |
| 928 | 928 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
| 929 | 929 | } |
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | /** |
| 933 | - * Handle the nonce field |
|
| 934 | - * |
|
| 935 | - * @since 6.3.0 |
|
| 936 | - * |
|
| 937 | - * @param string | $nonce_value | The form value of the nonce |
|
| 938 | - * @param string | $nonce_name | The name of the nonce |
|
| 939 | - */ |
|
| 933 | + * Handle the nonce field |
|
| 934 | + * |
|
| 935 | + * @since 6.3.0 |
|
| 936 | + * |
|
| 937 | + * @param string | $nonce_value | The form value of the nonce |
|
| 938 | + * @param string | $nonce_name | The name of the nonce |
|
| 939 | + */ |
|
| 940 | 940 | public function handle_nonce( $nonce_value, $nonce_name ) { |
| 941 | 941 | |
| 942 | 942 | // First, check our option - this is set in the general settings page |
| 943 | 943 | if ( get_option( 'yikes-mailchimp-use-nonce' ) === '1' ) { |
| 944 | 944 | |
| 945 | 945 | /** |
| 946 | - * yikes-mailchimp-use-nonce-verification |
|
| 947 | - * |
|
| 948 | - * Decide if we're going to check the nonce value. |
|
| 949 | - * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
| 950 | - * The default will always be to use the nonce. |
|
| 951 | - * |
|
| 952 | - * @param int | $form_id | The form id |
|
| 953 | - * |
|
| 954 | - * @return bool | True if we should check the nonce |
|
| 955 | - */ |
|
| 946 | + * yikes-mailchimp-use-nonce-verification |
|
| 947 | + * |
|
| 948 | + * Decide if we're going to check the nonce value. |
|
| 949 | + * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
| 950 | + * The default will always be to use the nonce. |
|
| 951 | + * |
|
| 952 | + * @param int | $form_id | The form id |
|
| 953 | + * |
|
| 954 | + * @return bool | True if we should check the nonce |
|
| 955 | + */ |
|
| 956 | 956 | $use_nonce = apply_filters( 'yikes-mailchimp-use-nonce-verification', true, $this->form_id ); |
| 957 | 957 | |
| 958 | 958 | // We let the filter override the option because the filter is on a per-form basis |
@@ -965,24 +965,24 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /** |
| 968 | - * Handle a merge_variables error |
|
| 969 | - * |
|
| 970 | - * @since 6.3.0 |
|
| 971 | - * |
|
| 972 | - * @param int | $error | Int $error = 1 if an error |
|
| 973 | - * @param string | $message | The message shown to the user |
|
| 974 | - */ |
|
| 968 | + * Handle a merge_variables error |
|
| 969 | + * |
|
| 970 | + * @since 6.3.0 |
|
| 971 | + * |
|
| 972 | + * @param int | $error | Int $error = 1 if an error |
|
| 973 | + * @param string | $message | The message shown to the user |
|
| 974 | + */ |
|
| 975 | 975 | public function handle_merge_variables_error( $error, $message ) { |
| 976 | 976 | return $this->yikes_fail( $hide = 0, $error, $message, array(), $return_response_non_ajax = true ); |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | /** |
| 980 | - * Handle an empty email field and return the corresponding error message |
|
| 981 | - * |
|
| 982 | - * @since 6.3.0 |
|
| 983 | - * |
|
| 984 | - * @param string | $email |
|
| 985 | - */ |
|
| 980 | + * Handle an empty email field and return the corresponding error message |
|
| 981 | + * |
|
| 982 | + * @since 6.3.0 |
|
| 983 | + * |
|
| 984 | + * @param string | $email |
|
| 985 | + */ |
|
| 986 | 986 | public function handle_empty_email( $email ) { |
| 987 | 987 | if ( empty( $email ) ) { |
| 988 | 988 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_email_message ); |
@@ -990,12 +990,12 @@ discard block |
||
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | /** |
| 993 | - * Check if the form is empty and return the corresponding error message |
|
| 994 | - * |
|
| 995 | - * @since 6.3.0 |
|
| 996 | - * |
|
| 997 | - * @param array | $form_data |
|
| 998 | - */ |
|
| 993 | + * Check if the form is empty and return the corresponding error message |
|
| 994 | + * |
|
| 995 | + * @since 6.3.0 |
|
| 996 | + * |
|
| 997 | + * @param array | $form_data |
|
| 998 | + */ |
|
| 999 | 999 | public function handle_empty_form( $form_data ) { |
| 1000 | 1000 | if ( empty( $form_data ) ) { |
| 1001 | 1001 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_message ); |
@@ -1003,12 +1003,12 @@ discard block |
||
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | 1005 | /** |
| 1006 | - * Check if the honeypot is NOT empty and return the corresponding error message |
|
| 1007 | - * |
|
| 1008 | - * @since 6.3.0 |
|
| 1009 | - * |
|
| 1010 | - * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
| 1011 | - */ |
|
| 1006 | + * Check if the honeypot is NOT empty and return the corresponding error message |
|
| 1007 | + * |
|
| 1008 | + * @since 6.3.0 |
|
| 1009 | + * |
|
| 1010 | + * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
| 1011 | + */ |
|
| 1012 | 1012 | public function handle_non_empty_honeypot( $honey_pot_filled ) { |
| 1013 | 1013 | if ( $honey_pot_filled === true ) { |
| 1014 | 1014 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_non_empty_honeypot_message ); |
@@ -1016,12 +1016,12 @@ discard block |
||
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | /** |
| 1019 | - * Loop through fields looking for null and return the corresponding error message |
|
| 1020 | - * |
|
| 1021 | - * @since 6.3.0 |
|
| 1022 | - * |
|
| 1023 | - * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
| 1024 | - */ |
|
| 1019 | + * Loop through fields looking for null and return the corresponding error message |
|
| 1020 | + * |
|
| 1021 | + * @since 6.3.0 |
|
| 1022 | + * |
|
| 1023 | + * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
| 1024 | + */ |
|
| 1025 | 1025 | public function handle_empty_fields_generic( $fields_array ) { |
| 1026 | 1026 | foreach( $fields_array as $field ) { |
| 1027 | 1027 | if ( $field === null ) { |
@@ -1031,12 +1031,12 @@ discard block |
||
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | 1033 | /** |
| 1034 | - * Check if the list handler is empty and return the corresponding error message |
|
| 1035 | - * |
|
| 1036 | - * @since 6.3.0 |
|
| 1037 | - * |
|
| 1038 | - * @param class | $list_handler | A class that handles list functions |
|
| 1039 | - */ |
|
| 1034 | + * Check if the list handler is empty and return the corresponding error message |
|
| 1035 | + * |
|
| 1036 | + * @since 6.3.0 |
|
| 1037 | + * |
|
| 1038 | + * @param class | $list_handler | A class that handles list functions |
|
| 1039 | + */ |
|
| 1040 | 1040 | public function handle_empty_list_handler( $list_handler ) { |
| 1041 | 1041 | if ( empty( $list_handler ) ) { |
| 1042 | 1042 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_list_handler_message ); |
@@ -1044,12 +1044,12 @@ discard block |
||
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | 1046 | /** |
| 1047 | - * Check if the form id is empty and return the corresponding error message |
|
| 1048 | - * |
|
| 1049 | - * @since 6.3.0 |
|
| 1050 | - * |
|
| 1051 | - * @param int | $form_id | The form ID |
|
| 1052 | - */ |
|
| 1047 | + * Check if the form id is empty and return the corresponding error message |
|
| 1048 | + * |
|
| 1049 | + * @since 6.3.0 |
|
| 1050 | + * |
|
| 1051 | + * @param int | $form_id | The form ID |
|
| 1052 | + */ |
|
| 1053 | 1053 | public function handle_empty_form_id( $form_id ) { |
| 1054 | 1054 | if ( empty( $form_id ) ) { |
| 1055 | 1055 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_id_message ); |
@@ -1057,10 +1057,10 @@ discard block |
||
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | /** |
| 1060 | - * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
| 1061 | - * |
|
| 1062 | - * @since 6.3.0 |
|
| 1063 | - */ |
|
| 1060 | + * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
| 1061 | + * |
|
| 1062 | + * @since 6.3.0 |
|
| 1063 | + */ |
|
| 1064 | 1064 | public function handle_disallowed_existing_user_update() { |
| 1065 | 1065 | |
| 1066 | 1066 | // Get the default response |
@@ -1073,10 +1073,10 @@ discard block |
||
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | /** |
| 1076 | - * Construct and filter the error message related to the profile link to update user's profile |
|
| 1077 | - * |
|
| 1078 | - * @since 6.3.0 |
|
| 1079 | - */ |
|
| 1076 | + * Construct and filter the error message related to the profile link to update user's profile |
|
| 1077 | + * |
|
| 1078 | + * @since 6.3.0 |
|
| 1079 | + */ |
|
| 1080 | 1080 | public function handle_updating_existing_user() { |
| 1081 | 1081 | |
| 1082 | 1082 | // Get the first half of the message |
@@ -1101,15 +1101,15 @@ discard block |
||
| 1101 | 1101 | /**** Helper Functions ****/ |
| 1102 | 1102 | |
| 1103 | 1103 | /** |
| 1104 | - * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
| 1105 | - * |
|
| 1106 | - * @since 6.3.0 |
|
| 1107 | - * |
|
| 1108 | - * @param string | $slug | The type of message we're looking for |
|
| 1109 | - * @param string | $response_text| The default response message |
|
| 1110 | - * @param array | $data | An array of data that may be needed to construct the user's error message |
|
| 1111 | - * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
| 1112 | - */ |
|
| 1104 | + * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
| 1105 | + * |
|
| 1106 | + * @since 6.3.0 |
|
| 1107 | + * |
|
| 1108 | + * @param string | $slug | The type of message we're looking for |
|
| 1109 | + * @param string | $response_text| The default response message |
|
| 1110 | + * @param array | $data | An array of data that may be needed to construct the user's error message |
|
| 1111 | + * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
| 1112 | + */ |
|
| 1113 | 1113 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
| 1114 | 1114 | |
| 1115 | 1115 | switch( $slug ) { |
@@ -1123,13 +1123,13 @@ discard block |
||
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | /** |
| 1126 | - * yikes-easy-mailchimp-user-already-subscribed-text |
|
| 1127 | - * |
|
| 1128 | - * Catch the message for user's already subscrbed before we show it to the user |
|
| 1129 | - * @param string | $message | The response message |
|
| 1130 | - * @param int | $form_id | The form id |
|
| 1131 | - * @param string | $email | The user's email |
|
| 1132 | - */ |
|
| 1126 | + * yikes-easy-mailchimp-user-already-subscribed-text |
|
| 1127 | + * |
|
| 1128 | + * Catch the message for user's already subscrbed before we show it to the user |
|
| 1129 | + * @param string | $message | The response message |
|
| 1130 | + * @param int | $form_id | The form id |
|
| 1131 | + * @param string | $email | The user's email |
|
| 1132 | + */ |
|
| 1133 | 1133 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-text', $response_text, $this->form_id, $this->email ); |
| 1134 | 1134 | |
| 1135 | 1135 | return $response_text; |
@@ -1148,13 +1148,13 @@ discard block |
||
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | /** |
| 1151 | - * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
| 1152 | - * |
|
| 1153 | - * Catch the message for user's already subscrbed link text before we show it to the user |
|
| 1154 | - * |
|
| 1155 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1156 | - * @param string | $form_id | The form ID |
|
| 1157 | - */ |
|
| 1151 | + * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
| 1152 | + * |
|
| 1153 | + * Catch the message for user's already subscrbed link text before we show it to the user |
|
| 1154 | + * |
|
| 1155 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1156 | + * @param string | $form_id | The form ID |
|
| 1157 | + */ |
|
| 1158 | 1158 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-link-text', $response_text, $this->form_id ); |
| 1159 | 1159 | |
| 1160 | 1160 | return $response_text; |
@@ -1168,14 +1168,14 @@ discard block |
||
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | /** |
| 1171 | - * yikes-mailchimp-success-double-optin-response |
|
| 1172 | - * |
|
| 1173 | - * Filter the success message displayed to the user |
|
| 1174 | - * |
|
| 1175 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1176 | - * @param string | $form_id | The form ID |
|
| 1177 | - * |
|
| 1178 | - */ |
|
| 1171 | + * yikes-mailchimp-success-double-optin-response |
|
| 1172 | + * |
|
| 1173 | + * Filter the success message displayed to the user |
|
| 1174 | + * |
|
| 1175 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1176 | + * @param string | $form_id | The form ID |
|
| 1177 | + * |
|
| 1178 | + */ |
|
| 1179 | 1179 | $response_text = apply_filters( 'yikes-mailchimp-success-double-optin-response', $response_text, $this->form_id ); |
| 1180 | 1180 | |
| 1181 | 1181 | return $response_text; |
@@ -1188,14 +1188,14 @@ discard block |
||
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | /** |
| 1191 | - * yikes-mailchimp-success-single-optin-response |
|
| 1192 | - * |
|
| 1193 | - * Filter the success message displayed to the user |
|
| 1194 | - * |
|
| 1195 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1196 | - * @param string | $form_id | The form ID |
|
| 1197 | - * |
|
| 1198 | - */ |
|
| 1191 | + * yikes-mailchimp-success-single-optin-response |
|
| 1192 | + * |
|
| 1193 | + * Filter the success message displayed to the user |
|
| 1194 | + * |
|
| 1195 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1196 | + * @param string | $form_id | The form ID |
|
| 1197 | + * |
|
| 1198 | + */ |
|
| 1199 | 1199 | $response_text = apply_filters( 'yikes-mailchimp-success-single-optin-response', $response_text, $this->form_id ); |
| 1200 | 1200 | |
| 1201 | 1201 | return $response_text; |
@@ -1208,14 +1208,14 @@ discard block |
||
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /** |
| 1211 | - * yikes-mailchimp-success-resubscribed-response |
|
| 1212 | - * |
|
| 1213 | - * Filter the success message displayed to the user |
|
| 1214 | - * |
|
| 1215 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1216 | - * @param string | $form_id | The form ID |
|
| 1217 | - * |
|
| 1218 | - */ |
|
| 1211 | + * yikes-mailchimp-success-resubscribed-response |
|
| 1212 | + * |
|
| 1213 | + * Filter the success message displayed to the user |
|
| 1214 | + * |
|
| 1215 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1216 | + * @param string | $form_id | The form ID |
|
| 1217 | + * |
|
| 1218 | + */ |
|
| 1219 | 1219 | $response_text = apply_filters( 'yikes-mailchimp-success-resubscribed-response', $response_text, $this->form_id ); |
| 1220 | 1220 | |
| 1221 | 1221 | return $response_text; |
@@ -1231,16 +1231,16 @@ discard block |
||
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | /** |
| 1234 | - * yikes-mailchimp-general-error-response |
|
| 1235 | - * |
|
| 1236 | - * Filter the error message displayed to the user |
|
| 1237 | - * |
|
| 1238 | - * @param string | $original_response_text | The original response message returned from the API |
|
| 1239 | - * @param string | $user_defined_response_text | The response message defined by the user |
|
| 1240 | - * @param string | $form_id | The form ID |
|
| 1241 | - * |
|
| 1242 | - * @return string | $response_text | The message that will be shown to the user |
|
| 1243 | - */ |
|
| 1234 | + * yikes-mailchimp-general-error-response |
|
| 1235 | + * |
|
| 1236 | + * Filter the error message displayed to the user |
|
| 1237 | + * |
|
| 1238 | + * @param string | $original_response_text | The original response message returned from the API |
|
| 1239 | + * @param string | $user_defined_response_text | The response message defined by the user |
|
| 1240 | + * @param string | $form_id | The form ID |
|
| 1241 | + * |
|
| 1242 | + * @return string | $response_text | The message that will be shown to the user |
|
| 1243 | + */ |
|
| 1244 | 1244 | $response_text = apply_filters( 'yikes-mailchimp-general-error-response', $original_response_text, $user_defined_response_text, $this->form_id ); |
| 1245 | 1245 | |
| 1246 | 1246 | return $response_text; |
@@ -1254,14 +1254,14 @@ discard block |
||
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | /** |
| 1257 | - * Wrap the response message in HTML for Non-AJAX form submissions |
|
| 1258 | - * |
|
| 1259 | - * @since 6.3.0 |
|
| 1260 | - * |
|
| 1261 | - * @param string | $message | The response message |
|
| 1262 | - * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
| 1263 | - * @return string| The $message wrapping in HTML |
|
| 1264 | - */ |
|
| 1257 | + * Wrap the response message in HTML for Non-AJAX form submissions |
|
| 1258 | + * |
|
| 1259 | + * @since 6.3.0 |
|
| 1260 | + * |
|
| 1261 | + * @param string | $message | The response message |
|
| 1262 | + * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
| 1263 | + * @return string| The $message wrapping in HTML |
|
| 1264 | + */ |
|
| 1265 | 1265 | public function wrap_form_submission_response( $message, $is_success ) { |
| 1266 | 1266 | |
| 1267 | 1267 | // If we're successful, we wrap the $message differently |
@@ -1275,14 +1275,14 @@ discard block |
||
| 1275 | 1275 | /**** Returning Success / Failure Functions ****/ |
| 1276 | 1276 | |
| 1277 | 1277 | /** |
| 1278 | - * Return success. Method of returning success based on the $is_ajax flag |
|
| 1279 | - * |
|
| 1280 | - * @since 6.3.0 |
|
| 1281 | - * |
|
| 1282 | - * @param array | $success_array | Array of success values to return |
|
| 1283 | - * |
|
| 1284 | - * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
| 1285 | - */ |
|
| 1278 | + * Return success. Method of returning success based on the $is_ajax flag |
|
| 1279 | + * |
|
| 1280 | + * @since 6.3.0 |
|
| 1281 | + * |
|
| 1282 | + * @param array | $success_array | Array of success values to return |
|
| 1283 | + * |
|
| 1284 | + * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
| 1285 | + */ |
|
| 1286 | 1286 | protected function yikes_success( $success_array ) { |
| 1287 | 1287 | if ( $this->is_ajax === true ) { |
| 1288 | 1288 | wp_send_json_success( $success_array ); |
@@ -1295,18 +1295,18 @@ discard block |
||
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | /** |
| 1298 | - * Return failure. Method of returning failure based on the $is_ajax flag |
|
| 1299 | - * |
|
| 1300 | - * @since 6.3.0 |
|
| 1301 | - * |
|
| 1302 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1303 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1304 | - * @param string | $response | The response message to display to the user |
|
| 1305 | - * @param array | $additional_fields | An array of additional fields to return |
|
| 1306 | - * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
| 1307 | - * |
|
| 1308 | - * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
| 1309 | - */ |
|
| 1298 | + * Return failure. Method of returning failure based on the $is_ajax flag |
|
| 1299 | + * |
|
| 1300 | + * @since 6.3.0 |
|
| 1301 | + * |
|
| 1302 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1303 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1304 | + * @param string | $response | The response message to display to the user |
|
| 1305 | + * @param array | $additional_fields | An array of additional fields to return |
|
| 1306 | + * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
| 1307 | + * |
|
| 1308 | + * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
| 1309 | + */ |
|
| 1310 | 1310 | protected function yikes_fail( $hide, $error, $response, $additional_fields = array(), $return_response_non_ajax = false ) { |
| 1311 | 1311 | if ( $this->is_ajax === true ) { |
| 1312 | 1312 | $this->yikes_send_json_error( $hide, $error, $response, $additional_fields ); |
@@ -1319,17 +1319,17 @@ discard block |
||
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | /** |
| 1322 | - * Wrapper function for wp_send_json_error() |
|
| 1323 | - * |
|
| 1324 | - * @since 6.3.0 |
|
| 1325 | - * |
|
| 1326 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1327 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1328 | - * @param string | $translated_string | The response message to display to the user |
|
| 1329 | - * @param array | $additional_fields | An array of additional fields to return |
|
| 1330 | - * |
|
| 1331 | - * @return func | wp_send_json_error() |
|
| 1332 | - */ |
|
| 1322 | + * Wrapper function for wp_send_json_error() |
|
| 1323 | + * |
|
| 1324 | + * @since 6.3.0 |
|
| 1325 | + * |
|
| 1326 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1327 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1328 | + * @param string | $translated_string | The response message to display to the user |
|
| 1329 | + * @param array | $additional_fields | An array of additional fields to return |
|
| 1330 | + * |
|
| 1331 | + * @return func | wp_send_json_error() |
|
| 1332 | + */ |
|
| 1333 | 1333 | protected function yikes_send_json_error( $hide, $error, $translated_string, $additional_fields = array() ) { |
| 1334 | 1334 | |
| 1335 | 1335 | // Default response array |
@@ -1353,14 +1353,14 @@ discard block |
||
| 1353 | 1353 | /** Static functions used in other places **/ |
| 1354 | 1354 | |
| 1355 | 1355 | /** |
| 1356 | - * Handle the redirect logic for successful submissions |
|
| 1357 | - * |
|
| 1358 | - * @since 6.3.0 |
|
| 1359 | - * |
|
| 1360 | - * @param array | $submission_settings | Array of the form's submission settings |
|
| 1361 | - * @param array | $page_data | Page ID |
|
| 1362 | - * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
| 1363 | - */ |
|
| 1356 | + * Handle the redirect logic for successful submissions |
|
| 1357 | + * |
|
| 1358 | + * @since 6.3.0 |
|
| 1359 | + * |
|
| 1360 | + * @param array | $submission_settings | Array of the form's submission settings |
|
| 1361 | + * @param array | $page_data | Page ID |
|
| 1362 | + * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
| 1363 | + */ |
|
| 1364 | 1364 | public static function handle_submission_response_success_redirect( $form_id, $submission_settings, $page_data ) { |
| 1365 | 1365 | |
| 1366 | 1366 | $default_redirect_time_ms = 1500; |
@@ -1393,23 +1393,23 @@ discard block |
||
| 1393 | 1393 | $redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
| 1394 | 1394 | |
| 1395 | 1395 | /** |
| 1396 | - * yikes-mailchimp-redirect-url |
|
| 1397 | - * |
|
| 1398 | - * Catch the redirect URL before it's shown to the user |
|
| 1399 | - * |
|
| 1400 | - * @param string | $redirect_url | The URL that we will redirect to |
|
| 1401 | - * @param string | $form_id | The ID of the current form being subscribed to |
|
| 1402 | - * @param array | $page_data | An array of data related to the page the form is on |
|
| 1403 | - */ |
|
| 1396 | + * yikes-mailchimp-redirect-url |
|
| 1397 | + * |
|
| 1398 | + * Catch the redirect URL before it's shown to the user |
|
| 1399 | + * |
|
| 1400 | + * @param string | $redirect_url | The URL that we will redirect to |
|
| 1401 | + * @param string | $form_id | The ID of the current form being subscribed to |
|
| 1402 | + * @param array | $page_data | An array of data related to the page the form is on |
|
| 1403 | + */ |
|
| 1404 | 1404 | $redirect_url = apply_filters( 'yikes-mailchimp-redirect-url', $redirect_url, $form_id, $page_data ); |
| 1405 | 1405 | |
| 1406 | 1406 | /** |
| 1407 | - * yikes-mailchimp-redirect-timer |
|
| 1408 | - * |
|
| 1409 | - * Catch the redirect timer before it's sent to the JavaScript file |
|
| 1410 | - * |
|
| 1411 | - * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
| 1412 | - */ |
|
| 1407 | + * yikes-mailchimp-redirect-timer |
|
| 1408 | + * |
|
| 1409 | + * Catch the redirect timer before it's sent to the JavaScript file |
|
| 1410 | + * |
|
| 1411 | + * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
| 1412 | + */ |
|
| 1413 | 1413 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data ); |
| 1414 | 1414 | |
| 1415 | 1415 | $redirect_array['redirect_timer'] = $redirect_timer; |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | $this->handle_updating_existing_user_link_message = __( 'To update your MailChimp profile, please click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ); |
| 256 | 256 | $this->handle_empty_required_field_message = __( 'A required field is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
| 257 | 257 | $this->handle_empty_required_interest_group_message = __( 'A required interest group is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
| 258 | - $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 258 | + $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 259 | 259 | $this->handle_non_filled_recaptcha_message_message = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' ); |
| 260 | 260 | $this->generic_recaptcha_error_message = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
| 261 | 261 | |
| 262 | 262 | // Define our success messages |
| 263 | - $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 264 | - $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 263 | + $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 264 | + $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 265 | 265 | $this->existing_subscriber_profile_update_message = __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' ); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -373,16 +373,16 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | // Check if the current iteration has a 'date_format' key set (i.e. date/birthday fields) |
| 376 | - if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) { |
|
| 377 | - $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ]['date_format'] ); |
|
| 376 | + if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) { |
|
| 377 | + $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ][ 'date_format' ] ); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | $merge_variables[ $merge_tag ] = $sanitized; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | // Make sure we send the lower-cased, sanitized email so it matches the one we're sending in the body of the request. |
| 384 | - if ( isset( $merge_variables['EMAIL'] ) ) { |
|
| 385 | - $merge_variables['EMAIL'] = $this->email; |
|
| 384 | + if ( isset( $merge_variables[ 'EMAIL' ] ) ) { |
|
| 385 | + $merge_variables[ 'EMAIL' ] = $this->email; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | if ( count( $pieces ) === 3 ) { |
| 460 | 460 | |
| 461 | 461 | // $pieces[1] = MM. $pieces[0] = DD. $date = MM/DD/YYYY |
| 462 | - $date = $pieces[1] . '/' . $pieces[0] . '/' . $pieces[2]; |
|
| 462 | + $date = $pieces[ 1 ] . '/' . $pieces[ 0 ] . '/' . $pieces[ 2 ]; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | return $date; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | if ( count( $pieces ) === 2 ) { |
| 485 | 485 | |
| 486 | 486 | // $pieces[1] = MM. $pieces[0] = DD. $birthday = MM/DD |
| 487 | - $birthday = $pieces[1] . '/' . $pieces[0]; |
|
| 487 | + $birthday = $pieces[ 1 ] . '/' . $pieces[ 0 ]; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | return $birthday; |
@@ -517,12 +517,12 @@ discard block |
||
| 517 | 517 | // Loop through the interest groups and create a single array like {group_id} => false |
| 518 | 518 | foreach ( $interest_groupings as $group_data ) { |
| 519 | 519 | |
| 520 | - if ( ! isset( $group_data['items'] ) || isset( $group_data['items'] ) && ( empty( $group_data['items'] ) || ! is_array( $group_data['items'] ) ) ) { |
|
| 520 | + if ( ! isset( $group_data[ 'items' ] ) || isset( $group_data[ 'items' ] ) && ( empty( $group_data[ 'items' ] ) || ! is_array( $group_data[ 'items' ] ) ) ) { |
|
| 521 | 521 | continue; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - foreach ( $group_data['items'] as $item ) { |
|
| 525 | - $groups[$item['id']] = false; |
|
| 524 | + foreach ( $group_data[ 'items' ] as $item ) { |
|
| 525 | + $groups[ $item[ 'id' ] ] = false; |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
| 636 | 636 | |
| 637 | 637 | // Get the optin value |
| 638 | - $optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
| 638 | + $optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
| 639 | 639 | |
| 640 | 640 | if ( 1 === $optin ) { |
| 641 | 641 | |
@@ -665,13 +665,13 @@ discard block |
||
| 665 | 665 | |
| 666 | 666 | // Construct our success array variables |
| 667 | 667 | $return_success_array = array( |
| 668 | - 'hide' => $submission_settings['hide_form_post_signup'], |
|
| 668 | + 'hide' => $submission_settings[ 'hide_form_post_signup' ], |
|
| 669 | 669 | 'error' => 0, |
| 670 | 670 | 'response' => $response_message, |
| 671 | - 'redirection' => $redirect_array['redirection'], |
|
| 672 | - 'redirect' => $redirect_array['redirect'], |
|
| 673 | - 'new_window' => $redirect_array['new_window'], |
|
| 674 | - 'redirect_timer' => $redirect_array['redirect_timer'], |
|
| 671 | + 'redirection' => $redirect_array[ 'redirection' ], |
|
| 672 | + 'redirect' => $redirect_array[ 'redirect' ], |
|
| 673 | + 'new_window' => $redirect_array[ 'new_window' ], |
|
| 674 | + 'redirect_timer' => $redirect_array[ 'redirect_timer' ], |
|
| 675 | 675 | ); |
| 676 | 676 | |
| 677 | 677 | // Return success array |
@@ -693,12 +693,12 @@ discard block |
||
| 693 | 693 | $details = ''; |
| 694 | 694 | |
| 695 | 695 | // Loop through the error data and retrieve any fields and messages |
| 696 | - if ( isset( $error_data['data'] ) ) { |
|
| 697 | - foreach ( $error_data['data'] as $datum ) { |
|
| 698 | - if ( ! isset( $datum['field'], $datum['message'] ) ) { |
|
| 696 | + if ( isset( $error_data[ 'data' ] ) ) { |
|
| 697 | + foreach ( $error_data[ 'data' ] as $datum ) { |
|
| 698 | + if ( ! isset( $datum[ 'field' ], $datum[ 'message' ] ) ) { |
|
| 699 | 699 | continue; |
| 700 | 700 | } |
| 701 | - $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum['field'] ]['label'], $datum['message'] ); |
|
| 701 | + $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum[ 'field' ] ][ 'label' ], $datum[ 'message' ] ); |
|
| 702 | 702 | } |
| 703 | 703 | } |
| 704 | 704 | |
@@ -741,21 +741,21 @@ discard block |
||
| 741 | 741 | $missing_fields = array(); |
| 742 | 742 | |
| 743 | 743 | // Loop through submitted form data |
| 744 | - foreach( $data as $merge_tag => $value ) { |
|
| 744 | + foreach ( $data as $merge_tag => $value ) { |
|
| 745 | 745 | |
| 746 | 746 | // Skip interest groups |
| 747 | - if ( isset( $form_fields[ $merge_tag ]['group_id'] ) ) { |
|
| 747 | + if ( isset( $form_fields[ $merge_tag ][ 'group_id' ] ) ) { |
|
| 748 | 748 | continue; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | // check if this field is required |
| 752 | - if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ]['require'] ) && $form_fields[ $merge_tag ]['require'] === '1' ) { |
|
| 752 | + if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ][ 'require' ] ) && $form_fields[ $merge_tag ][ 'require' ] === '1' ) { |
|
| 753 | 753 | |
| 754 | 754 | // Check if the field(s) are empty |
| 755 | 755 | if ( is_array( $value ) ) { |
| 756 | 756 | |
| 757 | 757 | // Loop through the data and check if any are empty |
| 758 | - foreach( $value as $field => $val ) { |
|
| 758 | + foreach ( $value as $field => $val ) { |
|
| 759 | 759 | |
| 760 | 760 | /** |
| 761 | 761 | * 'yikes-mailchimp-ignore-required-array-field' |
@@ -774,13 +774,13 @@ discard block |
||
| 774 | 774 | |
| 775 | 775 | // Set the merge label (e.g. MMERGE6) as the key so we don't get the same field multiple times |
| 776 | 776 | // (e.g. For arrays, like an address, where multiple address fields are empty) |
| 777 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
| 777 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
| 778 | 778 | } |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | } else if ( empty( $value ) ) { |
| 782 | 782 | $field_is_missing = true; |
| 783 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
| 783 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
| 784 | 784 | } |
| 785 | 785 | } |
| 786 | 786 | } |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | foreach ( $form_fields as $merge_tag => $field_data ) { |
| 831 | 831 | |
| 832 | 832 | // If an interest group and it's required |
| 833 | - if ( isset( $field_data['group_id'] ) && isset( $field_data['require'] ) && $field_data['require'] === '1' ) { |
|
| 833 | + if ( isset( $field_data[ 'group_id' ] ) && isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] === '1' ) { |
|
| 834 | 834 | |
| 835 | 835 | // Check if it was submitted (meaning, check if it's set in our $data array) |
| 836 | 836 | if ( ! isset( $data[ 'group-' . $merge_tag ] ) ) { |
@@ -892,30 +892,30 @@ discard block |
||
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | // Construct the API URL |
| 895 | - $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER['REMOTE_ADDR'] ); |
|
| 895 | + $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] ); |
|
| 896 | 896 | $response = wp_remote_get( $url ); |
| 897 | - $response_body = json_decode( $response['body'], true ); |
|
| 897 | + $response_body = json_decode( $response[ 'body' ], true ); |
|
| 898 | 898 | |
| 899 | 899 | // Set up errors array |
| 900 | 900 | $recaptcha_errors = array(); |
| 901 | 901 | |
| 902 | 902 | // if we've hit an error, lets return the error! |
| 903 | - if ( true !== $response_body['success'] ) { |
|
| 903 | + if ( true !== $response_body[ 'success' ] ) { |
|
| 904 | 904 | |
| 905 | - if( isset( $response_body['error-codes'] ) ) { |
|
| 905 | + if ( isset( $response_body[ 'error-codes' ] ) ) { |
|
| 906 | 906 | |
| 907 | 907 | // Loop through response error codes |
| 908 | - foreach ( $response_body['error-codes'] as $error_code ) { |
|
| 908 | + foreach ( $response_body[ 'error-codes' ] as $error_code ) { |
|
| 909 | 909 | if ( 'missing-input-response' === $error_code ) { |
| 910 | 910 | $error_code = $this->handle_non_filled_recaptcha_message; |
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | // Add our error_code to the errors array |
| 914 | - $recaptcha_errors[] = $error_code; |
|
| 914 | + $recaptcha_errors[ ] = $error_code; |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | } else { |
| 918 | - $recaptcha_errors[] = $this->generic_recaptcha_error_message; |
|
| 918 | + $recaptcha_errors[ ] = $this->generic_recaptcha_error_message; |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | /** |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
| 1024 | 1024 | */ |
| 1025 | 1025 | public function handle_empty_fields_generic( $fields_array ) { |
| 1026 | - foreach( $fields_array as $field ) { |
|
| 1026 | + foreach ( $fields_array as $field ) { |
|
| 1027 | 1027 | if ( $field === null ) { |
| 1028 | 1028 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_fields_generic_message ); |
| 1029 | 1029 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | |
| 1090 | 1090 | // Append our 'send-update-email' link and text |
| 1091 | 1091 | $response .= $link_start_tag; |
| 1092 | - $response .= $this->handle_updating_existing_user_link_message; |
|
| 1092 | + $response .= $this->handle_updating_existing_user_link_message; |
|
| 1093 | 1093 | $response .= $link_close_tag; |
| 1094 | 1094 | |
| 1095 | 1095 | // Check for a user-defined message |
@@ -1112,14 +1112,14 @@ discard block |
||
| 1112 | 1112 | */ |
| 1113 | 1113 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
| 1114 | 1114 | |
| 1115 | - switch( $slug ) { |
|
| 1115 | + switch ( $slug ) { |
|
| 1116 | 1116 | case 'already-subscribed': |
| 1117 | 1117 | |
| 1118 | 1118 | // Check if this error message exists |
| 1119 | - if ( isset( $this->error_messages['already-subscribed'] ) && ! empty( $this->error_messages['already-subscribed'] ) ) { |
|
| 1119 | + if ( isset( $this->error_messages[ 'already-subscribed' ] ) && ! empty( $this->error_messages[ 'already-subscribed' ] ) ) { |
|
| 1120 | 1120 | |
| 1121 | 1121 | // Check if the substring (that we replace) '[email]' is located in the string and replace it |
| 1122 | - $response_text = str_replace( '[email]', $this->email, $this->error_messages['already-subscribed'] ); |
|
| 1122 | + $response_text = str_replace( '[email]', $this->email, $this->error_messages[ 'already-subscribed' ] ); |
|
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | /** |
@@ -1138,13 +1138,13 @@ discard block |
||
| 1138 | 1138 | case 'update-link': |
| 1139 | 1139 | |
| 1140 | 1140 | // Check if this error message exists |
| 1141 | - if ( $data !== false && isset( $this->error_messages['update-link'] ) && ! empty( $this->error_messages['update-link'] ) ) { |
|
| 1141 | + if ( $data !== false && isset( $this->error_messages[ 'update-link' ] ) && ! empty( $this->error_messages[ 'update-link' ] ) ) { |
|
| 1142 | 1142 | |
| 1143 | 1143 | // Check if the substring (that we replace) '[link]' is located in the string and replace it |
| 1144 | - $response_text = str_replace( '[link]', $data['link_start_tag'], $this->error_messages['update-link'] ); |
|
| 1144 | + $response_text = str_replace( '[link]', $data[ 'link_start_tag' ], $this->error_messages[ 'update-link' ] ); |
|
| 1145 | 1145 | |
| 1146 | 1146 | // Remove [/link] |
| 1147 | - $response_text = str_replace( '[/link]', $data['link_close_tag'], $response_text ); |
|
| 1147 | + $response_text = str_replace( '[/link]', $data[ 'link_close_tag' ], $response_text ); |
|
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | /** |
@@ -1163,8 +1163,8 @@ discard block |
||
| 1163 | 1163 | case 'success': |
| 1164 | 1164 | |
| 1165 | 1165 | // 'success' is the user-defined success message for double opt-in |
| 1166 | - if ( isset( $this->error_messages['success'] ) && ! empty( $this->error_messages['success'] ) ) { |
|
| 1167 | - $response_text = $this->error_messages['success']; |
|
| 1166 | + if ( isset( $this->error_messages[ 'success' ] ) && ! empty( $this->error_messages[ 'success' ] ) ) { |
|
| 1167 | + $response_text = $this->error_messages[ 'success' ]; |
|
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | /** |
@@ -1183,8 +1183,8 @@ discard block |
||
| 1183 | 1183 | |
| 1184 | 1184 | case 'success-single-optin': |
| 1185 | 1185 | |
| 1186 | - if ( isset( $this->error_messages['success-single-optin'] ) && ! empty( $this->error_messages['success-single-optin'] ) ) { |
|
| 1187 | - $response_text = $this->error_messages['success-single-optin']; |
|
| 1186 | + if ( isset( $this->error_messages[ 'success-single-optin' ] ) && ! empty( $this->error_messages[ 'success-single-optin' ] ) ) { |
|
| 1187 | + $response_text = $this->error_messages[ 'success-single-optin' ]; |
|
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | /** |
@@ -1203,8 +1203,8 @@ discard block |
||
| 1203 | 1203 | |
| 1204 | 1204 | case 'success-resubscribed': |
| 1205 | 1205 | |
| 1206 | - if ( isset( $this->error_messages['success-resubscribed'] ) && ! empty( $this->error_messages['success-resubscribed'] ) ) { |
|
| 1207 | - $response_text = $this->error_messages['success-resubscribed']; |
|
| 1206 | + if ( isset( $this->error_messages[ 'success-resubscribed' ] ) && ! empty( $this->error_messages[ 'success-resubscribed' ] ) ) { |
|
| 1207 | + $response_text = $this->error_messages[ 'success-resubscribed' ]; |
|
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /** |
@@ -1226,8 +1226,8 @@ discard block |
||
| 1226 | 1226 | $original_response_text = $response_text; |
| 1227 | 1227 | $user_defined_response_text = ''; |
| 1228 | 1228 | |
| 1229 | - if ( isset( $this->error_messages['general-error'] ) && ! empty( $this->error_messages['general-error'] ) ) { |
|
| 1230 | - $user_defined_response_text = $this->error_messages['general-error']; |
|
| 1229 | + if ( isset( $this->error_messages[ 'general-error' ] ) && ! empty( $this->error_messages[ 'general-error' ] ) ) { |
|
| 1230 | + $user_defined_response_text = $this->error_messages[ 'general-error' ]; |
|
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | /** |
@@ -1289,7 +1289,7 @@ discard block |
||
| 1289 | 1289 | } else { |
| 1290 | 1290 | global $process_submission_response; |
| 1291 | 1291 | |
| 1292 | - $process_submission_response = isset( $success_array['response'] ) ? $success_array['response'] : ''; // DEFAULT SUCCESS? |
|
| 1292 | + $process_submission_response = isset( $success_array[ 'response' ] ) ? $success_array[ 'response' ] : ''; // DEFAULT SUCCESS? |
|
| 1293 | 1293 | $process_submission_response = $this->wrap_form_submission_response( $process_submission_response, $is_success = true ); |
| 1294 | 1294 | } |
| 1295 | 1295 | } |
@@ -1342,8 +1342,8 @@ discard block |
||
| 1342 | 1342 | // Add additional fields we've been supplied |
| 1343 | 1343 | if ( ! empty( $additional_fields ) ) { |
| 1344 | 1344 | |
| 1345 | - foreach( $additional_fields as $key => $value ) { |
|
| 1346 | - $response_array[$key] = $value; |
|
| 1345 | + foreach ( $additional_fields as $key => $value ) { |
|
| 1346 | + $response_array[ $key ] = $value; |
|
| 1347 | 1347 | } |
| 1348 | 1348 | } |
| 1349 | 1349 | |
@@ -1374,20 +1374,20 @@ discard block |
||
| 1374 | 1374 | ); |
| 1375 | 1375 | |
| 1376 | 1376 | // Let's confirm we have a value before trying to use it |
| 1377 | - $redirect_setting = isset( $submission_settings['redirect_on_submission'] ) ? $submission_settings['redirect_on_submission'] : false; |
|
| 1377 | + $redirect_setting = isset( $submission_settings[ 'redirect_on_submission' ] ) ? $submission_settings[ 'redirect_on_submission' ] : false; |
|
| 1378 | 1378 | |
| 1379 | 1379 | // Check the redirect flag |
| 1380 | 1380 | if ( '1' === $redirect_setting ) { |
| 1381 | 1381 | |
| 1382 | 1382 | // Supply return array with default value of 1 |
| 1383 | - $redirect_array['redirection'] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data ); |
|
| 1383 | + $redirect_array[ 'redirection' ] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data ); |
|
| 1384 | 1384 | |
| 1385 | 1385 | // Let's confirm we have redirect_page/custom_redirect_url/new_window values |
| 1386 | - $redirect_page_setting = isset( $submission_settings['redirect_page'] ) ? $submission_settings['redirect_page'] : false; |
|
| 1387 | - $custom_redirect_setting = isset( $submission_settings['custom_redirect_url'] ) ? $submission_settings['custom_redirect_url'] : false; |
|
| 1388 | - $redirect_new_window = isset( $submission_settings['redirect_new_window'] ) ? $submission_settings['redirect_new_window'] : false; |
|
| 1386 | + $redirect_page_setting = isset( $submission_settings[ 'redirect_page' ] ) ? $submission_settings[ 'redirect_page' ] : false; |
|
| 1387 | + $custom_redirect_setting = isset( $submission_settings[ 'custom_redirect_url' ] ) ? $submission_settings[ 'custom_redirect_url' ] : false; |
|
| 1388 | + $redirect_new_window = isset( $submission_settings[ 'redirect_new_window' ] ) ? $submission_settings[ 'redirect_new_window' ] : false; |
|
| 1389 | 1389 | |
| 1390 | - $redirect_array['new_window'] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data ); |
|
| 1390 | + $redirect_array[ 'new_window' ] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data ); |
|
| 1391 | 1391 | |
| 1392 | 1392 | // Check if we're redirecting to a custom_url or just the redirect_page |
| 1393 | 1393 | $redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
@@ -1412,9 +1412,9 @@ discard block |
||
| 1412 | 1412 | */ |
| 1413 | 1413 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data ); |
| 1414 | 1414 | |
| 1415 | - $redirect_array['redirect_timer'] = $redirect_timer; |
|
| 1415 | + $redirect_array[ 'redirect_timer' ] = $redirect_timer; |
|
| 1416 | 1416 | |
| 1417 | - $redirect_array['redirect'] = $redirect_url; |
|
| 1417 | + $redirect_array[ 'redirect' ] = $redirect_url; |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | return $redirect_array; |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | public function maybe_add_tags( $form_data, $subscriber_data ) { |
| 1424 | 1424 | |
| 1425 | 1425 | // Add the form's tags |
| 1426 | - $form_tags = isset( $form_data['tags'] ) ? $form_data['tags'] : array(); |
|
| 1426 | + $form_tags = isset( $form_data[ 'tags' ] ) ? $form_data[ 'tags' ] : array(); |
|
| 1427 | 1427 | $form_tags = apply_filters( 'yikes_mailchimp_subscriber_tags', $form_tags, $form_data, $this->list_id, $subscriber_data ); |
| 1428 | 1428 | |
| 1429 | 1429 | if ( ! empty( $form_tags ) ) { |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | $add_tag = apply_filters( 'yikes_mailchimp_subscriber_tag_active', true, $tag, $this->list_id, $subscriber_data ); |
| 1433 | 1433 | |
| 1434 | 1434 | if ( $add_tag ) { |
| 1435 | - $list_handler->create_member_tags( $this->list_id, $tag['id'], array( 'email_address' => $this->email ) ); |
|
| 1435 | + $list_handler->create_member_tags( $this->list_id, $tag[ 'id' ], array( 'email_address' => $this->email ) ); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | } |
| 1438 | 1438 | } |
@@ -11,16 +11,16 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | public function __construct() { |
| 13 | 13 | // ajax process form submission |
| 14 | - add_action( 'wp_ajax_nopriv_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
| 15 | - add_action( 'wp_ajax_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
| 14 | + add_action( 'wp_ajax_nopriv_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
| 15 | + add_action( 'wp_ajax_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
| 16 | 16 | |
| 17 | 17 | // ajax send update emails |
| 18 | - add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
| 19 | - add_action( 'wp_ajax_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
| 18 | + add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
| 19 | + add_action( 'wp_ajax_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
| 20 | 20 | |
| 21 | 21 | // increase submission count for a given form on successful submit |
| 22 | - add_action( 'wp_ajax_nopriv_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
| 23 | - add_action( 'wp_ajax_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
| 22 | + add_action( 'wp_ajax_nopriv_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
| 23 | + add_action( 'wp_ajax_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /* |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * Increase the submission count for a given form. |
| 38 | 38 | */ |
| 39 | 39 | public function increase_submission_count() { |
| 40 | - $form_id = intval( $_POST['form_id'] ); |
|
| 40 | + $form_id = intval( $_POST[ 'form_id' ] ); |
|
| 41 | 41 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 42 | 42 | $form = $interface->get_form( $form_id ); |
| 43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Update the form. |
| 50 | - $submission_count = isset( $form['submissions'] ) ? $form['submissions'] + 1 : 1; |
|
| 50 | + $submission_count = isset( $form[ 'submissions' ] ) ? $form[ 'submissions' ] + 1 : 1; |
|
| 51 | 51 | $interface->update_form_field( $form_id, 'submissions', $submission_count ); |
| 52 | 52 | |
| 53 | 53 | exit(); |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | @since v6.0.4.1 |
| 59 | 59 | */ |
| 60 | 60 | public function sendUpdateProfileEmail() { |
| 61 | - $user_email = filter_var( $_POST['user_email'], FILTER_SANITIZE_STRING ); |
|
| 61 | + $user_email = filter_var( $_POST[ 'user_email' ], FILTER_SANITIZE_STRING ); |
|
| 62 | 62 | $user_id = md5( $user_email ); |
| 63 | - $list_id = filter_var( $_POST['list_id'], FILTER_SANITIZE_STRING ); |
|
| 64 | - $form_id = filter_var( $_POST['form_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 65 | - $page_id = filter_var( $_POST['page_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 63 | + $list_id = filter_var( $_POST[ 'list_id' ], FILTER_SANITIZE_STRING ); |
|
| 64 | + $form_id = filter_var( $_POST[ 'form_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 65 | + $page_id = filter_var( $_POST[ 'page_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 66 | 66 | $full_site_url = get_bloginfo( 'url' ); |
| 67 | 67 | $manager = yikes_get_mc_api_manager(); |
| 68 | 68 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | 'class.public_ajax.php' |
| 80 | 80 | ); |
| 81 | 81 | $is_error = true; |
| 82 | - $errors[] = $list_details->get_error_message(); |
|
| 82 | + $errors[ ] = $list_details->get_error_message(); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Subscriber details API call. |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 89 | 89 | $error_logging->maybe_write_to_log( $subscriber_account_details->get_error_code(), __( 'Send Update Profile Email - Get Member Info.', 'yikes-inc-easy-mailchimp-extender' ), 'class.public_ajax.php' ); |
| 90 | 90 | $is_error = true; |
| 91 | - $errors[] = $subscriber_account_details->get_error_message(); |
|
| 91 | + $errors[ ] = $subscriber_account_details->get_error_message(); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Form details API call. |
@@ -96,22 +96,22 @@ discard block |
||
| 96 | 96 | if ( ! empty( $interface ) && method_exists( $interface, 'get_form' ) && ! empty( $form_id ) ) { |
| 97 | 97 | $form_data = $interface->get_form( $form_id ); |
| 98 | 98 | if ( ! empty( $form_data ) ) { |
| 99 | - if ( isset( $form_data['error_messages'] ) ) { |
|
| 99 | + if ( isset( $form_data[ 'error_messages' ] ) ) { |
|
| 100 | 100 | |
| 101 | - if ( isset( $form_data['error_messages']['email-body'] ) && ! empty( $form_data['error_messages']['email-body'] ) ) { |
|
| 102 | - $email_body = apply_filters( 'the_content', $form_data['error_messages']['email-body'] ); |
|
| 101 | + if ( isset( $form_data[ 'error_messages' ][ 'email-body' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-body' ] ) ) { |
|
| 102 | + $email_body = apply_filters( 'the_content', $form_data[ 'error_messages' ][ 'email-body' ] ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( isset( $form_data['error_messages']['email-subject'] ) && ! empty( $form_data['error_messages']['email-subject'] ) ) { |
|
| 106 | - $email_subject = $form_data['error_messages']['email-subject']; |
|
| 105 | + if ( isset( $form_data[ 'error_messages' ][ 'email-subject' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-subject' ] ) ) { |
|
| 106 | + $email_subject = $form_data[ 'error_messages' ][ 'email-subject' ]; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ( isset( $form_data['error_messages']['update-email-success'] ) && ! empty( $form_data['error_messages']['update-email-success'] ) ) { |
|
| 110 | - $update_email_success_message = $form_data['error_messages']['update-email-success']; |
|
| 109 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-success' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-success' ] ) ) { |
|
| 110 | + $update_email_success_message = $form_data[ 'error_messages' ][ 'update-email-success' ]; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ( isset( $form_data['error_messages']['update-email-failure'] ) && ! empty( $form_data['error_messages']['update-email-failure'] ) ) { |
|
| 114 | - $update_email_failed_message = $form_data['error_messages']['update-email-failure']; |
|
| 113 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) ) { |
|
| 114 | + $update_email_failed_message = $form_data[ 'error_messages' ][ 'update-email-failure' ]; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // Construct the headers & email message content. |
| 135 | - $subscriber_id = $subscriber_account_details['unique_email_id']; |
|
| 136 | - $update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] ); |
|
| 135 | + $subscriber_id = $subscriber_account_details[ 'unique_email_id' ]; |
|
| 136 | + $update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] ); |
|
| 137 | 137 | $update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href ); |
| 138 | 138 | $update_link_tag = '<a href="' . $update_link_href . '">'; |
| 139 | - $headers = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n"; |
|
| 139 | + $headers = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n"; |
|
| 140 | 140 | $headers .= 'Content-type: text/html'; |
| 141 | 141 | |
| 142 | 142 | if ( ! isset( $email_subject ) ) { |
@@ -178,26 +178,26 @@ discard block |
||
| 178 | 178 | $email_body = str_replace( array( '[subscriber_id]', '[SUBSCRIBER_ID]' ), $subscriber_id, $email_body ); |
| 179 | 179 | |
| 180 | 180 | // We let the user use [form_name] for the form's name so replace [form_name] with the form's name. |
| 181 | - $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data['form_name'], $email_body ); |
|
| 181 | + $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data[ 'form_name' ], $email_body ); |
|
| 182 | 182 | |
| 183 | 183 | // We let the user use [fname] and [lname] so replace those. |
| 184 | - $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details['merge_fields']['FNAME'] ) ? $subscriber_account_details['merge_fields']['FNAME'] : '', $email_body ); |
|
| 185 | - $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details['merge_fields']['LNAME'] ) ? $subscriber_account_details['merge_fields']['LNAME'] : '', $email_body ); |
|
| 184 | + $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] : '', $email_body ); |
|
| 185 | + $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] : '', $email_body ); |
|
| 186 | 186 | |
| 187 | 187 | /* Confirm that the email was sent */ |
| 188 | 188 | if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $email_subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_body, $update_link_href ), $headers ) ) { |
| 189 | 189 | |
| 190 | 190 | $update_email_success_message = apply_filters( 'yikes-mailchimp-update-email-success-message', $update_email_success_message, $form_id, $user_email ); |
| 191 | - $submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
| 191 | + $submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
| 192 | 192 | $redirect_settings = Yikes_Inc_Easy_MailChimp_Extender_Process_Submission_Handler::handle_submission_response_success_redirect( $form_id, $submission_settings, $page_id ); |
| 193 | 193 | |
| 194 | 194 | wp_send_json_success( |
| 195 | 195 | array( |
| 196 | 196 | 'response_text' => '<div class="yikes-easy-mc-success-message">' . $update_email_success_message . '</div>', |
| 197 | - 'redirection' => $redirect_settings['redirection'], |
|
| 198 | - 'redirect' => $redirect_settings['redirect'], |
|
| 199 | - 'redirect_timer' => $redirect_settings['redirect_timer'], |
|
| 200 | - 'new_window' => $redirect_settings['new_window'], |
|
| 197 | + 'redirection' => $redirect_settings[ 'redirection' ], |
|
| 198 | + 'redirect' => $redirect_settings[ 'redirect' ], |
|
| 199 | + 'redirect_timer' => $redirect_settings[ 'redirect_timer' ], |
|
| 200 | + 'new_window' => $redirect_settings[ 'new_window' ], |
|
| 201 | 201 | ) |
| 202 | 202 | ); |
| 203 | 203 | } else { |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | * Get and store our variables |
| 4 | 4 | * @since 6.0 |
| 5 | 5 | */ |
| 6 | -$list_id = $_GET['mailchimp-list']; |
|
| 7 | -$email_id = esc_attr( $_GET['email-id'] ); |
|
| 6 | +$list_id = $_GET[ 'mailchimp-list' ]; |
|
| 7 | +$email_id = esc_attr( $_GET[ 'email-id' ] ); |
|
| 8 | 8 | $list_helper = yikes_get_mc_api_manager()->get_list_handler(); |
| 9 | 9 | |
| 10 | 10 | /* |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $other_lists = $list_helper->get_members_lists( $email_id ); |
| 39 | -$merge_data_array = $user_data['merge_fields']; |
|
| 39 | +$merge_data_array = $user_data[ 'merge_fields' ]; |
|
| 40 | 40 | |
| 41 | 41 | $additional_lists = array(); |
| 42 | 42 | $merge_variable_fields = array(); |
| 43 | 43 | |
| 44 | 44 | /* Build the array of mailing lists the user is subscribed to */ |
| 45 | 45 | foreach ( $other_lists as $id => $value ) { |
| 46 | - if ( 'subscribed' !== $value['status'] ) { |
|
| 46 | + if ( 'subscribed' !== $value[ 'status' ] ) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | continue; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $additional_lists[ $list_data['id'] ] = $list_data['name']; |
|
| 61 | + $additional_lists[ $list_data[ 'id' ] ] = $list_data[ 'name' ]; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /* Build the array of merge variables => value */ |
@@ -74,21 +74,21 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | // loop and display |
| 76 | 76 | if ( $merge_variables ) { |
| 77 | - foreach ( $merge_variables['merge_fields'] as $merge_variable ) { |
|
| 78 | - if ( $merge_variable['tag'] != 'EMAIL' ) { |
|
| 79 | - $merge_variable_fields[ $merge_variable['name'] ] = ( isset( $merge_data_array[ $merge_variable['tag'] ] ) ) ? $merge_data_array[ $merge_variable['tag'] ] : ''; |
|
| 77 | + foreach ( $merge_variables[ 'merge_fields' ] as $merge_variable ) { |
|
| 78 | + if ( $merge_variable[ 'tag' ] != 'EMAIL' ) { |
|
| 79 | + $merge_variable_fields[ $merge_variable[ 'name' ] ] = ( isset( $merge_data_array[ $merge_variable[ 'tag' ] ] ) ) ? $merge_data_array[ $merge_variable[ 'tag' ] ] : ''; |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | // store usable data |
| 86 | -$user_email = sanitize_email( $user_data['email_address'] ); |
|
| 86 | +$user_email = sanitize_email( $user_data[ 'email_address' ] ); |
|
| 87 | 87 | // prepend our email address to the beginning |
| 88 | 88 | $merge_variable_fields = array( 'Email Address' => $user_email ) + $merge_variable_fields; |
| 89 | 89 | $gravatar_image = get_avatar( $user_email, 120 ); |
| 90 | -$email_type = $user_data['email_type']; |
|
| 91 | -$member_rating = ( ! empty( $user_data['member_rating'] ) ) ? (int) $user_data['member_rating'] : 0; |
|
| 90 | +$email_type = $user_data[ 'email_type' ]; |
|
| 91 | +$member_rating = ( ! empty( $user_data[ 'member_rating' ] ) ) ? (int) $user_data[ 'member_rating' ] : 0; |
|
| 92 | 92 | $member_rating_stars = ''; |
| 93 | 93 | |
| 94 | 94 | // Create member rating stars |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | -$last_changed = strtotime( $user_data['last_changed'] ); |
|
| 104 | -$user_language = ( ! empty( $user_data['language'] ) ) ? $user_data['language'] : ''; |
|
| 103 | +$last_changed = strtotime( $user_data[ 'last_changed' ] ); |
|
| 104 | +$user_language = ( ! empty( $user_data[ 'language' ] ) ) ? $user_data[ 'language' ] : ''; |
|
| 105 | 105 | $list_name = $additional_lists[ $list_id ]; |
| 106 | 106 | |
| 107 | 107 | // Generate our display page |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | echo sprintf( esc_html__( 'Subscribed: %1$1s', 'yikes-inc-easy-mailchimp-extender' ), esc_html( gmdate( 'F jS, Y h:i a', $last_changed ) ) ); |
| 145 | 145 | ?> |
| 146 | 146 | </span> |
| 147 | - <?php if ( isset( $user_data['location'] ) && isset( $user_data['location']['timezone'] ) && ! empty( $user_data['location']['timezone'] ) && isset( $user_data['location']['country_code'] ) && ! empty( $user_data['location']['country_code'] ) ) { ?> |
|
| 147 | + <?php if ( isset( $user_data[ 'location' ] ) && isset( $user_data[ 'location' ][ 'timezone' ] ) && ! empty( $user_data[ 'location' ][ 'timezone' ] ) && isset( $user_data[ 'location' ][ 'country_code' ] ) && ! empty( $user_data[ 'location' ][ 'country_code' ] ) ) { ?> |
|
| 148 | 148 | <span class="member-location-data"> |
| 149 | 149 | <?php |
| 150 | 150 | /* translators: the placeholders are a timezone and a country code */ |
| 151 | - echo sprintf( esc_html__( 'Location: %1$1s, %2$2s', 'yikes-inc-easy-mailchimp-extender' ), esc_html( $user_data['location']['timezone'] ), esc_html( $user_data['location']['country_code'] ) ); |
|
| 151 | + echo sprintf( esc_html__( 'Location: %1$1s, %2$2s', 'yikes-inc-easy-mailchimp-extender' ), esc_html( $user_data[ 'location' ][ 'timezone' ] ), esc_html( $user_data[ 'location' ][ 'country_code' ] ) ); |
|
| 152 | 152 | ?> |
| 153 | 153 | </span> |
| 154 | 154 | <?php } ?> |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | <hr class="yikes-mc-subscriber-hr" /> |
| 158 | 158 | |
| 159 | 159 | <?php |
| 160 | - if ( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && filter_var( wp_unslash( $_GET['section'] ), FILTER_SANITIZE_STRING ) === 'subscriber-data' ) ) { |
|
| 160 | + if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && filter_var( wp_unslash( $_GET[ 'section' ] ), FILTER_SANITIZE_STRING ) === 'subscriber-data' ) ) { |
|
| 161 | 161 | ?> |
| 162 | 162 | <section class="yikes-mc-card-body merge-variable-section"> |
| 163 | 163 | <h3><?php esc_html_e( 'Fields:', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
@@ -177,12 +177,12 @@ discard block |
||
| 177 | 177 | <strong><?php esc_html_e( 'No Subscriber Data Found', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 178 | 178 | <?php |
| 179 | 179 | } |
| 180 | - if ( isset( $user_data['ip_signup'] ) && ! empty( $user_data['ip_signup'] ) ) { |
|
| 180 | + if ( isset( $user_data[ 'ip_signup' ] ) && ! empty( $user_data[ 'ip_signup' ] ) ) { |
|
| 181 | 181 | ?> |
| 182 | 182 | <li> |
| 183 | 183 | <label> |
| 184 | 184 | <strong class="section-label"><?php esc_html_e( 'Signup IP', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 185 | - <p class="section-value"><em><?php esc_html_e( $user_data['ip_signup'] ); ?></em></p> |
|
| 185 | + <p class="section-value"><em><?php esc_html_e( $user_data[ 'ip_signup' ] ); ?></em></p> |
|
| 186 | 186 | </label> |
| 187 | 187 | </li> |
| 188 | 188 | <?php |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | <?php |
| 194 | 194 | |
| 195 | 195 | |
| 196 | - if ( isset( $_GET['section'] ) && $_GET['section'] == 'additional-subscriptions' ) { |
|
| 196 | + if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'additional-subscriptions' ) { |
|
| 197 | 197 | ?> |
| 198 | 198 | <section class="yikes-mc-card-body"> |
| 199 | 199 | <?php |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | ?> |
| 223 | 223 | |
| 224 | 224 | <?php |
| 225 | - if ( isset( $_GET['section'] ) && $_GET['section'] == 'delete-subscriber' ) { |
|
| 225 | + if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'delete-subscriber' ) { |
|
| 226 | 226 | $unsubscribe_subscriber_url = esc_url_raw( add_query_arg( array( |
| 227 | 227 | 'action' => 'yikes-easy-mc-unsubscribe-user', |
| 228 | 228 | 'mailchimp-list' => $list_id, |
@@ -277,36 +277,36 @@ discard block |
||
| 277 | 277 | <div id="customer-tab-wrapper"> |
| 278 | 278 | <ul id="customer-tab-wrapper-list"> |
| 279 | 279 | |
| 280 | - <?php if ( isset( $_GET['section'] ) && $_GET['section'] != 'subscriber-data' ) { ?> |
|
| 280 | + <?php if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] != 'subscriber-data' ) { ?> |
|
| 281 | 281 | <a title="<?php _e( 'Subscriber Details', 'yikes-inc-easy-mailchimp-extender' ); ?>" aria-label="<?php _e( 'Subscriber Details', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="<?php echo $subscriber_details; ?>"> |
| 282 | 282 | <?php } ?> |
| 283 | 283 | |
| 284 | - <li <?php if ( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] == 'subscriber-data' ) ) { ?>class="active" <?php } else { ?>class="inactive"<?php } ?>> |
|
| 284 | + <li <?php if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'subscriber-data' ) ) { ?>class="active" <?php } else { ?>class="inactive"<?php } ?>> |
|
| 285 | 285 | <span class="dashicons dashicons-id"></span></li> |
| 286 | 286 | |
| 287 | - <?php if ( isset( $_GET['section'] ) && $_GET['section'] != 'subscriber-data' ) { ?> |
|
| 287 | + <?php if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] != 'subscriber-data' ) { ?> |
|
| 288 | 288 | </a> |
| 289 | 289 | <?php } ?> |
| 290 | 290 | |
| 291 | - <?php if ( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] != 'additional-subscriptions' ) ) { ?> |
|
| 291 | + <?php if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] != 'additional-subscriptions' ) ) { ?> |
|
| 292 | 292 | <a title="<?php _e( 'Additional Subscriptions', 'yikes-inc-easy-mailchimp-extender' ); ?>" aria-label="<?php _e( 'Additional Subscriptions', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="<?php echo $additional_subscription_url; ?>"> |
| 293 | 293 | <?php } ?> |
| 294 | 294 | |
| 295 | - <li <?php if ( isset( $_GET['section'] ) && $_GET['section'] == 'additional-subscriptions' ) { ?>class="active" <?php } else { ?>class="inactive"<?php } ?>> |
|
| 295 | + <li <?php if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'additional-subscriptions' ) { ?>class="active" <?php } else { ?>class="inactive"<?php } ?>> |
|
| 296 | 296 | <span class="dashicons dashicons-portfolio"></span></li> |
| 297 | 297 | |
| 298 | - <?php if ( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] == 'additional-subscriptions' ) ) { ?> |
|
| 298 | + <?php if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'additional-subscriptions' ) ) { ?> |
|
| 299 | 299 | </a> |
| 300 | 300 | <?php } ?> |
| 301 | 301 | |
| 302 | - <?php if ( ! isset( $_GET['section'] ) || isset( $_GET['section'] ) && $_GET['section'] != 'delete-subscriber' ) { ?> |
|
| 302 | + <?php if ( ! isset( $_GET[ 'section' ] ) || isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] != 'delete-subscriber' ) { ?> |
|
| 303 | 303 | <a title="<?php _e( 'Delete Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?>" aria-label="<?php _e( 'Delete Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="<?php echo $delete_subscriber_url; ?>"> |
| 304 | 304 | <?php } ?> |
| 305 | 305 | |
| 306 | - <li <?php if ( isset( $_GET['section'] ) && $_GET['section'] == 'delete-subscriber' ) { ?>class="active" <?php } else { ?>class="inactive"<?php } ?>> |
|
| 306 | + <li <?php if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'delete-subscriber' ) { ?>class="active" <?php } else { ?>class="inactive"<?php } ?>> |
|
| 307 | 307 | <span class="dashicons dashicons-trash"></span></li> |
| 308 | 308 | |
| 309 | - <?php if ( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] == 'delete-subscriber' ) ) { ?> |
|
| 309 | + <?php if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'delete-subscriber' ) ) { ?> |
|
| 310 | 310 | </a> |
| 311 | 311 | <?php } ?> |
| 312 | 312 | |
@@ -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,19 +114,19 @@ 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 | - <input type="checkbox" name="field[<?php echo $group['group_id']; ?>][default_choice][]" value="<?php echo $id; ?>" <?php checked( $pre_selected, $id ); ?>><?php echo stripslashes( $interest_group['name'] ); ?> |
|
| 125 | + <input type="checkbox" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice][]" value="<?php echo $id; ?>" <?php checked( $pre_selected, $id ); ?>><?php echo stripslashes( $interest_group[ 'name' ] ); ?> |
|
| 126 | 126 | <?php |
| 127 | 127 | } |
| 128 | 128 | ?> |
| 129 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 129 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 130 | 130 | </td> |
| 131 | 131 | </tr> |
| 132 | 132 | |
@@ -138,18 +138,18 @@ discard block |
||
| 138 | 138 | <tr valign="top"> |
| 139 | 139 | <td scope="row"> |
| 140 | 140 | <label for="placeholder"> |
| 141 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 141 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 142 | 142 | </label> |
| 143 | 143 | </td> |
| 144 | 144 | <td> |
| 145 | - <select type="default" name="field[<?php echo $group['group_id']; ?>][default_choice]"> |
|
| 146 | - <?php $pre_selected = ! empty( $field_data['default_choice'] ) ? $field_data['default_choice'] : 'no-default'; ?> |
|
| 145 | + <select type="default" name="field[<?php echo $group[ 'group_id' ]; ?>][default_choice]"> |
|
| 146 | + <?php $pre_selected = ! empty( $field_data[ 'default_choice' ] ) ? $field_data[ 'default_choice' ] : 'no-default'; ?> |
|
| 147 | 147 | <option value="no-default">No Default</option> |
| 148 | - <?php foreach ( $field_data['items'] as $id => $interest_group ) { ?> |
|
| 149 | - <option value="<?php echo $id; ?>" <?php selected( $pre_selected, $id ); ?>><?php echo $interest_group['name']; ?></option> |
|
| 148 | + <?php foreach ( $field_data[ 'items' ] as $id => $interest_group ) { ?> |
|
| 149 | + <option value="<?php echo $id; ?>" <?php selected( $pre_selected, $id ); ?>><?php echo $interest_group[ 'name' ]; ?></option> |
|
| 150 | 150 | <?php } ?> |
| 151 | 151 | </select> |
| 152 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 152 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 153 | 153 | </td> |
| 154 | 154 | </tr> |
| 155 | 155 | |
@@ -161,25 +161,25 @@ discard block |
||
| 161 | 161 | <tr valign="top"> |
| 162 | 162 | <td scope="row"> |
| 163 | 163 | <label for="placeholder"> |
| 164 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 164 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 165 | 165 | </label> |
| 166 | 166 | </td> |
| 167 | 167 | <td> |
| 168 | - <textarea class="widefat field-description-input" name="field[<?php echo $group['group_id']; ?>][description]"></textarea> |
|
| 169 | - <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> |
|
| 168 | + <textarea class="widefat field-description-input" name="field[<?php echo $group[ 'group_id' ]; ?>][description]"></textarea> |
|
| 169 | + <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> |
|
| 170 | 170 | </td> |
| 171 | 171 | </tr> |
| 172 | 172 | |
| 173 | 173 | <!-- Description Above Field --> |
| 174 | 174 | <tr valign="top" class="yikes-checkbox-container"> |
| 175 | 175 | <td scope="row"> |
| 176 | - <label for="description_above_<?php echo esc_attr( $group['group_id'] ); ?>"> |
|
| 177 | - <?php _e( 'Description Above Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 176 | + <label for="description_above_<?php echo esc_attr( $group[ 'group_id' ] ); ?>"> |
|
| 177 | + <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 178 | 178 | </label> |
| 179 | 179 | </td> |
| 180 | 180 | <td> |
| 181 | - <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" /> |
|
| 182 | - <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> |
|
| 181 | + <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" /> |
|
| 182 | + <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> |
|
| 183 | 183 | </td> |
| 184 | 184 | </tr> |
| 185 | 185 | |
@@ -187,48 +187,48 @@ discard block |
||
| 187 | 187 | <tr valign="top"> |
| 188 | 188 | <td scope="row"> |
| 189 | 189 | <label for="placeholder"> |
| 190 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 190 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 191 | 191 | </label> |
| 192 | 192 | </td> |
| 193 | 193 | <td> |
| 194 | - <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'] ) ) : '' ; ?>" /> |
|
| 195 | - <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> |
|
| 194 | + <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' ] ) ) : ''; ?>" /> |
|
| 195 | + <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> |
|
| 196 | 196 | </td> |
| 197 | 197 | </tr> |
| 198 | 198 | <!-- Required Toggle --> |
| 199 | 199 | <tr valign="top" class="yikes-checkbox-container"> |
| 200 | 200 | <td scope="row"> |
| 201 | 201 | <label for="field-required"> |
| 202 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 202 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 203 | 203 | </label> |
| 204 | 204 | </td> |
| 205 | 205 | <td> |
| 206 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group['group_id']; ?>][require]"> |
|
| 207 | - <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> |
|
| 206 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group[ 'group_id' ]; ?>][require]"> |
|
| 207 | + <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> |
|
| 208 | 208 | </td> |
| 209 | 209 | </tr> |
| 210 | 210 | <!-- Visible Toggle --> |
| 211 | 211 | <tr valign="top" class="yikes-checkbox-container"> |
| 212 | 212 | <td scope="row"> |
| 213 | 213 | <label for="hide-field"> |
| 214 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 214 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 215 | 215 | </label> |
| 216 | 216 | </td> |
| 217 | 217 | <td> |
| 218 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group['group_id']; ?>][hide]"> |
|
| 219 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 218 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $group[ 'group_id' ]; ?>][hide]"> |
|
| 219 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 220 | 220 | </td> |
| 221 | 221 | </tr> |
| 222 | 222 | <!-- Toggle Field Label Visibility --> |
| 223 | 223 | <tr valign="top" class="yikes-checkbox-container"> |
| 224 | 224 | <td scope="row"> |
| 225 | 225 | <label for="placeholder"> |
| 226 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 226 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 227 | 227 | </label> |
| 228 | 228 | </td> |
| 229 | 229 | <td> |
| 230 | - <input type="checkbox" name="field[<?php echo $group['group_id']; ?>][hide-label]" value="1" /> |
|
| 231 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 230 | + <input type="checkbox" name="field[<?php echo $group[ 'group_id' ]; ?>][hide-label]" value="1" /> |
|
| 231 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 232 | 232 | </td> |
| 233 | 233 | </tr> |
| 234 | 234 | <!-- Toggle Buttons --> |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | </td> |
| 239 | 239 | <td> |
| 240 | 240 | <span class="toggle-container"> |
| 241 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 242 | - <a href="#" class="remove-field" alt="<?php echo $group['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 241 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 242 | + <a href="#" class="remove-field" alt="<?php echo $group[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 243 | 243 | </span> |
| 244 | 244 | </td> |
| 245 | 245 | </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 | |
@@ -213,18 +213,18 @@ discard block |
||
| 213 | 213 | <tr valign="top"> |
| 214 | 214 | <td scope="row"> |
| 215 | 215 | <label for="placeholder"> |
| 216 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 216 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 217 | 217 | </label> |
| 218 | 218 | </td> |
| 219 | 219 | <td> |
| 220 | - <select type="default" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]"> |
|
| 221 | - <?php $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : 'no-default'; ?> |
|
| 220 | + <select type="default" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]"> |
|
| 221 | + <?php $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : 'no-default'; ?> |
|
| 222 | 222 | <option value="no-default" <?php selected( $pre_selected, $choice ); ?>>No Default</option> |
| 223 | - <?php foreach ( $merge_field_data['options']['choices'] as $choice => $value ) { ?> |
|
| 223 | + <?php foreach ( $merge_field_data[ 'options' ][ 'choices' ] as $choice => $value ) { ?> |
|
| 224 | 224 | <option value="<?php echo $choice; ?>" <?php selected( $pre_selected, $choice ); ?>><?php echo stripslashes( $value ); ?></option> |
| 225 | 225 | <?php } ?> |
| 226 | 226 | </select> |
| 227 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 227 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 228 | 228 | </td> |
| 229 | 229 | </tr> |
| 230 | 230 | |
@@ -237,77 +237,77 @@ discard block |
||
| 237 | 237 | <tr valign="top"> |
| 238 | 238 | <td scope="row"> |
| 239 | 239 | <label for="placeholder"> |
| 240 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 240 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 241 | 241 | </label> |
| 242 | 242 | </td> |
| 243 | 243 | <td> |
| 244 | - <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data['tag']; ?>][description]"></textarea> |
|
| 245 | - <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> |
|
| 244 | + <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][description]"></textarea> |
|
| 245 | + <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> |
|
| 246 | 246 | </td> |
| 247 | 247 | </tr> |
| 248 | 248 | <!-- Description Above Field --> |
| 249 | 249 | <tr valign="top" class="yikes-checkbox-container"> |
| 250 | 250 | <td scope="row"> |
| 251 | - <label for="description_above_<?php echo esc_attr( $merge_field_data['tag'] ); ?>"> |
|
| 252 | - <?php _e( 'Description Above Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 251 | + <label for="description_above_<?php echo esc_attr( $merge_field_data[ 'tag' ] ); ?>"> |
|
| 252 | + <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 253 | 253 | </label> |
| 254 | 254 | </td> |
| 255 | 255 | <td> |
| 256 | - <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" /> |
|
| 257 | - <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> |
|
| 256 | + <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" /> |
|
| 257 | + <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> |
|
| 258 | 258 | </td> |
| 259 | 259 | </tr> |
| 260 | 260 | <!-- Additional Classes --> |
| 261 | 261 | <tr valign="top"> |
| 262 | 262 | <td scope="row"> |
| 263 | 263 | <label for="placeholder"> |
| 264 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 264 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 265 | 265 | </label> |
| 266 | 266 | </td> |
| 267 | 267 | <td> |
| 268 | - <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'] ) ) : '' ; ?>" /> |
|
| 269 | - <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> |
|
| 268 | + <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' ] ) ) : ''; ?>" /> |
|
| 269 | + <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> |
|
| 270 | 270 | </td> |
| 271 | 271 | </tr> |
| 272 | 272 | <!-- Required Toggle --> |
| 273 | 273 | <tr valign="top" class="yikes-checkbox-container"> |
| 274 | 274 | <td scope="row"> |
| 275 | 275 | <label for="field-required"> |
| 276 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 276 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 277 | 277 | </label> |
| 278 | 278 | </td> |
| 279 | 279 | <td> |
| 280 | - <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' ); } ?>"> |
|
| 281 | - <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> |
|
| 280 | + <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' ); } ?>"> |
|
| 281 | + <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> |
|
| 282 | 282 | </td> |
| 283 | 283 | </tr> |
| 284 | 284 | <!-- Visible Toggle --> |
| 285 | 285 | <tr valign="top" class="yikes-checkbox-container"> |
| 286 | 286 | <td scope="row"> |
| 287 | 287 | <label for="hide-field"> |
| 288 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 288 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 289 | 289 | </label> |
| 290 | 290 | </td> |
| 291 | 291 | <td> |
| 292 | - <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' ); } ?>"> |
|
| 293 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 292 | + <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' ); } ?>"> |
|
| 293 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 294 | 294 | </td> |
| 295 | 295 | </tr> |
| 296 | 296 | <!-- Toggle Field Label Visibility --> |
| 297 | 297 | <tr valign="top" class="yikes-checkbox-container"> |
| 298 | 298 | <td scope="row"> |
| 299 | 299 | <label for="placeholder"> |
| 300 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 300 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 301 | 301 | </label> |
| 302 | 302 | </td> |
| 303 | 303 | <td> |
| 304 | - <input type="checkbox" name="field[<?php echo $merge_field_data['tag']; ?>][hide-label]" value="1" /> |
|
| 305 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 304 | + <input type="checkbox" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide-label]" value="1" /> |
|
| 305 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 306 | 306 | </td> |
| 307 | 307 | </tr> |
| 308 | 308 | <!-- Display Phone/Date Formats back to the user --> |
| 309 | 309 | <?php |
| 310 | - switch( $form_data['field_type'] ) { |
|
| 310 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 311 | 311 | |
| 312 | 312 | /* Store the phone format, for properly regex pattern */ |
| 313 | 313 | case 'phone': |
@@ -318,23 +318,23 @@ discard block |
||
| 318 | 318 | <td scope="row"> |
| 319 | 319 | <label for="placeholder"> |
| 320 | 320 | <?php |
| 321 | - switch( $form_data['field_type'] ) { |
|
| 321 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 322 | 322 | default: |
| 323 | 323 | case 'birthday': |
| 324 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 325 | - $format = $merge_field_data['options']['date_format']; |
|
| 324 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 325 | + $format = $merge_field_data[ 'options' ][ 'date_format' ]; |
|
| 326 | 326 | $format_name = 'date_format'; |
| 327 | 327 | break; |
| 328 | 328 | |
| 329 | 329 | case 'date': |
| 330 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 331 | - $format = $merge_field_data['options']['date_format']; |
|
| 330 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 331 | + $format = $merge_field_data[ 'options' ][ 'date_format' ]; |
|
| 332 | 332 | $format_name = 'date_format'; |
| 333 | 333 | break; |
| 334 | 334 | |
| 335 | 335 | case 'phone': |
| 336 | - $type = __( 'Phone Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 337 | - $format = ( ( $merge_field_data['options']['phone_format'] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data['options']['phone_format'] ); |
|
| 336 | + $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 337 | + $format = ( ( $merge_field_data[ 'options' ][ 'phone_format' ] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data[ 'options' ][ 'phone_format' ] ); |
|
| 338 | 338 | $format_name = 'phone_format'; |
| 339 | 339 | break; |
| 340 | 340 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | </td> |
| 345 | 345 | <td> |
| 346 | 346 | <strong><?php echo $format; ?></strong> |
| 347 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 347 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 348 | 348 | <p class="description"><small> |
| 349 | 349 | <?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' ) ); ?> |
| 350 | 350 | </small></p> |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | </td> |
| 366 | 366 | <td> |
| 367 | 367 | <span class="toggle-container"> |
| 368 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 369 | - <a href="#" class="remove-field" alt="<?php echo $merge_field_data['tag']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 368 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 369 | + <a href="#" class="remove-field" alt="<?php echo $merge_field_data[ 'tag' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 370 | 370 | </span> |
| 371 | 371 | </td> |
| 372 | 372 | </tr> |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | $yikes_mc_api_constant = defined( 'YIKES_MC_API_KEY' ); |
| 9 | 9 | ?> |
| 10 | 10 | |
| 11 | -<h3><span><?php _e( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
| 11 | +<h3><span><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
| 12 | 12 | <div class="inside"> |
| 13 | 13 | |
| 14 | 14 | <!-- Settings Form --> |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | <!-- MailChimp API Input Field --> |
| 22 | 22 | <label for="yks-mailchimp-api-key"> |
| 23 | 23 | |
| 24 | - <p><?php _e( 'Enter your API key in the field below to connect your site to your MailChimp account.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 24 | + <p><?php _e( 'Enter your API key in the field below to connect your site to your MailChimp account.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 25 | 25 | |
| 26 | - <p><strong><?php _e( 'MailChimp API Key' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 26 | + <p><strong><?php _e( 'MailChimp API Key', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 27 | 27 | |
| 28 | - <input autocomplete="off" <?php if ( $yikes_mc_api_constant ) { echo 'readonly="readonly"'; } if( strlen( yikes_get_mc_api_key() ) > 0 ) { ?> type="password" <?php } else { ?> type="text" <?php } ?> value="<?php echo yikes_get_mc_api_key(); ?>" placeholder="<?php _e( 'MailChimp API Key' , 'yikes-inc-easy-mailchimp-extender' ); ?>" name="yikes-mc-api-key" id="yikes-mc-api-key" class="settings-page-input" /> |
|
| 28 | + <input autocomplete="off" <?php if ( $yikes_mc_api_constant ) { echo 'readonly="readonly"'; } if ( strlen( yikes_get_mc_api_key() ) > 0 ) { ?> type="password" <?php } else { ?> type="text" <?php } ?> value="<?php echo yikes_get_mc_api_key(); ?>" placeholder="<?php _e( 'MailChimp API Key', 'yikes-inc-easy-mailchimp-extender' ); ?>" name="yikes-mc-api-key" id="yikes-mc-api-key" class="settings-page-input" /> |
|
| 29 | 29 | |
| 30 | 30 | <?php if ( $yikes_mc_api_constant ) { ?> |
| 31 | 31 | <p class="description"><?php printf( __( "Your MailChimp API key has been defined using the %s constant, in a PHP file.", "yikes-inc-easy-mailchimp-extender" ), '<code>YIKES_MC_API_KEY</code>' ); ?></p> |
@@ -34,21 +34,21 @@ discard block |
||
| 34 | 34 | <?php echo $api_error_response; ?> |
| 35 | 35 | |
| 36 | 36 | <?php if ( ! $yikes_mc_api_constant ) { ?> |
| 37 | - <p class="description"><small><a href="https://admin.mailchimp.com/account/api" target="_blank" title="<?php _e( 'Get your API key here' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Get your API key here' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
| 37 | + <p class="description"><small><a href="https://admin.mailchimp.com/account/api" target="_blank" title="<?php _e( 'Get your API key here', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Get your API key here', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
| 38 | 38 | <?php } ?> |
| 39 | 39 | |
| 40 | 40 | <p class="description">Warning: changing your API key will break your current forms.</p> |
| 41 | 41 | </label> |
| 42 | 42 | |
| 43 | 43 | <!-- Use Nonce Validation Field --> |
| 44 | - <p><strong><?php _e( 'Enable nonce validation on this site?' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 44 | + <p><strong><?php _e( 'Enable nonce validation on this site?', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 45 | 45 | <label for="yikes-mailchimp-use-nonce-yes"> |
| 46 | 46 | Yes |
| 47 | - <input type="radio" name="yikes-mailchimp-use-nonce" id="yikes-mailchimp-use-nonce-yes" class="settings-page-input" value="1" <?php checked( get_option( 'yikes-mailchimp-use-nonce', '1' ) , '1' ); ?> /> |
|
| 47 | + <input type="radio" name="yikes-mailchimp-use-nonce" id="yikes-mailchimp-use-nonce-yes" class="settings-page-input" value="1" <?php checked( get_option( 'yikes-mailchimp-use-nonce', '1' ), '1' ); ?> /> |
|
| 48 | 48 | </label> |
| 49 | 49 | <label for="yikes-mailchimp-use-nonce-no"> |
| 50 | 50 | No |
| 51 | - <input type="radio" name="yikes-mailchimp-use-nonce" id="yikes-mailchimp-use-nonce-no" class="settings-page-input" value="0" <?php checked( get_option( 'yikes-mailchimp-use-nonce', '1' ) , '0' ); ?> /> |
|
| 51 | + <input type="radio" name="yikes-mailchimp-use-nonce" id="yikes-mailchimp-use-nonce-no" class="settings-page-input" value="0" <?php checked( get_option( 'yikes-mailchimp-use-nonce', '1' ), '0' ); ?> /> |
|
| 52 | 52 | </label> |
| 53 | 53 | |
| 54 | 54 | <?php submit_button(); ?> |
@@ -5,13 +5,13 @@ discard block |
||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | /* Get and Store Option Values */ |
| 8 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) === 'valid_api_key' ) { |
|
| 9 | - $api_connection = '<span id="connection-container" class="api-connected" title="' . __( "Your site is currently connected to the MailChimp API" , "yikes-inc-easy-mailchimp-extender" ) . '"><span class="dashicons dashicons-yes yikes-mc-api-connected"></span> ' . __( "Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
| 8 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) === 'valid_api_key' ) { |
|
| 9 | + $api_connection = '<span id="connection-container" class="api-connected" title="' . __( "Your site is currently connected to the MailChimp API", "yikes-inc-easy-mailchimp-extender" ) . '"><span class="dashicons dashicons-yes yikes-mc-api-connected"></span> ' . __( "Connected", 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
| 10 | 10 | $api_error_response = ''; |
| 11 | 11 | } else { |
| 12 | - $api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span> ' . __( "Not Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
| 13 | - if( get_option( 'yikes-mc-api-invalid-key-response' , '' ) != '' ) { |
|
| 14 | - $api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response' , '' ) . '</small></p>'; |
|
| 12 | + $api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span> ' . __( "Not Connected", 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
| 13 | + if ( get_option( 'yikes-mc-api-invalid-key-response', '' ) != '' ) { |
|
| 14 | + $api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response', '' ) . '</small></p>'; |
|
| 15 | 15 | } else { |
| 16 | 16 | $api_error_response = ''; |
| 17 | 17 | } |
@@ -23,23 +23,23 @@ discard block |
||
| 23 | 23 | * @since 6.2.2 |
| 24 | 24 | * |
| 25 | 25 | */ |
| 26 | - if ( isset( $_REQUEST['section'] ) ) { |
|
| 27 | - $_REQUEST['section'] = preg_replace('/[^\w-]/', '', strip_tags ( $_REQUEST['section'] ) ); |
|
| 26 | + if ( isset( $_REQUEST[ 'section' ] ) ) { |
|
| 27 | + $_REQUEST[ 'section' ] = preg_replace( '/[^\w-]/', '', strip_tags( $_REQUEST[ 'section' ] ) ); |
|
| 28 | 28 | } |
| 29 | 29 | ?> |
| 30 | 30 | <!-- Actual Settings Form --> |
| 31 | 31 | <div class="wrap"> |
| 32 | 32 | |
| 33 | 33 | <!-- Freddie Logo --> |
| 34 | - <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" /> |
|
| 34 | + <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" /> |
|
| 35 | 35 | |
| 36 | - <h1>Easy Forms for MailChimp | <?php if ( isset( $_REQUEST['section'] ) ) { echo ucwords( str_replace( '-', ' ', $_REQUEST['section'] ) ); } else { echo __( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); } ?></h1> |
|
| 36 | + <h1>Easy Forms for MailChimp | <?php if ( isset( $_REQUEST[ 'section' ] ) ) { echo ucwords( str_replace( '-', ' ', $_REQUEST[ 'section' ] ) ); } else { echo __( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); } ?></h1> |
|
| 37 | 37 | |
| 38 | 38 | <!-- Settings Page Description --> |
| 39 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Manage the overall settings for Easy forms for MailChimp.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 39 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Manage the overall settings for Easy forms for MailChimp.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 40 | 40 | <?php |
| 41 | 41 | /* Success Messages on Options Updated */ |
| 42 | - if( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) { |
|
| 42 | + if ( isset( $_REQUEST[ 'settings-updated' ] ) && $_REQUEST[ 'settings-updated' ] == 'true' ) { |
|
| 43 | 43 | ?> |
| 44 | 44 | <div class="updated manage-form-admin-notice"> |
| 45 | 45 | <p><?php _e( 'Settings successfully updated.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | <?php |
| 48 | 48 | } |
| 49 | 49 | /* MailChimp API Cleared Successfully message */ |
| 50 | - if( isset( $_REQUEST['transient-cleared'] ) && $_REQUEST['transient-cleared'] == 'true' ) { |
|
| 50 | + if ( isset( $_REQUEST[ 'transient-cleared' ] ) && $_REQUEST[ 'transient-cleared' ] == 'true' ) { |
|
| 51 | 51 | ?> |
| 52 | 52 | <div class="updated manage-form-admin-notice"> |
| 53 | 53 | <p><?php _e( 'MailChimp API Cache successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | /* Error Log Clear Messages */ |
| 58 | 58 | /* Success Messages on Options Updated */ |
| 59 | - if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'true' ) { |
|
| 59 | + if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'true' ) { |
|
| 60 | 60 | ?> |
| 61 | 61 | <div class="updated manage-form-admin-notice"> |
| 62 | 62 | <p><?php _e( 'Error log successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | <?php |
| 65 | 65 | } |
| 66 | 66 | /* MailChimp API Cleared Successfully message */ |
| 67 | - if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'false' ) { |
|
| 67 | + if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'false' ) { |
|
| 68 | 68 | ?> |
| 69 | 69 | <div class="error manage-form-admin-notice"> |
| 70 | 70 | <p><?php _e( "Whoops! We've encountered an error while trying to clear the error log. Please refresh the page and try again. If the error persists please get in touch with the YIKES Inc. support team.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -73,28 +73,28 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /* Display a success message if our error log was sucessfully created, or display an error if not */ |
| 76 | - if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'true' ) { |
|
| 76 | + if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'true' ) { |
|
| 77 | 77 | ?> |
| 78 | 78 | <div class="updated"> |
| 79 | 79 | <p><?php _e( 'Error log successfully created. You may now start logging errors.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
| 80 | 80 | </div> |
| 81 | 81 | <?php |
| 82 | - } else if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'false' ) { |
|
| 82 | + } else if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'false' ) { |
|
| 83 | 83 | ?> |
| 84 | 84 | <div class="error"> |
| 85 | - <p><?php echo esc_attr( urldecode( $_GET['error_message'] ) , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 85 | + <p><?php echo esc_attr( urldecode( $_GET[ 'error_message' ] ), 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 86 | 86 | </div> |
| 87 | 87 | <?php |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /* Display a success message if the user successfully imported some forms */ |
| 91 | - if( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-forms'] ) && $_GET['import-forms'] == 'true' ) { |
|
| 91 | + if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-forms' ] ) && $_GET[ 'import-forms' ] == 'true' ) { |
|
| 92 | 92 | ?> |
| 93 | 93 | <div class="updated"> |
| 94 | 94 | <p><?php printf( __( 'Opt-in forms successfully imported. <a href="%s" title="View Forms">View Forms</a>', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?></p> |
| 95 | 95 | </div> |
| 96 | 96 | <?php |
| 97 | - } elseif( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-settings'] ) && $_GET['import-settings'] == 'true' ) { |
|
| 97 | + } elseif ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-settings' ] ) && $_GET[ 'import-settings' ] == 'true' ) { |
|
| 98 | 98 | ?> |
| 99 | 99 | <div class="updated"> |
| 100 | 100 | <p><?php printf( __( 'YIKES Easy Forms for MailChimp settings successfully imported.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?></p> |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | <div class="postbox yikes-easy-mc-postbox"> |
| 117 | 117 | |
| 118 | - <?php if( !isset( $_REQUEST['section'] ) || $_REQUEST['section'] == '' ) { |
|
| 118 | + <?php if ( ! isset( $_REQUEST[ 'section' ] ) || $_REQUEST[ 'section' ] == '' ) { |
|
| 119 | 119 | include YIKES_MC_PATH . 'admin/partials/menu/options-sections/general-settings.php'; |
| 120 | 120 | } else { |
| 121 | - if( isset( $_REQUEST['addon'] ) && $_REQUEST['addon'] == 'true' ) { |
|
| 122 | - include apply_filters( 'yikes-mailchimp-'.$_REQUEST['section'].'-options-path' , '' ); |
|
| 121 | + if ( isset( $_REQUEST[ 'addon' ] ) && $_REQUEST[ 'addon' ] == 'true' ) { |
|
| 122 | + include apply_filters( 'yikes-mailchimp-' . $_REQUEST[ 'section' ] . '-options-path', '' ); |
|
| 123 | 123 | } else { |
| 124 | 124 | // White list a set of files that are allowed to be included here |
| 125 | 125 | $file_base = 'admin/partials/menu/options-sections/'; |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | $file_base . 'recaptcha-settings.php', |
| 133 | 133 | ); |
| 134 | 134 | // Ensure the included file is allowed and whitelisted above, before including it |
| 135 | - if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php', $acceptable_files ) ) { |
|
| 136 | - include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php'; |
|
| 135 | + if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php', $acceptable_files ) ) { |
|
| 136 | + include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php'; |
|
| 137 | 137 | } else { |
| 138 | 138 | wp_die( esc_attr__( 'Invalid file. If this error persists, please contact support.', 'yikes-inc-easy-mailchimp' ) ); |
| 139 | 139 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | public function __construct() { |
| 13 | 13 | |
| 14 | 14 | // Ajax send merge variable to form builder. |
| 15 | - add_action( 'wp_ajax_add_field_to_form', array( $this , 'send_field_to_form' ), 10 ); |
|
| 15 | + add_action( 'wp_ajax_add_field_to_form', array( $this, 'send_field_to_form' ), 10 ); |
|
| 16 | 16 | |
| 17 | 17 | // Ajax send interest group to form builder. |
| 18 | 18 | add_action( 'wp_ajax_add_interest_group_to_form', array( $this, 'send_interest_group_to_form' ), 10 ); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * - return a single container |
| 42 | 42 | */ |
| 43 | 43 | public function add_notification_to_form() { |
| 44 | - if ( isset( $_POST['notification_name'] ) ) { |
|
| 44 | + if ( isset( $_POST[ 'notification_name' ] ) ) { |
|
| 45 | 45 | include_once YIKES_MC_PATH . 'admin/partials/ajax/add_notification_to_form.php'; |
| 46 | 46 | } |
| 47 | 47 | exit(); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | // when the user wants to switch which form data |
| 52 | 52 | // is displayed on the dashboard |
| 53 | 53 | public function get_new_list_data() { |
| 54 | - $list_id = $_POST['list_id']; |
|
| 54 | + $list_id = $_POST[ 'list_id' ]; |
|
| 55 | 55 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_list( $list_id ); |
| 56 | 56 | if ( is_wp_error( $list_data ) ) { |
| 57 | 57 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | /* note: this function is called statically from the integration settings page */ |
| 75 | 75 | public static function check_list_for_interest_groups( $list_id = '', $integration_type = '', $load = false ) { |
| 76 | 76 | if ( ! $list_id ) { |
| 77 | - $list_id = $_POST['list_id']; |
|
| 77 | + $list_id = $_POST[ 'list_id' ]; |
|
| 78 | 78 | } |
| 79 | 79 | if ( ! $integration_type ) { |
| 80 | - $integration_type = $_POST['integration']; |
|
| 80 | + $integration_type = $_POST[ 'integration' ]; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | if ( ! check_ajax_referer( 'add-tag', 'nonce', false ) ) { |
| 123 | 123 | wp_send_json_error( '1' ); |
| 124 | 124 | } |
| 125 | - $tags = isset( $_POST['tags'] ) ? wp_unslash( $_POST['tags'] ) : array(); |
|
| 126 | - $list_id = isset( $_POST['list_id'] ) ? filter_var( wp_unslash( $_POST['list_id'] ), FILTER_SANITIZE_STRING ) : ''; |
|
| 127 | - $form_id = isset( $_POST['form_id'] ) ? filter_var( wp_unslash( $_POST['form_id'] ), FILTER_SANITIZE_NUMBER_INT ) : 0; |
|
| 125 | + $tags = isset( $_POST[ 'tags' ] ) ? wp_unslash( $_POST[ 'tags' ] ) : array(); |
|
| 126 | + $list_id = isset( $_POST[ 'list_id' ] ) ? filter_var( wp_unslash( $_POST[ 'list_id' ] ), FILTER_SANITIZE_STRING ) : ''; |
|
| 127 | + $form_id = isset( $_POST[ 'form_id' ] ) ? filter_var( wp_unslash( $_POST[ 'form_id' ] ), FILTER_SANITIZE_NUMBER_INT ) : 0; |
|
| 128 | 128 | |
| 129 | 129 | if ( empty( $tags ) || empty( $list_id ) || empty( $form_id ) ) { |
| 130 | 130 | wp_send_json_error( '2' ); |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | // This data came from $_POST so sanitize it. |
| 138 | 138 | foreach ( $tags as $tag ) { |
| 139 | - $form_tags[ filter_var( $tag['tag_id'], FILTER_SANITIZE_NUMBER_INT ) ] = array( |
|
| 140 | - 'name' => filter_var( $tag['tag_name'], FILTER_SANITIZE_STRING ), |
|
| 141 | - 'id' => filter_var( $tag['tag_id'], FILTER_SANITIZE_NUMBER_INT ), |
|
| 139 | + $form_tags[ filter_var( $tag[ 'tag_id' ], FILTER_SANITIZE_NUMBER_INT ) ] = array( |
|
| 140 | + 'name' => filter_var( $tag[ 'tag_name' ], FILTER_SANITIZE_STRING ), |
|
| 141 | + 'id' => filter_var( $tag[ 'tag_id' ], FILTER_SANITIZE_NUMBER_INT ), |
|
| 142 | 142 | ); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $form['tags'] = $form_tags + ( isset( $form['tags'] ) ? $form['tags'] : array() ); |
|
| 145 | + $form[ 'tags' ] = $form_tags + ( isset( $form[ 'tags' ] ) ? $form[ 'tags' ] : array() ); |
|
| 146 | 146 | $form_interface->update_form( $form_id, $form ); |
| 147 | 147 | wp_send_json_success( array( 'tags' => $form_tags ) ); |
| 148 | 148 | } |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | if ( ! check_ajax_referer( 'remove-tag', 'nonce', false ) ) { |
| 156 | 156 | wp_send_json_error( '1' ); |
| 157 | 157 | } |
| 158 | - $tag = isset( $_POST['tag'] ) ? filter_var( wp_unslash( $_POST['tag'] ), FILTER_SANITIZE_NUMBER_INT ) : array(); |
|
| 159 | - $list_id = isset( $_POST['list_id'] ) ? filter_var( wp_unslash( $_POST['list_id'] ), FILTER_SANITIZE_STRING ) : ''; |
|
| 160 | - $form_id = isset( $_POST['form_id'] ) ? filter_var( wp_unslash( $_POST['form_id'] ), FILTER_SANITIZE_NUMBER_INT ) : 0; |
|
| 158 | + $tag = isset( $_POST[ 'tag' ] ) ? filter_var( wp_unslash( $_POST[ 'tag' ] ), FILTER_SANITIZE_NUMBER_INT ) : array(); |
|
| 159 | + $list_id = isset( $_POST[ 'list_id' ] ) ? filter_var( wp_unslash( $_POST[ 'list_id' ] ), FILTER_SANITIZE_STRING ) : ''; |
|
| 160 | + $form_id = isset( $_POST[ 'form_id' ] ) ? filter_var( wp_unslash( $_POST[ 'form_id' ] ), FILTER_SANITIZE_NUMBER_INT ) : 0; |
|
| 161 | 161 | |
| 162 | 162 | if ( empty( $tag ) || empty( $list_id ) || empty( $form_id ) ) { |
| 163 | 163 | wp_send_json_error( '2' ); |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $form_interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 167 | 167 | $form = $form_interface->get_form( $form_id ); |
| 168 | - if ( isset( $form['tags'] ) && isset( $form['tags'][ $tag ] ) ) { |
|
| 169 | - unset( $form['tags'][ $tag ] ); |
|
| 168 | + if ( isset( $form[ 'tags' ] ) && isset( $form[ 'tags' ][ $tag ] ) ) { |
|
| 169 | + unset( $form[ 'tags' ][ $tag ] ); |
|
| 170 | 170 | } |
| 171 | 171 | $form_interface->update_form( $form_id, $form ); |
| 172 | 172 | wp_send_json_success(); |
@@ -190,10 +190,10 @@ discard block |
||
| 190 | 190 | public function save_field_label_edits() { |
| 191 | 191 | |
| 192 | 192 | // Capture our $_POST variables |
| 193 | - $list_id = isset( $_POST['list_id'] ) ? $_POST['list_id'] : ''; |
|
| 194 | - $field_data = isset( $_POST['field_data'] ) ? $_POST['field_data'] : array(); |
|
| 195 | - $field_name = isset( $field_data['field_name'] ) ? $field_data['field_name'] : ''; |
|
| 196 | - $field_id = isset( $field_data['field_id'] ) ? $field_data['field_id'] : ''; |
|
| 193 | + $list_id = isset( $_POST[ 'list_id' ] ) ? $_POST[ 'list_id' ] : ''; |
|
| 194 | + $field_data = isset( $_POST[ 'field_data' ] ) ? $_POST[ 'field_data' ] : array(); |
|
| 195 | + $field_name = isset( $field_data[ 'field_name' ] ) ? $field_data[ 'field_name' ] : ''; |
|
| 196 | + $field_id = isset( $field_data[ 'field_id' ] ) ? $field_data[ 'field_id' ] : ''; |
|
| 197 | 197 | |
| 198 | 198 | // Make sure we have our required variables before continuing |
| 199 | 199 | if ( $list_id === '' || $field_name === '' || $field_id === '' ) { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /***********************/ |
| 102 | 102 | /** Create A Form **/ |
| 103 | 103 | /**********************/ |
| 104 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-form' ) {
|
|
| 104 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-form' ) {
|
|
| 105 | 105 | |
| 106 | 106 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_form' ) ); |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | /***********************/ |
| 111 | 111 | /** Delete A Form **/ |
| 112 | 112 | /**********************/ |
| 113 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-delete-form' ) {
|
|
| 113 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-delete-form' ) {
|
|
| 114 | 114 | |
| 115 | 115 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_delete_form' ) ); |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /**********************************/ |
| 120 | 120 | /** Duplicate/Clone A Form **/ |
| 121 | 121 | /********************************/ |
| 122 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-duplicate-form' ) {
|
|
| 122 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-duplicate-form' ) {
|
|
| 123 | 123 | |
| 124 | 124 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_duplicate_form' ) ); |
| 125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | /*************************************/ |
| 129 | 129 | /** Reset Form Impression Stats **/ |
| 130 | 130 | /***********************************/ |
| 131 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-reset-stats' ) {
|
|
| 131 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-reset-stats' ) {
|
|
| 132 | 132 | |
| 133 | 133 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_reset_impression_stats' ) ); |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | /**********************************/ |
| 138 | 138 | /** Update A Form **/ |
| 139 | 139 | /********************************/ |
| 140 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-update-form' ) {
|
|
| 140 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-update-form' ) {
|
|
| 141 | 141 | |
| 142 | 142 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_update_form' ) ); |
| 143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | /**************************************************/ |
| 147 | 147 | /** Clear Store MailChimp Transient Data **/ |
| 148 | 148 | /*************************************************/ |
| 149 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-transient-data' ) {
|
|
| 149 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-transient-data' ) {
|
|
| 150 | 150 | |
| 151 | 151 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_transient_data' ) ); |
| 152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | /*******************************************/ |
| 156 | 156 | /** Remove a user from a mailing list **/ |
| 157 | 157 | /*****************************************/ |
| 158 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-unsubscribe-user' ) {
|
|
| 158 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-unsubscribe-user' ) {
|
|
| 159 | 159 | |
| 160 | 160 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_unsubscribe_user' ) ); |
| 161 | 161 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | /*******************************************/ |
| 165 | 165 | /** Create misisng error log file **/ |
| 166 | 166 | /*****************************************/ |
| 167 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-error-log' ) {
|
|
| 167 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-create-error-log' ) {
|
|
| 168 | 168 | |
| 169 | 169 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_missing_error_log' ) ); |
| 170 | 170 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | /**************************************************/ |
| 197 | 197 | /** Clear MailChimp Error Log Data **/ |
| 198 | 198 | /*************************************************/ |
| 199 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-error-log' ) {
|
|
| 199 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-clear-error-log' ) {
|
|
| 200 | 200 | |
| 201 | 201 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_error_log' ) ); |
| 202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /*********************************************/ |
| 206 | 206 | /** Export MailChimp Opt-in Forms **/ |
| 207 | 207 | /*******************************************/ |
| 208 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-forms' ) {
|
|
| 208 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-forms' ) {
|
|
| 209 | 209 | |
| 210 | 210 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_forms' ) ); |
| 211 | 211 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | /*********************************************/ |
| 215 | 215 | /** Export Plugin Settings **/ |
| 216 | 216 | /*******************************************/ |
| 217 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-settings' ) {
|
|
| 217 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-export-settings' ) {
|
|
| 218 | 218 | |
| 219 | 219 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_plugin_settings' ) ); |
| 220 | 220 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | /*******************************************/ |
| 224 | 224 | /** Import Class Inclusion **/ |
| 225 | 225 | /*****************************************/ |
| 226 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) {
|
|
| 226 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-import-forms' ) {
|
|
| 227 | 227 | |
| 228 | 228 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_import_forms' ) ); |
| 229 | 229 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /*******************************************/ |
| 233 | 233 | /** Premium Support Request **/ |
| 234 | 234 | /*****************************************/ |
| 235 | - if ( isset( $_POST['submit-premium-support-request'] ) ) {
|
|
| 235 | + if ( isset( $_POST[ 'submit-premium-support-request' ] ) ) {
|
|
| 236 | 236 | |
| 237 | 237 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_premium_support_request' ) ); |
| 238 | 238 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /****************************************/ |
| 242 | 242 | /** Dismiss Options Migrations **/ |
| 243 | 243 | /****************************************/ |
| 244 | - if ( isset( $_REQUEST['dismiss_migration_nonce'] ) ) {
|
|
| 244 | + if ( isset( $_REQUEST[ 'dismiss_migration_nonce' ] ) ) {
|
|
| 245 | 245 | |
| 246 | 246 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_dismiss_option_migrate' ) ); |
| 247 | 247 | |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | * @ return array $links New array of plugin actions |
| 278 | 278 | */ |
| 279 | 279 | public function easy_forms_plugin_action_links( $links ) {
|
| 280 | - $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=yikes-inc-easy-mailchimp-settings') ) .'">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 281 | - $links[] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES, Inc.', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 280 | + $links[ ] = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) . '">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 281 | + $links[ ] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES, Inc.', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 282 | 282 | return $links; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -379,17 +379,17 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | public function yikes_easy_mailchimp_export_forms() {
|
| 381 | 381 | // grab our nonce. |
| 382 | - $nonce = $_REQUEST['nonce']; |
|
| 382 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 383 | 383 | // grab the forms. |
| 384 | - $forms = isset( $_REQUEST['yikes_export_forms'] ) ? $_REQUEST['yikes_export_forms'] : array(); |
|
| 384 | + $forms = isset( $_REQUEST[ 'yikes_export_forms' ] ) ? $_REQUEST[ 'yikes_export_forms' ] : array(); |
|
| 385 | 385 | // validate nonce. |
| 386 | 386 | if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) {
|
| 387 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 387 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // run the export function. |
| 391 | 391 | // parameters: ( $table_name, $form_ids, $file_name ). |
| 392 | - Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export('Yikes-Inc-Easy-MailChimp-Forms-Export', $forms );
|
|
| 392 | + Yikes_Inc_Easy_MailChimp_Export_Class::yikes_mailchimp_form_export( 'Yikes-Inc-Easy-MailChimp-Forms-Export', $forms ); |
|
| 393 | 393 | // re-direct the user back to the page. |
| 394 | 394 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); |
| 395 | 395 | die(); |
@@ -403,10 +403,10 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public function yikes_easy_mailchimp_export_plugin_settings() {
|
| 405 | 405 | // grab our nonce |
| 406 | - $nonce = $_REQUEST['nonce']; |
|
| 406 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 407 | 407 | // validate nonce. |
| 408 | 408 | if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) {
|
| 409 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 409 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // run the export function. |
@@ -423,10 +423,10 @@ discard block |
||
| 423 | 423 | */ |
| 424 | 424 | public function yikes_easy_mailchimp_import_forms() {
|
| 425 | 425 | // grab our nonce. |
| 426 | - $nonce = $_REQUEST['nonce']; |
|
| 426 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 427 | 427 | // validate nonce. |
| 428 | 428 | if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) {
|
| 429 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 429 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 430 | 430 | } |
| 431 | 431 | // include the export class. |
| 432 | 432 | if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) {
|
@@ -447,18 +447,18 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function yikes_easy_mailchimp_premium_support_request() {
|
| 449 | 449 | |
| 450 | - if ( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) {
|
|
| 450 | + if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] != 'yikes-support-request' ) {
|
|
| 451 | 451 | return __( 'We encountered an error. Please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - $email = isset( $_POST['user-email'] ) ? $_POST['user-email'] : ''; |
|
| 455 | - $topic = isset( $_POST['support-topic'] ) ? $_POST['support-topic'] : ''; |
|
| 456 | - $issue = isset( $_POST['support-content'] ) ? $_POST['support-content'] : ''; |
|
| 457 | - $priority = isset( $_POST['support-priority'] ) ? $_POST['support-priority'] : 1; |
|
| 458 | - $license = isset( $_POST['license_key'] ) ? $_POST['license_key'] : ''; |
|
| 459 | - $plugin_name = isset( $_POST['plugin-name'] ) ? $_POST['plugin-name'] : ''; |
|
| 460 | - $plugin_slug = isset( $_POST['plugin-slug'] ) ? $_POST['plugin-slug'] : ''; |
|
| 461 | - $name = isset( $_POST['user-name'] ) ? $_POST['user-name'] : 'MailChimp Support'; |
|
| 454 | + $email = isset( $_POST[ 'user-email' ] ) ? $_POST[ 'user-email' ] : ''; |
|
| 455 | + $topic = isset( $_POST[ 'support-topic' ] ) ? $_POST[ 'support-topic' ] : ''; |
|
| 456 | + $issue = isset( $_POST[ 'support-content' ] ) ? $_POST[ 'support-content' ] : ''; |
|
| 457 | + $priority = isset( $_POST[ 'support-priority' ] ) ? $_POST[ 'support-priority' ] : 1; |
|
| 458 | + $license = isset( $_POST[ 'license_key' ] ) ? $_POST[ 'license_key' ] : ''; |
|
| 459 | + $plugin_name = isset( $_POST[ 'plugin-name' ] ) ? $_POST[ 'plugin-name' ] : ''; |
|
| 460 | + $plugin_slug = isset( $_POST[ 'plugin-slug' ] ) ? $_POST[ 'plugin-slug' ] : ''; |
|
| 461 | + $name = isset( $_POST[ 'user-name' ] ) ? $_POST[ 'user-name' ] : 'MailChimp Support'; |
|
| 462 | 462 | |
| 463 | 463 | $edd_item_id = $this->get_premium_license( $plugin_slug ); |
| 464 | 464 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | public function get_premium_license( $plugin_slug ) {
|
| 495 | 495 | |
| 496 | - switch( $plugin_slug ) {
|
|
| 496 | + switch ( $plugin_slug ) {
|
|
| 497 | 497 | |
| 498 | 498 | case 'form-customizer': |
| 499 | 499 | return defined( 'YIKES_CUSTOMIZER_EDD_ITEM_ID' ) ? YIKES_CUSTOMIZER_EDD_ITEM_ID : ''; |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | // add a new option to store the plugin activation date/time. |
| 554 | 554 | // @since v6.0.0. |
| 555 | 555 | // this is used to notify the user that they should review after 2 weeks. |
| 556 | - if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) {
|
|
| 556 | + if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) ) {
|
|
| 557 | 557 | add_option( 'yikes_easy_mailchimp_activation_date', strtotime( "now" ) ); |
| 558 | 558 | } |
| 559 | 559 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | $install_date = get_option( 'yikes_easy_mailchimp_activation_date' ); |
| 564 | 564 | $past_date = strtotime( '-14 days' ); |
| 565 | 565 | if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) {
|
| 566 | - add_action( 'admin_notices', array( $this , 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
| 566 | + add_action( 'admin_notices', array( $this, 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
@@ -576,13 +576,13 @@ discard block |
||
| 576 | 576 | */ |
| 577 | 577 | public function yikes_easy_mailchimp_display_review_us_notice() {
|
| 578 | 578 | /* Lets only display our admin notice on YT4WP pages to not annoy the hell out of people :) */ |
| 579 | - if ( in_array( get_current_screen()->base , array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) {
|
|
| 579 | + if ( in_array( get_current_screen()->base, array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base, 'yikes-inc-easy-mailchimp' ) !== false ) {
|
|
| 580 | 580 | |
| 581 | 581 | // The URL of the page the user is currently on |
| 582 | - $current_uri = isset( $_SERVER['REQUEST_URI'] ) && ! empty( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : false; |
|
| 583 | - $current_host = isset( $_SERVER['HTTP_HOST'] ) && ! empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : false; |
|
| 582 | + $current_uri = isset( $_SERVER[ 'REQUEST_URI' ] ) && ! empty( $_SERVER[ 'REQUEST_URI' ] ) ? $_SERVER[ 'REQUEST_URI' ] : false; |
|
| 583 | + $current_host = isset( $_SERVER[ 'HTTP_HOST' ] ) && ! empty( $_SERVER[ 'HTTP_HOST' ] ) ? $_SERVER[ 'HTTP_HOST' ] : false; |
|
| 584 | 584 | $current_protocol = is_ssl() === true ? 'https://' : 'http://'; |
| 585 | - $current_url = ( $current_uri !== false && $current_host !== false ) ? $current_protocol . $current_host . $current_uri : admin_url(); |
|
| 585 | + $current_url = ( $current_uri !== false && $current_host !== false ) ? $current_protocol . $current_host . $current_uri : admin_url(); |
|
| 586 | 586 | |
| 587 | 587 | $plugin_name = '<strong>Easy Forms for MailChimp</strong>'; |
| 588 | 588 | // Review URL - Change to the URL of your plugin on WordPress.org. |
@@ -593,17 +593,17 @@ discard block |
||
| 593 | 593 | // Make sure all of our variables have values. |
| 594 | 594 | $reviewurl = ( ! empty( $reviewurl ) ) ? $reviewurl : ''; |
| 595 | 595 | $addons_url = ( ! empty( $addons_url ) ) ? $addons_url : ''; |
| 596 | - $nobugurl = ( ! empty( $nobugurl ) ) ? $nobugurl : ''; |
|
| 596 | + $nobugurl = ( ! empty( $nobugurl ) ) ? $nobugurl : ''; |
|
| 597 | 597 | |
| 598 | 598 | $review_message = '<div id="yikes-mailchimp-logo"></div>'; |
| 599 | 599 | $review_message .= sprintf( |
| 600 | 600 | __( 'It looks like you\'ve been using %1$s for 2 weeks now. We hope you\'re enjoying the features included with the free version. If so, please consider leaving us a review. Reviews only help to catch other users attention as well as provide us with feedback to grow and improve upon. If you\'re really enjoying the plugin, consider buying an add-on or developer license for some really awesome features and premium support.', 'yikes-inc-easy-mailchimp-extender' ) |
| 601 | 601 | . '<span class="button-container"> <a href="%2$s" target="_blank" class="button-secondary"><span class="dashicons dashicons-star-filled"></span>' |
| 602 | - . __( "Leave A Review" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 602 | + . __( "Leave A Review", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 603 | 603 | . '</a> <a href="%3$s" class="button-secondary"><span class="dashicons dashicons-upload"></span>' |
| 604 | - . __( "View Addons" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 604 | + . __( "View Addons", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 605 | 605 | . '</a> <a href="%4$s" class="button-secondary"><span class="dashicons dashicons-no-alt"></span>' |
| 606 | - . __( "Dismiss" , 'yikes-inc-easy-mailchimp-extender' ) |
|
| 606 | + . __( "Dismiss", 'yikes-inc-easy-mailchimp-extender' ) |
|
| 607 | 607 | . "</a> </span>", |
| 608 | 608 | $plugin_name, $reviewurl, $addons_url, $nobugurl ); |
| 609 | 609 | ?> |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | @since v3.1.1 |
| 621 | 621 | */ |
| 622 | 622 | public function yikes_easy_mailchimp_stop_bugging_me() {
|
| 623 | - if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) && (int) filter_var( $_GET['yikes_easy_mc_icons_nobug'], FILTER_SANITIZE_NUMBER_INT ) === 1 ) {
|
|
| 623 | + if ( isset( $_GET[ 'yikes_easy_mc_icons_nobug' ] ) && (int) filter_var( $_GET[ 'yikes_easy_mc_icons_nobug' ], FILTER_SANITIZE_NUMBER_INT ) === 1 ) {
|
|
| 624 | 624 | add_option( 'yikes_easy_mailchimp_review_stop_bugging_me', true ); |
| 625 | 625 | } |
| 626 | 626 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | // inlcude the js for tinymce. |
| 659 | 659 | public function yks_mc_add_tinymce_plugin( $plugin_array ) {
|
| 660 | 660 | |
| 661 | - $plugin_array['yks_mc_tinymce_button'] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
| 661 | + $plugin_array[ 'yks_mc_tinymce_button' ] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
|
| 662 | 662 | |
| 663 | 663 | return $plugin_array; |
| 664 | 664 | } |
@@ -679,13 +679,13 @@ discard block |
||
| 679 | 679 | if ( ! empty( $list_data ) ) {
|
| 680 | 680 | // build an array to pass to our javascript. |
| 681 | 681 | foreach ( $list_data as $id => $form ) {
|
| 682 | - $lists[] = array( |
|
| 683 | - 'text' => urlencode( $form['form_name'] ), |
|
| 682 | + $lists[ ] = array( |
|
| 683 | + 'text' => urlencode( $form[ 'form_name' ] ), |
|
| 684 | 684 | 'value' => $id, |
| 685 | 685 | ); |
| 686 | 686 | } |
| 687 | 687 | } else {
|
| 688 | - $lists[0] = array( |
|
| 688 | + $lists[ 0 ] = array( |
|
| 689 | 689 | 'text' => __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ), |
| 690 | 690 | 'value' => '-', |
| 691 | 691 | ); |
@@ -773,8 +773,8 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | wp_enqueue_style( 'wp-color-picker' ); |
| 775 | 775 | wp_enqueue_script( 'wp-color-picker' ); |
| 776 | - wp_enqueue_script( 'jquery.timepicker.js',YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js', array( 'jquery' ) , $this->version, false ); |
|
| 777 | - wp_enqueue_script( 'edit-form-js', YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js', array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ) , $this->version, false ); |
|
| 776 | + wp_enqueue_script( 'jquery.timepicker.js', YIKES_MC_URL . 'admin/js/jquery.timepicker.min.js', array( 'jquery' ), $this->version, false ); |
|
| 777 | + wp_enqueue_script( 'edit-form-js', YIKES_MC_URL . 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js', array( 'jquery.timepicker.js', 'jquery-ui-datepicker' ), $this->version, false ); |
|
| 778 | 778 | |
| 779 | 779 | $localized_data = array( |
| 780 | 780 | 'add_tag_nonce' => wp_create_nonce( 'add-tag' ), |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | * Convert the php date format string to a js date format |
| 871 | 871 | */ |
| 872 | 872 | public function yikes_jQuery_datepicker_date_format( $site_option ) {
|
| 873 | - switch( $site_option ) {
|
|
| 873 | + switch ( $site_option ) {
|
|
| 874 | 874 | //Predefined WP date formats |
| 875 | 875 | default: |
| 876 | 876 | case 'F j, Y': |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | |
| 1083 | 1083 | /* Register General Settings Section */ |
| 1084 | 1084 | |
| 1085 | - register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this , 'yikes_mc_validate_api_key' ) ); |
|
| 1085 | + register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mc-api-key', array( $this, 'yikes_mc_validate_api_key' ) ); |
|
| 1086 | 1086 | |
| 1087 | 1087 | register_setting( 'yikes_inc_easy_mc_general_settings_page', 'yikes-mailchimp-use-nonce' ); |
| 1088 | 1088 | |
@@ -1127,7 +1127,7 @@ discard block |
||
| 1127 | 1127 | add_settings_field( |
| 1128 | 1128 | 'optin-checkbox-init', |
| 1129 | 1129 | __( 'Select Checkboxes to Generate', 'yikes-inc-easy-mailchimp-extender' ), |
| 1130 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1130 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1131 | 1131 | 'yikes_inc_easy_mc_checkbox_settings' |
| 1132 | 1132 | ); |
| 1133 | 1133 | /* End Checkbox Settings */ |
@@ -1149,21 +1149,21 @@ discard block |
||
| 1149 | 1149 | add_settings_field( |
| 1150 | 1150 | 'yikes-mc-recaptcha-site-key', |
| 1151 | 1151 | __( 'Enter reCAPTCHA Site Key', 'yikes-inc-easy-mailchimp-extender' ), |
| 1152 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1152 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1153 | 1153 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1154 | 1154 | ); |
| 1155 | 1155 | |
| 1156 | 1156 | add_settings_field( |
| 1157 | 1157 | 'yikes-mc-recaptcha-secret-key', |
| 1158 | 1158 | __( 'Enter reCAPTCHA Secret Key', 'yikes-inc-easy-mailchimp-extender' ), |
| 1159 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1159 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1160 | 1160 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1161 | 1161 | ); |
| 1162 | 1162 | |
| 1163 | 1163 | add_settings_field( |
| 1164 | 1164 | 'yikes-mc-recaptcha-status', |
| 1165 | 1165 | __( 'Enable ReCaptcha', 'yikes-inc-easy-mailchimp-extender' ), |
| 1166 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1166 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1167 | 1167 | 'yikes_easy_mc_settings_recpatcha_section' |
| 1168 | 1168 | ); |
| 1169 | 1169 | |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | add_settings_field( |
| 1184 | 1184 | 'yikes-mailchimp-debug-status', |
| 1185 | 1185 | __( 'Enable Debugging', 'yikes-inc-easy-mailchimp-extender' ), |
| 1186 | - '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1186 | + '', // callback + validation inside of admin/partials/menu/options.php |
|
| 1187 | 1187 | 'yikes_easy_mc_settings_debug_section' |
| 1188 | 1188 | ); |
| 1189 | 1189 | |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1204 | 1204 | return ''; |
| 1205 | 1205 | } |
| 1206 | - $api_key = strip_tags ( trim( $input ) ); |
|
| 1206 | + $api_key = strip_tags( trim( $input ) ); |
|
| 1207 | 1207 | $dash_position = strpos( trim( $input ), '-' ); |
| 1208 | 1208 | if ( $dash_position !== false ) {
|
| 1209 | 1209 | $manager = new Yikes_Inc_Easy_MailChimp_API_Manager( $api_key ); |
@@ -1218,9 +1218,9 @@ discard block |
||
| 1218 | 1218 | update_option( 'yikes-mc-api-validation', 'valid_api_key' ); |
| 1219 | 1219 | // Clear the API key transient data |
| 1220 | 1220 | $this->delete_yikes_mailchimp_transients(); |
| 1221 | - } else {
|
|
| 1221 | + } else {
|
|
| 1222 | 1222 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 1223 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message() , __( "Connecting to MailChimp" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Settings Page/General Settings" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1223 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message(), __( "Connecting to MailChimp", 'yikes-inc-easy-mailchimp-extender' ), __( "Settings Page/General Settings", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1224 | 1224 | update_option( 'yikes-mc-api-invalid-key-response', $response->get_error_message() ); |
| 1225 | 1225 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1226 | 1226 | } |
@@ -1269,11 +1269,11 @@ discard block |
||
| 1269 | 1269 | public function check_for_old_yks_mc_options() {
|
| 1270 | 1270 | $old_plugin_options = get_option( 'ykseme_storage' ); |
| 1271 | 1271 | // only perform options migrations if the site is not a multi-site setup |
| 1272 | - if ( !is_multisite() ) {
|
|
| 1272 | + if ( ! is_multisite() ) {
|
|
| 1273 | 1273 | if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) {
|
| 1274 | 1274 | // display a notice to the user that they should 'migrate' |
| 1275 | 1275 | // from the old plugin settings to the new ones |
| 1276 | - add_action( 'admin_notices', array( $this , 'display_options_migrate_notice' ) , 11 ); |
|
| 1276 | + add_action( 'admin_notices', array( $this, 'display_options_migrate_notice' ), 11 ); |
|
| 1277 | 1277 | } |
| 1278 | 1278 | } |
| 1279 | 1279 | } |
@@ -1306,11 +1306,11 @@ discard block |
||
| 1306 | 1306 | |
| 1307 | 1307 | // Confirm that the necessary forms table in the database exists, else bail |
| 1308 | 1308 | global $wpdb; |
| 1309 | - if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) {
|
|
| 1309 | + if ( $wpdb->get_var( "show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'" ) != $wpdb->prefix . "yikes_easy_mc_forms" ) {
|
|
| 1310 | 1310 | return; |
| 1311 | 1311 | } |
| 1312 | 1312 | |
| 1313 | - if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) {
|
|
| 1313 | + if ( isset( $_GET[ 'yikes-mc-options-migration-dismissed' ] ) && $_GET[ 'yikes-mc-options-migration-dismissed' ] == 'true' ) {
|
|
| 1314 | 1314 | // Delete the options, start a-new! (this will disable the migration notice altogether) |
| 1315 | 1315 | delete_option( 'widget_yikes_mc_widget' ); |
| 1316 | 1316 | delete_option( 'api_validation' ); |
@@ -1324,7 +1324,7 @@ discard block |
||
| 1324 | 1324 | } else {
|
| 1325 | 1325 | ?> |
| 1326 | 1326 | <div class="yikes-easy-mc-updated migrate-options-notice"> |
| 1327 | - <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list." , 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?></p> |
|
| 1327 | + <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?></p> |
|
| 1328 | 1328 | <p><?php _e( "Before you continue, it's strongly recommended you the perform the migration to ensure the plugin continues to function properly.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
| 1329 | 1329 | <p><em><?php _e( "It's also strongly recommended that you take a backup of your database.", 'yikes-inc-easy-mailchimp-extender' ); ?></em></p> |
| 1330 | 1330 | <section id="migration-buttons"> |
@@ -1349,9 +1349,9 @@ discard block |
||
| 1349 | 1349 | * and return the index ( used to find the list name assigned to a form ) |
| 1350 | 1350 | * - http://stackoverflow.com/questions/6661530/php-multi-dimensional-array-search |
| 1351 | 1351 | */ |
| 1352 | - function findMCListID($id, $array) {
|
|
| 1353 | - foreach ($array as $key => $val) {
|
|
| 1354 | - if ($val['id'] === $id) {
|
|
| 1352 | + function findMCListID( $id, $array ) {
|
|
| 1353 | + foreach ( $array as $key => $val ) {
|
|
| 1354 | + if ( $val[ 'id' ] === $id ) {
|
|
| 1355 | 1355 | return $key; |
| 1356 | 1356 | } |
| 1357 | 1357 | } |
@@ -1361,8 +1361,8 @@ discard block |
||
| 1361 | 1361 | /* Ajax Migrate Options */ |
| 1362 | 1362 | function migrate_archived_options() {
|
| 1363 | 1363 | // all options prefixed with 'yikes-mc-' |
| 1364 | - $option_name = 'yikes-mc-'.$_POST['option_name']; |
|
| 1365 | - $option_value = $_POST['option_value']; |
|
| 1364 | + $option_name = 'yikes-mc-' . $_POST[ 'option_name' ]; |
|
| 1365 | + $option_value = $_POST[ 'option_value' ]; |
|
| 1366 | 1366 | if ( json_decode( $option_value ) ) {
|
| 1367 | 1367 | // decode our lists() array, and store it |
| 1368 | 1368 | $opt_value = json_decode( $option_value, true ); |
@@ -1376,22 +1376,22 @@ discard block |
||
| 1376 | 1376 | |
| 1377 | 1377 | /* Ajax Migrate Forms */ |
| 1378 | 1378 | function migrate_previously_setup_forms() {
|
| 1379 | - $option_name = $_POST['option_name']; |
|
| 1380 | - $done = $_POST['done_import']; |
|
| 1379 | + $option_name = $_POST[ 'option_name' ]; |
|
| 1380 | + $done = $_POST[ 'done_import' ]; |
|
| 1381 | 1381 | // Create some starter forms for the user |
| 1382 | 1382 | // based on previously imported lists (to our old version) |
| 1383 | 1383 | if ( $option_name == 'yikes-mc-lists' ) {
|
| 1384 | - $option_value = $_POST['option_value']; |
|
| 1385 | - $new_options = json_decode( stripslashes_deep( $option_value ) , true ); |
|
| 1384 | + $option_value = $_POST[ 'option_value' ]; |
|
| 1385 | + $new_options = json_decode( stripslashes_deep( $option_value ), true ); |
|
| 1386 | 1386 | |
| 1387 | - $list_id = $new_options['id']; |
|
| 1388 | - $form_name = $new_options['name']; |
|
| 1389 | - $fields = $new_options['fields']; // our fields array |
|
| 1387 | + $list_id = $new_options[ 'id' ]; |
|
| 1388 | + $form_name = $new_options[ 'name' ]; |
|
| 1389 | + $fields = $new_options[ 'fields' ]; // our fields array |
|
| 1390 | 1390 | |
| 1391 | - $custom_styles = isset( $new_options['custom_styles'] ) ? $new_options['custom_styles']: '0'; // store as an array with all of our styles |
|
| 1392 | - $custom_template = isset( $new_options['custom_template'] ) ? $new_options['custom_template'] : '0'; // store template data as an array ( active , template used ) |
|
| 1393 | - $redirect_user_on_submit = isset( $new_options['yks_mailchimp_redirect_'.$list_id] ) ? '1' : '0'; |
|
| 1394 | - $redirect_page = isset( $new_options['page_id_'.$list_id] ) ? $new_options['page_id_'.$list_id] : ''; |
|
| 1391 | + $custom_styles = isset( $new_options[ 'custom_styles' ] ) ? $new_options[ 'custom_styles' ] : '0'; // store as an array with all of our styles |
|
| 1392 | + $custom_template = isset( $new_options[ 'custom_template' ] ) ? $new_options[ 'custom_template' ] : '0'; // store template data as an array ( active , template used ) |
|
| 1393 | + $redirect_user_on_submit = isset( $new_options[ 'yks_mailchimp_redirect_' . $list_id ] ) ? '1' : '0'; |
|
| 1394 | + $redirect_page = isset( $new_options[ 'page_id_' . $list_id ] ) ? $new_options[ 'page_id_' . $list_id ] : ''; |
|
| 1395 | 1395 | |
| 1396 | 1396 | /* Insert Forms Function */ |
| 1397 | 1397 | $this->form_interface->create_form( array( |
@@ -1427,8 +1427,8 @@ discard block |
||
| 1427 | 1427 | * @since v5.6 - complete re-write |
| 1428 | 1428 | */ |
| 1429 | 1429 | public function generate_options_pages_sidebar_menu() {
|
| 1430 | - if ( isset( $_REQUEST['section'] ) ) {
|
|
| 1431 | - $selected = $_REQUEST['section']; |
|
| 1430 | + if ( isset( $_REQUEST[ 'section' ] ) ) {
|
|
| 1431 | + $selected = $_REQUEST[ 'section' ]; |
|
| 1432 | 1432 | } |
| 1433 | 1433 | $installed_addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
| 1434 | 1434 | |
@@ -1445,25 +1445,25 @@ discard block |
||
| 1445 | 1445 | <h3><span><?php _e( 'Additional Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
| 1446 | 1446 | <div class="inside"> |
| 1447 | 1447 | <ul id="settings-nav"> |
| 1448 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'general-settings' || !isset( $_REQUEST['section'] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1449 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1450 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1451 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1452 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1453 | - <li><?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1448 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'general-settings' || ! isset( $_REQUEST[ 'section' ] ) ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'general-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) ); ?>"><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1449 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'integration-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'integration-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=integration-settings' ) ) ); ?>"><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1450 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'recaptcha-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'recaptcha-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) ); ?>"><?php _e( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1451 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'api-cache-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'api-cache-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings' ) ) ); ?>"><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1452 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'debug-settings' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'debug-settings' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings' ) ) ); ?>"><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1453 | + <li><?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == 'import-export-forms' ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => 'import-export-forms' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=import-export-forms' ) ) ); ?>"><?php _e( 'Import/Export', 'yikes-inc-easy-mailchimp-extender' ); ?></a></li>
|
|
| 1454 | 1454 | </ul> |
| 1455 | 1455 | <?php |
| 1456 | 1456 | // create our add-on settings pages |
| 1457 | - if ( !empty( $installed_addons ) ) {
|
|
| 1457 | + if ( ! empty( $installed_addons ) ) {
|
|
| 1458 | 1458 | ?> |
| 1459 | 1459 | <hr class="add-on-settings-divider" /> |
| 1460 | 1460 | <strong><?php _e( 'Addon Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 1461 | 1461 | <ul id="addon-settings-nav"> |
| 1462 | 1462 | <?php |
| 1463 | - foreach( $installed_addons as $addon_name ) {
|
|
| 1463 | + foreach ( $installed_addons as $addon_name ) {
|
|
| 1464 | 1464 | ?> |
| 1465 | 1465 | <li> |
| 1466 | - <?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion='.$addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
|
|
| 1466 | + <?php if ( isset( $_REQUEST[ 'section' ] ) && $_REQUEST[ 'section' ] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=' . $addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
|
|
| 1467 | 1467 | <?php |
| 1468 | 1468 | } |
| 1469 | 1469 | ?> |
@@ -1512,19 +1512,19 @@ discard block |
||
| 1512 | 1512 | <select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); disabled( true, empty( $lists ) ); ?>> |
| 1513 | 1513 | <?php |
| 1514 | 1514 | if ( ! empty( $lists ) ) {
|
| 1515 | - foreach( $lists as $mailing_list ) {
|
|
| 1515 | + foreach ( $lists as $mailing_list ) {
|
|
| 1516 | 1516 | ?> |
| 1517 | - <option value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option>
|
|
| 1517 | + <option value="<?php echo $mailing_list[ 'id' ]; ?>"><?php echo stripslashes( $mailing_list[ 'name' ] ) . ' (' . $mailing_list[ 'stats' ][ 'member_count' ] . ') '; ?></option>
|
|
| 1518 | 1518 | <?php |
| 1519 | 1519 | } |
| 1520 | 1520 | } else {
|
| 1521 | 1521 | if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
| 1522 | 1522 | ?> |
| 1523 | - <option><?php echo __( "Please enter a valid API key." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1523 | + <option><?php echo __( "Please enter a valid API key.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1524 | 1524 | <?php |
| 1525 | 1525 | } else {
|
| 1526 | 1526 | ?> |
| 1527 | - <option><?php echo __( "No lists were found on the account." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1527 | + <option><?php echo __( "No lists were found on the account.", 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 1528 | 1528 | <?php |
| 1529 | 1529 | |
| 1530 | 1530 | } |
@@ -1533,8 +1533,8 @@ discard block |
||
| 1533 | 1533 | </select> |
| 1534 | 1534 | |
| 1535 | 1535 | <?php |
| 1536 | - if ( isset( $_GET['transient-cleared'] ) ) {
|
|
| 1537 | - if ( 'true' === $_GET['transient-cleared'] ) {
|
|
| 1536 | + if ( isset( $_GET[ 'transient-cleared' ] ) ) {
|
|
| 1537 | + if ( 'true' === $_GET[ 'transient-cleared' ] ) {
|
|
| 1538 | 1538 | ?> |
| 1539 | 1539 | <div class="yikes-list-refreshed-notice"> |
| 1540 | 1540 | <p><?php esc_attr_e( 'MailChimp list data has been succesfully refreshed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -1547,7 +1547,7 @@ discard block |
||
| 1547 | 1547 | if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) {
|
| 1548 | 1548 | ?> |
| 1549 | 1549 | <p class="description"> |
| 1550 | - <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ) , __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
| 1550 | + <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ), __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
|
| 1551 | 1551 | </p> |
| 1552 | 1552 | <?php |
| 1553 | 1553 | } |
@@ -1556,9 +1556,9 @@ discard block |
||
| 1556 | 1556 | </label> |
| 1557 | 1557 | <?php |
| 1558 | 1558 | if ( $this->is_user_mc_api_valid_form( false ) ) {
|
| 1559 | - echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ) , 'primary', '', false , array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
| 1559 | + echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ), 'primary', '', false, array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
|
| 1560 | 1560 | } else {
|
| 1561 | - echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 1561 | + echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
| 1562 | 1562 | ?> |
| 1563 | 1563 | <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
| 1564 | 1564 | <?php |
@@ -1588,7 +1588,7 @@ discard block |
||
| 1588 | 1588 | $post_types = get_post_types(); |
| 1589 | 1589 | ?> |
| 1590 | 1590 | <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if ( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>">
|
| 1591 | - <?php _e( "Select A Page or Post" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1591 | + <?php _e( "Select A Page or Post", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1592 | 1592 | <select id="redirect-user-to-selection" name="redirect-user-to-selection" onchange="shouldWeDisplayCustomURL( this );return;"> |
| 1593 | 1593 | <?php |
| 1594 | 1594 | |
@@ -1604,7 +1604,7 @@ discard block |
||
| 1604 | 1604 | $excluded_post_types = apply_filters( 'yikes-mailchimp-excluded-redirect-post-types', $excluded_post_types ); |
| 1605 | 1605 | |
| 1606 | 1606 | // loop over registered post types, and query! |
| 1607 | - foreach( $post_types as $registered_post_type ) {
|
|
| 1607 | + foreach ( $post_types as $registered_post_type ) {
|
|
| 1608 | 1608 | |
| 1609 | 1609 | // exclude a few built in custom post types and any defined by the filter |
| 1610 | 1610 | if ( ! in_array( $registered_post_type, $excluded_post_types ) ) {
|
@@ -1626,8 +1626,8 @@ discard block |
||
| 1626 | 1626 | ?> |
| 1627 | 1627 | <optgroup label="<?php echo ucwords( str_replace( '_', ' ', $registered_post_type ) ); ?>"> |
| 1628 | 1628 | <?php |
| 1629 | - foreach( $post_ids as $post_id ) {
|
|
| 1630 | - ?><option <?php selected( $redirect_page , $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php |
|
| 1629 | + foreach ( $post_ids as $post_id ) {
|
|
| 1630 | + ?><option <?php selected( $redirect_page, $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php |
|
| 1631 | 1631 | } |
| 1632 | 1632 | ?> |
| 1633 | 1633 | </optgroup> |
@@ -1643,7 +1643,7 @@ discard block |
||
| 1643 | 1643 | </select> |
| 1644 | 1644 | |
| 1645 | 1645 | <label name="custom-redirect-url" class="custom_redirect_url_label" <?php if ( ! isset( $redirect_page ) || $redirect_page != 'custom_url' ) { echo 'style="display:none;"'; } ?>>
|
| 1646 | - <?php _e( "Enter Custom URL" , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1646 | + <?php _e( "Enter Custom URL", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 1647 | 1647 | <input type="text" class="widefat custom-redirect-url" name="custom-redirect-url" value="<?php echo $custom_redirect_url; ?>" /> |
| 1648 | 1648 | </label> |
| 1649 | 1649 | |
@@ -1702,7 +1702,7 @@ discard block |
||
| 1702 | 1702 | </p> |
| 1703 | 1703 | </div> |
| 1704 | 1704 | |
| 1705 | - <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s" , 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
| 1705 | + <p class="description sidebar-footer-text"><?php printf( __( "This plugin made with %s by %s", 'yikes-inc-easy-mailchimp-extender' ), '<span class="dashicons dashicons-heart yikes-love"></span>', '<a href="http://www.yikesinc.com" target="_blank" title="YIKES Inc.">YIKES Inc.</a>' ); ?> </p> |
|
| 1706 | 1706 | |
| 1707 | 1707 | <section id="about-yikes-inc" class="inside"> |
| 1708 | 1708 | <a href="https://www.yikesinc.com" target="_blank" title="YIKES Inc."> |
@@ -1720,7 +1720,7 @@ discard block |
||
| 1720 | 1720 | <!-- review us container --> |
| 1721 | 1721 | <h3><?php _e( 'Easy Forms for MailChimp Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
| 1722 | 1722 | <div id="review-yikes-easy-mc" class="inside"> |
| 1723 | - <p><?php _e( "Check out available add-ons for some seriously enhanced features." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1723 | + <p><?php _e( "Check out available add-ons for some seriously enhanced features.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1724 | 1724 | <p><a class="button-secondary" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-addons' ) ); ?>" title="<?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'View Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
| 1725 | 1725 | </div> |
| 1726 | 1726 | |
@@ -1747,11 +1747,11 @@ discard block |
||
| 1747 | 1747 | |
| 1748 | 1748 | // if no list id, die! |
| 1749 | 1749 | if ( ! $list_id ) {
|
| 1750 | - wp_die( __( "We've encountered an error. No list ID was sent." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1750 | + wp_die( __( "We've encountered an error. No list ID was sent.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1751 | 1751 | } |
| 1752 | 1752 | |
| 1753 | 1753 | if ( ! $merge_variables ) {
|
| 1754 | - wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1754 | + wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 1755 | 1755 | } |
| 1756 | 1756 | |
| 1757 | 1757 | if ( ! empty( $form_fields ) ) {
|
@@ -1762,17 +1762,17 @@ discard block |
||
| 1762 | 1762 | $available_interest_groups = array(); |
| 1763 | 1763 | |
| 1764 | 1764 | // Default variables as arrays - these are used for holding the MailChimp merge field ID |
| 1765 | - $merge_field_ids = array(); |
|
| 1766 | - $mailchimp_merge_field_ids = array(); |
|
| 1765 | + $merge_field_ids = array(); |
|
| 1766 | + $mailchimp_merge_field_ids = array(); |
|
| 1767 | 1767 | |
| 1768 | 1768 | // loop over merge variables |
| 1769 | - if ( ! empty( $merge_variables['merge_fields'] ) ) {
|
|
| 1770 | - $available_merge_variables = wp_list_pluck( $merge_variables['merge_fields'], 'tag' ); |
|
| 1771 | - $mailchimp_merge_field_ids = wp_list_pluck( $merge_variables['merge_fields'], 'merge_id' ); |
|
| 1769 | + if ( ! empty( $merge_variables[ 'merge_fields' ] ) ) {
|
|
| 1770 | + $available_merge_variables = wp_list_pluck( $merge_variables[ 'merge_fields' ], 'tag' ); |
|
| 1771 | + $mailchimp_merge_field_ids = wp_list_pluck( $merge_variables[ 'merge_fields' ], 'merge_id' ); |
|
| 1772 | 1772 | |
| 1773 | 1773 | // Array will look like $merge_tag => $merge_id |
| 1774 | - foreach( $available_merge_variables as $index => $merge_tag ) {
|
|
| 1775 | - $merge_field_ids[$merge_tag] = $mailchimp_merge_field_ids[$index]; |
|
| 1774 | + foreach ( $available_merge_variables as $index => $merge_tag ) {
|
|
| 1775 | + $merge_field_ids[ $merge_tag ] = $mailchimp_merge_field_ids[ $index ]; |
|
| 1776 | 1776 | } |
| 1777 | 1777 | } |
| 1778 | 1778 | |
@@ -1787,46 +1787,46 @@ discard block |
||
| 1787 | 1787 | $excluded_fields = array_diff( $assigned_fields, $merged_fields ); |
| 1788 | 1788 | |
| 1789 | 1789 | $i = 1; |
| 1790 | - foreach( $form_fields as $field ) {
|
|
| 1790 | + foreach ( $form_fields as $field ) {
|
|
| 1791 | 1791 | |
| 1792 | - if ( isset( $field['merge'] ) ) {
|
|
| 1792 | + if ( isset( $field[ 'merge' ] ) ) {
|
|
| 1793 | 1793 | // @todo: don't use in_array() |
| 1794 | - $excluded_field = in_array( $field['merge'], $excluded_fields, true ); |
|
| 1794 | + $excluded_field = in_array( $field[ 'merge' ], $excluded_fields, true ); |
|
| 1795 | 1795 | ?> |
| 1796 | - <section class="draggable" id="<?php echo $field['merge']; ?>"> |
|
| 1796 | + <section class="draggable" id="<?php echo $field[ 'merge' ]; ?>"> |
|
| 1797 | 1797 | <!-- top --> |
| 1798 | 1798 | <a class="expansion-section-title settings-sidebar"> |
| 1799 | 1799 | <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span> |
| 1800 | - <span class="yikes-mc-expansion-section-field-label"> <?php echo stripslashes( $field['label'] ); ?> </span> |
|
| 1800 | + <span class="yikes-mc-expansion-section-field-label"> <?php echo stripslashes( $field[ 'label' ] ); ?> </span> |
|
| 1801 | 1801 | <?php if ( $excluded_field ) { ?>
|
| 1802 | 1802 | <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-doesnt-exist-notice" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
| 1803 | 1803 | <?php } ?> |
| 1804 | - <input maxlength="50" type="text" class="yikes-mc-edit-field-label-input" value="<?php echo stripslashes( $field['label'] ); ?>" /> |
|
| 1804 | + <input maxlength="50" type="text" class="yikes-mc-edit-field-label-input" value="<?php echo stripslashes( $field[ 'label' ] ); ?>" /> |
|
| 1805 | 1805 | <span class="dashicons dashicons-yes yikes-mc-save-field-label-edits-icon" title="<?php _e( 'Click to save changes.', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
| 1806 | 1806 | <span class="dashicons dashicons-edit yikes-mc-edit-field-label-icon" title="<?php _e( 'Click to edit the label', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
| 1807 | 1807 | <span class="yikes-mc-edit-field-label-message"></span> |
| 1808 | - <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
| 1808 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
| 1809 | 1809 | </a> |
| 1810 | 1810 | <!-- expansion section --> |
| 1811 | 1811 | <div class="yikes-mc-settings-expansion-section"> |
| 1812 | 1812 | |
| 1813 | 1813 | <?php if ( $excluded_field ) { ?>
|
| 1814 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1814 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on your website.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 1815 | 1815 | <?php } ?> |
| 1816 | 1816 | |
| 1817 | 1817 | <!-- store field data --> |
| 1818 | - <input type="hidden" class="yikes-mc-merge-field-label" name="field[<?php echo $field['merge']; ?>][label]" value="<?php echo htmlspecialchars( $field['label'] ); ?>" /> |
|
| 1819 | - <input type="hidden" class="yikes-mc-merge-field-type" name="field[<?php echo $field['merge']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
| 1820 | - <input type="hidden" class="yikes-mc-merge-field-tag" name="field[<?php echo $field['merge']; ?>][merge]" value="<?php echo $field['merge']; ?>" /> |
|
| 1821 | - <input type="hidden" class="field-<?php echo $field['merge']; ?>-position position-input" name="field[<?php echo $field['merge']; ?>][position]" value="<?php echo $i++; ?>" /> |
|
| 1822 | - <?php if ( isset( $merge_field_ids[ $field['merge'] ] ) && is_int( $merge_field_ids[ $field['merge'] ] ) ) { ?>
|
|
| 1823 | - <input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field['merge']; ?>][id]" value="<?php echo $merge_field_ids[ $field['merge'] ] ?>" /> |
|
| 1818 | + <input type="hidden" class="yikes-mc-merge-field-label" name="field[<?php echo $field[ 'merge' ]; ?>][label]" value="<?php echo htmlspecialchars( $field[ 'label' ] ); ?>" /> |
|
| 1819 | + <input type="hidden" class="yikes-mc-merge-field-type" name="field[<?php echo $field[ 'merge' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
| 1820 | + <input type="hidden" class="yikes-mc-merge-field-tag" name="field[<?php echo $field[ 'merge' ]; ?>][merge]" value="<?php echo $field[ 'merge' ]; ?>" /> |
|
| 1821 | + <input type="hidden" class="field-<?php echo $field[ 'merge' ]; ?>-position position-input" name="field[<?php echo $field[ 'merge' ]; ?>][position]" value="<?php echo $i++; ?>" /> |
|
| 1822 | + <?php if ( isset( $merge_field_ids[ $field[ 'merge' ] ] ) && is_int( $merge_field_ids[ $field[ 'merge' ] ] ) ) { ?>
|
|
| 1823 | + <input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field[ 'merge' ]; ?>][id]" value="<?php echo $merge_field_ids[ $field[ 'merge' ] ] ?>" /> |
|
| 1824 | 1824 | <?php } ?> |
| 1825 | 1825 | |
| 1826 | - <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
|
|
| 1827 | - $choices = json_decode( $field['choices'], true ); |
|
| 1826 | + <?php if ( $field[ 'type' ] == 'radio' || $field[ 'type' ] == 'dropdown' || $field[ 'type' ] == 'select' ) {
|
|
| 1827 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
| 1828 | 1828 | ?> |
| 1829 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
| 1829 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
|
| 1830 | 1830 | <?php } ?> |
| 1831 | 1831 | |
| 1832 | 1832 | <!-- Single or Double Opt-in --> |
@@ -1842,12 +1842,12 @@ discard block |
||
| 1842 | 1842 | </label> |
| 1843 | 1843 | </td> |
| 1844 | 1844 | <td> |
| 1845 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field['merge']; ?>"> |
|
| 1845 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $field[ 'merge' ]; ?>"> |
|
| 1846 | 1846 | </td> |
| 1847 | 1847 | </tr> |
| 1848 | 1848 | |
| 1849 | 1849 | <!-- Placeholder Value --> |
| 1850 | - <?php switch( $field['type'] ) {
|
|
| 1850 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 1851 | 1851 | |
| 1852 | 1852 | case 'text': |
| 1853 | 1853 | case 'email': |
@@ -1861,13 +1861,13 @@ discard block |
||
| 1861 | 1861 | <!-- Placeholder --> |
| 1862 | 1862 | <tr valign="top"> |
| 1863 | 1863 | <td scope="row"> |
| 1864 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1864 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1865 | 1865 | <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1866 | 1866 | </label> |
| 1867 | 1867 | </td> |
| 1868 | 1868 | <td> |
| 1869 | - <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'] : '' ; ?>" /> |
|
| 1870 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1869 | + <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' ] : ''; ?>" /> |
|
| 1870 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1871 | 1871 | </td> |
| 1872 | 1872 | </tr> |
| 1873 | 1873 | <?php |
@@ -1878,13 +1878,13 @@ discard block |
||
| 1878 | 1878 | ?> |
| 1879 | 1879 | <tr valign="top"> |
| 1880 | 1880 | <td scope="row"> |
| 1881 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1881 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1882 | 1882 | <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1883 | 1883 | </label> |
| 1884 | 1884 | </td> |
| 1885 | 1885 | <td> |
| 1886 | - <input type="checkbox" id="placeholder_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][placeholder]" value="1" <?php echo isset( $field['placeholder'] ) && ! empty( $field['placeholder'] ) ? 'checked="checked"' : '' ; ?> /> |
|
| 1887 | - <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> |
|
| 1886 | + <input type="checkbox" id="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][placeholder]" value="1" <?php echo isset( $field[ 'placeholder' ] ) && ! empty( $field[ 'placeholder' ] ) ? 'checked="checked"' : ''; ?> /> |
|
| 1887 | + <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> |
|
| 1888 | 1888 | </td> |
| 1889 | 1889 | </tr> |
| 1890 | 1890 | <?php |
@@ -1894,7 +1894,7 @@ discard block |
||
| 1894 | 1894 | ?> |
| 1895 | 1895 | |
| 1896 | 1896 | <!-- Default Value --> |
| 1897 | - <?php switch( $field['type'] ) {
|
|
| 1897 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 1898 | 1898 | default: |
| 1899 | 1899 | case 'text': |
| 1900 | 1900 | case 'number': |
@@ -1902,15 +1902,15 @@ discard block |
||
| 1902 | 1902 | ?> |
| 1903 | 1903 | <tr valign="top"> |
| 1904 | 1904 | <td scope="row"> |
| 1905 | - <label for="default_value_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1905 | + <label for="default_value_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1906 | 1906 | <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1907 | 1907 | </label> |
| 1908 | 1908 | </td> |
| 1909 | 1909 | <td> |
| 1910 | - <input id="default_value_<?php echo esc_attr( $field['merge'] ); ?>" <?php if ( $field['type'] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field['merge']; ?>][default]" <?php if ( $field['type'] != 'url' ) { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( $field['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field['default'] ) ) ) : ''; ?>" <?php } ?> />
|
|
| 1911 | - <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> |
|
| 1910 | + <input id="default_value_<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php if ( $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][default]" <?php if ( $field[ 'type' ] != 'url' ) { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'default' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field[ 'default' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field[ 'default' ] ) ) ) : ''; ?>" <?php } ?> />
|
|
| 1911 | + <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> |
|
| 1912 | 1912 | <?php |
| 1913 | - switch( $field['type'] ) {
|
|
| 1913 | + switch ( $field[ 'type' ] ) {
|
|
| 1914 | 1914 | case 'text': |
| 1915 | 1915 | ?> |
| 1916 | 1916 | <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
@@ -1932,28 +1932,28 @@ discard block |
||
| 1932 | 1932 | </td> |
| 1933 | 1933 | <td> |
| 1934 | 1934 | <?php |
| 1935 | - $field['default_choice'] = ! isset( $field['default_choice'] ) ? 'no-default' : $field['default_choice']; |
|
| 1935 | + $field[ 'default_choice' ] = ! isset( $field[ 'default_choice' ] ) ? 'no-default' : $field[ 'default_choice' ]; |
|
| 1936 | 1936 | $x = 0; |
| 1937 | 1937 | ?> |
| 1938 | - <label for="<?php echo $field['merge'] . '-no-default'; ?>"> |
|
| 1939 | - <input id="<?php echo $field['merge'] . '-no-default'; ?>" |
|
| 1938 | + <label for="<?php echo $field[ 'merge' ] . '-no-default'; ?>"> |
|
| 1939 | + <input id="<?php echo $field[ 'merge' ] . '-no-default'; ?>" |
|
| 1940 | 1940 | type="radio" |
| 1941 | - name="field[<?php echo $field['merge']; ?>][default_choice]" |
|
| 1942 | - value="no-default" <?php checked( $field['default_choice'], 'no-default' ); ?> |
|
| 1941 | + name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]" |
|
| 1942 | + value="no-default" <?php checked( $field[ 'default_choice' ], 'no-default' ); ?> |
|
| 1943 | 1943 | > |
| 1944 | 1944 | No Default |
| 1945 | 1945 | </label> |
| 1946 | 1946 | <?php |
| 1947 | 1947 | foreach ( $choices as $choice => $value ) { ?>
|
| 1948 | - <label for="<?php echo $field['merge'].'-'.$x; ?>"> |
|
| 1949 | - <input id="<?php echo $field['merge'].'-'.$x; ?>" |
|
| 1948 | + <label for="<?php echo $field[ 'merge' ] . '-' . $x; ?>"> |
|
| 1949 | + <input id="<?php echo $field[ 'merge' ] . '-' . $x; ?>" |
|
| 1950 | 1950 | type="radio" |
| 1951 | - name="field[<?php echo $field['merge']; ?>][default_choice]" |
|
| 1952 | - value="<?php echo $x; ?>" <?php checked( $field['default_choice'], $x ); ?>> |
|
| 1951 | + name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]" |
|
| 1952 | + value="<?php echo $x; ?>" <?php checked( $field[ 'default_choice' ], $x ); ?>> |
|
| 1953 | 1953 | <?php echo $value; ?> |
| 1954 | 1954 | </label> |
| 1955 | 1955 | <?php $x++; } ?> |
| 1956 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1956 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1957 | 1957 | </td> |
| 1958 | 1958 | </tr> |
| 1959 | 1959 | |
@@ -1969,13 +1969,13 @@ discard block |
||
| 1969 | 1969 | </label> |
| 1970 | 1970 | </td> |
| 1971 | 1971 | <td> |
| 1972 | - <select type="default" name="field[<?php echo $field['merge']; ?>][default_choice]"> |
|
| 1973 | - <option value="no-default" <?php selected( $field['default_choice'] , 'no-default' ); ?>>No Default</option> |
|
| 1974 | - <?php foreach( json_decode( $field['choices'], true ) as $choice => $value ) { ?>
|
|
| 1975 | - <option value="<?php echo $choice; ?>" <?php selected( $field['default_choice'] , $choice ); ?>><?php echo $value; ?></option> |
|
| 1972 | + <select type="default" name="field[<?php echo $field[ 'merge' ]; ?>][default_choice]"> |
|
| 1973 | + <option value="no-default" <?php selected( $field[ 'default_choice' ], 'no-default' ); ?>>No Default</option> |
|
| 1974 | + <?php foreach ( json_decode( $field[ 'choices' ], true ) as $choice => $value ) { ?>
|
|
| 1975 | + <option value="<?php echo $choice; ?>" <?php selected( $field[ 'default_choice' ], $choice ); ?>><?php echo $value; ?></option> |
|
| 1976 | 1976 | <?php } ?> |
| 1977 | 1977 | </select> |
| 1978 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 1978 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 1979 | 1979 | </td> |
| 1980 | 1980 | </tr> |
| 1981 | 1981 | |
@@ -1992,82 +1992,82 @@ discard block |
||
| 1992 | 1992 | <!-- Field Description --> |
| 1993 | 1993 | <tr valign="top"> |
| 1994 | 1994 | <td scope="row"> |
| 1995 | - <label for="description_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 1995 | + <label for="description_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 1996 | 1996 | <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 1997 | 1997 | </label> |
| 1998 | 1998 | </td> |
| 1999 | 1999 | <td> |
| 2000 | - <textarea class="widefat field-description-input" id="description_<?php echo esc_attr( $field['merge'] ); ?>" name="field[<?php echo $field['merge']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
| 2001 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2000 | + <textarea class="widefat field-description-input" id="description_<?php echo esc_attr( $field[ 'merge' ] ); ?>" name="field[<?php echo $field[ 'merge' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
| 2001 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and will provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2002 | 2002 | </td> |
| 2003 | 2003 | </tr> |
| 2004 | 2004 | <!-- Description Above Field --> |
| 2005 | 2005 | <tr valign="top" class="yikes-checkbox-container"> |
| 2006 | 2006 | <td scope="row"> |
| 2007 | - <label for="description_above_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2007 | + <label for="description_above_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2008 | 2008 | <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2009 | 2009 | </label> |
| 2010 | 2010 | </td> |
| 2011 | 2011 | <td> |
| 2012 | - <input type="checkbox" id="description_above_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat field-description-input" name="field[<?php echo $field['merge']; ?>][description_above]" value="1" <?php echo isset( $field['description_above'] ) && $field['description_above'] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2013 | - <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> |
|
| 2012 | + <input type="checkbox" id="description_above_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'merge' ]; ?>][description_above]" value="1" <?php echo isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2013 | + <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> |
|
| 2014 | 2014 | </td> |
| 2015 | 2015 | </tr> |
| 2016 | 2016 | <!-- Additional Classes --> |
| 2017 | 2017 | <tr valign="top"> |
| 2018 | 2018 | <td scope="row"> |
| 2019 | - <label for="classes_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2019 | + <label for="classes_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2020 | 2020 | <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2021 | 2021 | </label> |
| 2022 | 2022 | </td> |
| 2023 | 2023 | <td> |
| 2024 | - <input type="text" id="classes_<?php echo esc_attr( $field['merge'] ); ?>" class="widefat" name="field[<?php echo $field['merge']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
| 2025 | - <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> |
|
| 2024 | + <input type="text" id="classes_<?php echo esc_attr( $field[ 'merge' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'merge' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
| 2025 | + <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> |
|
| 2026 | 2026 | </td> |
| 2027 | 2027 | </tr> |
| 2028 | 2028 | <!-- Required Toggle --> |
| 2029 | 2029 | <tr valign="top" class="yikes-checkbox-container yikes-checkbox-container-first"> |
| 2030 | 2030 | <td scope="row"> |
| 2031 | - <label for="field-required-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2031 | + <label for="field-required-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2032 | 2032 | <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2033 | 2033 | </label> |
| 2034 | 2034 | </td> |
| 2035 | 2035 | <td> |
| 2036 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
| 2037 | - <input id="field-required-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][require]" <?php checked( $checked , 1 ); ?> <?php if ( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2038 | - <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> |
|
| 2036 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
| 2037 | + <input id="field-required-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][require]" <?php checked( $checked, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2038 | + <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> |
|
| 2039 | 2039 | </td> |
| 2040 | 2040 | </tr> |
| 2041 | 2041 | <!-- Visible Toggle --> |
| 2042 | 2042 | <tr valign="top" class="yikes-checkbox-container"> |
| 2043 | 2043 | <td scope="row"> |
| 2044 | - <label for="hide-field-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2044 | + <label for="hide-field-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2045 | 2045 | <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2046 | 2046 | </label> |
| 2047 | 2047 | </td> |
| 2048 | 2048 | <td> |
| 2049 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
| 2050 | - <input id="hide-field-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field['merge']; ?>][hide]" <?php checked( $hide , 1 ); ?> <?php if ( $field['merge'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2051 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2049 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
| 2050 | + <input id="hide-field-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" class="widefat" value="1" name="field[<?php echo $field[ 'merge' ]; ?>][hide]" <?php checked( $hide, 1 ); ?> <?php if ( $field[ 'merge' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>">
|
|
| 2051 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2052 | 2052 | </td> |
| 2053 | 2053 | </tr> |
| 2054 | 2054 | <!-- Toggle Field Label Visibility --> |
| 2055 | 2055 | <tr valign="top" class="yikes-checkbox-container"> |
| 2056 | 2056 | <td scope="row"> |
| 2057 | - <label for="hide-label-<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 2057 | + <label for="hide-label-<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 2058 | 2058 | <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2059 | 2059 | </label> |
| 2060 | 2060 | </td> |
| 2061 | 2061 | <td> |
| 2062 | - <?php $hide_label = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
| 2063 | - <input id="hide-label-<?php echo esc_attr( $field['merge'] ); ?>" type="checkbox" name="field[<?php echo $field['merge']; ?>][hide-label]" value="1" <?php checked( $hide_label , 1 ); ?>/> |
|
| 2064 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2062 | + <?php $hide_label = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
| 2063 | + <input id="hide-label-<?php echo esc_attr( $field[ 'merge' ] ); ?>" type="checkbox" name="field[<?php echo $field[ 'merge' ]; ?>][hide-label]" value="1" <?php checked( $hide_label, 1 ); ?>/> |
|
| 2064 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2065 | 2065 | </td> |
| 2066 | 2066 | </tr> |
| 2067 | 2067 | <!-- Display Phone/Date Formats back to the user --> |
| 2068 | 2068 | <!-- Phone Format Initial Load --> |
| 2069 | 2069 | <?php |
| 2070 | - switch( $field['type'] ) {
|
|
| 2070 | + switch ( $field[ 'type' ] ) {
|
|
| 2071 | 2071 | /* Store the phone format, for properly regex pattern */ |
| 2072 | 2072 | case 'phone': |
| 2073 | 2073 | case 'birthday': |
@@ -2077,23 +2077,23 @@ discard block |
||
| 2077 | 2077 | <td scope="row"> |
| 2078 | 2078 | <label for="placeholder"> |
| 2079 | 2079 | <?php |
| 2080 | - switch( $field['type'] ) {
|
|
| 2080 | + switch ( $field[ 'type' ] ) {
|
|
| 2081 | 2081 | default: |
| 2082 | 2082 | case 'birthday': |
| 2083 | 2083 | $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2084 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD'; |
|
| 2084 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD'; |
|
| 2085 | 2085 | $format_name = 'date_format'; |
| 2086 | 2086 | break; |
| 2087 | 2087 | |
| 2088 | 2088 | case 'date': |
| 2089 | 2089 | $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2090 | - $format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'MM/DD/YYYY'; |
|
| 2090 | + $format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'MM/DD/YYYY'; |
|
| 2091 | 2091 | $format_name = 'date_format'; |
| 2092 | 2092 | break; |
| 2093 | 2093 | |
| 2094 | 2094 | case 'phone': |
| 2095 | 2095 | $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
| 2096 | - $format = isset( $field['phone_format'] ) && ! empty( $field['phone_format'] ) ? $field['phone_format'] : __( 'International', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2096 | + $format = isset( $field[ 'phone_format' ] ) && ! empty( $field[ 'phone_format' ] ) ? $field[ 'phone_format' ] : __( 'International', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2097 | 2097 | $format_name = 'phone_format'; |
| 2098 | 2098 | break; |
| 2099 | 2099 | } |
@@ -2103,7 +2103,7 @@ discard block |
||
| 2103 | 2103 | </td> |
| 2104 | 2104 | <td> |
| 2105 | 2105 | <strong><?php echo $format; ?></strong> |
| 2106 | - <input type="hidden" name="field[<?php echo $field['merge']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 2106 | + <input type="hidden" name="field[<?php echo $field[ 'merge' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 2107 | 2107 | <p class="description"><small> |
| 2108 | 2108 | <?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' ) ); ?> |
| 2109 | 2109 | </small></p> |
@@ -2124,8 +2124,8 @@ discard block |
||
| 2124 | 2124 | </td> |
| 2125 | 2125 | <td> |
| 2126 | 2126 | <span class="toggle-container"> |
| 2127 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2128 | - <a href="#" class="remove-field" alt="<?php echo $field['merge']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2127 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2128 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'merge' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2129 | 2129 | </span> |
| 2130 | 2130 | </td> |
| 2131 | 2131 | </tr> |
@@ -2143,35 +2143,35 @@ discard block |
||
| 2143 | 2143 | /**** Interest Group ****/ |
| 2144 | 2144 | |
| 2145 | 2145 | ?> |
| 2146 | - <section class="draggable" id="<?php echo $field['group_id']; ?>"> |
|
| 2146 | + <section class="draggable" id="<?php echo $field[ 'group_id' ]; ?>"> |
|
| 2147 | 2147 | <!-- top --> |
| 2148 | 2148 | <a href="#" class="expansion-section-title settings-sidebar"> |
| 2149 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php echo stripslashes( $field['label'] ); ?> |
|
| 2150 | - <?php if ( in_array( $field['group_id'] , $excluded_fields ) ) { ?>
|
|
| 2149 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle"></span><?php echo stripslashes( $field[ 'label' ] ); ?> |
|
| 2150 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?>
|
|
| 2151 | 2151 | <img src="<?php echo YIKES_MC_URL . 'includes/images/warning.svg'; ?>" class="field-no-longer-exists-warning" title="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>" alt="<?php _e( 'Field no longer exists.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
| 2152 | 2152 | <?php } ?> |
| 2153 | - <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field['type']; ?></small></span> |
|
| 2153 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $field[ 'type' ]; ?></small></span> |
|
| 2154 | 2154 | </a> |
| 2155 | 2155 | <!-- expansion section --> |
| 2156 | 2156 | <div class="yikes-mc-settings-expansion-section"> |
| 2157 | 2157 | |
| 2158 | 2158 | <!-- check if this field exists in the available interest group array --> |
| 2159 | - <?php if ( in_array( $field['group_id'] , $excluded_fields ) ) { ?>
|
|
| 2160 | - <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 2159 | + <?php if ( in_array( $field[ 'group_id' ], $excluded_fields ) ) { ?>
|
|
| 2160 | + <p class="yikes-mc-warning-message"><?php _e( "This field no longer exists in this list. Delete this field from the form to prevent issues on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 2161 | 2161 | <?php } ?> |
| 2162 | 2162 | |
| 2163 | 2163 | <!-- store the label --> |
| 2164 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][label]" value="<?php echo htmlspecialchars( $field['label'] ); ?>" /> |
|
| 2165 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][type]" value="<?php echo $field['type']; ?>" /> |
|
| 2166 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][group_id]" value="<?php echo $field['group_id']; ?>" /> |
|
| 2167 | - <input type="hidden" name="field[<?php echo $field['group_id']; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field['groups'], true ) ) ); ?>' /> |
|
| 2164 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][label]" value="<?php echo htmlspecialchars( $field[ 'label' ] ); ?>" /> |
|
| 2165 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][type]" value="<?php echo $field[ 'type' ]; ?>" /> |
|
| 2166 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][group_id]" value="<?php echo $field[ 'group_id' ]; ?>" /> |
|
| 2167 | + <input type="hidden" name="field[<?php echo $field[ 'group_id' ]; ?>][groups]" value='<?php echo esc_attr( json_encode( json_decode( $field[ 'groups' ], true ) ) ); ?>' /> |
|
| 2168 | 2168 | |
| 2169 | 2169 | <!-- Single or Double Opt-in --> |
| 2170 | 2170 | <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); --> |
| 2171 | 2171 | |
| 2172 | 2172 | <table class="form-table form-field-container"> |
| 2173 | 2173 | <!-- Default Value --> |
| 2174 | - <?php switch( $field['type'] ) {
|
|
| 2174 | + <?php switch ( $field[ 'type' ] ) {
|
|
| 2175 | 2175 | default: |
| 2176 | 2176 | case 'radio': |
| 2177 | 2177 | case 'checkboxes': |
@@ -2184,15 +2184,15 @@ discard block |
||
| 2184 | 2184 | </td> |
| 2185 | 2185 | <td> |
| 2186 | 2186 | <?php |
| 2187 | - $field['default_choice'] = isset( $field['default_choice'] ) ? $field['default_choice'] : ''; |
|
| 2187 | + $field[ 'default_choice' ] = isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : ''; |
|
| 2188 | 2188 | |
| 2189 | 2189 | $default_shown = false; |
| 2190 | 2190 | |
| 2191 | - foreach ( json_decode( $field['groups'], true ) as $id => $group ) {
|
|
| 2192 | - $field_id = "{$field['group_id']}-{$id}";
|
|
| 2193 | - $field_type = 'hidden' == $field['type'] ? 'checkbox' : $field['type']; |
|
| 2191 | + foreach ( json_decode( $field[ 'groups' ], true ) as $id => $group ) {
|
|
| 2192 | + $field_id = "{$field[ 'group_id' ]}-{$id}";
|
|
| 2193 | + $field_type = 'hidden' == $field[ 'type' ] ? 'checkbox' : $field[ 'type' ]; |
|
| 2194 | 2194 | $field_type = 'checkboxes' == $field_type ? 'checkbox' : $field_type; |
| 2195 | - $field_name = "field[{$field['group_id']}][default_choice]";
|
|
| 2195 | + $field_name = "field[{$field[ 'group_id' ]}][default_choice]";
|
|
| 2196 | 2196 | $field_name = 'checkbox' == $field_type ? $field_name . '[]' : $field_name; |
| 2197 | 2197 | |
| 2198 | 2198 | // Determine if the current group is checked. |
@@ -2200,13 +2200,13 @@ discard block |
||
| 2200 | 2200 | switch ( $field_type ) {
|
| 2201 | 2201 | case 'radio': |
| 2202 | 2202 | default: |
| 2203 | - $default = is_array( $field['default_choice'] ) ? current( $field['default_choice'] ) : $field['default_choice']; |
|
| 2204 | - $checked = is_array( $field['default_choice'] ) ? checked( current( $field['default_choice'] ), $id, false ) : checked( $field['default_choice'], $id, false ); |
|
| 2203 | + $default = is_array( $field[ 'default_choice' ] ) ? current( $field[ 'default_choice' ] ) : $field[ 'default_choice' ]; |
|
| 2204 | + $checked = is_array( $field[ 'default_choice' ] ) ? checked( current( $field[ 'default_choice' ] ), $id, false ) : checked( $field[ 'default_choice' ], $id, false ); |
|
| 2205 | 2205 | break; |
| 2206 | 2206 | |
| 2207 | 2207 | case 'checkbox': |
| 2208 | 2208 | case 'hidden': |
| 2209 | - if ( is_array( $field['default_choice'] ) && in_array( $id, $field['default_choice'] ) ) {
|
|
| 2209 | + if ( is_array( $field[ 'default_choice' ] ) && in_array( $id, $field[ 'default_choice' ] ) ) {
|
|
| 2210 | 2210 | $checked = checked( true, true, false ); |
| 2211 | 2211 | } |
| 2212 | 2212 | break; |
@@ -2221,7 +2221,7 @@ discard block |
||
| 2221 | 2221 | type="<?php echo $field_type; ?>" |
| 2222 | 2222 | name="<?php echo $field_name; ?>" |
| 2223 | 2223 | value="no-default" |
| 2224 | - <?php is_array( $field['default_choice'] ) ? checked( current( $field['default_choice'] ), 'no-default' ) : checked( $field['default_choice'], 'no-default' ); ?>> |
|
| 2224 | + <?php is_array( $field[ 'default_choice' ] ) ? checked( current( $field[ 'default_choice' ] ), 'no-default' ) : checked( $field[ 'default_choice' ], 'no-default' ); ?>> |
|
| 2225 | 2225 | No Default |
| 2226 | 2226 | </label> |
| 2227 | 2227 | <?php |
@@ -2237,7 +2237,7 @@ discard block |
||
| 2237 | 2237 | </label> |
| 2238 | 2238 | <?php |
| 2239 | 2239 | } ?> |
| 2240 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2240 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2241 | 2241 | </td> |
| 2242 | 2242 | </tr> |
| 2243 | 2243 | |
@@ -2253,13 +2253,13 @@ discard block |
||
| 2253 | 2253 | </label> |
| 2254 | 2254 | </td> |
| 2255 | 2255 | <td> |
| 2256 | - <select type="default" name="field[<?php echo $field['group_id']; ?>][default_choice]"> |
|
| 2256 | + <select type="default" name="field[<?php echo $field[ 'group_id' ]; ?>][default_choice]"> |
|
| 2257 | 2257 | <option value="no-default">No Default</option> |
| 2258 | - <?php foreach( json_decode( stripslashes_deep( $field['groups'] ) , true ) as $id => $group ) { ?>
|
|
| 2259 | - <option value="<?php echo $id; ?>" <?php selected( $field['default_choice'] , $id ); ?>><?php echo stripslashes( $group ); ?></option> |
|
| 2258 | + <?php foreach ( json_decode( stripslashes_deep( $field[ 'groups' ] ), true ) as $id => $group ) { ?>
|
|
| 2259 | + <option value="<?php echo $id; ?>" <?php selected( $field[ 'default_choice' ], $id ); ?>><?php echo stripslashes( $group ); ?></option> |
|
| 2260 | 2260 | <?php } ?> |
| 2261 | 2261 | </select> |
| 2262 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2262 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2263 | 2263 | </td> |
| 2264 | 2264 | </tr> |
| 2265 | 2265 | |
@@ -2272,78 +2272,78 @@ discard block |
||
| 2272 | 2272 | <!-- Field Description --> |
| 2273 | 2273 | <tr valign="top"> |
| 2274 | 2274 | <td scope="row"> |
| 2275 | - <label for="description_<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2275 | + <label for="description_<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2276 | 2276 | <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2277 | 2277 | </label> |
| 2278 | 2278 | </td> |
| 2279 | 2279 | <td> |
| 2280 | - <textarea id="description_<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat field-description-input" name="field[<?php echo $field['group_id']; ?>][description]"><?php echo isset( $field['description'] ) ? stripslashes( esc_html( $field['description'] ) ) : '' ; ?></textarea> |
|
| 2281 | - <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> |
|
| 2280 | + <textarea id="description_<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'group_id' ]; ?>][description]"><?php echo isset( $field[ 'description' ] ) ? stripslashes( esc_html( $field[ 'description' ] ) ) : ''; ?></textarea> |
|
| 2281 | + <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> |
|
| 2282 | 2282 | </td> |
| 2283 | 2283 | </tr> |
| 2284 | 2284 | |
| 2285 | 2285 | <!-- Description Above Field --> |
| 2286 | 2286 | <tr valign="top" class="yikes-checkbox-container"> |
| 2287 | 2287 | <td scope="row"> |
| 2288 | - <label for="description_above_<?php echo $field['group_id']; ?>"> |
|
| 2288 | + <label for="description_above_<?php echo $field[ 'group_id' ]; ?>"> |
|
| 2289 | 2289 | <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2290 | 2290 | </label> |
| 2291 | 2291 | </td> |
| 2292 | 2292 | <td> |
| 2293 | - <input type="checkbox" id="description_above_<?php echo $field['group_id']; ?>" class="widefat field-description-input" name="field[<?php echo $field['group_id']; ?>][description_above]" value="1" <?php echo isset( $field['description_above'] ) && $field['description_above'] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2294 | - <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> |
|
| 2293 | + <input type="checkbox" id="description_above_<?php echo $field[ 'group_id' ]; ?>" class="widefat field-description-input" name="field[<?php echo $field[ 'group_id' ]; ?>][description_above]" value="1" <?php echo isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? 'checked="checked"' : ''; ?> /> |
|
| 2294 | + <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> |
|
| 2295 | 2295 | </td> |
| 2296 | 2296 | </tr> |
| 2297 | 2297 | |
| 2298 | 2298 | <!-- Additional Classes --> |
| 2299 | 2299 | <tr valign="top"> |
| 2300 | 2300 | <td scope="row"> |
| 2301 | - <label for="classes_<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2301 | + <label for="classes_<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2302 | 2302 | <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2303 | 2303 | </label> |
| 2304 | 2304 | </td> |
| 2305 | 2305 | <td> |
| 2306 | - <input type="text" id="classes_<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" name="field[<?php echo $field['group_id']; ?>][additional-classes]" value="<?php echo isset( $field['additional-classes'] ) ? stripslashes( wp_strip_all_tags( $field['additional-classes'] ) ) : '' ; ?>" /> |
|
| 2307 | - <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> |
|
| 2306 | + <input type="text" id="classes_<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" name="field[<?php echo $field[ 'group_id' ]; ?>][additional-classes]" value="<?php echo isset( $field[ 'additional-classes' ] ) ? stripslashes( wp_strip_all_tags( $field[ 'additional-classes' ] ) ) : ''; ?>" /> |
|
| 2307 | + <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> |
|
| 2308 | 2308 | </td> |
| 2309 | 2309 | </tr> |
| 2310 | 2310 | <!-- Required Toggle --> |
| 2311 | 2311 | <tr valign="top" class="yikes-checkbox-container"> |
| 2312 | 2312 | <td scope="row"> |
| 2313 | - <label for="field-required-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2313 | + <label for="field-required-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2314 | 2314 | <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2315 | 2315 | </label> |
| 2316 | 2316 | </td> |
| 2317 | 2317 | <td> |
| 2318 | - <?php $checked = isset( $field['require'] ) ? $field['require'] : '0'; ?> |
|
| 2319 | - <input type="checkbox" id="field-required-<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][require]" <?php checked( $checked , 1 ); ?>> |
|
| 2320 | - <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> |
|
| 2318 | + <?php $checked = isset( $field[ 'require' ] ) ? $field[ 'require' ] : '0'; ?> |
|
| 2319 | + <input type="checkbox" id="field-required-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][require]" <?php checked( $checked, 1 ); ?>> |
|
| 2320 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2321 | 2321 | </td> |
| 2322 | 2322 | </tr> |
| 2323 | 2323 | <!-- Visible Toggle --> |
| 2324 | 2324 | <tr valign="top" class="yikes-checkbox-container"> |
| 2325 | 2325 | <td scope="row"> |
| 2326 | - <label for="hide-field-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2326 | + <label for="hide-field-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2327 | 2327 | <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2328 | 2328 | </label> |
| 2329 | 2329 | </td> |
| 2330 | 2330 | <td> |
| 2331 | - <?php $hide = isset( $field['hide'] ) ? $field['hide'] : '0'; ?> |
|
| 2332 | - <input type="checkbox" id="hide-field-<?php echo esc_attr( $field['group_id'] ); ?>" class="widefat" value="1" name="field[<?php echo $field['group_id']; ?>][hide]" <?php checked( $hide , 1 ); ?>> |
|
| 2333 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2331 | + <?php $hide = isset( $field[ 'hide' ] ) ? $field[ 'hide' ] : '0'; ?> |
|
| 2332 | + <input type="checkbox" id="hide-field-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" class="widefat" value="1" name="field[<?php echo $field[ 'group_id' ]; ?>][hide]" <?php checked( $hide, 1 ); ?>> |
|
| 2333 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2334 | 2334 | </td> |
| 2335 | 2335 | </tr> |
| 2336 | 2336 | <!-- Toggle Field Label Visibility --> |
| 2337 | 2337 | <tr valign="top" class="yikes-checkbox-container"> |
| 2338 | 2338 | <td scope="row"> |
| 2339 | - <label for="hide-label-<?php echo esc_attr( $field['group_id'] ); ?>"> |
|
| 2339 | + <label for="hide-label-<?php echo esc_attr( $field[ 'group_id' ] ); ?>"> |
|
| 2340 | 2340 | <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
| 2341 | 2341 | </label> |
| 2342 | 2342 | </td> |
| 2343 | 2343 | <td> |
| 2344 | - <?php $hide = isset( $field['hide-label'] ) ? $field['hide-label'] : '0'; ?> |
|
| 2345 | - <input type="checkbox" id="hide-label-<?php echo esc_attr( $field['group_id'] ); ?>" name="field[<?php echo $field['group_id']; ?>][hide-label]" value="1" <?php checked( $hide , 1 ); ?>/> |
|
| 2346 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 2344 | + <?php $hide = isset( $field[ 'hide-label' ] ) ? $field[ 'hide-label' ] : '0'; ?> |
|
| 2345 | + <input type="checkbox" id="hide-label-<?php echo esc_attr( $field[ 'group_id' ] ); ?>" name="field[<?php echo $field[ 'group_id' ]; ?>][hide-label]" value="1" <?php checked( $hide, 1 ); ?>/> |
|
| 2346 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 2347 | 2347 | </td> |
| 2348 | 2348 | </tr> |
| 2349 | 2349 | <!-- Toggle Buttons --> |
@@ -2353,8 +2353,8 @@ discard block |
||
| 2353 | 2353 | </td> |
| 2354 | 2354 | <td> |
| 2355 | 2355 | <span class="toggle-container"> |
| 2356 | - <a href="#" class="close-form-expansion"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2357 | - <a href="#" class="remove-field" alt="<?php echo $field['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2356 | + <a href="#" class="close-form-expansion"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 2357 | + <a href="#" class="remove-field" alt="<?php echo $field[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 2358 | 2358 | </span> |
| 2359 | 2359 | </td> |
| 2360 | 2360 | </tr> |
@@ -2375,7 +2375,7 @@ discard block |
||
| 2375 | 2375 | add_thickbox(); |
| 2376 | 2376 | // enqueue jquery qtip for our tooltip |
| 2377 | 2377 | wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js', array( 'jquery' ) ); |
| 2378 | - wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
| 2378 | + wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
| 2379 | 2379 | $available_tags = array( |
| 2380 | 2380 | array( |
| 2381 | 2381 | 'tag' => '{page_title}',
|
@@ -2430,14 +2430,14 @@ discard block |
||
| 2430 | 2430 | <h3><?php _e( 'Pre Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
| 2431 | 2431 | <p class="description"><?php _e( 'You can use any of the following tags to populate a MailChimp text field with dynamic content. This can be used to determine which page the user signed up on, if the user was logged in and more.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
| 2432 | 2432 | <ul> |
| 2433 | - <?php foreach( apply_filters( 'yikes-mailchimp-custom-default-value-tags', $available_tags ) as $tag ) { ?>
|
|
| 2433 | + <?php foreach ( apply_filters( 'yikes-mailchimp-custom-default-value-tags', $available_tags ) as $tag ) { ?>
|
|
| 2434 | 2434 | <li class="tooltop-tag"> |
| 2435 | 2435 | <!-- link/tag --> |
| 2436 | - <a href="#" onclick="populateDefaultValue( '<?php echo $tag['tag']; ?>' );return false;" data-attr-tag="<?php echo $tag['tag']; ?>" title="<?php echo $tag['title']; ?>"><?php echo $tag['title']; ?></a> |
|
| 2436 | + <a href="#" onclick="populateDefaultValue( '<?php echo $tag[ 'tag' ]; ?>' );return false;" data-attr-tag="<?php echo $tag[ 'tag' ]; ?>" title="<?php echo $tag[ 'title' ]; ?>"><?php echo $tag[ 'title' ]; ?></a> |
|
| 2437 | 2437 | <!-- help icon --> |
| 2438 | 2438 | <span class="dashicons dashicons-editor-help"></span> |
| 2439 | 2439 | <!-- tooltip --> |
| 2440 | - <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag['description']; ?></div> |
|
| 2440 | + <div class="tooltiptext qtip-bootstrap yikes-easy-mc-hidden"><?php echo $tag[ 'description' ]; ?></div> |
|
| 2441 | 2441 | </li> |
| 2442 | 2442 | <?php } ?> |
| 2443 | 2443 | </ul> |
@@ -2456,32 +2456,32 @@ discard block |
||
| 2456 | 2456 | public function build_available_merge_vars( $form_fields, $available_merge_variables ) {
|
| 2457 | 2457 | $fields_assigned_to_form = array(); |
| 2458 | 2458 | foreach ( $form_fields as $field ) {
|
| 2459 | - if ( isset( $field['merge'] ) ) {
|
|
| 2460 | - $fields_assigned_to_form[ $field['merge'] ] = true; |
|
| 2459 | + if ( isset( $field[ 'merge' ] ) ) {
|
|
| 2460 | + $fields_assigned_to_form[ $field[ 'merge' ] ] = true; |
|
| 2461 | 2461 | } |
| 2462 | 2462 | } |
| 2463 | 2463 | |
| 2464 | - if ( ! empty( $available_merge_variables['merge_fields'] ) ) {
|
|
| 2464 | + if ( ! empty( $available_merge_variables[ 'merge_fields' ] ) ) {
|
|
| 2465 | 2465 | ?> |
| 2466 | 2466 | <ul id="available-fields"><?php |
| 2467 | - foreach ( $available_merge_variables['merge_fields'] as $merge_var ) {
|
|
| 2468 | - $not_available = isset( $fields_assigned_to_form[ $merge_var['tag'] ] ); |
|
| 2467 | + foreach ( $available_merge_variables[ 'merge_fields' ] as $merge_var ) {
|
|
| 2468 | + $not_available = isset( $fields_assigned_to_form[ $merge_var[ 'tag' ] ] ); |
|
| 2469 | 2469 | ?> |
| 2470 | 2470 | <li class="available-field <?php echo $not_available ? 'not-available' : ''; ?>" |
| 2471 | - alt="<?php echo esc_attr( $merge_var['tag'] ); ?>" |
|
| 2472 | - data-attr-field-type="<?php echo esc_attr( $merge_var['type'] ); ?>" |
|
| 2473 | - data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>" |
|
| 2474 | - data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>" |
|
| 2471 | + alt="<?php echo esc_attr( $merge_var[ 'tag' ] ); ?>" |
|
| 2472 | + data-attr-field-type="<?php echo esc_attr( $merge_var[ 'type' ] ); ?>" |
|
| 2473 | + data-attr-field-name="<?php echo esc_attr( $merge_var[ 'name' ] ); ?>" |
|
| 2474 | + data-attr-form-id="<?php echo esc_attr( $available_merge_variables[ 'list_id' ] ); ?>" |
|
| 2475 | 2475 | title="<?php echo $not_available ? esc_attr__( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ) : ''; ?>" |
| 2476 | 2476 | <?php echo $not_available ? 'disabled="disabled"' : ''; ?> |
| 2477 | 2477 | > |
| 2478 | 2478 | <?php |
| 2479 | - echo esc_html( stripslashes( $merge_var['name'] ) ); |
|
| 2480 | - if ( $merge_var['required'] ) {
|
|
| 2479 | + echo esc_html( stripslashes( $merge_var[ 'name' ] ) ); |
|
| 2480 | + if ( $merge_var[ 'required' ] ) {
|
|
| 2481 | 2481 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
| 2482 | 2482 | } |
| 2483 | 2483 | ?> |
| 2484 | - <small class="field-type-text"><?php echo esc_html( $merge_var['type'] ); ?></small> |
|
| 2484 | + <small class="field-type-text"><?php echo esc_html( $merge_var[ 'type' ] ); ?></small> |
|
| 2485 | 2485 | </li> |
| 2486 | 2486 | <?php |
| 2487 | 2487 | } |
@@ -2506,8 +2506,8 @@ discard block |
||
| 2506 | 2506 | $fields_assigned_to_form = array(); |
| 2507 | 2507 | if ( ! empty( $form_fields ) ) {
|
| 2508 | 2508 | foreach ( $form_fields as $field ) {
|
| 2509 | - if ( isset( $field['group_id'] ) ) {
|
|
| 2510 | - $fields_assigned_to_form[ $field['group_id'] ] = true; |
|
| 2509 | + if ( isset( $field[ 'group_id' ] ) ) {
|
|
| 2510 | + $fields_assigned_to_form[ $field[ 'group_id' ] ] = true; |
|
| 2511 | 2511 | } |
| 2512 | 2512 | } |
| 2513 | 2513 | } |
@@ -2517,19 +2517,19 @@ discard block |
||
| 2517 | 2517 | <ul id="available-interest-groups"> |
| 2518 | 2518 | <?php |
| 2519 | 2519 | foreach ( $available_interest_groups as $interest_group ) {
|
| 2520 | - $not_available = isset( $fields_assigned_to_form[ $interest_group['id'] ] ); |
|
| 2520 | + $not_available = isset( $fields_assigned_to_form[ $interest_group[ 'id' ] ] ); |
|
| 2521 | 2521 | ?> |
| 2522 | 2522 | <li class="available-field <?php echo $not_available ? 'not-available' : ''; ?>" |
| 2523 | - alt="<?php echo esc_attr( $interest_group['id'] ); ?>" |
|
| 2524 | - data-group-id="<?php echo esc_attr( $interest_group['id'] ); ?>" |
|
| 2525 | - data-attr-field-name="<?php echo esc_attr( htmlspecialchars( $interest_group['title'] ) ); ?>" |
|
| 2526 | - data-attr-field-type="<?php echo esc_attr( $interest_group['type'] ); ?>" |
|
| 2523 | + alt="<?php echo esc_attr( $interest_group[ 'id' ] ); ?>" |
|
| 2524 | + data-group-id="<?php echo esc_attr( $interest_group[ 'id' ] ); ?>" |
|
| 2525 | + data-attr-field-name="<?php echo esc_attr( htmlspecialchars( $interest_group[ 'title' ] ) ); ?>" |
|
| 2526 | + data-attr-field-type="<?php echo esc_attr( $interest_group[ 'type' ] ); ?>" |
|
| 2527 | 2527 | data-attr-form-id="<?php echo esc_attr( $list_id ); ?>" |
| 2528 | 2528 | title="<?php echo $not_available ? __( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ) : ''; ?>" |
| 2529 | 2529 | <?php echo $not_available ? 'disabled="disabled"' : ''; ?> |
| 2530 | 2530 | > |
| 2531 | - <?php echo esc_html( stripslashes( $interest_group['title'] ) ); ?> |
|
| 2532 | - <small class="field-type-text"><?php echo esc_html( $interest_group['type'] ); ?></small> |
|
| 2531 | + <?php echo esc_html( stripslashes( $interest_group[ 'title' ] ) ); ?> |
|
| 2532 | + <small class="field-type-text"><?php echo esc_html( $interest_group[ 'type' ] ); ?></small> |
|
| 2533 | 2533 | </li> |
| 2534 | 2534 | <?php |
| 2535 | 2535 | } |
@@ -2555,13 +2555,13 @@ discard block |
||
| 2555 | 2555 | $not_available = isset( $form_tags[ $tag_id ] ); |
| 2556 | 2556 | ?> |
| 2557 | 2557 | <li class="available-field <?php echo $not_available ? 'not-available' : ''; ?>" |
| 2558 | - id="tag-<?php echo esc_attr( $tag['id'] ); ?>" |
|
| 2559 | - data-tag-id="<?php echo esc_attr( $tag['id'] ); ?>" |
|
| 2560 | - data-tag-name="<?php echo esc_attr( $tag['name'] ); ?>" |
|
| 2561 | - title="<?php echo $not_available ? __( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ) : esc_attr( $tag['name'] ); ?>" |
|
| 2558 | + id="tag-<?php echo esc_attr( $tag[ 'id' ] ); ?>" |
|
| 2559 | + data-tag-id="<?php echo esc_attr( $tag[ 'id' ] ); ?>" |
|
| 2560 | + data-tag-name="<?php echo esc_attr( $tag[ 'name' ] ); ?>" |
|
| 2561 | + title="<?php echo $not_available ? __( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ) : esc_attr( $tag[ 'name' ] ); ?>" |
|
| 2562 | 2562 | <?php echo $not_available ? 'disabled="disabled"' : ''; ?> |
| 2563 | 2563 | > |
| 2564 | - <?php echo esc_html( $tag['name'] ); ?> |
|
| 2564 | + <?php echo esc_html( $tag[ 'name' ] ); ?> |
|
| 2565 | 2565 | </li> |
| 2566 | 2566 | <?php |
| 2567 | 2567 | } |
@@ -2582,15 +2582,15 @@ discard block |
||
| 2582 | 2582 | * - must clean up db tables , ensure what data is going in and what is needed... |
| 2583 | 2583 | */ |
| 2584 | 2584 | public function yikes_easy_mailchimp_create_form() {
|
| 2585 | - $nonce = $_REQUEST['nonce']; |
|
| 2585 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2586 | 2586 | if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) {
|
| 2587 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2587 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2588 | 2588 | } |
| 2589 | 2589 | |
| 2590 | 2590 | $result = $this->form_interface->create_form( array( |
| 2591 | - 'list_id' => sanitize_key( $_POST['associated-list'] ), |
|
| 2592 | - 'form_name' => stripslashes( $_POST['form-name'] ), |
|
| 2593 | - 'form_description' => stripslashes( $_POST['form-description'] ), |
|
| 2591 | + 'list_id' => sanitize_key( $_POST[ 'associated-list' ] ), |
|
| 2592 | + 'form_name' => stripslashes( $_POST[ 'form-name' ] ), |
|
| 2593 | + 'form_description' => stripslashes( $_POST[ 'form-description' ] ), |
|
| 2594 | 2594 | ) ); |
| 2595 | 2595 | |
| 2596 | 2596 | // if an error occurs during the form creation process |
@@ -2598,11 +2598,11 @@ discard block |
||
| 2598 | 2598 | // write it to the error log |
| 2599 | 2599 | // if the form was not created successfully |
| 2600 | 2600 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 2601 | - $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender') , __( "Creating a new form" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Forms" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2601 | + $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ), __( "Creating a new form", 'yikes-inc-easy-mailchimp-extender' ), __( "Forms", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 2602 | 2602 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&sql_error=' . urlencode( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ) ) ) ) ); |
| 2603 | 2603 | } else {
|
| 2604 | 2604 | // redirect the user to the new form edit page |
| 2605 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result) ) ); |
|
| 2605 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result ) ) ); |
|
| 2606 | 2606 | } |
| 2607 | 2607 | exit(); |
| 2608 | 2608 | } |
@@ -2615,11 +2615,11 @@ discard block |
||
| 2615 | 2615 | */ |
| 2616 | 2616 | public function yikes_easy_mailchimp_delete_form() {
|
| 2617 | 2617 | // grab & store our variables ( associated list & form name ) |
| 2618 | - $nonce = $_REQUEST['nonce']; |
|
| 2619 | - $post_id_to_delete = $_REQUEST['mailchimp-form']; |
|
| 2618 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2619 | + $post_id_to_delete = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2620 | 2620 | // verify our nonce |
| 2621 | - if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) {
|
|
| 2622 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2621 | + if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-' . $post_id_to_delete ) ) {
|
|
| 2622 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2623 | 2623 | } |
| 2624 | 2624 | |
| 2625 | 2625 | $this->form_interface->delete_form( $post_id_to_delete ); |
@@ -2635,19 +2635,19 @@ discard block |
||
| 2635 | 2635 | */ |
| 2636 | 2636 | public function yikes_easy_mailchimp_duplicate_form() {
|
| 2637 | 2637 | // grab & store our variables ( associated list & form name ) |
| 2638 | - $nonce = $_REQUEST['nonce']; |
|
| 2639 | - $post_id_to_clone = $_REQUEST['mailchimp-form']; |
|
| 2638 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2639 | + $post_id_to_clone = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2640 | 2640 | // verify our nonce |
| 2641 | - if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) {
|
|
| 2642 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2641 | + if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-' . $post_id_to_clone ) ) {
|
|
| 2642 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2643 | 2643 | } |
| 2644 | 2644 | |
| 2645 | 2645 | // Get the current form data. |
| 2646 | 2646 | $form_data = $this->form_interface->get_form( $post_id_to_clone ); |
| 2647 | 2647 | |
| 2648 | 2648 | // Update some of the data before duplication |
| 2649 | - $form_data['form_name'] .= ' - Copy'; |
|
| 2650 | - $form_data['impressions'] = $form_data['submissions'] = 0; |
|
| 2649 | + $form_data[ 'form_name' ] .= ' - Copy'; |
|
| 2650 | + $form_data[ 'impressions' ] = $form_data[ 'submissions' ] = 0; |
|
| 2651 | 2651 | |
| 2652 | 2652 | // Create the new form, and handle the result. |
| 2653 | 2653 | $result = $this->form_interface->create_form( $form_data ); |
@@ -2678,11 +2678,11 @@ discard block |
||
| 2678 | 2678 | */ |
| 2679 | 2679 | public function yikes_easy_mailchimp_reset_impression_stats() {
|
| 2680 | 2680 | // grab & store our variables ( associated list & form name ) |
| 2681 | - $nonce = $_REQUEST['nonce']; |
|
| 2682 | - $form_id_to_reset = $_REQUEST['mailchimp-form']; |
|
| 2681 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2682 | + $form_id_to_reset = $_REQUEST[ 'mailchimp-form' ]; |
|
| 2683 | 2683 | // verify our nonce |
| 2684 | - if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) {
|
|
| 2685 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2684 | + if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-' . $form_id_to_reset ) ) {
|
|
| 2685 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2686 | 2686 | } |
| 2687 | 2687 | |
| 2688 | 2688 | $result = $this->form_interface->update_form( |
@@ -2710,8 +2710,8 @@ discard block |
||
| 2710 | 2710 | */ |
| 2711 | 2711 | public function yikes_easy_mailchimp_update_form() {
|
| 2712 | 2712 | |
| 2713 | - $nonce = $_REQUEST['nonce']; |
|
| 2714 | - $form_id = $_REQUEST['id']; |
|
| 2713 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2714 | + $form_id = $_REQUEST[ 'id' ]; |
|
| 2715 | 2715 | |
| 2716 | 2716 | // verify our nonce |
| 2717 | 2717 | if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) {
|
@@ -2725,70 +2725,70 @@ discard block |
||
| 2725 | 2725 | } |
| 2726 | 2726 | |
| 2727 | 2727 | // Store our values! |
| 2728 | - $list_id = $_POST['associated-list']; |
|
| 2729 | - $form_name = stripslashes( $_POST['form-name'] ); |
|
| 2730 | - $form_description = sanitize_text_field( stripslashes( $_POST['form-description'] ) ); |
|
| 2731 | - $redirect_user_on_submit = $_POST['redirect-user-on-submission']; |
|
| 2732 | - $redirect_page = $_POST['redirect-user-to-selection']; |
|
| 2728 | + $list_id = $_POST[ 'associated-list' ]; |
|
| 2729 | + $form_name = stripslashes( $_POST[ 'form-name' ] ); |
|
| 2730 | + $form_description = sanitize_text_field( stripslashes( $_POST[ 'form-description' ] ) ); |
|
| 2731 | + $redirect_user_on_submit = $_POST[ 'redirect-user-on-submission' ]; |
|
| 2732 | + $redirect_page = $_POST[ 'redirect-user-to-selection' ]; |
|
| 2733 | 2733 | |
| 2734 | 2734 | // stripslashes_deep on save, to prevent foreign languages from added excessive backslashes |
| 2735 | - $assigned_fields = isset( $_POST['field'] ) ? stripslashes_deep( $_POST['field'] ): array(); |
|
| 2735 | + $assigned_fields = isset( $_POST[ 'field' ] ) ? stripslashes_deep( $_POST[ 'field' ] ) : array(); |
|
| 2736 | 2736 | |
| 2737 | 2737 | // setup our submission settings serialized array |
| 2738 | 2738 | $submission_settings = array( |
| 2739 | - 'ajax' => $_POST['form-ajax-submission'], |
|
| 2740 | - 'redirect_on_submission' => $_POST['redirect-user-on-submission'], |
|
| 2741 | - 'redirect_page' => $_POST['redirect-user-to-selection'], |
|
| 2742 | - 'custom_redirect_url' => esc_url( $_POST['custom-redirect-url'] ), |
|
| 2743 | - 'redirect_new_window' => $_POST['redirect_new_window'], |
|
| 2744 | - 'hide_form_post_signup' => $_POST['hide-form-post-signup'], |
|
| 2745 | - 'replace_interests' => $_POST['replace-interest-groups'], |
|
| 2739 | + 'ajax' => $_POST[ 'form-ajax-submission' ], |
|
| 2740 | + 'redirect_on_submission' => $_POST[ 'redirect-user-on-submission' ], |
|
| 2741 | + 'redirect_page' => $_POST[ 'redirect-user-to-selection' ], |
|
| 2742 | + 'custom_redirect_url' => esc_url( $_POST[ 'custom-redirect-url' ] ), |
|
| 2743 | + 'redirect_new_window' => $_POST[ 'redirect_new_window' ], |
|
| 2744 | + 'hide_form_post_signup' => $_POST[ 'hide-form-post-signup' ], |
|
| 2745 | + 'replace_interests' => $_POST[ 'replace-interest-groups' ], |
|
| 2746 | 2746 | ); |
| 2747 | 2747 | |
| 2748 | 2748 | // setup our opt-in settings serialized array |
| 2749 | 2749 | $optin_settings = array( |
| 2750 | - 'optin' => $_POST['single-double-optin'], |
|
| 2751 | - 'update_existing_user' => $_POST['update-existing-user'], |
|
| 2752 | - 'send_update_email' => $_POST['update-existing-email'], |
|
| 2750 | + 'optin' => $_POST[ 'single-double-optin' ], |
|
| 2751 | + 'update_existing_user' => $_POST[ 'update-existing-user' ], |
|
| 2752 | + 'send_update_email' => $_POST[ 'update-existing-email' ], |
|
| 2753 | 2753 | ); |
| 2754 | 2754 | |
| 2755 | 2755 | // Setup our error settings serialized array |
| 2756 | 2756 | $error_settings = array( |
| 2757 | - 'success' => trim( $_POST['yikes-easy-mc-success-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-success-message'] ) ) : '', |
|
| 2758 | - 'success-single-optin' => trim( $_POST['yikes-easy-mc-success-single-optin-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-success-single-optin-message'] ) ) : '', |
|
| 2759 | - 'success-resubscribed' => trim( $_POST['yikes-easy-mc-user-resubscribed-success-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-resubscribed-success-message'] ) ) : '', |
|
| 2760 | - 'general-error' => trim( $_POST['yikes-easy-mc-general-error-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-general-error-message'] ) ) : '', |
|
| 2761 | - 'already-subscribed' => trim( $_POST['yikes-easy-mc-user-subscribed-message'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-subscribed-message'] ) ) : '', |
|
| 2762 | - 'update-link' => trim( $_POST['yikes-easy-mc-user-update-link'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-update-link'] ) ) : '', |
|
| 2763 | - 'email-subject' => trim( $_POST['yikes-easy-mc-user-email-subject'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-email-subject'] ) ) : '', |
|
| 2764 | - 'email-body' => trim( $_POST['yikes-easy-mc-user-email-body'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-user-email-body'] ) ) : '', |
|
| 2765 | - 'update-email-success' => trim( $_POST['yikes-easy-mc-update-email-successful'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-update-email-successful'] ) ) : '', |
|
| 2766 | - 'update-email-failure' => trim( $_POST['yikes-easy-mc-update-email-failure'] ) ? trim( stripslashes( $_POST['yikes-easy-mc-update-email-failure'] ) ) : '', |
|
| 2757 | + 'success' => trim( $_POST[ 'yikes-easy-mc-success-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-success-message' ] ) ) : '', |
|
| 2758 | + 'success-single-optin' => trim( $_POST[ 'yikes-easy-mc-success-single-optin-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-success-single-optin-message' ] ) ) : '', |
|
| 2759 | + 'success-resubscribed' => trim( $_POST[ 'yikes-easy-mc-user-resubscribed-success-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-resubscribed-success-message' ] ) ) : '', |
|
| 2760 | + 'general-error' => trim( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-general-error-message' ] ) ) : '', |
|
| 2761 | + 'already-subscribed' => trim( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-subscribed-message' ] ) ) : '', |
|
| 2762 | + 'update-link' => trim( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-update-link' ] ) ) : '', |
|
| 2763 | + 'email-subject' => trim( $_POST[ 'yikes-easy-mc-user-email-subject' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-email-subject' ] ) ) : '', |
|
| 2764 | + 'email-body' => trim( $_POST[ 'yikes-easy-mc-user-email-body' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-user-email-body' ] ) ) : '', |
|
| 2765 | + 'update-email-success' => trim( $_POST[ 'yikes-easy-mc-update-email-successful' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-update-email-successful' ] ) ) : '', |
|
| 2766 | + 'update-email-failure' => trim( $_POST[ 'yikes-easy-mc-update-email-failure' ] ) ? trim( stripslashes( $_POST[ 'yikes-easy-mc-update-email-failure' ] ) ) : '', |
|
| 2767 | 2767 | ); |
| 2768 | 2768 | |
| 2769 | 2769 | // Setup the new form settings array |
| 2770 | 2770 | // @since 6.0.3.8 |
| 2771 | 2771 | // To Do: Combine date & time so it's a single unix timestamp |
| 2772 | 2772 | $form_settings = array( |
| 2773 | - 'yikes-easy-mc-form-class-names' => trim( $_POST['yikes-easy-mc-form-class-names'] ), |
|
| 2774 | - 'yikes-easy-mc-inline-form' => $_POST['yikes-easy-mc-inline-form'][0], |
|
| 2775 | - 'yikes-easy-mc-submit-button-type' => $_POST['yikes-easy-mc-submit-button-type'][0], |
|
| 2776 | - 'yikes-easy-mc-submit-button-text' => trim( $_POST['yikes-easy-mc-submit-button-text'] ), |
|
| 2777 | - 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST['yikes-easy-mc-submit-button-image'] ) ), |
|
| 2778 | - 'yikes-easy-mc-submit-button-classes' => trim( $_POST['yikes-easy-mc-submit-button-classes'] ), |
|
| 2779 | - 'yikes-easy-mc-form-schedule' => ( isset( $_POST['yikes-easy-mc-form-schedule'] ) ) ? '1' : '0', |
|
| 2780 | - 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST['yikes-easy-mc-form-restriction-start-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-start-time'] ), |
|
| 2781 | - 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST['yikes-easy-mc-form-restriction-end-date'] . ' ' . $_POST['yikes-easy-mc-form-restriction-end-time'] ), |
|
| 2782 | - 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST['yikes-easy-mc-form-restriction-pending-message'] ), |
|
| 2783 | - 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST['yikes-easy-mc-form-restriction-expired-message'] ), |
|
| 2784 | - 'yikes-easy-mc-form-login-required' => ( isset( $_POST['yikes-easy-mc-form-login-required'] ) ) ? '1' : '0', |
|
| 2785 | - 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST['yikes-easy-mc-form-restriction-login-message'] ), |
|
| 2773 | + 'yikes-easy-mc-form-class-names' => trim( $_POST[ 'yikes-easy-mc-form-class-names' ] ), |
|
| 2774 | + 'yikes-easy-mc-inline-form' => $_POST[ 'yikes-easy-mc-inline-form' ][ 0 ], |
|
| 2775 | + 'yikes-easy-mc-submit-button-type' => $_POST[ 'yikes-easy-mc-submit-button-type' ][ 0 ], |
|
| 2776 | + 'yikes-easy-mc-submit-button-text' => trim( $_POST[ 'yikes-easy-mc-submit-button-text' ] ), |
|
| 2777 | + 'yikes-easy-mc-submit-button-image' => esc_url( trim( $_POST[ 'yikes-easy-mc-submit-button-image' ] ) ), |
|
| 2778 | + 'yikes-easy-mc-submit-button-classes' => trim( $_POST[ 'yikes-easy-mc-submit-button-classes' ] ), |
|
| 2779 | + 'yikes-easy-mc-form-schedule' => ( isset( $_POST[ 'yikes-easy-mc-form-schedule' ] ) ) ? '1' : '0', |
|
| 2780 | + 'yikes-easy-mc-form-restriction-start' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-start-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-start-time' ] ), |
|
| 2781 | + 'yikes-easy-mc-form-restriction-end' => strtotime( $_POST[ 'yikes-easy-mc-form-restriction-end-date' ] . ' ' . $_POST[ 'yikes-easy-mc-form-restriction-end-time' ] ), |
|
| 2782 | + 'yikes-easy-mc-form-restriction-pending-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-pending-message' ] ), |
|
| 2783 | + 'yikes-easy-mc-form-restriction-expired-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-expired-message' ] ), |
|
| 2784 | + 'yikes-easy-mc-form-login-required' => ( isset( $_POST[ 'yikes-easy-mc-form-login-required' ] ) ) ? '1' : '0', |
|
| 2785 | + 'yikes-easy-mc-form-restriction-login-message' => trim( $_POST[ 'yikes-easy-mc-form-restriction-login-message' ] ), |
|
| 2786 | 2786 | ); |
| 2787 | 2787 | |
| 2788 | 2788 | // additional custom fields (extensions / user defined fields) |
| 2789 | 2789 | $custom_fields = array(); |
| 2790 | - if ( isset( $_POST['custom-field'] ) ) {
|
|
| 2791 | - foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) {
|
|
| 2790 | + if ( isset( $_POST[ 'custom-field' ] ) ) {
|
|
| 2791 | + foreach ( $_POST[ 'custom-field' ] as $custom_field => $custom_value ) {
|
|
| 2792 | 2792 | if ( is_array( $custom_value ) ) {
|
| 2793 | 2793 | $custom_fields[ $custom_field ] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!) |
| 2794 | 2794 | } else {
|
@@ -2820,7 +2820,7 @@ discard block |
||
| 2820 | 2820 | $this->form_interface->update_form( $form_id, $form_updates ); |
| 2821 | 2821 | |
| 2822 | 2822 | /* Custom action hook which allows users to update specific options when a form is updated - used in add ons */ |
| 2823 | - do_action( 'yikes-mailchimp-save-form', $form_id, $custom_fields ); |
|
| 2823 | + do_action( 'yikes-mailchimp-save-form', $form_id, $custom_fields ); |
|
| 2824 | 2824 | |
| 2825 | 2825 | // redirect the user to the manage forms page, display confirmation |
| 2826 | 2826 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form_id . '&updated-form=true' ) ) ); |
@@ -2831,11 +2831,11 @@ discard block |
||
| 2831 | 2831 | $email_body = '<p>' . __( 'Greetings,', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
| 2832 | 2832 | |
| 2833 | 2833 | $email_body .= '<p>'; |
| 2834 | - $email_body .= __( 'A request has been made to update your MailChimp account profile information.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2835 | - $email_body .= __( ' To do so please use the following link: ', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2836 | - $email_body .= '[link]'; |
|
| 2837 | - $email_body .= __( 'Update MailChimp Profile Info', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2838 | - $email_body .= '[/link]'; |
|
| 2834 | + $email_body .= __( 'A request has been made to update your MailChimp account profile information.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2835 | + $email_body .= __( ' To do so please use the following link: ', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2836 | + $email_body .= '[link]'; |
|
| 2837 | + $email_body .= __( 'Update MailChimp Profile Info', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 2838 | + $email_body .= '[/link]'; |
|
| 2839 | 2839 | $email_body .= '</p>'; |
| 2840 | 2840 | |
| 2841 | 2841 | $email_body .= '<p>' . __( 'If you did not request this update, please disregard this email.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
@@ -2851,13 +2851,13 @@ discard block |
||
| 2851 | 2851 | |
| 2852 | 2852 | /* Unsubscribe a given user from our list */ |
| 2853 | 2853 | public function yikes_easy_mailchimp_unsubscribe_user() {
|
| 2854 | - $nonce = $_REQUEST['nonce']; |
|
| 2855 | - $list_id = $_REQUEST['mailchimp-list']; |
|
| 2856 | - $email_id = $_REQUEST['email_id']; |
|
| 2854 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2855 | + $list_id = $_REQUEST[ 'mailchimp-list' ]; |
|
| 2856 | + $email_id = $_REQUEST[ 'email_id' ]; |
|
| 2857 | 2857 | |
| 2858 | 2858 | // verify our nonce |
| 2859 | 2859 | if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) {
|
| 2860 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2860 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2861 | 2861 | } |
| 2862 | 2862 | |
| 2863 | 2863 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_unsubscribe( $list_id, $email_id ); |
@@ -2876,21 +2876,21 @@ discard block |
||
| 2876 | 2876 | |
| 2877 | 2877 | public function yikes_easy_mailchimp_create_missing_error_log() {
|
| 2878 | 2878 | // grab our nonnce |
| 2879 | - $nonce = $_REQUEST['nonce']; |
|
| 2879 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2880 | 2880 | // validate nonce |
| 2881 | - if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) {
|
|
| 2882 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2881 | + if ( ! wp_verify_nonce( $nonce, 'create_error_log' ) ) {
|
|
| 2882 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2883 | 2883 | } |
| 2884 | 2884 | // setup the path to the error log |
| 2885 | 2885 | $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' ); |
| 2886 | 2886 | try {
|
| 2887 | 2887 | // create the file |
| 2888 | - fwrite( $error_log , '' ); |
|
| 2888 | + fwrite( $error_log, '' ); |
|
| 2889 | 2889 | // close out |
| 2890 | 2890 | fclose( $error_log ); |
| 2891 | 2891 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=true' ) ) ); |
| 2892 | 2892 | } catch ( Exception $e ) {
|
| 2893 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message='.urlencode( $e->getMessage() ) ) ) ); |
|
| 2893 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message=' . urlencode( $e->getMessage() ) ) ) ); |
|
| 2894 | 2894 | } |
| 2895 | 2895 | } |
| 2896 | 2896 | |
@@ -2901,9 +2901,9 @@ discard block |
||
| 2901 | 2901 | public function yikes_easy_mailchimp_clear_transient_data() {
|
| 2902 | 2902 | |
| 2903 | 2903 | // verify our nonce |
| 2904 | - $nonce = $_REQUEST['nonce']; |
|
| 2904 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 2905 | 2905 | if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) {
|
| 2906 | - wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
|
| 2906 | + wp_die( __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), array( 'response' => 500, 'back_link' => true ) ); |
|
| 2907 | 2907 | } |
| 2908 | 2908 | |
| 2909 | 2909 | $this->delete_yikes_mailchimp_transients(); |
@@ -2912,10 +2912,10 @@ discard block |
||
| 2912 | 2912 | $referer = wp_get_referer(); |
| 2913 | 2913 | if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) {
|
| 2914 | 2914 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings&transient-cleared=true' ) ) ); |
| 2915 | - } elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) {
|
|
| 2915 | + } elseif ( isset( $_REQUEST[ 'page' ] ) && $_REQUEST[ 'page' ] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST[ 'id' ] ) && ! empty( $_REQUEST[ 'id' ] ) ) {
|
|
| 2916 | 2916 | |
| 2917 | 2917 | // else check if we were editing a form. |
| 2918 | - $id = filter_var( $_REQUEST['id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 2918 | + $id = filter_var( $_REQUEST[ 'id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 2919 | 2919 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $id ) ) ); |
| 2920 | 2920 | } else {
|
| 2921 | 2921 | // else redirect to the manage forms page. |
@@ -2959,7 +2959,7 @@ discard block |
||
| 2959 | 2959 | */ |
| 2960 | 2960 | public function yikes_mailchimp_load_helper_class() {
|
| 2961 | 2961 | // check to see if it's already loaded up. |
| 2962 | - if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
|
|
| 2962 | + if ( ! class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
|
|
| 2963 | 2963 | // Include our main helper class file |
| 2964 | 2964 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/init.php' ); |
| 2965 | 2965 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @subpackage Yikes_Inc_Easy_Mailchimp_Forms/admin |
| 10 | 10 | * @author YIKES, Inc. <[email protected]> |
| 11 | 11 | */ |
| 12 | -class Yikes_Inc_Easy_Mailchimp_Forms_Admin {
|
|
| 12 | +class Yikes_Inc_Easy_Mailchimp_Forms_Admin { |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * The ID of this plugin. |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $yikes_inc_easy_mailchimp_extender, |
| 50 | 50 | $version, |
| 51 | 51 | Yikes_Inc_Easy_MailChimp_Extender_Form_Interface $form_interface |
| 52 | - ) {
|
|
| 52 | + ) { |
|
| 53 | 53 | $this->yikes_inc_easy_mailchimp_extender = $yikes_inc_easy_mailchimp_extender; |
| 54 | 54 | $this->version = $version; |
| 55 | 55 | $this->form_interface = $form_interface; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @author Jeremy Pry |
| 62 | 62 | */ |
| 63 | - public function hooks() {
|
|
| 63 | + public function hooks() { |
|
| 64 | 64 | |
| 65 | 65 | // check for old plugin options and migrate if exist. |
| 66 | 66 | add_action( 'admin_menu', array( $this, 'register_admin_pages' ), 11 ); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /***********************/ |
| 102 | 102 | /** Create A Form **/ |
| 103 | 103 | /**********************/ |
| 104 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-form' ) {
|
|
| 104 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-form' ) { |
|
| 105 | 105 | |
| 106 | 106 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_form' ) ); |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | /***********************/ |
| 111 | 111 | /** Delete A Form **/ |
| 112 | 112 | /**********************/ |
| 113 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-delete-form' ) {
|
|
| 113 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-delete-form' ) { |
|
| 114 | 114 | |
| 115 | 115 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_delete_form' ) ); |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /**********************************/ |
| 120 | 120 | /** Duplicate/Clone A Form **/ |
| 121 | 121 | /********************************/ |
| 122 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-duplicate-form' ) {
|
|
| 122 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-duplicate-form' ) { |
|
| 123 | 123 | |
| 124 | 124 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_duplicate_form' ) ); |
| 125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | /*************************************/ |
| 129 | 129 | /** Reset Form Impression Stats **/ |
| 130 | 130 | /***********************************/ |
| 131 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-reset-stats' ) {
|
|
| 131 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-reset-stats' ) { |
|
| 132 | 132 | |
| 133 | 133 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_reset_impression_stats' ) ); |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | /**********************************/ |
| 138 | 138 | /** Update A Form **/ |
| 139 | 139 | /********************************/ |
| 140 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-update-form' ) {
|
|
| 140 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-update-form' ) { |
|
| 141 | 141 | |
| 142 | 142 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_update_form' ) ); |
| 143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | /**************************************************/ |
| 147 | 147 | /** Clear Store MailChimp Transient Data **/ |
| 148 | 148 | /*************************************************/ |
| 149 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-transient-data' ) {
|
|
| 149 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-transient-data' ) { |
|
| 150 | 150 | |
| 151 | 151 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_transient_data' ) ); |
| 152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | /*******************************************/ |
| 156 | 156 | /** Remove a user from a mailing list **/ |
| 157 | 157 | /*****************************************/ |
| 158 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-unsubscribe-user' ) {
|
|
| 158 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-unsubscribe-user' ) { |
|
| 159 | 159 | |
| 160 | 160 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_unsubscribe_user' ) ); |
| 161 | 161 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | /*******************************************/ |
| 165 | 165 | /** Create misisng error log file **/ |
| 166 | 166 | /*****************************************/ |
| 167 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-error-log' ) {
|
|
| 167 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-create-error-log' ) { |
|
| 168 | 168 | |
| 169 | 169 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_create_missing_error_log' ) ); |
| 170 | 170 | |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | add_action( 'admin_head', array( $this, 'add_tinyMCE_buttons' ) ); |
| 177 | 177 | |
| 178 | 178 | // pass our lists data to tinyMCE button for use. |
| 179 | - foreach ( array( 'post.php', 'post-new.php' ) as $hook ) {
|
|
| 179 | + foreach ( array( 'post.php', 'post-new.php' ) as $hook ) { |
|
| 180 | 180 | |
| 181 | 181 | add_action( 'admin_enqueue_scripts', array( $this, 'tinymce_yikes_easy_mc' ) ); |
| 182 | 182 | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // display an admin notice for users on PHP < 5.3. |
| 186 | - if ( phpversion() < '5.3' ) {
|
|
| 186 | + if ( phpversion() < '5.3' ) { |
|
| 187 | 187 | add_action( "admin_notices", array( $this, 'display_php_warning' ), 999 ); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | /**************************************************/ |
| 197 | 197 | /** Clear MailChimp Error Log Data **/ |
| 198 | 198 | /*************************************************/ |
| 199 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-error-log' ) {
|
|
| 199 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-clear-error-log' ) { |
|
| 200 | 200 | |
| 201 | 201 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_clear_error_log' ) ); |
| 202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /*********************************************/ |
| 206 | 206 | /** Export MailChimp Opt-in Forms **/ |
| 207 | 207 | /*******************************************/ |
| 208 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-forms' ) {
|
|
| 208 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-forms' ) { |
|
| 209 | 209 | |
| 210 | 210 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_forms' ) ); |
| 211 | 211 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | /*********************************************/ |
| 215 | 215 | /** Export Plugin Settings **/ |
| 216 | 216 | /*******************************************/ |
| 217 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-settings' ) {
|
|
| 217 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-export-settings' ) { |
|
| 218 | 218 | |
| 219 | 219 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_export_plugin_settings' ) ); |
| 220 | 220 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | /*******************************************/ |
| 224 | 224 | /** Import Class Inclusion **/ |
| 225 | 225 | /*****************************************/ |
| 226 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) {
|
|
| 226 | + if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) { |
|
| 227 | 227 | |
| 228 | 228 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_import_forms' ) ); |
| 229 | 229 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /*******************************************/ |
| 233 | 233 | /** Premium Support Request **/ |
| 234 | 234 | /*****************************************/ |
| 235 | - if ( isset( $_POST['submit-premium-support-request'] ) ) {
|
|
| 235 | + if ( isset( $_POST['submit-premium-support-request'] ) ) { |
|
| 236 | 236 | |
| 237 | 237 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_premium_support_request' ) ); |
| 238 | 238 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /****************************************/ |
| 242 | 242 | /** Dismiss Options Migrations **/ |
| 243 | 243 | /****************************************/ |
| 244 | - if ( isset( $_REQUEST['dismiss_migration_nonce'] ) ) {
|
|
| 244 | + if ( isset( $_REQUEST['dismiss_migration_nonce'] ) ) { |
|
| 245 | 245 | |
| 246 | 246 | add_action( 'init', array( $this, 'yikes_easy_mailchimp_dismiss_option_migrate' ) ); |
| 247 | 247 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @ param array $links Pre-existing plugin action links |
| 277 | 277 | * @ return array $links New array of plugin actions |
| 278 | 278 | */ |
| 279 | - public function easy_forms_plugin_action_links( $links ) {
|
|
| 279 | + public function easy_forms_plugin_action_links( $links ) { |
|
| 280 | 280 | $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=yikes-inc-easy-mailchimp-settings') ) .'">' . __( 'Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
| 281 | 281 | $links[] = '<a href="' . esc_url( 'http://www.yikesplugins.com?utm_source=plugins-page&utm_medium=plugin-row&utm_campaign=admin' ) . '" target="_blank">' . __( 'More plugins by YIKES, Inc.', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
| 282 | 282 | return $links; |
@@ -292,13 +292,13 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @return string |
| 294 | 294 | */ |
| 295 | - public function yikes_easy_forms_admin_disclaimer( $footer_text ) {
|
|
| 295 | + public function yikes_easy_forms_admin_disclaimer( $footer_text ) { |
|
| 296 | 296 | $page = get_current_screen(); |
| 297 | 297 | $base = $page->base; |
| 298 | - if ( strpos( $base, 'yikes-inc-easy-mailchimp' ) !== false || strpos( $base, 'yikes-mailchimp' ) !== false ) {
|
|
| 298 | + if ( strpos( $base, 'yikes-inc-easy-mailchimp' ) !== false || strpos( $base, 'yikes-mailchimp' ) !== false ) { |
|
| 299 | 299 | $disclaimer_text = sprintf( '<em>' . __( 'Disclaimer: <strong>Easy Forms for MailChimp</strong> is in no way endorsed, affiliated or backed by MailChimp, or its parent company Rocket Science Group.', 'yikes-inc-easy-mailchimp-extender' ), '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . __( 'Thanks :)', 'yikes-inc-easy-mailchimp-extender' ) . '">', '</a></em>' ); |
| 300 | 300 | return $disclaimer_text; |
| 301 | - } else {
|
|
| 301 | + } else { |
|
| 302 | 302 | return $footer_text; |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -310,32 +310,32 @@ discard block |
||
| 310 | 310 | * @since 6.0.0 |
| 311 | 311 | * @return parsed tag content |
| 312 | 312 | */ |
| 313 | - public function parse_mailchimp_default_tag( $default_tag ) {
|
|
| 314 | - if ( ! $default_tag || $default_tag == '' ) {
|
|
| 313 | + public function parse_mailchimp_default_tag( $default_tag ) { |
|
| 314 | + if ( ! $default_tag || $default_tag == '' ) { |
|
| 315 | 315 | return $default_tag; |
| 316 | 316 | } |
| 317 | 317 | global $post; |
| 318 | 318 | // page title. |
| 319 | - if ( $default_tag == '{page_title}' ) {
|
|
| 319 | + if ( $default_tag == '{page_title}' ) { |
|
| 320 | 320 | $default_tag = get_the_title( $post->ID ); |
| 321 | 321 | } |
| 322 | 322 | // page id. |
| 323 | - if ( $default_tag == '{page_id}' ) {
|
|
| 323 | + if ( $default_tag == '{page_id}' ) { |
|
| 324 | 324 | $default_tag = $post->ID; |
| 325 | 325 | } |
| 326 | 326 | // page url. |
| 327 | - if ( $default_tag == '{page_url}' ) {
|
|
| 327 | + if ( $default_tag == '{page_url}' ) { |
|
| 328 | 328 | $default_tag = get_permalink( $post->ID ); |
| 329 | 329 | } |
| 330 | 330 | // blog name. |
| 331 | - if ( $default_tag == '{blog_name}' ) {
|
|
| 331 | + if ( $default_tag == '{blog_name}' ) { |
|
| 332 | 332 | $default_tag = get_bloginfo( 'name' ); |
| 333 | 333 | } |
| 334 | 334 | // is user logged in. |
| 335 | - if ( $default_tag == '{user_logged_in}' ) {
|
|
| 336 | - if ( is_user_logged_in() ) {
|
|
| 335 | + if ( $default_tag == '{user_logged_in}' ) { |
|
| 336 | + if ( is_user_logged_in() ) { |
|
| 337 | 337 | $default_tag = 'Registered User'; |
| 338 | - } else {
|
|
| 338 | + } else { |
|
| 339 | 339 | $default_tag = 'Guest User'; |
| 340 | 340 | } |
| 341 | 341 | } |
@@ -349,21 +349,21 @@ discard block |
||
| 349 | 349 | * When a user clicks 'Clear Log' on the debug settings page, this funciton |
| 350 | 350 | * is used to clear the data out of our php file. |
| 351 | 351 | */ |
| 352 | - public function yikes_easy_mailchimp_clear_error_log() {
|
|
| 352 | + public function yikes_easy_mailchimp_clear_error_log() { |
|
| 353 | 353 | |
| 354 | 354 | // Get our error log class. |
| 355 | 355 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 356 | 356 | |
| 357 | 357 | // file put contents $returned error + other data. |
| 358 | - if ( file_exists( $error_logging->error_log_file_path ) ) {
|
|
| 358 | + if ( file_exists( $error_logging->error_log_file_path ) ) { |
|
| 359 | 359 | |
| 360 | 360 | $clear_log = file_put_contents( $error_logging->error_log_file_path, '' ); |
| 361 | 361 | |
| 362 | - if ( $clear_log === false ) {
|
|
| 362 | + if ( $clear_log === false ) { |
|
| 363 | 363 | |
| 364 | 364 | // redirect the user to the manage forms page, display error message. |
| 365 | 365 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error-log-cleared=false' ) ) ); |
| 366 | - } else {
|
|
| 366 | + } else { |
|
| 367 | 367 | |
| 368 | 368 | // redirect the user to the manage forms page, display confirmation. |
| 369 | 369 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error-log-cleared=true' ) ) ); |
@@ -377,13 +377,13 @@ discard block |
||
| 377 | 377 | * @since 6.0.0 |
| 378 | 378 | * @return CSV export file |
| 379 | 379 | */ |
| 380 | - public function yikes_easy_mailchimp_export_forms() {
|
|
| 380 | + public function yikes_easy_mailchimp_export_forms() { |
|
| 381 | 381 | // grab our nonce. |
| 382 | 382 | $nonce = $_REQUEST['nonce']; |
| 383 | 383 | // grab the forms. |
| 384 | 384 | $forms = isset( $_REQUEST['yikes_export_forms'] ) ? $_REQUEST['yikes_export_forms'] : array(); |
| 385 | 385 | // validate nonce. |
| 386 | - if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) {
|
|
| 386 | + if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) { |
|
| 387 | 387 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | * @since 6.0.0 |
| 402 | 402 | * @return CSV export file |
| 403 | 403 | */ |
| 404 | - public function yikes_easy_mailchimp_export_plugin_settings() {
|
|
| 404 | + public function yikes_easy_mailchimp_export_plugin_settings() { |
|
| 405 | 405 | // grab our nonce |
| 406 | 406 | $nonce = $_REQUEST['nonce']; |
| 407 | 407 | // validate nonce. |
| 408 | - if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) {
|
|
| 408 | + if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) { |
|
| 409 | 409 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 410 | 410 | } |
| 411 | 411 | |
@@ -421,15 +421,15 @@ discard block |
||
| 421 | 421 | * Custom import function to import all or specific forms |
| 422 | 422 | * @since 6.0.0 |
| 423 | 423 | */ |
| 424 | - public function yikes_easy_mailchimp_import_forms() {
|
|
| 424 | + public function yikes_easy_mailchimp_import_forms() { |
|
| 425 | 425 | // grab our nonce. |
| 426 | 426 | $nonce = $_REQUEST['nonce']; |
| 427 | 427 | // validate nonce. |
| 428 | - if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) {
|
|
| 428 | + if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) { |
|
| 429 | 429 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 430 | 430 | } |
| 431 | 431 | // include the export class. |
| 432 | - if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) {
|
|
| 432 | + if ( ! class_exists( 'Yikes_Inc_Easy_MailChimp_Import_Class' ) ) { |
|
| 433 | 433 | include_once( YIKES_MC_PATH . 'includes/import-export/yikes-easy-mailchimp-import.class.php' ); |
| 434 | 434 | } |
| 435 | 435 | // run the import function. |
@@ -445,9 +445,9 @@ discard block |
||
| 445 | 445 | * Premium Support Request |
| 446 | 446 | * @since 6.0.0 |
| 447 | 447 | */ |
| 448 | - public function yikes_easy_mailchimp_premium_support_request() {
|
|
| 448 | + public function yikes_easy_mailchimp_premium_support_request() { |
|
| 449 | 449 | |
| 450 | - if ( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) {
|
|
| 450 | + if ( isset( $_POST['action'] ) && $_POST['action'] != 'yikes-support-request' ) { |
|
| 451 | 451 | return __( 'We encountered an error. Please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); |
| 452 | 452 | } |
| 453 | 453 | |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | ) ); |
| 484 | 484 | |
| 485 | 485 | // Catch the error. |
| 486 | - if ( is_wp_error( $response ) ) {
|
|
| 486 | + if ( is_wp_error( $response ) ) { |
|
| 487 | 487 | wp_send_json_error( $response->getMessage() ); |
| 488 | 488 | } |
| 489 | 489 | |
@@ -491,9 +491,9 @@ discard block |
||
| 491 | 491 | $response_body = json_decode( wp_remote_retrieve_body( $response ) ); |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - public function get_premium_license( $plugin_slug ) {
|
|
| 494 | + public function get_premium_license( $plugin_slug ) { |
|
| 495 | 495 | |
| 496 | - switch( $plugin_slug ) {
|
|
| 496 | + switch( $plugin_slug ) { |
|
| 497 | 497 | |
| 498 | 498 | case 'form-customizer': |
| 499 | 499 | return defined( 'YIKES_CUSTOMIZER_EDD_ITEM_ID' ) ? YIKES_CUSTOMIZER_EDD_ITEM_ID : ''; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | * |
| 515 | 515 | * @since 6.0.0 |
| 516 | 516 | **/ |
| 517 | - public function yikes_easy_mailchimp_dismiss_option_migrate() {
|
|
| 517 | + public function yikes_easy_mailchimp_dismiss_option_migrate() { |
|
| 518 | 518 | // delete the options and allow the user to manually update things. |
| 519 | 519 | |
| 520 | 520 | // Verify the NONCE is valid. |
@@ -532,8 +532,8 @@ discard block |
||
| 532 | 532 | * |
| 533 | 533 | * @since 6.0.0 |
| 534 | 534 | */ |
| 535 | - public function load_error_logging_class() {
|
|
| 536 | - if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
|
|
| 535 | + public function load_error_logging_class() { |
|
| 536 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 537 | 537 | // if error logging is enabled we should include our error logging class |
| 538 | 538 | /* Generate oure error logging table */ |
| 539 | 539 | require_once YIKES_MC_PATH . '/includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
@@ -548,21 +548,21 @@ discard block |
||
| 548 | 548 | * |
| 549 | 549 | * @since v6.0.0 |
| 550 | 550 | */ |
| 551 | - public function yikes_easy_mailchimp_check_installation_date() {
|
|
| 551 | + public function yikes_easy_mailchimp_check_installation_date() { |
|
| 552 | 552 | |
| 553 | 553 | // add a new option to store the plugin activation date/time. |
| 554 | 554 | // @since v6.0.0. |
| 555 | 555 | // this is used to notify the user that they should review after 2 weeks. |
| 556 | - if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) {
|
|
| 556 | + if ( !get_option( 'yikes_easy_mailchimp_activation_date' ) ) { |
|
| 557 | 557 | add_option( 'yikes_easy_mailchimp_activation_date', strtotime( "now" ) ); |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | $stop_bugging_me = get_option( 'yikes_easy_mailchimp_review_stop_bugging_me' ); |
| 561 | 561 | |
| 562 | - if ( ! $stop_bugging_me ) {
|
|
| 562 | + if ( ! $stop_bugging_me ) { |
|
| 563 | 563 | $install_date = get_option( 'yikes_easy_mailchimp_activation_date' ); |
| 564 | 564 | $past_date = strtotime( '-14 days' ); |
| 565 | - if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) {
|
|
| 565 | + if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) { |
|
| 566 | 566 | add_action( 'admin_notices', array( $this , 'yikes_easy_mailchimp_display_review_us_notice' ) ); |
| 567 | 567 | } |
| 568 | 568 | } |
@@ -574,9 +574,9 @@ discard block |
||
| 574 | 574 | asking for a review, and for user feedback |
| 575 | 575 | @since v6.0.0 |
| 576 | 576 | */ |
| 577 | - public function yikes_easy_mailchimp_display_review_us_notice() {
|
|
| 577 | + public function yikes_easy_mailchimp_display_review_us_notice() { |
|
| 578 | 578 | /* Lets only display our admin notice on YT4WP pages to not annoy the hell out of people :) */ |
| 579 | - if ( in_array( get_current_screen()->base , array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) {
|
|
| 579 | + if ( in_array( get_current_screen()->base , array( 'dashboard', 'post', 'edit' ) ) || strpos( get_current_screen()->base ,'yikes-inc-easy-mailchimp') !== false ) { |
|
| 580 | 580 | |
| 581 | 581 | // The URL of the page the user is currently on |
| 582 | 582 | $current_uri = isset( $_SERVER['REQUEST_URI'] ) && ! empty( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : false; |
@@ -619,8 +619,8 @@ discard block |
||
| 619 | 619 | Remove the Review us notification when user clicks 'Dismiss' |
| 620 | 620 | @since v3.1.1 |
| 621 | 621 | */ |
| 622 | - public function yikes_easy_mailchimp_stop_bugging_me() {
|
|
| 623 | - if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) && (int) filter_var( $_GET['yikes_easy_mc_icons_nobug'], FILTER_SANITIZE_NUMBER_INT ) === 1 ) {
|
|
| 622 | + public function yikes_easy_mailchimp_stop_bugging_me() { |
|
| 623 | + if ( isset( $_GET['yikes_easy_mc_icons_nobug'] ) && (int) filter_var( $_GET['yikes_easy_mc_icons_nobug'], FILTER_SANITIZE_NUMBER_INT ) === 1 ) { |
|
| 624 | 624 | add_option( 'yikes_easy_mailchimp_review_stop_bugging_me', true ); |
| 625 | 625 | } |
| 626 | 626 | } |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | /* End Two Week Notification */ |
| 629 | 629 | |
| 630 | 630 | /* Display a warning users who are using PHP < 5.3 */ |
| 631 | - public function display_php_warning() {
|
|
| 631 | + public function display_php_warning() { |
|
| 632 | 632 | $message = __( 'Easy Forms for MailChimp requires a minimum of PHP 5.3. The plugin will not function properly until you update. Please reach out to your host provider for assistance.', 'yikes-inc-easy-mailchimp-extender' ); |
| 633 | 633 | echo "<div class='error'> <p><span class='dashicons dashicons-no-alt' style='color:rgb(231, 98, 98)'></span> $message</p></div>"; |
| 634 | 634 | } |
@@ -638,10 +638,10 @@ discard block |
||
| 638 | 638 | * TinyMCE Functions |
| 639 | 639 | */ |
| 640 | 640 | // load our button and pass in the JS form data variable. |
| 641 | - public function add_tinyMCE_buttons() {
|
|
| 641 | + public function add_tinyMCE_buttons() { |
|
| 642 | 642 | global $typenow; |
| 643 | 643 | // only on Post Type: post and page. |
| 644 | - if ( ! in_array( $typenow, array( 'post', 'page' ) ) ) {
|
|
| 644 | + if ( ! in_array( $typenow, array( 'post', 'page' ) ) ) { |
|
| 645 | 645 | return; |
| 646 | 646 | } |
| 647 | 647 | add_filter( 'mce_buttons', array( $this, 'yks_mc_add_tinymce_button' ) ); |
@@ -649,14 +649,14 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | // Add the button key for address via JS. |
| 652 | - public function yks_mc_add_tinymce_button( $buttons ) {
|
|
| 652 | + public function yks_mc_add_tinymce_button( $buttons ) { |
|
| 653 | 653 | array_push( $buttons, 'yks_mc_tinymce_button_key' ); |
| 654 | 654 | // Print all buttons. |
| 655 | 655 | return $buttons; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // inlcude the js for tinymce. |
| 659 | - public function yks_mc_add_tinymce_plugin( $plugin_array ) {
|
|
| 659 | + public function yks_mc_add_tinymce_plugin( $plugin_array ) { |
|
| 660 | 660 | |
| 661 | 661 | $plugin_array['yks_mc_tinymce_button'] = plugins_url( '/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js', __FILE__ ); |
| 662 | 662 | |
@@ -668,23 +668,23 @@ discard block |
||
| 668 | 668 | * Pass our imported list data, to the JS file |
| 669 | 669 | * to build the drop down list in the modal |
| 670 | 670 | */ |
| 671 | - public function tinymce_yikes_easy_mc() {
|
|
| 671 | + public function tinymce_yikes_easy_mc() { |
|
| 672 | 672 | // check capabilities. |
| 673 | - if ( ! current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
|
|
| 673 | + if ( ! current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 674 | 674 | return; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | $list_data = $this->form_interface->get_all_forms(); |
| 678 | 678 | $lists = array(); |
| 679 | - if ( ! empty( $list_data ) ) {
|
|
| 679 | + if ( ! empty( $list_data ) ) { |
|
| 680 | 680 | // build an array to pass to our javascript. |
| 681 | - foreach ( $list_data as $id => $form ) {
|
|
| 681 | + foreach ( $list_data as $id => $form ) { |
|
| 682 | 682 | $lists[] = array( |
| 683 | 683 | 'text' => urlencode( $form['form_name'] ), |
| 684 | 684 | 'value' => $id, |
| 685 | 685 | ); |
| 686 | 686 | } |
| 687 | - } else {
|
|
| 687 | + } else { |
|
| 688 | 688 | $lists[0] = array( |
| 689 | 689 | 'text' => __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ), |
| 690 | 690 | 'value' => '-', |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | /** |
| 710 | 710 | * Fix the MailChimp icon spacing in the admin menu. |
| 711 | 711 | */ |
| 712 | - public function fix_menu_icon_spacing() {
|
|
| 712 | + public function fix_menu_icon_spacing() { |
|
| 713 | 713 | ?> |
| 714 | 714 | <style> |
| 715 | 715 | a[href="admin.php?page=yikes-inc-easy-mailchimp"] .wp-menu-image img {
|
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | * |
| 725 | 725 | * @since 6.0.0 |
| 726 | 726 | */ |
| 727 | - public function enqueue_styles() {
|
|
| 727 | + public function enqueue_styles() { |
|
| 728 | 728 | /** |
| 729 | 729 | * Enqueue our global dashboard styles. |
| 730 | 730 | */ |
@@ -733,14 +733,14 @@ discard block |
||
| 733 | 733 | /* |
| 734 | 734 | * Enqueue Add-ons styles. |
| 735 | 735 | */ |
| 736 | - if ( get_current_screen()->base == 'easy-forms_page_yikes-inc-easy-mailchimp-addons' ) {
|
|
| 736 | + if ( get_current_screen()->base == 'easy-forms_page_yikes-inc-easy-mailchimp-addons' ) { |
|
| 737 | 737 | wp_enqueue_style( 'yikes-inc-easy-mailchimp-extender-addons-styles', plugin_dir_url( __FILE__ ) . 'css/yikes-inc-easy-mailchimp-extender-addons.min.css', array(), $this->version, 'all' ); |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | /* |
| 741 | 741 | * Enqueue Subscriber Profile Flags. |
| 742 | 742 | */ |
| 743 | - if ( get_current_screen()->base == 'admin_page_yikes-mailchimp-view-user' ) {
|
|
| 743 | + if ( get_current_screen()->base == 'admin_page_yikes-mailchimp-view-user' ) { |
|
| 744 | 744 | wp_enqueue_style( 'yikes-inc-easy-mailchimp-extender-subscriber-flags', plugin_dir_url( __FILE__ ) . 'css/flag-icon.min.css', array(), $this->version, 'all' ); |
| 745 | 745 | } |
| 746 | 746 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | * |
| 750 | 750 | * @since 6.0.0 |
| 751 | 751 | */ |
| 752 | - public function enqueue_scripts() {
|
|
| 752 | + public function enqueue_scripts() { |
|
| 753 | 753 | wp_enqueue_script( 'yikes-inc-easy-mailchimp-extender-admin-js', plugin_dir_url( __FILE__ ) . 'js/min/yikes-inc-easy-mailchimp-extender-admin.min.js', array( 'jquery', 'jquery-ui-sortable' ), $this->version, false ); |
| 754 | 754 | |
| 755 | 755 | $localized_data = array( |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | // Enqueue required scripts for the form editor |
| 766 | 766 | $screen = get_current_screen(); |
| 767 | - if ( ! isset( $screen->base ) || 'admin_page_yikes-mailchimp-edit-form' !== $screen->base ) {
|
|
| 767 | + if ( ! isset( $screen->base ) || 'admin_page_yikes-mailchimp-edit-form' !== $screen->base ) { |
|
| 768 | 768 | return; |
| 769 | 769 | } |
| 770 | 770 | |
@@ -812,12 +812,12 @@ discard block |
||
| 812 | 812 | /** |
| 813 | 813 | * Convert the php date format string to a js date format |
| 814 | 814 | */ |
| 815 | - public function yikes_jQuery_datepicker_date_format_php_to_js( $sFormat, $type ) {
|
|
| 816 | - switch ( $type ) {
|
|
| 815 | + public function yikes_jQuery_datepicker_date_format_php_to_js( $sFormat, $type ) { |
|
| 816 | + switch ( $type ) { |
|
| 817 | 817 | default: |
| 818 | 818 | case 'date': |
| 819 | 819 | // Standard Date Fields |
| 820 | - switch ( $sFormat ) {
|
|
| 820 | + switch ( $sFormat ) { |
|
| 821 | 821 | //Predefined WP date formats |
| 822 | 822 | case 'F j, Y': |
| 823 | 823 | case 'j F Y': |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | break; |
| 841 | 841 | // Birthday Fields |
| 842 | 842 | case 'birthday': |
| 843 | - switch ( $sFormat ) {
|
|
| 843 | + switch ( $sFormat ) { |
|
| 844 | 844 | //Predefined WP date formats |
| 845 | 845 | case 'F j, Y': |
| 846 | 846 | case 'j F Y': |
@@ -869,8 +869,8 @@ discard block |
||
| 869 | 869 | /** |
| 870 | 870 | * Convert the php date format string to a js date format |
| 871 | 871 | */ |
| 872 | - public function yikes_jQuery_datepicker_date_format( $site_option ) {
|
|
| 873 | - switch( $site_option ) {
|
|
| 872 | + public function yikes_jQuery_datepicker_date_format( $site_option ) { |
|
| 873 | + switch( $site_option ) { |
|
| 874 | 874 | //Predefined WP date formats |
| 875 | 875 | default: |
| 876 | 876 | case 'F j, Y': |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | * Register our admin pages |
| 891 | 891 | * used to display data back to the user |
| 892 | 892 | **/ |
| 893 | - public function register_admin_pages() {
|
|
| 893 | + public function register_admin_pages() { |
|
| 894 | 894 | |
| 895 | 895 | /* Top Level Menu 'Easy MailChimp' */ |
| 896 | 896 | add_menu_page( |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | * when they click 'Go Pro' in the admin menu |
| 1014 | 1014 | * to do: populate with sales URL |
| 1015 | 1015 | */ |
| 1016 | - public function generateAddOnsPage() {
|
|
| 1016 | + public function generateAddOnsPage() { |
|
| 1017 | 1017 | require_once YIKES_MC_PATH . 'admin/partials/menu/add-ons.php'; // include our add-ons page |
| 1018 | 1018 | } |
| 1019 | 1019 | |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | * |
| 1023 | 1023 | * @since 1.0.0 |
| 1024 | 1024 | */ |
| 1025 | - function generateManageFormsPage() {
|
|
| 1025 | + function generateManageFormsPage() { |
|
| 1026 | 1026 | require_once YIKES_MC_PATH . 'admin/partials/menu/manage-forms.php'; // include our manage forms page |
| 1027 | 1027 | } |
| 1028 | 1028 | |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | * |
| 1032 | 1032 | * @since 1.0.0 |
| 1033 | 1033 | */ |
| 1034 | - function generateManageListsPage() {
|
|
| 1034 | + function generateManageListsPage() { |
|
| 1035 | 1035 | require_once YIKES_MC_PATH . 'admin/partials/menu/manage-lists.php'; // include our lists page |
| 1036 | 1036 | } |
| 1037 | 1037 | |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | * |
| 1041 | 1041 | * @since 1.0.0 |
| 1042 | 1042 | */ |
| 1043 | - function generateSupportPage() {
|
|
| 1043 | + function generateSupportPage() { |
|
| 1044 | 1044 | |
| 1045 | 1045 | wp_enqueue_script( 'yikes-inc-easy-mailchimp-extender-support-scripts', plugin_dir_url( __FILE__ ) . 'js/support.js', array( 'jquery' ), $this->version, false ); |
| 1046 | 1046 | require_once YIKES_MC_PATH . 'admin/partials/menu/support.php'; |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | * |
| 1052 | 1052 | * @since 1.0.0 |
| 1053 | 1053 | */ |
| 1054 | - function generateEditFormPage() {
|
|
| 1054 | + function generateEditFormPage() { |
|
| 1055 | 1055 | require_once YIKES_MC_PATH . 'admin/partials/edit-form.php'; // include our options page |
| 1056 | 1056 | } |
| 1057 | 1057 | |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | * |
| 1061 | 1061 | * @since 1.0.0 |
| 1062 | 1062 | */ |
| 1063 | - function generateViewListPage() {
|
|
| 1063 | + function generateViewListPage() { |
|
| 1064 | 1064 | require_once YIKES_MC_PATH . 'admin/partials/view-list.php'; // include our options page |
| 1065 | 1065 | } |
| 1066 | 1066 | |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | * |
| 1070 | 1070 | * @since 1.0.0 |
| 1071 | 1071 | */ |
| 1072 | - function generateViewUserPage() {
|
|
| 1072 | + function generateViewUserPage() { |
|
| 1073 | 1073 | require_once YIKES_MC_PATH . 'admin/partials/view-user.php'; // include our options page |
| 1074 | 1074 | } |
| 1075 | 1075 | |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | * |
| 1079 | 1079 | * @since v.5.4 |
| 1080 | 1080 | **/ |
| 1081 | - function yikes_easy_mc_settings_init() {
|
|
| 1081 | + function yikes_easy_mc_settings_init() { |
|
| 1082 | 1082 | |
| 1083 | 1083 | /* Register General Settings Section */ |
| 1084 | 1084 | |
@@ -1198,27 +1198,27 @@ discard block |
||
| 1198 | 1198 | * Options Sanitization & Validation |
| 1199 | 1199 | * @since complete re-write |
| 1200 | 1200 | **/ |
| 1201 | - function yikes_mc_validate_api_key( $input ) {
|
|
| 1202 | - if ( $input === '' ) {
|
|
| 1201 | + function yikes_mc_validate_api_key( $input ) { |
|
| 1202 | + if ( $input === '' ) { |
|
| 1203 | 1203 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1204 | 1204 | return ''; |
| 1205 | 1205 | } |
| 1206 | 1206 | $api_key = strip_tags ( trim( $input ) ); |
| 1207 | 1207 | $dash_position = strpos( trim( $input ), '-' ); |
| 1208 | - if ( $dash_position !== false ) {
|
|
| 1208 | + if ( $dash_position !== false ) { |
|
| 1209 | 1209 | $manager = new Yikes_Inc_Easy_MailChimp_API_Manager( $api_key ); |
| 1210 | - } else {
|
|
| 1210 | + } else { |
|
| 1211 | 1211 | update_option( 'yikes-mc-api-invalid-key-response', __( 'Your API key appears to be invalid.', 'yikes-inc-easy-mailchimp-extender' ) ); |
| 1212 | 1212 | update_option( 'yikes-mc-api-validation', 'invalid_api_key' ); |
| 1213 | 1213 | return $api_key; |
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | 1216 | $response = $manager->get_account_handler()->get_account( false ); |
| 1217 | - if ( ! is_wp_error( $response ) ) {
|
|
| 1217 | + if ( ! is_wp_error( $response ) ) { |
|
| 1218 | 1218 | update_option( 'yikes-mc-api-validation', 'valid_api_key' ); |
| 1219 | 1219 | // Clear the API key transient data |
| 1220 | 1220 | $this->delete_yikes_mailchimp_transients(); |
| 1221 | - } else {
|
|
| 1221 | + } else { |
|
| 1222 | 1222 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 1223 | 1223 | $error_logging->yikes_easy_mailchimp_write_to_error_log( $response->get_error_message() , __( "Connecting to MailChimp" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Settings Page/General Settings" , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 1224 | 1224 | update_option( 'yikes-mc-api-invalid-key-response', $response->get_error_message() ); |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | * |
| 1234 | 1234 | * @since 1.0.0 |
| 1235 | 1235 | */ |
| 1236 | - function generatePageOptions() {
|
|
| 1236 | + function generatePageOptions() { |
|
| 1237 | 1237 | require_once YIKES_MC_PATH . 'admin/partials/menu/options.php'; // include our options page |
| 1238 | 1238 | } |
| 1239 | 1239 | |
@@ -1243,15 +1243,15 @@ discard block |
||
| 1243 | 1243 | * to form fields. (input, dropdowns, buttons etc.) |
| 1244 | 1244 | * @since v5.5 re-write |
| 1245 | 1245 | **/ |
| 1246 | - public function is_user_mc_api_valid_form( $echo = true ) {
|
|
| 1247 | - if ( $echo == true ) {
|
|
| 1248 | - if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
|
| 1246 | + public function is_user_mc_api_valid_form( $echo = true ) { |
|
| 1247 | + if ( $echo == true ) { |
|
| 1248 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
| 1249 | 1249 | echo 'disabled="disabled"'; |
| 1250 | 1250 | } |
| 1251 | - } else {
|
|
| 1252 | - if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
|
| 1251 | + } else { |
|
| 1252 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
| 1253 | 1253 | return false; |
| 1254 | - } else {
|
|
| 1254 | + } else { |
|
| 1255 | 1255 | return true; |
| 1256 | 1256 | } |
| 1257 | 1257 | } |
@@ -1266,11 +1266,11 @@ discard block |
||
| 1266 | 1266 | * @param string $yikes_inc_easy_mailchimp_extender The name of this plugin. |
| 1267 | 1267 | * @param string $version The version of this plugin. |
| 1268 | 1268 | */ |
| 1269 | - public function check_for_old_yks_mc_options() {
|
|
| 1269 | + public function check_for_old_yks_mc_options() { |
|
| 1270 | 1270 | $old_plugin_options = get_option( 'ykseme_storage' ); |
| 1271 | 1271 | // only perform options migrations if the site is not a multi-site setup |
| 1272 | - if ( !is_multisite() ) {
|
|
| 1273 | - if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) {
|
|
| 1272 | + if ( !is_multisite() ) { |
|
| 1273 | + if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) { |
|
| 1274 | 1274 | // display a notice to the user that they should 'migrate' |
| 1275 | 1275 | // from the old plugin settings to the new ones |
| 1276 | 1276 | add_action( 'admin_notices', array( $this , 'display_options_migrate_notice' ) , 11 ); |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | * moving from 5.5 and beyond.. |
| 1284 | 1284 | * @since |
| 1285 | 1285 | */ |
| 1286 | - public function migrate_old_yks_mc_options() {
|
|
| 1286 | + public function migrate_old_yks_mc_options() { |
|
| 1287 | 1287 | // include our migrate options helper file |
| 1288 | 1288 | include_once YIKES_MC_PATH . 'admin/partials/upgrade-helpers/upgrade-migrate-options.php'; |
| 1289 | 1289 | } |
@@ -1302,15 +1302,15 @@ discard block |
||
| 1302 | 1302 | * @param string $yikes_inc_easy_mailchimp_extender The name of this plugin. |
| 1303 | 1303 | * @param string $version The version of this plugin. |
| 1304 | 1304 | */ |
| 1305 | - public function display_options_migrate_notice() {
|
|
| 1305 | + public function display_options_migrate_notice() { |
|
| 1306 | 1306 | |
| 1307 | 1307 | // Confirm that the necessary forms table in the database exists, else bail |
| 1308 | 1308 | global $wpdb; |
| 1309 | - if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) {
|
|
| 1309 | + if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) { |
|
| 1310 | 1310 | return; |
| 1311 | 1311 | } |
| 1312 | 1312 | |
| 1313 | - if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) {
|
|
| 1313 | + if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) { |
|
| 1314 | 1314 | // Delete the options, start a-new! (this will disable the migration notice altogether) |
| 1315 | 1315 | delete_option( 'widget_yikes_mc_widget' ); |
| 1316 | 1316 | delete_option( 'api_validation' ); |
@@ -1321,7 +1321,7 @@ discard block |
||
| 1321 | 1321 | <p><?php printf( __( "The previously stored options for %s have been cleared from the database. You should update the plugin options on the <a href='%s' title='Settings Page'>settings page</a> before continuing. You should also update the shortcodes used to generate your forms, and any widgets you may have previously set-up.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>', admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ); ?></p> |
| 1322 | 1322 | </div> |
| 1323 | 1323 | <?php |
| 1324 | - } else {
|
|
| 1324 | + } else { |
|
| 1325 | 1325 | ?> |
| 1326 | 1326 | <div class="yikes-easy-mc-updated migrate-options-notice"> |
| 1327 | 1327 | <p><?php printf( __( "It looks like you're upgrading from a previous version of %s.", 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?> <?php printf( __( "In the newest version of %s, the options data structure has changed. We've also moved the mailing lists into its own database table to allow for some higher level customization. Now you can easily create multiple forms and assign them to the same mailing list." , 'yikes-inc-easy-mailchimp-extender' ), '<strong>Us Easy Forms for MailChimp</strong>' ); ?></p> |
@@ -1349,9 +1349,9 @@ discard block |
||
| 1349 | 1349 | * and return the index ( used to find the list name assigned to a form ) |
| 1350 | 1350 | * - http://stackoverflow.com/questions/6661530/php-multi-dimensional-array-search |
| 1351 | 1351 | */ |
| 1352 | - function findMCListID($id, $array) {
|
|
| 1353 | - foreach ($array as $key => $val) {
|
|
| 1354 | - if ($val['id'] === $id) {
|
|
| 1352 | + function findMCListID($id, $array) { |
|
| 1353 | + foreach ($array as $key => $val) { |
|
| 1354 | + if ($val['id'] === $id) { |
|
| 1355 | 1355 | return $key; |
| 1356 | 1356 | } |
| 1357 | 1357 | } |
@@ -1359,14 +1359,14 @@ discard block |
||
| 1359 | 1359 | } // end |
| 1360 | 1360 | |
| 1361 | 1361 | /* Ajax Migrate Options */ |
| 1362 | - function migrate_archived_options() {
|
|
| 1362 | + function migrate_archived_options() { |
|
| 1363 | 1363 | // all options prefixed with 'yikes-mc-' |
| 1364 | 1364 | $option_name = 'yikes-mc-'.$_POST['option_name']; |
| 1365 | 1365 | $option_value = $_POST['option_value']; |
| 1366 | - if ( json_decode( $option_value ) ) {
|
|
| 1366 | + if ( json_decode( $option_value ) ) { |
|
| 1367 | 1367 | // decode our lists() array, and store it |
| 1368 | 1368 | $opt_value = json_decode( $option_value, true ); |
| 1369 | - } else {
|
|
| 1369 | + } else { |
|
| 1370 | 1370 | $opt_value = $option_value; |
| 1371 | 1371 | } |
| 1372 | 1372 | update_option( $option_name, $opt_value ); |
@@ -1375,12 +1375,12 @@ discard block |
||
| 1375 | 1375 | } |
| 1376 | 1376 | |
| 1377 | 1377 | /* Ajax Migrate Forms */ |
| 1378 | - function migrate_previously_setup_forms() {
|
|
| 1378 | + function migrate_previously_setup_forms() { |
|
| 1379 | 1379 | $option_name = $_POST['option_name']; |
| 1380 | 1380 | $done = $_POST['done_import']; |
| 1381 | 1381 | // Create some starter forms for the user |
| 1382 | 1382 | // based on previously imported lists (to our old version) |
| 1383 | - if ( $option_name == 'yikes-mc-lists' ) {
|
|
| 1383 | + if ( $option_name == 'yikes-mc-lists' ) { |
|
| 1384 | 1384 | $option_value = $_POST['option_value']; |
| 1385 | 1385 | $new_options = json_decode( stripslashes_deep( $option_value ) , true ); |
| 1386 | 1386 | |
@@ -1412,9 +1412,9 @@ discard block |
||
| 1412 | 1412 | 'custom_fields' => '', |
| 1413 | 1413 | ) ); |
| 1414 | 1414 | } |
| 1415 | - if ( $done == 'done' ) {
|
|
| 1415 | + if ( $done == 'done' ) { |
|
| 1416 | 1416 | wp_send_json( array( 'form_name' => $form_name, 'completed_import' => true ) ); |
| 1417 | - } else {
|
|
| 1417 | + } else { |
|
| 1418 | 1418 | wp_send_json( array( 'form_name' => $form_name, 'completed_import' => false ) ); |
| 1419 | 1419 | } |
| 1420 | 1420 | wp_die(); |
@@ -1426,8 +1426,8 @@ discard block |
||
| 1426 | 1426 | * Render our sidebar menu on all of the setings pages (general, form, checkbox, recaptcha, popup, debug etc. ) |
| 1427 | 1427 | * @since v5.6 - complete re-write |
| 1428 | 1428 | */ |
| 1429 | - public function generate_options_pages_sidebar_menu() {
|
|
| 1430 | - if ( isset( $_REQUEST['section'] ) ) {
|
|
| 1429 | + public function generate_options_pages_sidebar_menu() { |
|
| 1430 | + if ( isset( $_REQUEST['section'] ) ) { |
|
| 1431 | 1431 | $selected = $_REQUEST['section']; |
| 1432 | 1432 | } |
| 1433 | 1433 | $installed_addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
@@ -1454,13 +1454,13 @@ discard block |
||
| 1454 | 1454 | </ul> |
| 1455 | 1455 | <?php |
| 1456 | 1456 | // create our add-on settings pages |
| 1457 | - if ( !empty( $installed_addons ) ) {
|
|
| 1457 | + if ( !empty( $installed_addons ) ) { |
|
| 1458 | 1458 | ?> |
| 1459 | 1459 | <hr class="add-on-settings-divider" /> |
| 1460 | 1460 | <strong><?php _e( 'Addon Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 1461 | 1461 | <ul id="addon-settings-nav"> |
| 1462 | 1462 | <?php |
| 1463 | - foreach( $installed_addons as $addon_name ) {
|
|
| 1463 | + foreach( $installed_addons as $addon_name ) { |
|
| 1464 | 1464 | ?> |
| 1465 | 1465 | <li> |
| 1466 | 1466 | <?php if ( isset( $_REQUEST['section'] ) && $_REQUEST['section'] == $addon_name ) { ?><div class="option-menu-selected-arrow"></div><?php } ?><a href="<?php echo esc_url_raw( add_query_arg( array( 'section' => $addon_name, 'addon' => 'true' ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion='.$addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
|
@@ -1480,7 +1480,7 @@ discard block |
||
| 1480 | 1480 | * Render our sidebar menu on all of the setings pages (general, form, checkbox, recaptcha, popup, debug etc. ) |
| 1481 | 1481 | * @since v5.6 - complete re-write |
| 1482 | 1482 | */ |
| 1483 | - public function generate_manage_forms_sidebar( $lists ) {
|
|
| 1483 | + public function generate_manage_forms_sidebar( $lists ) { |
|
| 1484 | 1484 | // create a custom URL to allow for creating fields |
| 1485 | 1485 | $url = esc_url_raw( |
| 1486 | 1486 | add_query_arg( |
@@ -1511,18 +1511,18 @@ discard block |
||
| 1511 | 1511 | <label for="associated-list"><strong><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 1512 | 1512 | <select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); disabled( true, empty( $lists ) ); ?>> |
| 1513 | 1513 | <?php |
| 1514 | - if ( ! empty( $lists ) ) {
|
|
| 1515 | - foreach( $lists as $mailing_list ) {
|
|
| 1514 | + if ( ! empty( $lists ) ) { |
|
| 1515 | + foreach( $lists as $mailing_list ) { |
|
| 1516 | 1516 | ?> |
| 1517 | 1517 | <option value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option>
|
| 1518 | 1518 | <?php |
| 1519 | 1519 | } |
| 1520 | - } else {
|
|
| 1521 | - if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
|
|
| 1520 | + } else { |
|
| 1521 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
| 1522 | 1522 | ?> |
| 1523 | 1523 | <option><?php echo __( "Please enter a valid API key." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
| 1524 | 1524 | <?php |
| 1525 | - } else {
|
|
| 1525 | + } else { |
|
| 1526 | 1526 | ?> |
| 1527 | 1527 | <option><?php echo __( "No lists were found on the account." , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
| 1528 | 1528 | <?php |
@@ -1533,8 +1533,8 @@ discard block |
||
| 1533 | 1533 | </select> |
| 1534 | 1534 | |
| 1535 | 1535 | <?php |
| 1536 | - if ( isset( $_GET['transient-cleared'] ) ) {
|
|
| 1537 | - if ( 'true' === $_GET['transient-cleared'] ) {
|
|
| 1536 | + if ( isset( $_GET['transient-cleared'] ) ) { |
|
| 1537 | + if ( 'true' === $_GET['transient-cleared'] ) { |
|
| 1538 | 1538 | ?> |
| 1539 | 1539 | <div class="yikes-list-refreshed-notice"> |
| 1540 | 1540 | <p><?php esc_attr_e( 'MailChimp list data has been succesfully refreshed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -1543,8 +1543,8 @@ discard block |
||
| 1543 | 1543 | } |
| 1544 | 1544 | } |
| 1545 | 1545 | |
| 1546 | - if ( isset( $lists ) && empty( $lists ) ) {
|
|
| 1547 | - if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) {
|
|
| 1546 | + if ( isset( $lists ) && empty( $lists ) ) { |
|
| 1547 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) { |
|
| 1548 | 1548 | ?> |
| 1549 | 1549 | <p class="description"> |
| 1550 | 1550 | <?php printf( __( 'Head over to <a href="http://www.MailChimp.com" title="%s">MailChimp</a> to create a new list.', 'yikes-inc-easy-mailchimp-extender' ) , __( 'Create a list', 'yikes-inc-easy-mailchimp-extender' ) ); ?> |
@@ -1555,9 +1555,9 @@ discard block |
||
| 1555 | 1555 | ?> |
| 1556 | 1556 | </label> |
| 1557 | 1557 | <?php |
| 1558 | - if ( $this->is_user_mc_api_valid_form( false ) ) {
|
|
| 1558 | + if ( $this->is_user_mc_api_valid_form( false ) ) { |
|
| 1559 | 1559 | echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ) , 'primary', '', false , array( 'style' => 'margin:.75em 0 .5em 0;' ) ); |
| 1560 | - } else {
|
|
| 1560 | + } else { |
|
| 1561 | 1561 | echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
| 1562 | 1562 | ?> |
| 1563 | 1563 | <a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&settings-updated=true' ) ); ?>"><?php _e( 'general settings', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
@@ -1568,7 +1568,7 @@ discard block |
||
| 1568 | 1568 | |
| 1569 | 1569 | <!-- Clear API CACHE --> |
| 1570 | 1570 | <?php |
| 1571 | - if ( isset( $lists ) && ! empty( $lists ) ) {
|
|
| 1571 | + if ( isset( $lists ) && ! empty( $lists ) ) { |
|
| 1572 | 1572 | if ( false !== get_transient( 'yikes-easy-mailchimp-list-data' ) ) { ?>
|
| 1573 | 1573 | <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data', 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" method="post"> |
| 1574 | 1574 | <input type="submit" class="button-secondary clear-mailchimp-api-cache" value="<?php _e( 'Refresh Lists', 'yikes-inc-easy-mailchimp-extender' ); ?>" /> |
@@ -1584,7 +1584,7 @@ discard block |
||
| 1584 | 1584 | * Generate a dropdown of post and pages |
| 1585 | 1585 | * so the user can send the user to on form submission |
| 1586 | 1586 | */ |
| 1587 | - public function generate_page_redirect_dropdown( $redirect, $redirect_page, $custom_redirect_url ) {
|
|
| 1587 | + public function generate_page_redirect_dropdown( $redirect, $redirect_page, $custom_redirect_url ) { |
|
| 1588 | 1588 | $post_types = get_post_types(); |
| 1589 | 1589 | ?> |
| 1590 | 1590 | <label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if ( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>">
|
@@ -1604,10 +1604,10 @@ discard block |
||
| 1604 | 1604 | $excluded_post_types = apply_filters( 'yikes-mailchimp-excluded-redirect-post-types', $excluded_post_types ); |
| 1605 | 1605 | |
| 1606 | 1606 | // loop over registered post types, and query! |
| 1607 | - foreach( $post_types as $registered_post_type ) {
|
|
| 1607 | + foreach( $post_types as $registered_post_type ) { |
|
| 1608 | 1608 | |
| 1609 | 1609 | // exclude a few built in custom post types and any defined by the filter |
| 1610 | - if ( ! in_array( $registered_post_type, $excluded_post_types ) ) {
|
|
| 1610 | + if ( ! in_array( $registered_post_type, $excluded_post_types ) ) { |
|
| 1611 | 1611 | |
| 1612 | 1612 | // Grab only the post IDs - in the past we've created timeout issues on some servers with lots of posts |
| 1613 | 1613 | $wp_query_args = array( |
@@ -1622,11 +1622,11 @@ discard block |
||
| 1622 | 1622 | |
| 1623 | 1623 | $post_ids = ! empty( $wp_query_result->posts ) ? $wp_query_result->posts : array(); |
| 1624 | 1624 | |
| 1625 | - if ( ! empty ( $post_ids ) ) {
|
|
| 1625 | + if ( ! empty ( $post_ids ) ) { |
|
| 1626 | 1626 | ?> |
| 1627 | 1627 | <optgroup label="<?php echo ucwords( str_replace( '_', ' ', $registered_post_type ) ); ?>"> |
| 1628 | 1628 | <?php |
| 1629 | - foreach( $post_ids as $post_id ) {
|
|
| 1629 | + foreach( $post_ids as $post_id ) { |
|
| 1630 | 1630 | ?><option <?php selected( $redirect_page , $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php |
| 1631 | 1631 | } |
| 1632 | 1632 | ?> |
@@ -1657,15 +1657,15 @@ discard block |
||
| 1657 | 1657 | * |
| 1658 | 1658 | * Displayed in sidebars |
| 1659 | 1659 | */ |
| 1660 | - public function generate_show_some_love_container() {
|
|
| 1660 | + public function generate_show_some_love_container() { |
|
| 1661 | 1661 | // if no active add-ons are installed, |
| 1662 | 1662 | // lets display our branding and add-on sidebar |
| 1663 | 1663 | $options = get_option( 'yikes-easy-mc-active-addons', array() ); |
| 1664 | - if ( empty( $options ) ) {
|
|
| 1664 | + if ( empty( $options ) ) { |
|
| 1665 | 1665 | |
| 1666 | 1666 | /* On Edit Forms Page Display Upsell to Customizer */ |
| 1667 | 1667 | $screen = get_current_screen(); |
| 1668 | - if ( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) {
|
|
| 1668 | + if ( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) { |
|
| 1669 | 1669 | ?> |
| 1670 | 1670 | |
| 1671 | 1671 | <div class="postbox yikes-easy-mc-postbox show-some-love-container"> |
@@ -1743,18 +1743,18 @@ discard block |
||
| 1743 | 1743 | * - |
| 1744 | 1744 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 1745 | 1745 | */ |
| 1746 | - public function generate_form_editor( $form_fields, $list_id, $merge_variables, $interest_groups ) {
|
|
| 1746 | + public function generate_form_editor( $form_fields, $list_id, $merge_variables, $interest_groups ) { |
|
| 1747 | 1747 | |
| 1748 | 1748 | // if no list id, die! |
| 1749 | - if ( ! $list_id ) {
|
|
| 1749 | + if ( ! $list_id ) { |
|
| 1750 | 1750 | wp_die( __( "We've encountered an error. No list ID was sent." , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 1751 | 1751 | } |
| 1752 | 1752 | |
| 1753 | - if ( ! $merge_variables ) {
|
|
| 1753 | + if ( ! $merge_variables ) { |
|
| 1754 | 1754 | wp_die( __( "We've encountered an error. Reload the page and try again. If the error persists, please reach out to support." , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 1755 | 1755 | } |
| 1756 | 1756 | |
| 1757 | - if ( ! empty( $form_fields ) ) {
|
|
| 1757 | + if ( ! empty( $form_fields ) ) { |
|
| 1758 | 1758 | |
| 1759 | 1759 | // find any fields that are assigned to this form, that don't exist in MailChimp |
| 1760 | 1760 | // or else were going to run into issues when we submit the form |
@@ -1766,18 +1766,18 @@ discard block |
||
| 1766 | 1766 | $mailchimp_merge_field_ids = array(); |
| 1767 | 1767 | |
| 1768 | 1768 | // loop over merge variables |
| 1769 | - if ( ! empty( $merge_variables['merge_fields'] ) ) {
|
|
| 1769 | + if ( ! empty( $merge_variables['merge_fields'] ) ) { |
|
| 1770 | 1770 | $available_merge_variables = wp_list_pluck( $merge_variables['merge_fields'], 'tag' ); |
| 1771 | 1771 | $mailchimp_merge_field_ids = wp_list_pluck( $merge_variables['merge_fields'], 'merge_id' ); |
| 1772 | 1772 | |
| 1773 | 1773 | // Array will look like $merge_tag => $merge_id |
| 1774 | - foreach( $available_merge_variables as $index => $merge_tag ) {
|
|
| 1774 | + foreach( $available_merge_variables as $index => $merge_tag ) { |
|
| 1775 | 1775 | $merge_field_ids[$merge_tag] = $mailchimp_merge_field_ids[$index]; |
| 1776 | 1776 | } |
| 1777 | 1777 | } |
| 1778 | 1778 | |
| 1779 | 1779 | // loop over interest groups |
| 1780 | - if ( ! empty( $interest_groups ) ) {
|
|
| 1780 | + if ( ! empty( $interest_groups ) ) { |
|
| 1781 | 1781 | $available_interest_groups = array_keys( $interest_groups ); |
| 1782 | 1782 | } |
| 1783 | 1783 | |
@@ -1787,9 +1787,9 @@ discard block |
||
| 1787 | 1787 | $excluded_fields = array_diff( $assigned_fields, $merged_fields ); |
| 1788 | 1788 | |
| 1789 | 1789 | $i = 1; |
| 1790 | - foreach( $form_fields as $field ) {
|
|
| 1790 | + foreach( $form_fields as $field ) { |
|
| 1791 | 1791 | |
| 1792 | - if ( isset( $field['merge'] ) ) {
|
|
| 1792 | + if ( isset( $field['merge'] ) ) { |
|
| 1793 | 1793 | // @todo: don't use in_array() |
| 1794 | 1794 | $excluded_field = in_array( $field['merge'], $excluded_fields, true ); |
| 1795 | 1795 | ?> |
@@ -1823,7 +1823,7 @@ discard block |
||
| 1823 | 1823 | <input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field['merge']; ?>][id]" value="<?php echo $merge_field_ids[ $field['merge'] ] ?>" /> |
| 1824 | 1824 | <?php } ?> |
| 1825 | 1825 | |
| 1826 | - <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
|
|
| 1826 | + <?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) { |
|
| 1827 | 1827 | $choices = json_decode( $field['choices'], true ); |
| 1828 | 1828 | ?> |
| 1829 | 1829 | <input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' /> |
@@ -1847,7 +1847,7 @@ discard block |
||
| 1847 | 1847 | </tr> |
| 1848 | 1848 | |
| 1849 | 1849 | <!-- Placeholder Value --> |
| 1850 | - <?php switch( $field['type'] ) {
|
|
| 1850 | + <?php switch( $field['type'] ) { |
|
| 1851 | 1851 | |
| 1852 | 1852 | case 'text': |
| 1853 | 1853 | case 'email': |
@@ -1894,7 +1894,7 @@ discard block |
||
| 1894 | 1894 | ?> |
| 1895 | 1895 | |
| 1896 | 1896 | <!-- Default Value --> |
| 1897 | - <?php switch( $field['type'] ) {
|
|
| 1897 | + <?php switch( $field['type'] ) { |
|
| 1898 | 1898 | default: |
| 1899 | 1899 | case 'text': |
| 1900 | 1900 | case 'number': |
@@ -1910,7 +1910,7 @@ discard block |
||
| 1910 | 1910 | <input id="default_value_<?php echo esc_attr( $field['merge'] ); ?>" <?php if ( $field['type'] != 'number' ) { ?> type="text" <?php } else { ?> type="number" <?php } ?> class="widefat" name="field[<?php echo $field['merge']; ?>][default]" <?php if ( $field['type'] != 'url' ) { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( $field['default'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $field['default'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $field['default'] ) ) ) : ''; ?>" <?php } ?> />
|
| 1911 | 1911 | <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> |
| 1912 | 1912 | <?php |
| 1913 | - switch( $field['type'] ) {
|
|
| 1913 | + switch( $field['type'] ) { |
|
| 1914 | 1914 | case 'text': |
| 1915 | 1915 | ?> |
| 1916 | 1916 | <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" onclick="storeGlobalClicked( jQuery( this ) );" class="thickbox"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
@@ -2067,7 +2067,7 @@ discard block |
||
| 2067 | 2067 | <!-- Display Phone/Date Formats back to the user --> |
| 2068 | 2068 | <!-- Phone Format Initial Load --> |
| 2069 | 2069 | <?php |
| 2070 | - switch( $field['type'] ) {
|
|
| 2070 | + switch( $field['type'] ) { |
|
| 2071 | 2071 | /* Store the phone format, for properly regex pattern */ |
| 2072 | 2072 | case 'phone': |
| 2073 | 2073 | case 'birthday': |
@@ -2077,7 +2077,7 @@ discard block |
||
| 2077 | 2077 | <td scope="row"> |
| 2078 | 2078 | <label for="placeholder"> |
| 2079 | 2079 | <?php |
| 2080 | - switch( $field['type'] ) {
|
|
| 2080 | + switch( $field['type'] ) { |
|
| 2081 | 2081 | default: |
| 2082 | 2082 | case 'birthday': |
| 2083 | 2083 | $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
@@ -2138,7 +2138,7 @@ discard block |
||
| 2138 | 2138 | |
| 2139 | 2139 | |
| 2140 | 2140 | |
| 2141 | - } else {
|
|
| 2141 | + } else { |
|
| 2142 | 2142 | |
| 2143 | 2143 | /**** Interest Group ****/ |
| 2144 | 2144 | |
@@ -2171,7 +2171,7 @@ discard block |
||
| 2171 | 2171 | |
| 2172 | 2172 | <table class="form-table form-field-container"> |
| 2173 | 2173 | <!-- Default Value --> |
| 2174 | - <?php switch( $field['type'] ) {
|
|
| 2174 | + <?php switch( $field['type'] ) { |
|
| 2175 | 2175 | default: |
| 2176 | 2176 | case 'radio': |
| 2177 | 2177 | case 'checkboxes': |
@@ -2188,7 +2188,7 @@ discard block |
||
| 2188 | 2188 | |
| 2189 | 2189 | $default_shown = false; |
| 2190 | 2190 | |
| 2191 | - foreach ( json_decode( $field['groups'], true ) as $id => $group ) {
|
|
| 2191 | + foreach ( json_decode( $field['groups'], true ) as $id => $group ) { |
|
| 2192 | 2192 | $field_id = "{$field['group_id']}-{$id}";
|
| 2193 | 2193 | $field_type = 'hidden' == $field['type'] ? 'checkbox' : $field['type']; |
| 2194 | 2194 | $field_type = 'checkboxes' == $field_type ? 'checkbox' : $field_type; |
@@ -2197,7 +2197,7 @@ discard block |
||
| 2197 | 2197 | |
| 2198 | 2198 | // Determine if the current group is checked. |
| 2199 | 2199 | $checked = ''; |
| 2200 | - switch ( $field_type ) {
|
|
| 2200 | + switch ( $field_type ) { |
|
| 2201 | 2201 | case 'radio': |
| 2202 | 2202 | default: |
| 2203 | 2203 | $default = is_array( $field['default_choice'] ) ? current( $field['default_choice'] ) : $field['default_choice']; |
@@ -2206,14 +2206,14 @@ discard block |
||
| 2206 | 2206 | |
| 2207 | 2207 | case 'checkbox': |
| 2208 | 2208 | case 'hidden': |
| 2209 | - if ( is_array( $field['default_choice'] ) && in_array( $id, $field['default_choice'] ) ) {
|
|
| 2209 | + if ( is_array( $field['default_choice'] ) && in_array( $id, $field['default_choice'] ) ) { |
|
| 2210 | 2210 | $checked = checked( true, true, false ); |
| 2211 | 2211 | } |
| 2212 | 2212 | break; |
| 2213 | 2213 | } |
| 2214 | 2214 | |
| 2215 | 2215 | // Allow users to not set a default choice for radio buttons. |
| 2216 | - if ( $field_type === 'radio' && $default_shown === false ) {
|
|
| 2216 | + if ( $field_type === 'radio' && $default_shown === false ) { |
|
| 2217 | 2217 | $default_shown = true; |
| 2218 | 2218 | ?> |
| 2219 | 2219 | <label for="<?php echo $field_id . 'no-default'; ?>"> |
@@ -2366,7 +2366,7 @@ discard block |
||
| 2366 | 2366 | <?php |
| 2367 | 2367 | } |
| 2368 | 2368 | } |
| 2369 | - } else {
|
|
| 2369 | + } else { |
|
| 2370 | 2370 | ?> |
| 2371 | 2371 | <h4 class="no-fields-assigned-notice non-draggable-yikes"><em><?php _e( 'No fields are assigned to this form. Select fields from the right hand column to add to this form.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></h4> |
| 2372 | 2372 | <?php |
@@ -2453,18 +2453,18 @@ discard block |
||
| 2453 | 2453 | * - |
| 2454 | 2454 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 2455 | 2455 | */ |
| 2456 | - public function build_available_merge_vars( $form_fields, $available_merge_variables ) {
|
|
| 2456 | + public function build_available_merge_vars( $form_fields, $available_merge_variables ) { |
|
| 2457 | 2457 | $fields_assigned_to_form = array(); |
| 2458 | - foreach ( $form_fields as $field ) {
|
|
| 2459 | - if ( isset( $field['merge'] ) ) {
|
|
| 2458 | + foreach ( $form_fields as $field ) { |
|
| 2459 | + if ( isset( $field['merge'] ) ) { |
|
| 2460 | 2460 | $fields_assigned_to_form[ $field['merge'] ] = true; |
| 2461 | 2461 | } |
| 2462 | 2462 | } |
| 2463 | 2463 | |
| 2464 | - if ( ! empty( $available_merge_variables['merge_fields'] ) ) {
|
|
| 2464 | + if ( ! empty( $available_merge_variables['merge_fields'] ) ) { |
|
| 2465 | 2465 | ?> |
| 2466 | 2466 | <ul id="available-fields"><?php |
| 2467 | - foreach ( $available_merge_variables['merge_fields'] as $merge_var ) {
|
|
| 2467 | + foreach ( $available_merge_variables['merge_fields'] as $merge_var ) { |
|
| 2468 | 2468 | $not_available = isset( $fields_assigned_to_form[ $merge_var['tag'] ] ); |
| 2469 | 2469 | ?> |
| 2470 | 2470 | <li class="available-field <?php echo $not_available ? 'not-available' : ''; ?>" |
@@ -2477,7 +2477,7 @@ discard block |
||
| 2477 | 2477 | > |
| 2478 | 2478 | <?php |
| 2479 | 2479 | echo esc_html( stripslashes( $merge_var['name'] ) ); |
| 2480 | - if ( $merge_var['required'] ) {
|
|
| 2480 | + if ( $merge_var['required'] ) { |
|
| 2481 | 2481 | echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>'; |
| 2482 | 2482 | } |
| 2483 | 2483 | ?> |
@@ -2502,21 +2502,21 @@ discard block |
||
| 2502 | 2502 | * - |
| 2503 | 2503 | * @parameters - $list_id - pass in the list ID to retreive merge variables from |
| 2504 | 2504 | */ |
| 2505 | - public function build_available_interest_groups( $form_fields, $available_interest_groups, $list_id ) {
|
|
| 2505 | + public function build_available_interest_groups( $form_fields, $available_interest_groups, $list_id ) { |
|
| 2506 | 2506 | $fields_assigned_to_form = array(); |
| 2507 | - if ( ! empty( $form_fields ) ) {
|
|
| 2508 | - foreach ( $form_fields as $field ) {
|
|
| 2509 | - if ( isset( $field['group_id'] ) ) {
|
|
| 2507 | + if ( ! empty( $form_fields ) ) { |
|
| 2508 | + foreach ( $form_fields as $field ) { |
|
| 2509 | + if ( isset( $field['group_id'] ) ) { |
|
| 2510 | 2510 | $fields_assigned_to_form[ $field['group_id'] ] = true; |
| 2511 | 2511 | } |
| 2512 | 2512 | } |
| 2513 | 2513 | } |
| 2514 | 2514 | |
| 2515 | - if ( ! empty( $available_interest_groups ) ) {
|
|
| 2515 | + if ( ! empty( $available_interest_groups ) ) { |
|
| 2516 | 2516 | ?> |
| 2517 | 2517 | <ul id="available-interest-groups"> |
| 2518 | 2518 | <?php |
| 2519 | - foreach ( $available_interest_groups as $interest_group ) {
|
|
| 2519 | + foreach ( $available_interest_groups as $interest_group ) { |
|
| 2520 | 2520 | $not_available = isset( $fields_assigned_to_form[ $interest_group['id'] ] ); |
| 2521 | 2521 | ?> |
| 2522 | 2522 | <li class="available-field <?php echo $not_available ? 'not-available' : ''; ?>" |
@@ -2547,11 +2547,11 @@ discard block |
||
| 2547 | 2547 | /** |
| 2548 | 2548 | * Smt. |
| 2549 | 2549 | */ |
| 2550 | - public function build_available_tags( $form_tags, $tags, $list_id ) {
|
|
| 2550 | + public function build_available_tags( $form_tags, $tags, $list_id ) { |
|
| 2551 | 2551 | ?> |
| 2552 | 2552 | <ul id="available-tags"> |
| 2553 | 2553 | <?php |
| 2554 | - foreach ( $tags as $tag_id => $tag ) {
|
|
| 2554 | + foreach ( $tags as $tag_id => $tag ) { |
|
| 2555 | 2555 | $not_available = isset( $form_tags[ $tag_id ] ); |
| 2556 | 2556 | ?> |
| 2557 | 2557 | <li class="available-field <?php echo $not_available ? 'not-available' : ''; ?>" |
@@ -2581,9 +2581,9 @@ discard block |
||
| 2581 | 2581 | * and include it here for easy maintenance |
| 2582 | 2582 | * - must clean up db tables , ensure what data is going in and what is needed... |
| 2583 | 2583 | */ |
| 2584 | - public function yikes_easy_mailchimp_create_form() {
|
|
| 2584 | + public function yikes_easy_mailchimp_create_form() { |
|
| 2585 | 2585 | $nonce = $_REQUEST['nonce']; |
| 2586 | - if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) {
|
|
| 2586 | + if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) { |
|
| 2587 | 2587 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 2588 | 2588 | } |
| 2589 | 2589 | |
@@ -2594,13 +2594,13 @@ discard block |
||
| 2594 | 2594 | ) ); |
| 2595 | 2595 | |
| 2596 | 2596 | // if an error occurs during the form creation process |
| 2597 | - if ( false == $result ) {
|
|
| 2597 | + if ( false == $result ) { |
|
| 2598 | 2598 | // write it to the error log |
| 2599 | 2599 | // if the form was not created successfully |
| 2600 | 2600 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 2601 | 2601 | $error_logging->maybe_write_to_log( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender') , __( "Creating a new form" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Forms" , 'yikes-inc-easy-mailchimp-extender' ) ); |
| 2602 | 2602 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&sql_error=' . urlencode( __( 'Error creating a new form', 'yikes-inc-easy-mailchimp-extender' ) ) ) ) ); |
| 2603 | - } else {
|
|
| 2603 | + } else { |
|
| 2604 | 2604 | // redirect the user to the new form edit page |
| 2605 | 2605 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result) ) ); |
| 2606 | 2606 | } |
@@ -2613,12 +2613,12 @@ discard block |
||
| 2613 | 2613 | * and include it here for easy maintenance |
| 2614 | 2614 | * - must clean up db tables , ensure what data is going in and what is needed... |
| 2615 | 2615 | */ |
| 2616 | - public function yikes_easy_mailchimp_delete_form() {
|
|
| 2616 | + public function yikes_easy_mailchimp_delete_form() { |
|
| 2617 | 2617 | // grab & store our variables ( associated list & form name ) |
| 2618 | 2618 | $nonce = $_REQUEST['nonce']; |
| 2619 | 2619 | $post_id_to_delete = $_REQUEST['mailchimp-form']; |
| 2620 | 2620 | // verify our nonce |
| 2621 | - if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) {
|
|
| 2621 | + if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) { |
|
| 2622 | 2622 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2623 | 2623 | } |
| 2624 | 2624 | |
@@ -2633,12 +2633,12 @@ discard block |
||
| 2633 | 2633 | * Duplicate an entire form ! |
| 2634 | 2634 | * Probably Move these to its own file, |
| 2635 | 2635 | */ |
| 2636 | - public function yikes_easy_mailchimp_duplicate_form() {
|
|
| 2636 | + public function yikes_easy_mailchimp_duplicate_form() { |
|
| 2637 | 2637 | // grab & store our variables ( associated list & form name ) |
| 2638 | 2638 | $nonce = $_REQUEST['nonce']; |
| 2639 | 2639 | $post_id_to_clone = $_REQUEST['mailchimp-form']; |
| 2640 | 2640 | // verify our nonce |
| 2641 | - if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) {
|
|
| 2641 | + if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) { |
|
| 2642 | 2642 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2643 | 2643 | } |
| 2644 | 2644 | |
@@ -2662,10 +2662,10 @@ discard block |
||
| 2662 | 2662 | */ |
| 2663 | 2663 | do_action( 'yikes-mailchimp-after-duplicating-form', $post_id_to_clone, $result, $form_data ); |
| 2664 | 2664 | |
| 2665 | - if ( false === $result ) {
|
|
| 2665 | + if ( false === $result ) { |
|
| 2666 | 2666 | // redirect the user to the manage forms page, display error |
| 2667 | 2667 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&duplicated-form=false' ) ) ); |
| 2668 | - } else {
|
|
| 2668 | + } else { |
|
| 2669 | 2669 | // redirect the user to the manage forms page, display confirmation |
| 2670 | 2670 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&duplicated-form=true' ) ) ); |
| 2671 | 2671 | } |
@@ -2676,12 +2676,12 @@ discard block |
||
| 2676 | 2676 | /* |
| 2677 | 2677 | * Reset a forms impression stats |
| 2678 | 2678 | */ |
| 2679 | - public function yikes_easy_mailchimp_reset_impression_stats() {
|
|
| 2679 | + public function yikes_easy_mailchimp_reset_impression_stats() { |
|
| 2680 | 2680 | // grab & store our variables ( associated list & form name ) |
| 2681 | 2681 | $nonce = $_REQUEST['nonce']; |
| 2682 | 2682 | $form_id_to_reset = $_REQUEST['mailchimp-form']; |
| 2683 | 2683 | // verify our nonce |
| 2684 | - if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) {
|
|
| 2684 | + if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) { |
|
| 2685 | 2685 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2686 | 2686 | } |
| 2687 | 2687 | |
@@ -2693,10 +2693,10 @@ discard block |
||
| 2693 | 2693 | ) |
| 2694 | 2694 | ); |
| 2695 | 2695 | |
| 2696 | - if ( false === $result ) {
|
|
| 2696 | + if ( false === $result ) { |
|
| 2697 | 2697 | // redirect the user to the manage forms page, display error |
| 2698 | 2698 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&reset-stats=false' ) ) ); |
| 2699 | - } else {
|
|
| 2699 | + } else { |
|
| 2700 | 2700 | // redirect the user to the manage forms page, display confirmation |
| 2701 | 2701 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&reset-stats=true' ) ) ); |
| 2702 | 2702 | } |
@@ -2708,13 +2708,13 @@ discard block |
||
| 2708 | 2708 | * Update an entire form ! |
| 2709 | 2709 | * Probably Move these to its own file, |
| 2710 | 2710 | */ |
| 2711 | - public function yikes_easy_mailchimp_update_form() {
|
|
| 2711 | + public function yikes_easy_mailchimp_update_form() { |
|
| 2712 | 2712 | |
| 2713 | 2713 | $nonce = $_REQUEST['nonce']; |
| 2714 | 2714 | $form_id = $_REQUEST['id']; |
| 2715 | 2715 | |
| 2716 | 2716 | // verify our nonce |
| 2717 | - if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) {
|
|
| 2717 | + if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) { |
|
| 2718 | 2718 | wp_die( |
| 2719 | 2719 | __( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), |
| 2720 | 2720 | __( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ), |
@@ -2787,11 +2787,11 @@ discard block |
||
| 2787 | 2787 | |
| 2788 | 2788 | // additional custom fields (extensions / user defined fields) |
| 2789 | 2789 | $custom_fields = array(); |
| 2790 | - if ( isset( $_POST['custom-field'] ) ) {
|
|
| 2791 | - foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) {
|
|
| 2792 | - if ( is_array( $custom_value ) ) {
|
|
| 2790 | + if ( isset( $_POST['custom-field'] ) ) { |
|
| 2791 | + foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) { |
|
| 2792 | + if ( is_array( $custom_value ) ) { |
|
| 2793 | 2793 | $custom_fields[ $custom_field ] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!) |
| 2794 | - } else {
|
|
| 2794 | + } else { |
|
| 2795 | 2795 | $custom_fields[ $custom_field ] = stripslashes( $custom_value ); |
| 2796 | 2796 | } |
| 2797 | 2797 | } |
@@ -2827,7 +2827,7 @@ discard block |
||
| 2827 | 2827 | exit(); |
| 2828 | 2828 | } |
| 2829 | 2829 | |
| 2830 | - public static function generate_default_email_body() {
|
|
| 2830 | + public static function generate_default_email_body() { |
|
| 2831 | 2831 | $email_body = '<p>' . __( 'Greetings,', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
| 2832 | 2832 | |
| 2833 | 2833 | $email_body .= '<p>'; |
@@ -2850,18 +2850,18 @@ discard block |
||
| 2850 | 2850 | } |
| 2851 | 2851 | |
| 2852 | 2852 | /* Unsubscribe a given user from our list */ |
| 2853 | - public function yikes_easy_mailchimp_unsubscribe_user() {
|
|
| 2853 | + public function yikes_easy_mailchimp_unsubscribe_user() { |
|
| 2854 | 2854 | $nonce = $_REQUEST['nonce']; |
| 2855 | 2855 | $list_id = $_REQUEST['mailchimp-list']; |
| 2856 | 2856 | $email_id = $_REQUEST['email_id']; |
| 2857 | 2857 | |
| 2858 | 2858 | // verify our nonce |
| 2859 | - if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) {
|
|
| 2859 | + if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) { |
|
| 2860 | 2860 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2861 | 2861 | } |
| 2862 | 2862 | |
| 2863 | 2863 | $response = yikes_get_mc_api_manager()->get_list_handler()->member_unsubscribe( $list_id, $email_id ); |
| 2864 | - if ( is_wp_error( $response ) ) {
|
|
| 2864 | + if ( is_wp_error( $response ) ) { |
|
| 2865 | 2865 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 2866 | 2866 | $error_logging->maybe_write_to_log( |
| 2867 | 2867 | $response->get_error_code(), |
@@ -2874,22 +2874,22 @@ discard block |
||
| 2874 | 2874 | exit; |
| 2875 | 2875 | } |
| 2876 | 2876 | |
| 2877 | - public function yikes_easy_mailchimp_create_missing_error_log() {
|
|
| 2877 | + public function yikes_easy_mailchimp_create_missing_error_log() { |
|
| 2878 | 2878 | // grab our nonnce |
| 2879 | 2879 | $nonce = $_REQUEST['nonce']; |
| 2880 | 2880 | // validate nonce |
| 2881 | - if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) {
|
|
| 2881 | + if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) { |
|
| 2882 | 2882 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2883 | 2883 | } |
| 2884 | 2884 | // setup the path to the error log |
| 2885 | 2885 | $error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' ); |
| 2886 | - try {
|
|
| 2886 | + try { |
|
| 2887 | 2887 | // create the file |
| 2888 | 2888 | fwrite( $error_log , '' ); |
| 2889 | 2889 | // close out |
| 2890 | 2890 | fclose( $error_log ); |
| 2891 | 2891 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=true' ) ) ); |
| 2892 | - } catch ( Exception $e ) {
|
|
| 2892 | + } catch ( Exception $e ) { |
|
| 2893 | 2893 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=debug-settings&error_log_created=false&error_message='.urlencode( $e->getMessage() ) ) ) ); |
| 2894 | 2894 | } |
| 2895 | 2895 | } |
@@ -2898,11 +2898,11 @@ discard block |
||
| 2898 | 2898 | * Clear Transient Data ! |
| 2899 | 2899 | * Probably Move these to its own file, |
| 2900 | 2900 | */ |
| 2901 | - public function yikes_easy_mailchimp_clear_transient_data() {
|
|
| 2901 | + public function yikes_easy_mailchimp_clear_transient_data() { |
|
| 2902 | 2902 | |
| 2903 | 2903 | // verify our nonce |
| 2904 | 2904 | $nonce = $_REQUEST['nonce']; |
| 2905 | - if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) {
|
|
| 2905 | + if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) { |
|
| 2906 | 2906 | wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) ); |
| 2907 | 2907 | } |
| 2908 | 2908 | |
@@ -2910,14 +2910,14 @@ discard block |
||
| 2910 | 2910 | |
| 2911 | 2911 | // if the request came from the settings page, redirect to the settings page. |
| 2912 | 2912 | $referer = wp_get_referer(); |
| 2913 | - if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) {
|
|
| 2913 | + if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) { |
|
| 2914 | 2914 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=api-cache-settings&transient-cleared=true' ) ) ); |
| 2915 | - } elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) {
|
|
| 2915 | + } elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) { |
|
| 2916 | 2916 | |
| 2917 | 2917 | // else check if we were editing a form. |
| 2918 | 2918 | $id = filter_var( $_REQUEST['id'], FILTER_SANITIZE_NUMBER_INT ); |
| 2919 | 2919 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $id ) ) ); |
| 2920 | - } else {
|
|
| 2920 | + } else { |
|
| 2921 | 2921 | // else redirect to the manage forms page. |
| 2922 | 2922 | wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&transient-cleared=true' ) ) ); |
| 2923 | 2923 | } |
@@ -2933,17 +2933,17 @@ discard block |
||
| 2933 | 2933 | * @since 6.0.2 |
| 2934 | 2934 | * @return $list_id_array - array of list id's to loop over |
| 2935 | 2935 | */ |
| 2936 | - public function get_mailchimp_list_ids_on_account() {
|
|
| 2936 | + public function get_mailchimp_list_ids_on_account() { |
|
| 2937 | 2937 | $api_key = yikes_get_mc_api_key(); |
| 2938 | - if ( ! $api_key ) {
|
|
| 2938 | + if ( ! $api_key ) { |
|
| 2939 | 2939 | // if no api key is set/site is not connected, return an empty array. |
| 2940 | 2940 | return array(); |
| 2941 | 2941 | } |
| 2942 | 2942 | |
| 2943 | 2943 | $lists = get_transient( 'yikesinc_eme_list_ids' ); |
| 2944 | - if ( false === $lists ) {
|
|
| 2944 | + if ( false === $lists ) { |
|
| 2945 | 2945 | $lists = yikes_get_mc_api_manager()->get_list_handler()->get_list_ids(); |
| 2946 | - if ( is_wp_error( $lists ) ) {
|
|
| 2946 | + if ( is_wp_error( $lists ) ) { |
|
| 2947 | 2947 | return array(); |
| 2948 | 2948 | } |
| 2949 | 2949 | set_transient( 'yikesinc_eme_list_ids', $lists, HOUR_IN_SECONDS ); |
@@ -2957,9 +2957,9 @@ discard block |
||
| 2957 | 2957 | * |
| 2958 | 2958 | * @since 6.0 |
| 2959 | 2959 | */ |
| 2960 | - public function yikes_mailchimp_load_helper_class() {
|
|
| 2960 | + public function yikes_mailchimp_load_helper_class() { |
|
| 2961 | 2961 | // check to see if it's already loaded up. |
| 2962 | - if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
|
|
| 2962 | + if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) { |
|
| 2963 | 2963 | // Include our main helper class file |
| 2964 | 2964 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/init.php' ); |
| 2965 | 2965 | } |
@@ -2972,11 +2972,11 @@ discard block |
||
| 2972 | 2972 | * @order requires that yikes-inc-easy-mailchimp-extender-admin.min.css be enqueued, so we can override the defaults (handle: yikes-inc-easy-mailchimp-extender-admin) |
| 2973 | 2973 | * @return print out custom styles to the admin header to alter the default blue color |
| 2974 | 2974 | */ |
| 2975 | - public function alter_yikes_easy_mc_color_scheme() {
|
|
| 2975 | + public function alter_yikes_easy_mc_color_scheme() { |
|
| 2976 | 2976 | // get the current set color scheme for the logged in user |
| 2977 | 2977 | $current_color_scheme = get_user_option( 'admin_color' ); |
| 2978 | 2978 | // switch over each color scheme, and set our variable |
| 2979 | - switch ( $current_color_scheme ) {
|
|
| 2979 | + switch ( $current_color_scheme ) { |
|
| 2980 | 2980 | default: |
| 2981 | 2981 | case 'fresh': // default blue (defined by this plugin) |
| 2982 | 2982 | $main_color = '#00a0d2'; |
@@ -3024,16 +3024,16 @@ discard block |
||
| 3024 | 3024 | /** |
| 3025 | 3025 | * Display premium support page if any add-ons are installed, otherwise display free support page |
| 3026 | 3026 | */ |
| 3027 | - public function display_support_page_content() {
|
|
| 3027 | + public function display_support_page_content() { |
|
| 3028 | 3028 | |
| 3029 | 3029 | $addons = get_option( 'yikes-easy-mc-active-addons', array() ); |
| 3030 | 3030 | |
| 3031 | 3031 | // If we have premium add-ons... |
| 3032 | - if ( ! empty( $addons ) ) {
|
|
| 3032 | + if ( ! empty( $addons ) ) { |
|
| 3033 | 3033 | |
| 3034 | 3034 | // Add our premium support partial. |
| 3035 | 3035 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/premium-support.php' ); |
| 3036 | - } else {
|
|
| 3036 | + } else { |
|
| 3037 | 3037 | |
| 3038 | 3038 | // Otherwise add our free support partial. |
| 3039 | 3039 | include_once( YIKES_MC_PATH . 'admin/partials/helpers/free-support.php' ); |
@@ -3045,8 +3045,8 @@ discard block |
||
| 3045 | 3045 | * |
| 3046 | 3046 | * @since 6.0.4 |
| 3047 | 3047 | */ |
| 3048 | - public function check_yikes_mc_table_version() {
|
|
| 3049 | - if ( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) {
|
|
| 3048 | + public function check_yikes_mc_table_version() { |
|
| 3049 | + if ( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) { |
|
| 3050 | 3050 | require_once YIKES_MC_PATH . 'includes/class-yikes-inc-easy-mailchimp-extender-activator.php'; |
| 3051 | 3051 | global $wpdb; |
| 3052 | 3052 | Yikes_Inc_Easy_Mailchimp_Extender_Activator::_activate_yikes_easy_mailchimp( $wpdb ); |
@@ -3060,7 +3060,7 @@ discard block |
||
| 3060 | 3060 | * |
| 3061 | 3061 | * @since 6.0.4.4 |
| 3062 | 3062 | */ |
| 3063 | - public function process_subscriber_count_shortcode_in_form_descriptions( $form_description, $form_id ) {
|
|
| 3063 | + public function process_subscriber_count_shortcode_in_form_descriptions( $form_description, $form_id ) { |
|
| 3064 | 3064 | $form_description = str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $form_id . '"]' ), $form_description ); |
| 3065 | 3065 | return $form_description; |
| 3066 | 3066 | } |
@@ -3070,9 +3070,9 @@ discard block |
||
| 3070 | 3070 | * |
| 3071 | 3071 | * @since 6.0.3 |
| 3072 | 3072 | */ |
| 3073 | - public function generate_edit_forms_upsell_ad() {
|
|
| 3073 | + public function generate_edit_forms_upsell_ad() { |
|
| 3074 | 3074 | $upsell_ads = glob( YIKES_MC_PATH . 'includes/upsells/*.php' ); |
| 3075 | - if ( $upsell_ads && ! empty( $upsell_ads ) ) {
|
|
| 3075 | + if ( $upsell_ads && ! empty( $upsell_ads ) ) { |
|
| 3076 | 3076 | $ad_count = absint( count( $upsell_ads ) - 1 ); |
| 3077 | 3077 | $ad = $upsell_ads[ mt_rand( 0, $ad_count ) ]; |
| 3078 | 3078 | ob_start(); |
@@ -3089,11 +3089,11 @@ discard block |
||
| 3089 | 3089 | * Mainly used when the API key is altered, changed or removed. |
| 3090 | 3090 | * @since 6.1.3 |
| 3091 | 3091 | */ |
| 3092 | - public function delete_yikes_mailchimp_transients() {
|
|
| 3092 | + public function delete_yikes_mailchimp_transients() { |
|
| 3093 | 3093 | |
| 3094 | 3094 | // delete all of the list_id transients. |
| 3095 | 3095 | $list_ids = $this->get_mailchimp_list_ids_on_account(); |
| 3096 | - foreach ( $list_ids as $id ) {
|
|
| 3096 | + foreach ( $list_ids as $id ) { |
|
| 3097 | 3097 | delete_transient( "yikes_eme_list_{$id}" );
|
| 3098 | 3098 | delete_transient( "yikes_eme_merge_variables_{$id}" );
|
| 3099 | 3099 | delete_transient( "yikes_eme_interest_categories_{$id}" );
|
@@ -3115,13 +3115,13 @@ discard block |
||
| 3115 | 3115 | * |
| 3116 | 3116 | * @author Jeremy Pry |
| 3117 | 3117 | */ |
| 3118 | - public function check_db_version() {
|
|
| 3118 | + public function check_db_version() { |
|
| 3119 | 3119 | $option = get_option( 'yikes_easy_mailchimp_extender_version', '0.0.0' ); |
| 3120 | - if ( version_compare( $option, '6.2.0', '<' ) ) {
|
|
| 3120 | + if ( version_compare( $option, '6.2.0', '<' ) ) { |
|
| 3121 | 3121 | $this->convert_db_to_option(); |
| 3122 | 3122 | } |
| 3123 | 3123 | |
| 3124 | - if ( version_compare( $option, YIKES_MC_VERSION, '<' ) ) {
|
|
| 3124 | + if ( version_compare( $option, YIKES_MC_VERSION, '<' ) ) { |
|
| 3125 | 3125 | update_option( 'yikes_easy_mailchimp_extender_version', YIKES_MC_VERSION ); |
| 3126 | 3126 | } |
| 3127 | 3127 | } |
@@ -3131,7 +3131,7 @@ discard block |
||
| 3131 | 3131 | * |
| 3132 | 3132 | * @author Jeremy Pry |
| 3133 | 3133 | */ |
| 3134 | - public function convert_db_to_option() {
|
|
| 3134 | + public function convert_db_to_option() { |
|
| 3135 | 3135 | /** @var wpdb */ |
| 3136 | 3136 | global $wpdb; |
| 3137 | 3137 | |
@@ -3140,11 +3140,11 @@ discard block |
||
| 3140 | 3140 | $form_option = array(); |
| 3141 | 3141 | $form_ids = $db_interface->get_form_ids(); |
| 3142 | 3142 | |
| 3143 | - if ( empty( $form_ids ) ) {
|
|
| 3143 | + if ( empty( $form_ids ) ) { |
|
| 3144 | 3144 | return; |
| 3145 | 3145 | } |
| 3146 | 3146 | |
| 3147 | - foreach ( $form_ids as $form_id ) {
|
|
| 3147 | + foreach ( $form_ids as $form_id ) { |
|
| 3148 | 3148 | $form_option[ $form_id ] = $db_interface->get_form( $form_id ); |
| 3149 | 3149 | } |
| 3150 | 3150 | |
@@ -3156,7 +3156,7 @@ discard block |
||
| 3156 | 3156 | * |
| 3157 | 3157 | * @author Jeremy Pry |
| 3158 | 3158 | */ |
| 3159 | - public function register_optin_widget() {
|
|
| 3159 | + public function register_optin_widget() { |
|
| 3160 | 3160 | register_widget( 'Yikes_Inc_Easy_Mailchimp_Extender_Widget' ); |
| 3161 | 3161 | } |
| 3162 | 3162 | } |