Completed
Push — master ( 70ba95...7f995b )
by
unknown
23:29 queued 21:01
created
public/partials/shortcodes/process_form_shortcode.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -474,7 +474,9 @@  discard block
 block discarded – undo
474 474
 						$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
475 475
 						$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
476 476
 						$label_class_array[] = ( $tag === 'merge' ) ? $field['merge'] . '-label' : $field['group_id'] . '-label';
477
-						if ( isset( $field['require'] ) ) $label_class_array[] = 'yikes-mailchimp-field-required';
477
+						if ( isset( $field['require'] ) ) {
478
+							$label_class_array[] = 'yikes-mailchimp-field-required';
479
+						}
478 480
 					}
479 481
 
480 482
 					// if both hide label and hide field are checked, we gotta hide the field!
@@ -761,7 +763,7 @@  discard block
 block discarded – undo
761 763
 														} else {
762 764
 															$zip_value = $_POST[$field['merge']]; 
763 765
 														}
764
-													} else { 
766
+													} else {
765 767
 
766 768
 														/**
767 769
 														* A filter to set the default zip code value.
@@ -1125,7 +1127,7 @@  discard block
 block discarded – undo
1125 1127
 												echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : '';
1126 1128
 
1127 1129
 												$i = 0;
1128
-												foreach( $groups as $group_id => $name ) { 
1130
+												foreach( $groups as $group_id => $name ) {
1129 1131
 
1130 1132
 													// If the form was submitted and failed, set the submitted/chosen values as the default
1131 1133
 													if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) {
@@ -1174,7 +1176,7 @@  discard block
 block discarded – undo
1174 1176
 										// Turn $default_choice into an array if it isn't already
1175 1177
 										$default_choice = ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice : array( $default_choice );
1176 1178
 
1177
-										foreach( $groups as $group_id => $name ) { 
1179
+										foreach( $groups as $group_id => $name ) {
1178 1180
 											?>
1179 1181
 											<label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;">
1180 1182
 												<input 
Please login to merge, or discard this patch.
admin/class-yikes-inc-easy-mailchimp-extender-admin.php 1 patch
Braces   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&section=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&section=debug-settings&error-log-cleared=true' ) ) );
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -810,12 +810,12 @@  discard block
 block discarded – undo
810 810
 	/**
811 811
 	 * Convert the php date format string to a js date format
812 812
 	 */
813
-	public function yikes_jQuery_datepicker_date_format_php_to_js( $sFormat, $type ) {
814
-		switch ( $type ) {
813
+	public function yikes_jQuery_datepicker_date_format_php_to_js( $sFormat, $type ) {
814
+		switch ( $type ) {
815 815
 			default:
816 816
 			case 'date':
817 817
 				// Standard Date Fields
818
-				switch ( $sFormat ) {
818
+				switch ( $sFormat ) {
819 819
 					//Predefined WP date formats
820 820
 					case 'F j, Y':
821 821
 					case 'j F Y':
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 				break;
839 839
 			// Birthday Fields
840 840
 			case 'birthday':
841
-				switch ( $sFormat ) {
841
+				switch ( $sFormat ) {
842 842
 					//Predefined WP date formats
843 843
 					case 'F j, Y':
844 844
 					case 'j F Y':
@@ -867,8 +867,8 @@  discard block
 block discarded – undo
867 867
 	/**
868 868
 	 * Convert the php date format string to a js date format
869 869
 	 */
870
-	public function yikes_jQuery_datepicker_date_format( $site_option ) {
871
-		switch( $site_option ) {
870
+	public function yikes_jQuery_datepicker_date_format( $site_option ) {
871
+		switch( $site_option ) {
872 872
 			//Predefined WP date formats
873 873
 			default:
874 874
 			case 'F j, Y':
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	*	Register our admin pages
889 889
 	*	used to display data back to the user
890 890
 	**/
891
-	public function register_admin_pages() {
891
+	public function register_admin_pages() {
892 892
 
893 893
 		/* Top Level Menu 'Easy MailChimp' */
894 894
 		add_menu_page(
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 	*	when they click 'Go Pro' in the admin menu
1012 1012
 	*	to do: populate with sales URL
1013 1013
 	*/
1014
-	public function generateAddOnsPage() {
1014
+	public function generateAddOnsPage() {
1015 1015
 		require_once YIKES_MC_PATH . 'admin/partials/menu/add-ons.php'; // include our add-ons page
1016 1016
 	}
1017 1017
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 	*
1021 1021
 	* @since    1.0.0
1022 1022
 	*/
1023
-	function generateManageFormsPage() {
1023
+	function generateManageFormsPage() {
1024 1024
 		require_once YIKES_MC_PATH . 'admin/partials/menu/manage-forms.php'; // include our manage forms page
1025 1025
 	}
1026 1026
 
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 	*
1030 1030
 	* @since    1.0.0
1031 1031
 	*/
1032
-	function generateManageListsPage() {
1032
+	function generateManageListsPage() {
1033 1033
 		require_once YIKES_MC_PATH . 'admin/partials/menu/manage-lists.php'; // include our lists page
1034 1034
 	}
1035 1035
 
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 	*
1039 1039
 	* @since    1.0.0
1040 1040
 	*/
1041
-	function generateSupportPage() {
1041
+	function generateSupportPage() {
1042 1042
 
1043 1043
 		wp_enqueue_script( 'yikes-inc-easy-mailchimp-extender-support-scripts', plugin_dir_url( __FILE__ ) . 'js/support.js', array( 'jquery' ), $this->version, false );	
1044 1044
 		require_once YIKES_MC_PATH . 'admin/partials/menu/support.php';
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 	*
1050 1050
 	* @since    1.0.0
1051 1051
 	*/
1052
-	function generateEditFormPage() {
1052
+	function generateEditFormPage() {
1053 1053
 		require_once YIKES_MC_PATH . 'admin/partials/edit-form.php'; // include our options page
1054 1054
 	}
1055 1055
 
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 	*
1059 1059
 	* @since    1.0.0
1060 1060
 	*/
1061
-	function generateViewListPage() {
1061
+	function generateViewListPage() {
1062 1062
 		require_once YIKES_MC_PATH . 'admin/partials/view-list.php'; // include our options page
1063 1063
 	}
1064 1064
 
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 	*
1068 1068
 	* @since    1.0.0
1069 1069
 	*/
1070
-	function generateViewUserPage() {
1070
+	function generateViewUserPage() {
1071 1071
 		require_once YIKES_MC_PATH . 'admin/partials/view-user.php'; // include our options page
1072 1072
 	}
1073 1073
 
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 	*
1077 1077
 	* @since v.5.4
1078 1078
 	**/
1079
-	function yikes_easy_mc_settings_init() {
1079
+	function yikes_easy_mc_settings_init() {
1080 1080
 
1081 1081
 		/* Register General Settings Section */
1082 1082
 
@@ -1196,27 +1196,27 @@  discard block
 block discarded – undo
1196 1196
 	*	Options Sanitization & Validation
1197 1197
 	*	@since complete re-write
1198 1198
 	**/
1199
-	function yikes_mc_validate_api_key( $input ) {
1200
-		if ( $input === '' ) {
1199
+	function yikes_mc_validate_api_key( $input ) {
1200
+		if ( $input === '' ) {
1201 1201
 			update_option( 'yikes-mc-api-validation', 'invalid_api_key' );
1202 1202
 			return '';
1203 1203
 		}
1204 1204
 		$api_key = strip_tags ( trim( $input ) );
1205 1205
 		$dash_position = strpos( trim( $input ), '-' );
1206
-		if ( $dash_position !== false ) {
1206
+		if ( $dash_position !== false ) {
1207 1207
 			$manager = new Yikes_Inc_Easy_MailChimp_API_Manager( $api_key );
1208
-		} else {
1208
+		} else {
1209 1209
 			update_option( 'yikes-mc-api-invalid-key-response', __( 'Your API key appears to be invalid.', 'yikes-inc-easy-mailchimp-extender' ) );
1210 1210
 			update_option( 'yikes-mc-api-validation', 'invalid_api_key' );
1211 1211
 			return $api_key;
1212 1212
 		}
1213 1213
 
1214 1214
 		$response = $manager->get_account_handler()->get_account( false );
1215
-		if ( ! is_wp_error( $response ) ) {
1215
+		if ( ! is_wp_error( $response ) ) {
1216 1216
 			update_option( 'yikes-mc-api-validation', 'valid_api_key' );
1217 1217
 				// Clear the API key transient data
1218 1218
 			$this->delete_yikes_mailchimp_transients();
1219
-		}  else {
1219
+		} else {
1220 1220
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
1221 1221
 			$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' ) );
1222 1222
 			update_option( 'yikes-mc-api-invalid-key-response', $response->get_error_message() );
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 	*
1232 1232
 	* @since    1.0.0
1233 1233
 	*/
1234
-	function generatePageOptions() {
1234
+	function generatePageOptions() {
1235 1235
 		require_once YIKES_MC_PATH . 'admin/partials/menu/options.php'; // include our options page
1236 1236
 	}
1237 1237
 
@@ -1241,15 +1241,15 @@  discard block
 block discarded – undo
1241 1241
 	*	to form fields. (input, dropdowns, buttons etc.)
1242 1242
 	* 	@since v5.5 re-write
1243 1243
 	**/
1244
-	public function is_user_mc_api_valid_form( $echo = true ) {
1245
-		if ( $echo == true ) {
1246
-			if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
1244
+	public function is_user_mc_api_valid_form( $echo = true ) {
1245
+		if ( $echo == true ) {
1246
+			if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
1247 1247
 				echo 'disabled="disabled"';
1248 1248
 			}
1249
-		} else {
1250
-			if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
1249
+		} else {
1250
+			if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
1251 1251
 				return false;
1252
-			} else {
1252
+			} else {
1253 1253
 				return true;
1254 1254
 			}
1255 1255
 		}
@@ -1264,11 +1264,11 @@  discard block
 block discarded – undo
1264 1264
 	 * @param      string    $yikes_inc_easy_mailchimp_extender       The name of this plugin.
1265 1265
 	 * @param      string    $version    The version of this plugin.
1266 1266
 	 */
1267
-	public function check_for_old_yks_mc_options() {
1267
+	public function check_for_old_yks_mc_options() {
1268 1268
 		$old_plugin_options = get_option( 'ykseme_storage' );
1269 1269
 		// only perform options migrations if the site is not a multi-site setup
1270
-		if ( !is_multisite() ) {
1271
-			if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) {
1270
+		if ( !is_multisite() ) {
1271
+			if ( apply_filters( 'yikes_mc_old_options_filter', $old_plugin_options ) ) {
1272 1272
 				// display a notice to the user that they should 'migrate'
1273 1273
 				// from the old plugin settings to the new ones
1274 1274
 				add_action( 'admin_notices', array( $this , 'display_options_migrate_notice' ) , 11 );
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
 	 * moving from 5.5 and beyond..
1282 1282
 	 * @since
1283 1283
 	*/
1284
-	public function migrate_old_yks_mc_options() {
1284
+	public function migrate_old_yks_mc_options() {
1285 1285
 		// include our migrate options helper file
1286 1286
 		include_once YIKES_MC_PATH . 'admin/partials/upgrade-helpers/upgrade-migrate-options.php';
1287 1287
 	}
@@ -1300,15 +1300,15 @@  discard block
 block discarded – undo
1300 1300
 		 * @param      string    $yikes_inc_easy_mailchimp_extender       The name of this plugin.
1301 1301
 		 * @param      string    $version    The version of this plugin.
1302 1302
 		 */
1303
-		public function display_options_migrate_notice() {
1303
+		public function display_options_migrate_notice() {
1304 1304
 
1305 1305
 			// Confirm that the necessary forms table in the database exists, else bail
1306 1306
 			global $wpdb;
1307
-			if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) {
1307
+			if ( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) {
1308 1308
 				return;
1309 1309
 			}
1310 1310
 
1311
-			if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) {
1311
+			if ( isset( $_GET['yikes-mc-options-migration-dismissed'] ) && $_GET['yikes-mc-options-migration-dismissed'] == 'true' ) {
1312 1312
 					// Delete the options, start a-new! (this will disable the migration notice altogether)
1313 1313
 					delete_option( 'widget_yikes_mc_widget' );
1314 1314
 					delete_option( 'api_validation' );
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 						<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>
1320 1320
 					</div>
1321 1321
 				<?php
1322
-			} else {
1322
+			} else {
1323 1323
 			?>
1324 1324
 				<div class="yikes-easy-mc-updated migrate-options-notice">
1325 1325
 					<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>
@@ -1347,9 +1347,9 @@  discard block
 block discarded – undo
1347 1347
 		*	and return the index ( used to find the list name assigned to a form )
1348 1348
 		*	- http://stackoverflow.com/questions/6661530/php-multi-dimensional-array-search
1349 1349
 		*/
1350
-		function findMCListID($id, $array) {
1351
-		   foreach ($array as $key => $val) {
1352
-			   if ($val['id'] === $id) {
1350
+		function findMCListID($id, $array) {
1351
+		   foreach ($array as $key => $val) {
1352
+			   if ($val['id'] === $id) {
1353 1353
 				   return $key;
1354 1354
 			   }
1355 1355
 		   }
@@ -1357,14 +1357,14 @@  discard block
 block discarded – undo
1357 1357
 		} // end
1358 1358
 
1359 1359
 		/* Ajax Migrate Options */
1360
-		function migrate_archived_options() {
1360
+		function migrate_archived_options() {
1361 1361
 			// all options prefixed with 'yikes-mc-'
1362 1362
 			$option_name = 'yikes-mc-'.$_POST['option_name'];
1363 1363
 			$option_value = $_POST['option_value'];
1364
-			if ( json_decode( $option_value ) ) {
1364
+			if ( json_decode( $option_value ) ) {
1365 1365
 				// decode our lists() array, and store it
1366 1366
 				$opt_value = json_decode( $option_value, true );
1367
-			} else {
1367
+			} else {
1368 1368
 				$opt_value = $option_value;
1369 1369
 			}
1370 1370
 			update_option( $option_name, $opt_value );
@@ -1373,12 +1373,12 @@  discard block
 block discarded – undo
1373 1373
 		}
1374 1374
 
1375 1375
 		/* Ajax Migrate Forms */
1376
-		function migrate_previously_setup_forms() {
1376
+		function migrate_previously_setup_forms() {
1377 1377
 			$option_name = $_POST['option_name'];
1378 1378
 			$done = $_POST['done_import'];
1379 1379
 			// Create some starter forms for the user
1380 1380
 			// based on previously imported lists (to our old version)
1381
-			if ( $option_name == 'yikes-mc-lists' ) {
1381
+			if ( $option_name == 'yikes-mc-lists' ) {
1382 1382
 				$option_value = $_POST['option_value'];
1383 1383
 				$new_options = json_decode( stripslashes_deep( $option_value ) , true );
1384 1384
 
@@ -1410,9 +1410,9 @@  discard block
 block discarded – undo
1410 1410
 					'custom_fields'           => '',
1411 1411
 				) );
1412 1412
 			}
1413
-			if ( $done == 'done' ) {
1413
+			if ( $done == 'done' ) {
1414 1414
 				wp_send_json( array( 'form_name' => $form_name, 'completed_import' => true ) );
1415
-			} else {
1415
+			} else {
1416 1416
 				wp_send_json( array( 'form_name' => $form_name, 'completed_import' => false ) );
1417 1417
 			}
1418 1418
 			wp_die();
@@ -1424,8 +1424,8 @@  discard block
 block discarded – undo
1424 1424
 		*	Render our sidebar menu on all of the setings pages (general, form, checkbox, recaptcha, popup, debug etc. )
1425 1425
 		*	@since v5.6 - complete re-write
1426 1426
 		*/
1427
-		public function generate_options_pages_sidebar_menu() {
1428
-			if ( isset( $_REQUEST['section'] ) ) {
1427
+		public function generate_options_pages_sidebar_menu() {
1428
+			if ( isset( $_REQUEST['section'] ) ) {
1429 1429
 				$selected = $_REQUEST['section'];
1430 1430
 			}
1431 1431
 			$installed_addons = get_option( 'yikes-easy-mc-active-addons', array() );
@@ -1452,13 +1452,13 @@  discard block
 block discarded – undo
1452 1452
 					</ul>
1453 1453
 					<?php
1454 1454
 						// create our add-on settings pages
1455
-						if ( !empty( $installed_addons ) ) {
1455
+						if ( !empty( $installed_addons ) ) {
1456 1456
 							?>
1457 1457
 							<hr class="add-on-settings-divider" />
1458 1458
 							<strong><?php _e( 'Addon Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></strong>
1459 1459
 							<ul id="addon-settings-nav">
1460 1460
 							<?php
1461
-							foreach( $installed_addons as $addon_name ) {
1461
+							foreach( $installed_addons as $addon_name ) {
1462 1462
 								?>
1463 1463
 									<li>
1464 1464
 										<?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&section='.$addon_name ) ) ); ?>"><?php echo ucwords( str_replace( '-', ' ', $addon_name ) ); ?></a></li>
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
 		*	Render our sidebar menu on all of the setings pages (general, form, checkbox, recaptcha, popup, debug etc. )
1479 1479
 		*	@since v5.6 - complete re-write
1480 1480
 		*/
1481
-		public function generate_manage_forms_sidebar( $lists ) {
1481
+		public function generate_manage_forms_sidebar( $lists ) {
1482 1482
 			// create a custom URL to allow for creating fields
1483 1483
 			$url = esc_url_raw(
1484 1484
 				add_query_arg(
@@ -1509,18 +1509,18 @@  discard block
 block discarded – undo
1509 1509
 					<label for="associated-list"><strong><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?></strong>
1510 1510
 						<select name="associated-list" id="associated-list" class=" input-field" <?php $this->is_user_mc_api_valid_form( true ); disabled( true, empty( $lists ) ); ?>>
1511 1511
 							<?php
1512
-							if ( ! empty( $lists ) ) {
1513
-								foreach( $lists as $mailing_list ) {
1512
+							if ( ! empty( $lists ) ) {
1513
+								foreach( $lists as $mailing_list ) {
1514 1514
 									?>
1515 1515
 									<option value="<?php echo $mailing_list['id']; ?>"><?php echo stripslashes( $mailing_list['name'] ) . ' (' . $mailing_list['stats']['member_count'] . ') '; ?></option>
1516 1516
 									<?php
1517 1517
 								}
1518
-							} else {
1519
-								if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
1518
+							} else {
1519
+								if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
1520 1520
 									?>
1521 1521
 									<option><?php echo __( "Please enter a valid API key." , 'yikes-inc-easy-mailchimp-extender' ); ?></option>
1522 1522
 									<?php
1523
-								} else {
1523
+								} else {
1524 1524
 									?>
1525 1525
 									<option><?php echo __( "No lists were found on the account." , 'yikes-inc-easy-mailchimp-extender' ); ?></option>
1526 1526
 									<?php
@@ -1531,8 +1531,8 @@  discard block
 block discarded – undo
1531 1531
 						</select>
1532 1532
 
1533 1533
 						<?php
1534
-						if ( isset( $_GET['transient-cleared'] ) ) {
1535
-							if ( 'true' === $_GET['transient-cleared'] ) {
1534
+						if ( isset( $_GET['transient-cleared'] ) ) {
1535
+							if ( 'true' === $_GET['transient-cleared'] ) {
1536 1536
 								?>
1537 1537
 								<div class="yikes-list-refreshed-notice">
1538 1538
 									<p><?php esc_attr_e( 'MailChimp list data has been succesfully refreshed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
@@ -1541,8 +1541,8 @@  discard block
 block discarded – undo
1541 1541
 							}
1542 1542
 						}
1543 1543
 
1544
-						if ( isset( $lists ) && empty( $lists ) ) {
1545
-							if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) {
1544
+						if ( isset( $lists ) && empty( $lists ) ) {
1545
+							if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'invalid_api_key' ) {
1546 1546
 								?>
1547 1547
 									<p class="description">
1548 1548
 										<?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' ) ); ?>
@@ -1553,9 +1553,9 @@  discard block
 block discarded – undo
1553 1553
 						?>
1554 1554
 					</label>
1555 1555
 					<?php
1556
-						if ( $this->is_user_mc_api_valid_form( false ) ) {
1556
+						if ( $this->is_user_mc_api_valid_form( false ) ) {
1557 1557
 							echo submit_button( __( 'Create', 'yikes-inc-easy-mailchimp-extender' ) , 'primary', '', false , array( 'style' => 'margin:.75em 0 .5em 0;' ) );
1558
-						} else {
1558
+						} else {
1559 1559
 							echo '<p class="description">' . __( "Please enter a valid MailChimp API key to get started." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
1560 1560
 							?>
1561 1561
 								<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>
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
 
1567 1567
 				<!-- Clear API CACHE -->
1568 1568
 				<?php
1569
-				if ( isset( $lists ) && ! empty( $lists ) ) {
1569
+				if ( isset( $lists ) && ! empty( $lists ) ) {
1570 1570
 					if ( false !== get_transient( 'yikes-easy-mailchimp-list-data' ) ) { ?>
1571 1571
 						<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">
1572 1572
 							<input type="submit" class="button-secondary clear-mailchimp-api-cache" value="<?php _e( 'Refresh Lists', 'yikes-inc-easy-mailchimp-extender' ); ?>" />
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
 		*	Generate a dropdown of post and pages
1583 1583
 		*	so the user can send the user to on form submission
1584 1584
 		*/
1585
-		public function generate_page_redirect_dropdown( $redirect, $redirect_page, $custom_redirect_url ) {
1585
+		public function generate_page_redirect_dropdown( $redirect, $redirect_page, $custom_redirect_url ) {
1586 1586
 				$post_types = get_post_types();
1587 1587
 				?>
1588 1588
 				<label id="redirect-user-to-selection-label" for="redirect-user-to-selection" class="<?php if ( $redirect == '0' ) { echo 'yikes-easy-mc-hidden'; } ?>">
@@ -1602,10 +1602,10 @@  discard block
 block discarded – undo
1602 1602
 					$excluded_post_types = apply_filters( 'yikes-mailchimp-excluded-redirect-post-types', $excluded_post_types );
1603 1603
 
1604 1604
 						// loop over registered post types, and query!
1605
-						foreach( $post_types as $registered_post_type ) {
1605
+						foreach( $post_types as $registered_post_type ) {
1606 1606
 
1607 1607
 							// exclude a few built in custom post types and any defined by the filter
1608
-							if ( ! in_array( $registered_post_type, $excluded_post_types ) ) {
1608
+							if ( ! in_array( $registered_post_type, $excluded_post_types ) ) {
1609 1609
 
1610 1610
 								// Grab only the post IDs - in the past we've created timeout issues on some servers with lots of posts
1611 1611
 								$wp_query_args = array(
@@ -1620,11 +1620,11 @@  discard block
 block discarded – undo
1620 1620
 
1621 1621
 								$post_ids = ! empty( $wp_query_result->posts ) ? $wp_query_result->posts : array();
1622 1622
 
1623
-								if ( ! empty ( $post_ids ) ) {
1623
+								if ( ! empty ( $post_ids ) ) {
1624 1624
 									?>
1625 1625
 										<optgroup label="<?php echo ucwords( str_replace( '_', ' ', $registered_post_type ) ); ?>">
1626 1626
 									<?php
1627
-											foreach( $post_ids as $post_id ) {
1627
+											foreach( $post_ids as $post_id ) {
1628 1628
 												?><option <?php selected( $redirect_page , $post_id ); ?> value="<?php echo $post_id; ?>"><?php echo get_the_title( $post_id ) ?></option><?php
1629 1629
 											}
1630 1630
 									?>
@@ -1655,14 +1655,14 @@  discard block
 block discarded – undo
1655 1655
 		*
1656 1656
 		* 	Displayed in sidebars
1657 1657
 		*/
1658
-		public function generate_show_some_love_container() {
1658
+		public function generate_show_some_love_container() {
1659 1659
 			// if no active add-ons are installed,
1660 1660
 			// lets display our branding and add-on sidebar
1661
-			if ( empty( get_option( 'yikes-easy-mc-active-addons', array() ) ) ) {
1661
+			if ( empty( get_option( 'yikes-easy-mc-active-addons', array() ) ) ) {
1662 1662
 
1663 1663
 				/* On Edit Forms Page Display Upsell to Customizer */
1664 1664
 				$screen = get_current_screen();
1665
-				if ( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) {
1665
+				if ( isset( $screen ) && $screen->base == 'admin_page_yikes-mailchimp-edit-form' ) {
1666 1666
 				?>
1667 1667
 
1668 1668
 					<div class="postbox yikes-easy-mc-postbox show-some-love-container">
@@ -1740,18 +1740,18 @@  discard block
 block discarded – undo
1740 1740
 		*	-
1741 1741
 		* @parameters - $list_id - pass in the list ID to retreive merge variables from
1742 1742
 		*/
1743
-		public function generate_form_editor( $form_fields, $list_id, $merge_variables, $interest_groups ) {
1743
+		public function generate_form_editor( $form_fields, $list_id, $merge_variables, $interest_groups ) {
1744 1744
 
1745 1745
 			// if no list id, die!
1746
-			if ( ! $list_id ) {
1746
+			if ( ! $list_id ) {
1747 1747
 				wp_die( __( "We've encountered an error. No list ID was sent." , 'yikes-inc-easy-mailchimp-extender' ) );
1748 1748
 			}
1749 1749
 
1750
-			if ( ! $merge_variables ) {
1750
+			if ( ! $merge_variables ) {
1751 1751
 				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' ) );
1752 1752
 			}
1753 1753
 
1754
-			if ( ! empty( $form_fields ) ) {
1754
+			if ( ! empty( $form_fields ) ) {
1755 1755
 
1756 1756
 				// find any fields that are assigned to this form, that don't exist in MailChimp
1757 1757
 				// or else were going to run into issues when we submit the form
@@ -1763,18 +1763,18 @@  discard block
 block discarded – undo
1763 1763
 				$mailchimp_merge_field_ids	= array();
1764 1764
 
1765 1765
 				// loop over merge variables
1766
-				if ( ! empty( $merge_variables['merge_fields'] ) ) {
1766
+				if ( ! empty( $merge_variables['merge_fields'] ) ) {
1767 1767
 					$available_merge_variables = wp_list_pluck( $merge_variables['merge_fields'], 'tag' );
1768 1768
 					$mailchimp_merge_field_ids = wp_list_pluck( $merge_variables['merge_fields'], 'merge_id' );
1769 1769
 					
1770 1770
 					// Array will look like $merge_tag => $merge_id
1771
-					foreach( $available_merge_variables as $index => $merge_tag ) { 
1771
+					foreach( $available_merge_variables as $index => $merge_tag ) {
1772 1772
 						$merge_field_ids[$merge_tag] = $mailchimp_merge_field_ids[$index];
1773 1773
 					}
1774 1774
 				}
1775 1775
 
1776 1776
 				// loop over interest groups
1777
-				if ( ! empty( $interest_groups ) ) {
1777
+				if ( ! empty( $interest_groups ) ) {
1778 1778
 					$available_interest_groups = array_keys( $interest_groups );
1779 1779
 				}
1780 1780
 
@@ -1784,9 +1784,9 @@  discard block
 block discarded – undo
1784 1784
 				$excluded_fields = array_diff( $assigned_fields, $merged_fields );
1785 1785
 
1786 1786
 				$i = 1;
1787
-				foreach( $form_fields as $field ) {
1787
+				foreach( $form_fields as $field ) {
1788 1788
 
1789
-					if ( isset( $field['merge'] ) ) {
1789
+					if ( isset( $field['merge'] ) ) {
1790 1790
 						// @todo: don't use in_array()
1791 1791
 						$excluded_field = in_array( $field['merge'], $excluded_fields, true );
1792 1792
 						?>
@@ -1820,7 +1820,7 @@  discard block
 block discarded – undo
1820 1820
 									<input type="hidden" class="yikes-mc-merge-field-id" name="field[<?php echo $field['merge']; ?>][id]" value="<?php echo $merge_field_ids[ $field['merge'] ] ?>" />  
1821 1821
 								<?php } ?>
1822 1822
 
1823
-								<?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
1823
+								<?php if ( $field['type'] == 'radio' || $field['type'] == 'dropdown' || $field['type'] == 'select' ) {
1824 1824
 									$choices = json_decode( $field['choices'], true );
1825 1825
 								?>
1826 1826
 									<input type="hidden" name="field[<?php echo $field['merge']; ?>][choices]" value='<?php echo esc_attr( json_encode( $choices ) ); ?>' />
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 										</tr>
1845 1845
 
1846 1846
 										<!-- Placeholder Value -->
1847
-										<?php switch( $field['type'] ) {
1847
+										<?php switch( $field['type'] ) {
1848 1848
 
1849 1849
 											case 'text':
1850 1850
 											case 'email':
@@ -1891,7 +1891,7 @@  discard block
 block discarded – undo
1891 1891
 										?>
1892 1892
 
1893 1893
 										<!-- Default Value -->
1894
-										<?php switch( $field['type'] ) {
1894
+										<?php switch( $field['type'] ) {
1895 1895
 											default:
1896 1896
 											case 'text':
1897 1897
 											case 'number':
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
 													<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 } ?> />
1908 1908
 													<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>
1909 1909
 													<?php
1910
-													switch( $field['type'] ) {
1910
+													switch( $field['type'] ) {
1911 1911
 														case 'text':
1912 1912
 															?>
1913 1913
 																<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>
@@ -2064,7 +2064,7 @@  discard block
 block discarded – undo
2064 2064
 										<!-- Display Phone/Date Formats back to the user -->
2065 2065
 										<!-- Phone Format Initial Load -->
2066 2066
 										<?php
2067
-											switch( $field['type'] ) {
2067
+											switch( $field['type'] ) {
2068 2068
 												/* Store the phone format, for properly regex pattern */
2069 2069
 												case 'phone':
2070 2070
 												case 'birthday':
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
 															<td scope="row">
2075 2075
 																<label for="placeholder">
2076 2076
 																	<?php
2077
-																		switch( $field['type'] ) {
2077
+																		switch( $field['type'] ) {
2078 2078
 																			default:
2079 2079
 																			case 'birthday':
2080 2080
 																				$type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' );
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
 
2136 2136
 
2137 2137
 
2138
-					} else {
2138
+					} else {
2139 2139
 
2140 2140
 						/**** Interest Group ****/
2141 2141
 
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
 
2169 2169
 									<table class="form-table form-field-container">
2170 2170
 										<!-- Default Value -->
2171
-										<?php switch( $field['type'] ) {
2171
+										<?php switch( $field['type'] ) {
2172 2172
 											default:
2173 2173
 											case 'radio':
2174 2174
 											case 'checkboxes':
@@ -2185,7 +2185,7 @@  discard block
 block discarded – undo
2185 2185
 
2186 2186
 														$default_shown = false;
2187 2187
 
2188
-														foreach ( json_decode( $field['groups'], true ) as $id => $group ) {
2188
+														foreach ( json_decode( $field['groups'], true ) as $id => $group ) {
2189 2189
 															$field_id   = "{$field['group_id']}-{$id}";
2190 2190
 															$field_type = 'hidden' == $field['type'] ? 'checkbox' : $field['type'];
2191 2191
 															$field_type = 'checkboxes' == $field_type ? 'checkbox' : $field_type;
@@ -2194,7 +2194,7 @@  discard block
 block discarded – undo
2194 2194
 
2195 2195
 															// Determine if the current group is checked.
2196 2196
 															$checked = '';
2197
-															switch ( $field_type ) {
2197
+															switch ( $field_type ) {
2198 2198
 																case 'radio':
2199 2199
 																default:
2200 2200
 																	$default = is_array( $field['default_choice'] ) ? current( $field['default_choice'] ) : $field['default_choice'];
@@ -2203,14 +2203,14 @@  discard block
 block discarded – undo
2203 2203
 
2204 2204
 																case 'checkbox':
2205 2205
 																case 'hidden':
2206
-																	if ( is_array( $field['default_choice'] ) && in_array( $id, $field['default_choice'] ) ) {
2206
+																	if ( is_array( $field['default_choice'] ) && in_array( $id, $field['default_choice'] ) ) {
2207 2207
 																		$checked = checked( true, true, false );
2208 2208
 																	}
2209 2209
 																break;
2210 2210
 															}
2211 2211
 
2212 2212
 															// Allow users to not set a default choice for radio buttons.
2213
-															if ( $field_type === 'radio' && $default_shown === false ) {
2213
+															if ( $field_type === 'radio' && $default_shown === false ) {
2214 2214
 																$default_shown = true;
2215 2215
 																?>
2216 2216
 																<label for="<?php echo $field_id . 'no-default'; ?>">
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 						<?php
2364 2364
 					}
2365 2365
 				}
2366
-			} else {
2366
+			} else {
2367 2367
 				?>
2368 2368
 					<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>
2369 2369
 				<?php
@@ -2450,19 +2450,19 @@  discard block
 block discarded – undo
2450 2450
 		*	-
2451 2451
 		* @parameters - $list_id - pass in the list ID to retreive merge variables from
2452 2452
 		*/
2453
-		public function build_available_merge_vars( $form_fields , $available_merge_variables ) {
2453
+		public function build_available_merge_vars( $form_fields , $available_merge_variables ) {
2454 2454
 			$fields_assigned_to_form = array();
2455
-			foreach ( $form_fields as $field ) {
2456
-				if ( isset( $field['merge'] ) ) {
2455
+			foreach ( $form_fields as $field ) {
2456
+				if ( isset( $field['merge'] ) ) {
2457 2457
 					$fields_assigned_to_form[ $field['merge'] ] = true;
2458 2458
 				}
2459 2459
 			}
2460 2460
 
2461
-			if ( ! empty( $available_merge_variables['merge_fields'] ) ) {
2461
+			if ( ! empty( $available_merge_variables['merge_fields'] ) ) {
2462 2462
 				?>
2463 2463
 				<ul id="available-fields"><?php
2464
-				foreach ( $available_merge_variables['merge_fields'] as $merge_var ) {
2465
-					if ( isset( $fields_assigned_to_form[ $merge_var['tag'] ] ) ) {
2464
+				foreach ( $available_merge_variables['merge_fields'] as $merge_var ) {
2465
+					if ( isset( $fields_assigned_to_form[ $merge_var['tag'] ] ) ) {
2466 2466
 						?>
2467 2467
 						<li class="available-form-field not-available"
2468 2468
 						    alt="<?php echo $merge_var['tag']; ?>"
@@ -2472,13 +2472,13 @@  discard block
 block discarded – undo
2472 2472
 						    title="<?php esc_attr_e( 'Already assigned to your form', 'yikes-inc-easy-mailchimp-extender' ); ?>"
2473 2473
 						    disabled="disabled">
2474 2474
 							<?php echo stripslashes( $merge_var['name'] );
2475
-							if ( $merge_var['required'] ) {
2475
+							if ( $merge_var['required'] ) {
2476 2476
 								echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>';
2477 2477
 							} ?>
2478 2478
 							<small class="field-type-text"><?php echo $merge_var['type']; ?></small>
2479 2479
 						</li>
2480 2480
 						<?php
2481
-					} else {
2481
+					} else {
2482 2482
 						?>
2483 2483
 						<li class="available-form-field"
2484 2484
 						    alt="<?php echo $merge_var['tag']; ?>"
@@ -2486,7 +2486,7 @@  discard block
 block discarded – undo
2486 2486
 						    data-attr-field-name="<?php echo esc_attr( $merge_var['name'] ); ?>"
2487 2487
 						    data-attr-form-id="<?php echo esc_attr( $available_merge_variables['list_id'] ); ?>">
2488 2488
 							<?php echo stripslashes( $merge_var['name'] );
2489
-							if ( $merge_var['required'] ) {
2489
+							if ( $merge_var['required'] ) {
2490 2490
 								echo ' <span class="field-required" title="' . __( 'required field', 'yikes-inc-easy-mailchimp-extender' ) . '">*</span>';
2491 2491
 							} ?>
2492 2492
 							<small class="field-type-text"><?php echo $merge_var['type']; ?></small>
@@ -2511,21 +2511,21 @@  discard block
 block discarded – undo
2511 2511
 		*	-
2512 2512
 		* @parameters - $list_id - pass in the list ID to retreive merge variables from
2513 2513
 		*/
2514
-		public function build_available_interest_groups( $form_fields , $available_interest_groups , $list_id ) {
2514
+		public function build_available_interest_groups( $form_fields , $available_interest_groups , $list_id ) {
2515 2515
 			$fields_assigned_to_form = array();
2516
-			if ( ! empty( $form_fields ) ) {
2517
-				foreach ( $form_fields as $field ) {
2518
-					if ( isset( $field['group_id'] ) ) {
2516
+			if ( ! empty( $form_fields ) ) {
2517
+				foreach ( $form_fields as $field ) {
2518
+					if ( isset( $field['group_id'] ) ) {
2519 2519
 						$fields_assigned_to_form[ $field['group_id'] ] = true;
2520 2520
 					}
2521 2521
 				}
2522 2522
 			}
2523 2523
 
2524
-			if ( ! empty( $available_interest_groups ) ) {
2524
+			if ( ! empty( $available_interest_groups ) ) {
2525 2525
 				?>
2526 2526
 				<ul id="available-interest-groups"><?php
2527
-				foreach ( $available_interest_groups as $interest_group ) {
2528
-					if ( isset( $fields_assigned_to_form[ $interest_group['id'] ] ) ) {
2527
+				foreach ( $available_interest_groups as $interest_group ) {
2528
+					if ( isset( $fields_assigned_to_form[ $interest_group['id'] ] ) ) {
2529 2529
 						?>
2530 2530
 						<li class="available-interest-group not-available" 
2531 2531
 							alt="<?php echo $interest_group['id']; ?>" 
@@ -2538,7 +2538,7 @@  discard block
 block discarded – undo
2538 2538
 							<small class="field-type-text"><?php echo $interest_group['type']; ?></small>
2539 2539
 						</li>
2540 2540
 						<?php
2541
-					} else {
2541
+					} else {
2542 2542
 						?>
2543 2543
 						<li class="available-interest-group" 
2544 2544
 							alt="<?php echo $interest_group['id']; ?>" 
@@ -2568,9 +2568,9 @@  discard block
 block discarded – undo
2568 2568
 		*	and include it here for easy maintenance
2569 2569
 		*	- must clean up db tables , ensure what data is going in and what is needed...
2570 2570
 		*/
2571
-		public function yikes_easy_mailchimp_create_form() {
2571
+		public function yikes_easy_mailchimp_create_form() {
2572 2572
 			$nonce = $_REQUEST['nonce'];
2573
-			if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) {
2573
+			if ( ! wp_verify_nonce( $nonce, 'create_mailchimp_form' ) ) {
2574 2574
 				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) );
2575 2575
 			}
2576 2576
 
@@ -2581,13 +2581,13 @@  discard block
 block discarded – undo
2581 2581
 			) );
2582 2582
 
2583 2583
 			// if an error occurs during the form creation process
2584
-			if ( false == $result ) {
2584
+			if ( false == $result ) {
2585 2585
 				// write it to the error log
2586 2586
 				// if the form was not created successfully
2587 2587
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
2588 2588
 				$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' ) );
2589 2589
 				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' ) ) ) ) );
2590
-			} else {
2590
+			} else {
2591 2591
 				// redirect the user to the new form edit page
2592 2592
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $result) ) );
2593 2593
 			}
@@ -2600,12 +2600,12 @@  discard block
 block discarded – undo
2600 2600
 		*	and include it here for easy maintenance
2601 2601
 		*	- must clean up db tables , ensure what data is going in and what is needed...
2602 2602
 		*/
2603
-		public function yikes_easy_mailchimp_delete_form() {
2603
+		public function yikes_easy_mailchimp_delete_form() {
2604 2604
 			// grab & store our variables ( associated list & form name )
2605 2605
 			$nonce = $_REQUEST['nonce'];
2606 2606
 			$post_id_to_delete = $_REQUEST['mailchimp-form'];
2607 2607
 			// verify our nonce
2608
-			if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) {
2608
+			if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) {
2609 2609
 				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 ) );
2610 2610
 			}
2611 2611
 
@@ -2620,12 +2620,12 @@  discard block
 block discarded – undo
2620 2620
 		*	Duplicate an entire form !
2621 2621
 		*	Probably Move these to its own file,
2622 2622
 		*/
2623
-		public function yikes_easy_mailchimp_duplicate_form() {
2623
+		public function yikes_easy_mailchimp_duplicate_form() {
2624 2624
 			// grab & store our variables ( associated list & form name )
2625 2625
 			$nonce = $_REQUEST['nonce'];
2626 2626
 			$post_id_to_clone = $_REQUEST['mailchimp-form'];
2627 2627
 			// verify our nonce
2628
-			if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) {
2628
+			if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) {
2629 2629
 				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 ) );
2630 2630
 			}
2631 2631
 
@@ -2649,10 +2649,10 @@  discard block
 block discarded – undo
2649 2649
 			*/
2650 2650
 			do_action( 'yikes-mailchimp-after-duplicating-form', $post_id_to_clone, $result, $form_data );
2651 2651
 
2652
-			if ( false === $result ) {
2652
+			if ( false === $result ) {
2653 2653
 				// redirect the user to the manage forms page, display error
2654 2654
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&duplicated-form=false' ) ) );
2655
-			} else {
2655
+			} else {
2656 2656
 				// redirect the user to the manage forms page, display confirmation
2657 2657
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&duplicated-form=true' ) ) );
2658 2658
 			}
@@ -2663,12 +2663,12 @@  discard block
 block discarded – undo
2663 2663
 		/*
2664 2664
 		*	Reset a forms impression stats
2665 2665
 		*/
2666
-		public function yikes_easy_mailchimp_reset_impression_stats() {
2666
+		public function yikes_easy_mailchimp_reset_impression_stats() {
2667 2667
 			// grab & store our variables ( associated list & form name )
2668 2668
 			$nonce = $_REQUEST['nonce'];
2669 2669
 			$form_id_to_reset = $_REQUEST['mailchimp-form'];
2670 2670
 			// verify our nonce
2671
-			if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) {
2671
+			if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) {
2672 2672
 				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 ) );
2673 2673
 			}
2674 2674
 
@@ -2680,10 +2680,10 @@  discard block
 block discarded – undo
2680 2680
 				)
2681 2681
 			);
2682 2682
 
2683
-			if ( false === $result ) {
2683
+			if ( false === $result ) {
2684 2684
 				// redirect the user to the manage forms page, display error
2685 2685
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&reset-stats=false' ) ) );
2686
-			} else {
2686
+			} else {
2687 2687
 				// redirect the user to the manage forms page, display confirmation
2688 2688
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&reset-stats=true' ) ) );
2689 2689
 			}
@@ -2695,13 +2695,13 @@  discard block
 block discarded – undo
2695 2695
 		*	Update an entire form !
2696 2696
 		*	Probably Move these to its own file,
2697 2697
 		*/
2698
-		public function yikes_easy_mailchimp_update_form() {
2698
+		public function yikes_easy_mailchimp_update_form() {
2699 2699
 
2700 2700
 			$nonce   = $_REQUEST['nonce'];
2701 2701
 			$form_id = $_REQUEST['id'];
2702 2702
 
2703 2703
 			// verify our nonce
2704
-			if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) {
2704
+			if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) {
2705 2705
 				wp_die(
2706 2706
 					__( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ),
2707 2707
 					__( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ),
@@ -2774,11 +2774,11 @@  discard block
 block discarded – undo
2774 2774
 
2775 2775
 			// additional custom fields (extensions / user defined fields)
2776 2776
 			$custom_fields = array();
2777
-			if ( isset( $_POST['custom-field'] ) ) {
2778
-				foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) {
2779
-					if ( is_array( $custom_value ) ) {
2777
+			if ( isset( $_POST['custom-field'] ) ) {
2778
+				foreach ( $_POST['custom-field'] as $custom_field => $custom_value ) {
2779
+					if ( is_array( $custom_value ) ) {
2780 2780
 						$custom_fields[ $custom_field ] = array_filter( stripslashes_deep( $custom_value ) ); // array_filters to remove empty items (don't save them!)
2781
-					} else {
2781
+					} else {
2782 2782
 						$custom_fields[ $custom_field ] = stripslashes( $custom_value );
2783 2783
 					}
2784 2784
 				}
@@ -2814,7 +2814,7 @@  discard block
 block discarded – undo
2814 2814
 			exit();
2815 2815
 		}
2816 2816
 
2817
-		public static function generate_default_email_body() {
2817
+		public static function generate_default_email_body() {
2818 2818
 			$email_body  = '<p>' . __( 'Greetings,', 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; 
2819 2819
 
2820 2820
 			$email_body .= '<p>';
@@ -2837,18 +2837,18 @@  discard block
 block discarded – undo
2837 2837
 		}
2838 2838
 
2839 2839
 		/* Unsubscribe a given user from our list */
2840
-		public function yikes_easy_mailchimp_unsubscribe_user() {
2840
+		public function yikes_easy_mailchimp_unsubscribe_user() {
2841 2841
 			$nonce    = $_REQUEST['nonce'];
2842 2842
 			$list_id  = $_REQUEST['mailchimp-list'];
2843 2843
 			$email_id = $_REQUEST['email_id'];
2844 2844
 
2845 2845
 			// verify our nonce
2846
-			if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) {
2846
+			if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) {
2847 2847
 				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 ) );
2848 2848
 			}
2849 2849
 
2850 2850
 			$response = yikes_get_mc_api_manager()->get_list_handler()->member_unsubscribe( $list_id, $email_id );
2851
-			if ( is_wp_error( $response ) ) {
2851
+			if ( is_wp_error( $response ) ) {
2852 2852
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
2853 2853
 				$error_logging->maybe_write_to_log(
2854 2854
 					$response->get_error_code(),
@@ -2861,22 +2861,22 @@  discard block
 block discarded – undo
2861 2861
 			exit;
2862 2862
 		}
2863 2863
 
2864
-		public function yikes_easy_mailchimp_create_missing_error_log() {
2864
+		public function yikes_easy_mailchimp_create_missing_error_log() {
2865 2865
 			// grab our nonnce
2866 2866
 			$nonce = $_REQUEST['nonce'];
2867 2867
 			// validate nonce
2868
-			if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) {
2868
+			if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) {
2869 2869
 				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 ) );
2870 2870
 			}
2871 2871
 			// setup the path to the error log
2872 2872
 			$error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' );
2873
-			try {
2873
+			try {
2874 2874
 				// create the file
2875 2875
 				fwrite( $error_log , '' );
2876 2876
 				// close out
2877 2877
 				fclose( $error_log );
2878 2878
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=debug-settings&error_log_created=true' ) ) );
2879
-			} catch ( Exception $e ) {
2879
+			} catch ( Exception $e ) {
2880 2880
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=debug-settings&error_log_created=false&error_message='.urlencode( $e->getMessage() ) ) ) );
2881 2881
 			}
2882 2882
 		}
@@ -2885,11 +2885,11 @@  discard block
 block discarded – undo
2885 2885
 		*	Clear Transient Data !
2886 2886
 		*	Probably Move these to its own file,
2887 2887
 		*/
2888
-		public function yikes_easy_mailchimp_clear_transient_data() {
2888
+		public function yikes_easy_mailchimp_clear_transient_data() {
2889 2889
 
2890 2890
 			// verify our nonce
2891 2891
 			$nonce = $_REQUEST['nonce'];
2892
-			if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) {
2892
+			if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) {
2893 2893
 				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 ) );
2894 2894
 			}
2895 2895
 
@@ -2897,14 +2897,14 @@  discard block
 block discarded – undo
2897 2897
 
2898 2898
 			// if the request came from the settings page, redirect to the settings page.
2899 2899
 			$referer = wp_get_referer();
2900
-			if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) {
2900
+			if ( $referer && ( strpos( $referer, 'yikes-inc-easy-mailchimp-settings' ) > 0 ) ) {
2901 2901
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=api-cache-settings&transient-cleared=true' ) ) );
2902
-			} elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) {
2902
+			} elseif ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'yikes-mailchimp-edit-form' && isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) {
2903 2903
 
2904 2904
 				// else check if we were editing a form.
2905 2905
 				$id = filter_var( $_REQUEST['id'], FILTER_SANITIZE_NUMBER_INT );
2906 2906
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $id ) ) );
2907
-			} else {
2907
+			} else {
2908 2908
 				// else redirect to the manage forms page.
2909 2909
 				wp_redirect( esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp&transient-cleared=true' ) ) );
2910 2910
 			}
@@ -2920,17 +2920,17 @@  discard block
 block discarded – undo
2920 2920
 		 * @since 6.0.2
2921 2921
 		 * @return $list_id_array - array of list id's to loop over
2922 2922
 		 */
2923
-		public function get_mailchimp_list_ids_on_account() {
2923
+		public function get_mailchimp_list_ids_on_account() {
2924 2924
 			$api_key = yikes_get_mc_api_key();
2925
-			if ( ! $api_key ) {
2925
+			if ( ! $api_key ) {
2926 2926
 				// if no api key is set/site is not connected, return an empty array.
2927 2927
 				return array();
2928 2928
 			}
2929 2929
 
2930 2930
 			$lists = get_transient( 'yikesinc_eme_list_ids' );
2931
-			if ( false === $lists ) {
2931
+			if ( false === $lists ) {
2932 2932
 				$lists = yikes_get_mc_api_manager()->get_list_handler()->get_list_ids();
2933
-				if ( is_wp_error( $lists ) ) {
2933
+				if ( is_wp_error( $lists ) ) {
2934 2934
 					return array();
2935 2935
 				}
2936 2936
 				set_transient( 'yikesinc_eme_list_ids', $lists, HOUR_IN_SECONDS );
@@ -2944,9 +2944,9 @@  discard block
 block discarded – undo
2944 2944
 		 *
2945 2945
 		 *	@since 6.0
2946 2946
 		 */
2947
-		public function yikes_mailchimp_load_helper_class() {
2947
+		public function yikes_mailchimp_load_helper_class() {
2948 2948
 			// check to see if it's already loaded up.
2949
-			if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
2949
+			if ( !class_exists( 'Yikes_Inc_Easy_Mailchimp_Forms_Helper' ) ) {
2950 2950
 				// Include our main helper class file
2951 2951
 				include_once( YIKES_MC_PATH . 'admin/partials/helpers/init.php' );
2952 2952
 			}
@@ -2959,11 +2959,11 @@  discard block
 block discarded – undo
2959 2959
 		 * @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)
2960 2960
 		 * @return print out custom styles to the admin header to alter the default blue color
2961 2961
 		 */
2962
-		public function alter_yikes_easy_mc_color_scheme() {
2962
+		public function alter_yikes_easy_mc_color_scheme() {
2963 2963
 			// get the current set color scheme for the logged in user
2964 2964
 			$current_color_scheme = get_user_option( 'admin_color' );
2965 2965
 			// switch over each color scheme, and set our variable
2966
-			switch ( $current_color_scheme ) {
2966
+			switch ( $current_color_scheme ) {
2967 2967
 				default:
2968 2968
 				case 'fresh': // default blue (defined by this plugin)
2969 2969
 					$main_color = '#00a0d2';
@@ -3011,16 +3011,16 @@  discard block
 block discarded – undo
3011 3011
 		/**
3012 3012
 		 *	Display premium support page if any add-ons are installed, otherwise display free support page
3013 3013
 		 */
3014
-		public function display_support_page_content() {
3014
+		public function display_support_page_content() {
3015 3015
 
3016 3016
 			$addons = get_option( 'yikes-easy-mc-active-addons', array() );
3017 3017
 
3018 3018
 			// If we have premium add-ons...
3019
-			if ( ! empty( $addons ) ) { 
3019
+			if ( ! empty( $addons ) ) {
3020 3020
 
3021 3021
 				// Add our premium support partial.
3022 3022
 				include_once( YIKES_MC_PATH . 'admin/partials/helpers/premium-support.php' );
3023
-			} else {
3023
+			} else {
3024 3024
 
3025 3025
 				// Otherwise add our free support partial.
3026 3026
 				include_once( YIKES_MC_PATH . 'admin/partials/helpers/free-support.php' );
@@ -3032,8 +3032,8 @@  discard block
 block discarded – undo
3032 3032
 		 *
3033 3033
 		 * @since 6.0.4
3034 3034
 		 */
3035
-		public function check_yikes_mc_table_version() {
3036
-			if ( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) {
3035
+		public function check_yikes_mc_table_version() {
3036
+			if ( get_option( 'yikes_mc_database_version', '0.00' ) < '1.0' ) {
3037 3037
 				require_once YIKES_MC_PATH . 'includes/class-yikes-inc-easy-mailchimp-extender-activator.php';
3038 3038
 				global $wpdb;
3039 3039
 				Yikes_Inc_Easy_Mailchimp_Extender_Activator::_activate_yikes_easy_mailchimp( $wpdb );
@@ -3047,7 +3047,7 @@  discard block
 block discarded – undo
3047 3047
 		 *
3048 3048
 		 * @since 6.0.4.4
3049 3049
 		 */
3050
-		public function process_subscriber_count_shortcode_in_form_descriptions( $form_description, $form_id ) {
3050
+		public function process_subscriber_count_shortcode_in_form_descriptions( $form_description, $form_id ) {
3051 3051
 			$form_description = str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $form_id . '"]' ), $form_description );
3052 3052
 			return $form_description;
3053 3053
 		}
@@ -3057,9 +3057,9 @@  discard block
 block discarded – undo
3057 3057
 		 *
3058 3058
 		 * @since 6.0.3
3059 3059
 		 */
3060
-		public function generate_edit_forms_upsell_ad() {
3060
+		public function generate_edit_forms_upsell_ad() {
3061 3061
 		$upsell_ads = glob( YIKES_MC_PATH . 'includes/upsells/*.php' );
3062
-		if ( $upsell_ads && ! empty( $upsell_ads ) ) {
3062
+		if ( $upsell_ads && ! empty( $upsell_ads ) ) {
3063 3063
 			$ad_count = absint( count( $upsell_ads ) - 1 );
3064 3064
 			$ad       = $upsell_ads[ mt_rand( 0, $ad_count ) ];
3065 3065
 			ob_start();
@@ -3076,11 +3076,11 @@  discard block
 block discarded – undo
3076 3076
 		 * Mainly used when the API key is altered, changed or removed.
3077 3077
 		 * @since 6.1.3
3078 3078
 		 */
3079
-		public function delete_yikes_mailchimp_transients() {
3079
+		public function delete_yikes_mailchimp_transients() {
3080 3080
 
3081 3081
 		// delete all of the list_id transients.
3082 3082
 		$list_ids = $this->get_mailchimp_list_ids_on_account();
3083
-		foreach ( $list_ids as $id ) {
3083
+		foreach ( $list_ids as $id ) {
3084 3084
 			delete_transient( "yikes_eme_list_{$id}" );
3085 3085
 			delete_transient( "yikes_eme_merge_variables_{$id}" );
3086 3086
 			delete_transient( "yikes_eme_interest_categories_{$id}" );
@@ -3100,13 +3100,13 @@  discard block
 block discarded – undo
3100 3100
 	 *
3101 3101
 	 * @author Jeremy Pry
3102 3102
 	 */
3103
-	public function check_db_version() {
3103
+	public function check_db_version() {
3104 3104
 		$option = get_option( 'yikes_easy_mailchimp_extender_version', '0.0.0' );
3105
-		if ( version_compare( $option, '6.2.0', '<' ) ) {
3105
+		if ( version_compare( $option, '6.2.0', '<' ) ) {
3106 3106
 			$this->convert_db_to_option();
3107 3107
 		}
3108 3108
 
3109
-		if ( version_compare( $option, YIKES_MC_VERSION, '<' ) ) {
3109
+		if ( version_compare( $option, YIKES_MC_VERSION, '<' ) ) {
3110 3110
 			update_option( 'yikes_easy_mailchimp_extender_version', YIKES_MC_VERSION );
3111 3111
 		}
3112 3112
 	}
@@ -3116,7 +3116,7 @@  discard block
 block discarded – undo
3116 3116
 	 *
3117 3117
 	 * @author Jeremy Pry
3118 3118
 	 */
3119
-	public function convert_db_to_option() {
3119
+	public function convert_db_to_option() {
3120 3120
 		/** @var wpdb */
3121 3121
 		global $wpdb;
3122 3122
 
@@ -3125,11 +3125,11 @@  discard block
 block discarded – undo
3125 3125
 		$form_option      = array();
3126 3126
 		$form_ids         = $db_interface->get_form_ids();
3127 3127
 
3128
-		if ( empty( $form_ids ) ) {
3128
+		if ( empty( $form_ids ) ) {
3129 3129
 			return;
3130 3130
 		}
3131 3131
 
3132
-		foreach ( $form_ids as $form_id ) {
3132
+		foreach ( $form_ids as $form_id ) {
3133 3133
 			$form_option[ $form_id ] = $db_interface->get_form( $form_id );
3134 3134
 		}
3135 3135
 
@@ -3141,7 +3141,7 @@  discard block
 block discarded – undo
3141 3141
 	 *
3142 3142
 	 * @author Jeremy Pry
3143 3143
 	 */
3144
-	public function register_optin_widget() {
3144
+	public function register_optin_widget() {
3145 3145
 		register_widget( 'Yikes_Inc_Easy_Mailchimp_Extender_Widget' );
3146 3146
 	}
3147 3147
 }
Please login to merge, or discard this patch.
public/classes/checkbox-integrations.php 1 patch
Braces   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 /**
10 10
  * Main Checkbox Integration class.
11 11
  */
12
-class Yikes_Easy_MC_Checkbox_Integration_Class {
12
+class Yikes_Easy_MC_Checkbox_Integration_Class {
13 13
 
14 14
 	/**
15 15
 	 * The integration type.
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return bool Whether the current user is subscribed to a list.
30 30
 	 */
31
-	public function is_user_already_subscribed( $type, $email = '' ) {
31
+	public function is_user_already_subscribed( $type, $email = '' ) {
32 32
 		// Make sure we have an email address to use.
33
-		if ( empty( $email ) ) {
34
-			if ( ! is_user_logged_in() ) {
33
+		if ( empty( $email ) ) {
34
+			if ( ! is_user_logged_in() ) {
35 35
 				return false;
36 36
 			}
37 37
 
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 
42 42
 		// Ensure we have a valid email.
43
-		if ( ! is_email( $email ) ) {
43
+		if ( ! is_email( $email ) ) {
44 44
 			return false;
45 45
 		}
46 46
 
47 47
 		// Convert the integration type to a list ID.
48 48
 		$checkbox_options = get_option( 'optin-checkbox-init', '' );
49
-		if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) {
49
+		if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) {
50 50
 			return false;
51 51
 		}
52 52
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 		$list_ids = is_array( $list_ids ) ? $list_ids : array( $list_ids );
55 55
 
56 56
 		// Go through each list...
57
-		foreach ( $list_ids as $list_id ) {
58
-			if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) {
57
+		foreach ( $list_ids as $list_id ) {
58
+			if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) {
59 59
 				return false;
60 60
 			}
61 61
 		}
@@ -74,19 +74,19 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return bool Whether the email is subscribed to the list.
76 76
 	 */
77
-	public function is_user_subscribed( $email, $list_id, $type ) {
77
+	public function is_user_subscribed( $email, $list_id, $type ) {
78 78
 		$email      = sanitize_email( $email );
79 79
 		$email_hash = md5( $email );
80 80
 
81 81
 		// Check the API to see the status.
82 82
 		$response = yikes_get_mc_api_manager()->get_list_handler()->get_member( $list_id, $email_hash, false );
83
-		if ( is_wp_error( $response ) ) {
83
+		if ( is_wp_error( $response ) ) {
84 84
 			$data = $response->get_error_data();
85 85
 
86 86
 			// If the error response is a 404, they are not subscribed.
87
-			if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) {
87
+			if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) {
88 88
 				return false;
89
-			} else {
89
+			} else {
90 90
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
91 91
 				$error_logging->maybe_write_to_log(
92 92
 					$response->get_error_code(),
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return string The HTML for the checkbox.
112 112
 	 */
113
-	public function yikes_get_checkbox() {
113
+	public function yikes_get_checkbox() {
114 114
 
115 115
 		// Get our options.
116 116
 		$checkbox_options = get_option( 'optin-checkbox-init', array() );
117 117
 		$has_list_ids     = isset( $checkbox_options[ $this->type ]['associated-list'] ) && '-' !== $checkbox_options[ $this->type ]['associated-list'];
118 118
 		$has_list_ids     = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ]['associated-list'], true );
119 119
 
120
-		if ( $has_list_ids ) {
120
+		if ( $has_list_ids ) {
121 121
 			$label    = isset( $checkbox_options[ $this->type ]['label'] ) && ! empty( trim( $checkbox_options[ $this->type ]['label'] ) ) ? trim( $checkbox_options[ $this->type ]['label'] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' );
122 122
 			$checked  = 'true' === $checkbox_options[ $this->type ]['precheck'] ? 'checked="checked"' : '';
123 123
 			$before   = apply_filters( 'yikes-mailchimp-before-checkbox-html', '' );
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 	 * @param string $type       The integration type.
145 145
 	 * @param array  $merge_vars The array of form data to send.
146 146
 	 */
147
-	public function subscribe_user_integration( $email, $type, $merge_vars ) {
147
+	public function subscribe_user_integration( $email, $type, $merge_vars ) {
148 148
 		$options = get_option( 'optin-checkbox-init', '' );
149 149
 
150 150
 		// Make sure we have a list ID.
151
-		if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) {
151
+		if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) {
152 152
 			// @todo: Throw some kind of error?
153 153
 			return;
154 154
 		}
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
 		// Check for an IP address.
159 159
 		$user_ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
160
-		if ( isset( $merge_vars['OPTIN_IP'] ) ) {
160
+		if ( isset( $merge_vars['OPTIN_IP'] ) ) {
161 161
 			$user_ip = sanitize_text_field( $merge_vars['OPTIN_IP'] );
162 162
 		}
163 163
 
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
 			'ip_signup'     => $user_ip,
174 174
 		);
175 175
 
176
-		foreach ( $list_ids as $list_id ) {
176
+		foreach ( $list_ids as $list_id ) {
177 177
 
178 178
 			$interests = isset( $options[ $type ]['interest-groups'] ) ? $options[ $type ]['interest-groups'] : array();
179 179
 			$interests = isset( $interests[ $list_id ] ) ? $interests[ $list_id ] : $interests;
180 180
 
181 181
 			// Only re-format and add interest groups if not empty.
182
-			if ( ! empty( $interests ) ) {
182
+			if ( ! empty( $interests ) ) {
183 183
 				$groups = array();
184 184
 
185 185
 				// Need to reformat interest groups array as $interest_group_ID => true.
186
-				foreach ( $interests as $interest ) {
187
-					if ( is_array( $interest ) ) {
188
-						foreach ( $interest as $group_id ) {
186
+				foreach ( $interests as $interest ) {
187
+					if ( is_array( $interest ) ) {
188
+						foreach ( $interest as $group_id ) {
189 189
 							$groups[ $group_id ] = true;
190 190
 						}
191 191
 					}
@@ -217,14 +217,14 @@  discard block
 block discarded – undo
217 217
 			$list_id = apply_filters( 'yikes-mailchimp-checkbox-integration-list-id', $list_id, $data, $type );
218 218
 
219 219
 			// Don't send an empty merge fields array.
220
-			if ( empty( $data['merge_fields'] ) ) {
220
+			if ( empty( $data['merge_fields'] ) ) {
221 221
 				unset( $data['merge_fields'] );
222 222
 			}
223 223
 
224 224
 			// Subscribe the user to the list via the API.
225 225
 			$response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, $id, $data );
226 226
 
227
-			if ( is_wp_error( $response ) ) {
227
+			if ( is_wp_error( $response ) ) {
228 228
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
229 229
 				$error_logging->maybe_write_to_log(
230 230
 					$response->get_error_code(),
@@ -242,15 +242,15 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @param WP_User $user A WP User.
244 244
 	 */
245
-	public function user_merge_vars( WP_User $user ) {
245
+	public function user_merge_vars( WP_User $user ) {
246 246
 
247 247
 		// Setup our array.
248 248
 		$merge_vars = array();
249 249
 
250
-		if ( ! empty( $user->first_name ) ) {
250
+		if ( ! empty( $user->first_name ) ) {
251 251
 			$merge_vars['FNAME'] = $user->first_name;
252 252
 		}
253
-		if ( ! empty( $user->last_name ) ) {
253
+		if ( ! empty( $user->last_name ) ) {
254 254
 			$merge_vars['LNAME'] = $user->last_name;
255 255
 		}
256 256
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 *
275 275
 	 * @return bool True if the checkbox was checked.
276 276
 	 */
277
-	public function was_checkbox_checked( $type ) {
277
+	public function was_checkbox_checked( $type ) {
278 278
 		return isset( $_POST[ 'yikes_mailchimp_checkbox_' . $type ] ) && '1' === filter_var( $_POST[ 'yikes_mailchimp_checkbox_' . $type ], FILTER_SANITIZE_STRING );
279 279
 	}
280 280
 }
Please login to merge, or discard this patch.
includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php 1 patch
Braces   +22 added lines, -21 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes
26 26
  * @author     YIKES Inc. <[email protected]>
27 27
  */
28
-class Yikes_Inc_Easy_Mailchimp_Error_Logging {
28
+class Yikes_Inc_Easy_Mailchimp_Error_Logging {
29 29
 
30 30
 	/**
31 31
 	 * Whether we're doing debugging.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @since    1.0.0
59 59
 	 */
60
-	public function __construct() {
60
+	public function __construct() {
61 61
 		$this->is_debugging          = WP_DEBUG || (string) get_option( 'yikes-mailchimp-debug-status', '' ) === '1';
62 62
 		$this->error_log_file_path   = $this->get_error_log_file_path();
63 63
 		$this->error_log_folder_path = $this->get_error_log_folder();
@@ -78,35 +78,35 @@  discard block
 block discarded – undo
78 78
 	 * @param string $error_type     The error type.
79 79
 	 * @param string $page           The page information.
80 80
 	 */
81
-	public function maybe_write_to_log( $returned_error, $error_type, $page = '' ) {
82
-		if ( ! $this->is_debugging ) {
81
+	public function maybe_write_to_log( $returned_error, $error_type, $page = '' ) {
82
+		if ( ! $this->is_debugging ) {
83 83
 			return;
84 84
 		}
85 85
 
86 86
 		$this->yikes_easy_mailchimp_write_to_error_log( $returned_error, $error_type, $page );
87 87
 	}
88 88
 
89
-	public function create_error_log_folder() {
89
+	public function create_error_log_folder() {
90 90
 
91 91
 		// If our directory doesn't exist, make it.
92
-		if ( ! file_exists( $this->get_error_log_folder() ) ) {
92
+		if ( ! file_exists( $this->get_error_log_folder() ) ) {
93 93
 			mkdir( $this->get_error_log_folder() );
94 94
 		}
95 95
 	}
96 96
 
97
-	public function create_error_log_file() {
97
+	public function create_error_log_file() {
98 98
 
99 99
 		// If our error log doesn't exist, make it.
100
-		if ( ! file_exists( $this->error_log_file_path ) ) {
100
+		if ( ! file_exists( $this->error_log_file_path ) ) {
101 101
 			file_put_contents( $this->error_log_file_path, '' );
102 102
 		}
103 103
 	}
104 104
 
105
-	private function get_error_log_folder() {
105
+	private function get_error_log_folder() {
106 106
 		return WP_CONTENT_DIR . '/uploads/yikes-log/';
107 107
 	}
108 108
 
109
-	private function get_error_log_file_path() {
109
+	private function get_error_log_file_path() {
110 110
 		return WP_CONTENT_DIR . '/uploads/yikes-log/yikes-easy-mailchimp-error-log.txt';
111 111
 	}
112 112
 	
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 	*	@returned_error 
123 123
 	*	@error_type - what was running when the error occured ie (new user subscription, remove user etc)
124 124
 	*/
125
-	public function yikes_easy_mailchimp_write_to_error_log( $returned_error , $error_type , $page='' ) {
125
+	public function yikes_easy_mailchimp_write_to_error_log( $returned_error , $error_type , $page='' ) {
126 126
 		
127 127
 		// confirm error logging is toggled on, else lets exit
128
-		if( get_option( 'yikes-mailchimp-debug-status' , '' )  != '1' ) {
128
+		if( get_option( 'yikes-mailchimp-debug-status' , '' )  != '1' ) {
129 129
 			return;
130 130
 		}
131 131
 		
132 132
 		$contents = file_get_contents( $this->error_log_file_path, true );
133 133
 		
134 134
 		// if we pass in a custom page, don't set things up
135
-		if ( empty( $page ) ) {
135
+		if ( empty( $page ) ) {
136 136
 
137 137
 			// get the current page, admin or front end?
138 138
 			$page = is_admin() ? __( 'Admin', 'yikes-inc-easy-mailchimp-extender' ) : __( 'Front End', 'yikes-inc-easy-mailchimp-extender' );
@@ -168,20 +168,20 @@  discard block
 block discarded – undo
168 168
 	*
169 169
 	*  @since 5.6
170 170
 	*/	
171
-	public function yikes_easy_mailchimp_generate_error_log_table() {		
171
+	public function yikes_easy_mailchimp_generate_error_log_table() {
172 172
 
173 173
 		// ensure file_get_contents exists
174
-		if( function_exists( 'file_get_contents' ) ) {	
174
+		if( function_exists( 'file_get_contents' ) ) {
175 175
 			// confirm that our file exists
176
-			if( file_exists( $this->error_log_file_path ) ) {
176
+			if( file_exists( $this->error_log_file_path ) ) {
177 177
 				$error_log_contents = file_get_contents( $this->error_log_file_path, true );							
178
-				if( $error_log_contents === FALSE ) {
178
+				if( $error_log_contents === FALSE ) {
179 179
 					return _e( 'File get contents not available' , 'yikes-inc-easy-mailchimp-extender' );
180 180
 				}
181
-				if ( $error_log_contents != '' ) {
181
+				if ( $error_log_contents != '' ) {
182 182
 					// return $error_log_contents;
183 183
 					print_r( $error_log_contents );
184
-				} else {
184
+				} else {
185 185
 					?>
186 186
 						<!-- table body -->
187 187
 						<tr class="error-log-tr">
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 						</tr>
196 196
 					<?php
197 197
 				}
198
-			} else {
198
+			} else {
199 199
 				?>
200 200
 						<!-- table body -->
201 201
 						<tr class="error-log-tr">
@@ -223,7 +223,8 @@  discard block
 block discarded – undo
223 223
 						</tr>
224 224
 					<?php
225 225
 			}
226
-		} else { // if file_get_contents is disabled server side
226
+		} else {
227
+// if file_get_contents is disabled server side
227 228
 			?>
228 229
 				<!-- table body -->
229 230
 				<tr>
Please login to merge, or discard this patch.