Completed
Push — staging ( 8d1e38...561133 )
by Evan
17:42
created
admin/partials/helpers/fields/yikes-mailchimp-checkbox-field.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
 	*	For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/]
6 6
 	* 	@since 6.0
7 7
 	*/
8
-	$field_data = json_decode( $form_data['custom_fields'] , true ); 
8
+	$field_data = json_decode( $form_data[ 'custom_fields' ], true ); 
9 9
 ?>
10 10
 <label class="custom-field-section">
11
-	<strong><?php echo $field['label']; ?></strong>
12
-	<input type="checkbox" class="widefat" name="custom-field[<?php echo $field['id']; ?>]" id="custom-field" value="1" <?php checked( isset( $field_data[$field['id']] ) ? $field_data[$field['id']] : 0, 1, true ); ?>>
13
-	<?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?>
14
-	<p class="description"><?php echo $field['description']; ?></p>
11
+	<strong><?php echo $field[ 'label' ]; ?></strong>
12
+	<input type="checkbox" class="widefat" name="custom-field[<?php echo $field[ 'id' ]; ?>]" id="custom-field" value="1" <?php checked( isset( $field_data[ $field[ 'id' ] ] ) ? $field_data[ $field[ 'id' ] ] : 0, 1, true ); ?>>
13
+	<?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?>
14
+	<p class="description"><?php echo $field[ 'description' ]; ?></p>
15 15
 	<?php } ?>
16 16
 </label>
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
admin/partials/helpers/fields/yikes-mailchimp-file-field.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,33 +5,33 @@
 block discarded – undo
5 5
 	*	For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/]
6 6
 	* 	@since 6.0
7 7
 	*/
8
-	$field_data = json_decode( $form_data['custom_fields'] , true ); 
8
+	$field_data = json_decode( $form_data[ 'custom_fields' ], true ); 
9 9
 	// This will enqueue the Media Uploader script
10 10
 	wp_enqueue_media();
11 11
 	// And let's not forget the script we wrote earlier
12 12
 	wp_enqueue_script( 'yikes-mailchimp-file-field-script', plugin_dir_url( __FILE__ ) . 'js/yikes-mc-file-upload.js', array( 'jquery' ), '1.0', false );
13 13
 	// print_r( $field_data );
14
-	wp_localize_script( 'yikes-mailchimp-file-field-script' , 'additional_data' , array(
14
+	wp_localize_script( 'yikes-mailchimp-file-field-script', 'additional_data', array(
15 15
 		'wp_includes_image_url' => includes_url() . 'images/media/'
16 16
 	) );
17 17
 	$i = 1;
18 18
 	// create an single item array when nothing is stored yet, loop for one field 
19
-	$field_data['incentive-attachment'] = ( isset( $field_data['incentive-attachment'] ) && !empty( $field_data['incentive-attachment'] ) )  ? $field_data['incentive-attachment'] : array( '' );
19
+	$field_data[ 'incentive-attachment' ] = ( isset( $field_data[ 'incentive-attachment' ] ) && ! empty( $field_data[ 'incentive-attachment' ] ) ) ? $field_data[ 'incentive-attachment' ] : array( '' );
20 20
 ?>
21 21
 	
22 22
 	<div class="yikes-mailchimp-file-field">
23
-		<label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label>
24
-		<?php foreach( $field_data['incentive-attachment'] as $attachment ) { ?>
25
-			<input type="text" name="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[$field['id']][$i] ) ? $field_data[$field['id']][$i] : ''; ?>">
26
-			<input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File' , 'yikes-inc-easy-mailchimp-extender' ); ?>">
23
+		<label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label>
24
+		<?php foreach ( $field_data[ 'incentive-attachment' ] as $attachment ) { ?>
25
+			<input type="text" name="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[ $field[ 'id' ] ][ $i ] ) ? $field_data[ $field[ 'id' ] ][ $i ] : ''; ?>">
26
+			<input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File', 'yikes-inc-easy-mailchimp-extender' ); ?>">
27 27
 			<div class="file-container">
28 28
 				<p class="file-remove-wrapper">
29
-					<a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File' , 'yikes-inc-easy-mailchimp-extender' ); ?></a>
29
+					<a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File', 'yikes-inc-easy-mailchimp-extender' ); ?></a>
30 30
 				</p>
31 31
 			</div>
32 32
 		<?php $i++; } ?>
33
-		<?php if( isset( $field['repeat'] ) ) { ?>
33
+		<?php if ( isset( $field[ 'repeat' ] ) ) { ?>
34 34
 			<a href="#" class="button-secondary add-new-incentive-attachment" data-attr-position="<?php echo $i; ?>"><span class="dashicons dashicons-plus"></span></a>
35 35
 		<?php } ?>
36
-		<p class="description"><?php echo $field['description']; ?></p>
36
+		<p class="description"><?php echo $field[ 'description' ]; ?></p>
37 37
 	</div>
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
admin/partials/helpers/knowledge-base-articles-RSS.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 		*	Loop over all of our queries set above
42 42
 		*	@sicne 6.0.3.8
43 43
 		*/
44
-		foreach( $kb_queries as $article_title => $rss_feed_url ) {
45
-			$page = ( isset( $_GET['page'] ) ) ? $_GET['page'] : 'yikes-inc-easy-mailchimp-support';
44
+		foreach ( $kb_queries as $article_title => $rss_feed_url ) {
45
+			$page = ( isset( $_GET[ 'page' ] ) ) ? $_GET[ 'page' ] : 'yikes-inc-easy-mailchimp-support';
46 46
 			/* Create the SimplePie object */
47 47
 			$article_feed = new SimplePie(); 
48 48
 			$article_feed->enable_cache( true ); // temporary
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 				return $article_feed = new WP_Error( 'simplepie-error', $article_feed->error() );
65 65
 			}
66 66
 			// loop over latest items
67
-			if( $article_feed->get_items() ) {
67
+			if ( $article_feed->get_items() ) {
68 68
 				?><ul class="knowledge-base-listing">
69 69
 					<li class="list-title"><?php echo $article_title; ?></li>
70 70
 				<?php
71
-					foreach( $article_feed->get_items( 0, 5 ) as $kb_article ) {
71
+					foreach ( $article_feed->get_items( 0, 5 ) as $kb_article ) {
72 72
 						// store the description
73 73
 						$description_pre_split = $kb_article->get_description();
74 74
 						$kb_article_permalink = esc_url_raw( $kb_article->get_permalink() );
Please login to merge, or discard this patch.
admin/partials/helpers/edit-form-hidden-section-template.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@  discard block
 block discarded – undo
8 8
 		// grab our global form_data;
9 9
 		global $form_data;
10 10
 	?>
11
-	<label class="hidden-setting-label yikes-easy-mc-hidden" for="form" id=<?php esc_attr_e( $section_data['id'] ); ?>>
11
+	<label class="hidden-setting-label yikes-easy-mc-hidden" for="form" id=<?php esc_attr_e( $section_data[ 'id' ] ); ?>>
12 12
 		<div id="poststuff">
13
-			<div id="post-body" class="metabox-holder <?php if( self::is_custom_section_two_column( $section_data ) ) { ?> columns-2 <?php } else { ?> columns-1 <?php } ?>">
13
+			<div id="post-body" class="metabox-holder <?php if ( self::is_custom_section_two_column( $section_data ) ) { ?> columns-2 <?php } else { ?> columns-1 <?php } ?>">
14 14
 				<div id="post-body-content">
15 15
 					<div class="meta-box-sortables ui-sortable">
16 16
 						<div class="postbox yikes-easy-mc-postbox">
17
-							<h3 class="edit-form-title"><span><?php echo $section_data['main_title']; ?></span></h3>
18
-								<div class="inside <?php esc_attr_e( $section_data['id'] ); ?>-container">
17
+							<h3 class="edit-form-title"><span><?php echo $section_data[ 'main_title' ]; ?></span></h3>
18
+								<div class="inside <?php esc_attr_e( $section_data[ 'id' ] ); ?>-container">
19 19
 									<?php 
20
-										if( isset( $section_data['main_description'] ) && $section_data['main_description'] != '' ) {
20
+										if ( isset( $section_data[ 'main_description' ] ) && $section_data[ 'main_description' ] != '' ) {
21 21
 											?>
22
-												<p><?php echo $section_data['main_description']; ?></p>
22
+												<p><?php echo $section_data[ 'main_description' ]; ?></p>
23 23
 											<?php
24 24
 										}
25
-										$main_field_data = $section_data['main_fields'];
26
-										foreach( $main_field_data as $field ) { 
27
-											if( $field['type'] == 'custom' ) {
25
+										$main_field_data = $section_data[ 'main_fields' ];
26
+										foreach ( $main_field_data as $field ) { 
27
+											if ( $field[ 'type' ] == 'custom' ) {
28 28
 												// execute the custom callback
29
-												$field['callback']();
29
+												$field[ 'callback' ]();
30 30
 											} else {
31 31
 												// include our field files
32
-												include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field['type'] . '-field.php' );
32
+												include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field[ 'type' ] . '-field.php' );
33 33
 											}
34 34
 										}
35 35
 									?>
@@ -39,27 +39,27 @@  discard block
 block discarded – undo
39 39
 					</div>
40 40
 					
41 41
 					<!-- check for single/double box -->
42
-					<?php if( self::is_custom_section_two_column( $section_data ) ) { ?>
42
+					<?php if ( self::is_custom_section_two_column( $section_data ) ) { ?>
43 43
 						<!-- begin sidebar -->
44 44
 						<div id="postbox-container-1" class="postbox-container">
45 45
 							<div class="meta-box-sortables">
46 46
 								<div class="postbox yikes-easy-mc-postbox">
47
-									<h3 class="edit-form-title"><span><?php echo $section_data['sidebar_title']; ?></span></h3>
48
-									<div class="inside <?php esc_attr_e( $section_data['id'] ); ?>-sidebar-container"> 
47
+									<h3 class="edit-form-title"><span><?php echo $section_data[ 'sidebar_title' ]; ?></span></h3>
48
+									<div class="inside <?php esc_attr_e( $section_data[ 'id' ] ); ?>-sidebar-container"> 
49 49
 										<?php
50
-											if( isset( $section_data['sidebar_description'] ) && $section_data['sidebar_description'] != '' ) {
50
+											if ( isset( $section_data[ 'sidebar_description' ] ) && $section_data[ 'sidebar_description' ] != '' ) {
51 51
 												?>
52
-													<p><?php echo $section_data['sidebar_description']; ?></p>
52
+													<p><?php echo $section_data[ 'sidebar_description' ]; ?></p>
53 53
 												<?php
54 54
 											}
55
-											$sidebar_field_data = $section_data['sidebar_fields'];
56
-											foreach( $sidebar_field_data as $field ) { 
57
-												if( $field['type'] == 'custom' ) {
55
+											$sidebar_field_data = $section_data[ 'sidebar_fields' ];
56
+											foreach ( $sidebar_field_data as $field ) { 
57
+												if ( $field[ 'type' ] == 'custom' ) {
58 58
 													// execute the custom callback
59
-													$field['callback']();
59
+													$field[ 'callback' ]();
60 60
 												} else {
61 61
 													// include our field files
62
-													include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field['type'] . '-field.php' );
62
+													include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field[ 'type' ] . '-field.php' );
63 63
 												}
64 64
 											}
65 65
 										?>
Please login to merge, or discard this patch.
admin/partials/front-end-widgets/front-end-widget-form.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 			// Widget name will appear in UI
15 15
 			__( 'Easy MailChimp Forms', 'yikes-inc-easy-mailchimp-extender' ), 
16 16
 			// Widget description
17
-			array( 'description' => __( 'MailChimp opt-in widget for your sidebar.', 'yikes-inc-easy-mailchimp-extender' ), ) 
17
+			array( 'description' => __( 'MailChimp opt-in widget for your sidebar.', 'yikes-inc-easy-mailchimp-extender' ),) 
18 18
 		);
19 19
 		
20 20
 	}
@@ -27,41 +27,41 @@  discard block
 block discarded – undo
27 27
 		global $wpdb;
28 28
 		$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms LIMIT 1', ARRAY_A );
29 29
 		
30
-		$title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : __( 'MailChimp Signup Form', 'yikes-inc-easy-mailchimp-extender' );
31
-		$form_id = isset( $instance['form_id'] ) ? $instance['form_id'] : $form_results[0]['id'];
32
-		$form_description = isset( $instance['form_description'] ) ? $instance['form_description'] : '';
33
-		$submit_button_text = isset( $instance['submit_text'] ) ? $instance['submit_text'] : __( 'Submit' , 'yikes-inc-easy-mailchimp-extender' );
30
+		$title = isset( $instance[ 'title' ] ) ? apply_filters( 'widget_title', $instance[ 'title' ] ) : __( 'MailChimp Signup Form', 'yikes-inc-easy-mailchimp-extender' );
31
+		$form_id = isset( $instance[ 'form_id' ] ) ? $instance[ 'form_id' ] : $form_results[ 0 ][ 'id' ];
32
+		$form_description = isset( $instance[ 'form_description' ] ) ? $instance[ 'form_description' ] : '';
33
+		$submit_button_text = isset( $instance[ 'submit_text' ] ) ? $instance[ 'submit_text' ] : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
34 34
 		
35 35
 		$shortcode_attributes = array();
36 36
 		// Build our array based on settings chosen
37
-		$sortcode_attributes[] = 'form="' . $form_id .'"';
37
+		$sortcode_attributes[ ] = 'form="' . $form_id . '"';
38 38
 		// form description
39
-		if( !empty( $form_description ) ) {
40
-			$sortcode_attributes[] = 'description="1"';
39
+		if ( ! empty( $form_description ) ) {
40
+			$sortcode_attributes[ ] = 'description="1"';
41 41
 		}
42 42
 		// submit button text
43
-		$sortcode_attributes[] = 'submit="' . $submit_button_text .'"';
43
+		$sortcode_attributes[ ] = 'submit="' . $submit_button_text . '"';
44 44
 		
45 45
 		// before and after widget arguments are defined by themes
46
-		echo $args['before_widget'];
46
+		echo $args[ 'before_widget' ];
47 47
 		
48 48
 			if ( ! empty( $title ) )
49
-				echo $args['before_title'] . $title . $args['after_title'];
49
+				echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
50 50
 				
51 51
 			// Custom action hooks to place content in the widget before the form
52 52
 			// See FAQ for examples on usage
53
-			do_action( 'yikes-mailchimp-before-form-'.$form_id );
53
+			do_action( 'yikes-mailchimp-before-form-' . $form_id );
54 54
 			do_action( 'yikes-mailchimp-before-form' );
55 55
 			
56 56
 			// This is where you run the code and display the output
57
-			echo do_shortcode( '[yikes-mailchimp ' . implode( ' ' , $sortcode_attributes ) . ']' );
57
+			echo do_shortcode( '[yikes-mailchimp ' . implode( ' ', $sortcode_attributes ) . ']' );
58 58
 			
59 59
 			// Custom action hooks to place content in the widget after the form
60 60
 			// See FAQ for examples on usage
61
-			do_action( 'yikes-mailchimp-after-form-'.$form_id );
61
+			do_action( 'yikes-mailchimp-after-form-' . $form_id );
62 62
 			do_action( 'yikes-mailchimp-after-form' );
63 63
 		
64
-		echo $args['after_widget'];
64
+		echo $args[ 'after_widget' ];
65 65
 		
66 66
 	}
67 67
 			
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 		global $wpdb;
73 73
 		$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms', ARRAY_A );
74 74
 	
75
-		if( empty( $form_results ) ) {
75
+		if ( empty( $form_results ) ) {
76 76
 			?>
77 77
 				<section class="no-forms-widget">
78
-				<strong><span class="dashicons dashicons-no-alt no-forms-found-icon"></span><?php echo sprintf( __( 'No forms found. It looks like you need to <a href="%s" title="%s">%s</a>.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ), __( 'Create a form' , 'yikes-inc-easy-mailchimp-extender' ), __( 'create a form' , 'yikes-inc-easy-mailchimp-extender' ) ); ?></strong>
78
+				<strong><span class="dashicons dashicons-no-alt no-forms-found-icon"></span><?php echo sprintf( __( 'No forms found. It looks like you need to <a href="%s" title="%s">%s</a>.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ), __( 'Create a form', 'yikes-inc-easy-mailchimp-extender' ), __( 'create a form', 'yikes-inc-easy-mailchimp-extender' ) ); ?></strong>
79 79
 				</section>
80 80
 			<?php
81 81
 			return;
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 				$submit_text = __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
103 103
 			}
104 104
 			
105
-			 if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) {
105
+			 if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) {
106 106
 				?>
107
-					<p class="enter-valid-api-error-widget"><strong><?php _e( 'Please enter a valid MailChimp API key to connect your site to MailChimp.' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p>
107
+					<p class="enter-valid-api-error-widget"><strong><?php _e( 'Please enter a valid MailChimp API key to connect your site to MailChimp.', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p>
108 108
 				<?php
109 109
 				return;
110 110
 			}
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 				<select id="<?php echo $this->get_field_id( 'form_id' ); ?>" name="<?php echo $this->get_field_name( 'form_id' ); ?>" class="widefat">
122 122
 					<?php 
123 123
 					// build our array
124
-					foreach( $form_results as $form ) {
124
+					foreach ( $form_results as $form ) {
125 125
 						?>
126
-							<option <?php selected( $selected_form , $form['id'] ); ?> name="<?php echo $this->get_field_name( 'form_id' ); ?>" value="<?php echo $form['id']; ?>"><?php echo stripslashes( $form['form_name'] ); ?></option>
126
+							<option <?php selected( $selected_form, $form[ 'id' ] ); ?> name="<?php echo $this->get_field_name( 'form_id' ); ?>" value="<?php echo $form[ 'id' ]; ?>"><?php echo stripslashes( $form[ 'form_name' ] ); ?></option>
127 127
 						<?php
128 128
 					}
129 129
 					?>
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		
133 133
 			<p>
134 134
 				<label for="<?php echo $this->get_field_id( 'form_description' ); ?>"><?php _e( 'Display Form Description:' ); ?></label> 
135
-				<input class="widefat" id="<?php echo $this->get_field_id( 'form_description' ); ?>" name="<?php echo $this->get_field_name( 'form_description' ); ?>" type="checkbox" value="1" <?php if( isset( $instance['form_description'] ) ) { checked( $instance['form_description'] , 1 ); } ?> />
135
+				<input class="widefat" id="<?php echo $this->get_field_id( 'form_description' ); ?>" name="<?php echo $this->get_field_name( 'form_description' ); ?>" type="checkbox" value="1" <?php if ( isset( $instance[ 'form_description' ] ) ) { checked( $instance[ 'form_description' ], 1 ); } ?> />
136 136
 			</p>
137 137
 			
138 138
 			<p>
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 	// Updating widget replacing old instances with new
146 146
 	public function update( $new_instance, $old_instance ) {
147 147
 		$instance = array();
148
-		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
149
-		$instance['form_id'] = $new_instance['form_id'];
150
-		$instance['form_description'] = isset( $new_instance['form_description'] ) ? '1' : '';
151
-		$instance['submit_text'] = ( ! empty( $new_instance['submit_text'] ) ) ? strip_tags( $new_instance['submit_text'] ) : 'Submit';
148
+		$instance[ 'title' ] = ( ! empty( $new_instance[ 'title' ] ) ) ? strip_tags( $new_instance[ 'title' ] ) : '';
149
+		$instance[ 'form_id' ] = $new_instance[ 'form_id' ];
150
+		$instance[ 'form_description' ] = isset( $new_instance[ 'form_description' ] ) ? '1' : '';
151
+		$instance[ 'submit_text' ] = ( ! empty( $new_instance[ 'submit_text' ] ) ) ? strip_tags( $new_instance[ 'submit_text' ] ) : 'Submit';
152 152
 		return $instance;
153 153
 	}
154 154
 	
Please login to merge, or discard this patch.
admin/partials/view-list.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	if( isset( $_REQUEST['list-id'] ) ) {	
3
-		$list_id = sanitize_key( $_REQUEST['list-id'] );
4
-		$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );		
2
+	if ( isset( $_REQUEST[ 'list-id' ] ) ) {	
3
+		$list_id = sanitize_key( $_REQUEST[ 'list-id' ] );
4
+		$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );		
5 5
 		$dash_position = strpos( $api_key, '-' );
6
-		if( $dash_position !== false ) {
6
+		if ( $dash_position !== false ) {
7 7
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json';
8 8
 		}
9 9
 		$list_data = wp_remote_post( $api_endpoint, array( 
@@ -15,40 +15,40 @@  discard block
 block discarded – undo
15 15
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
16 16
 		) );
17 17
 		$list_data = json_decode( wp_remote_retrieve_body( $list_data ), true );	
18
-		if( isset( $list_data['error'] ) ) {	
19
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
18
+		if ( isset( $list_data[ 'error' ] ) ) {	
19
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
20 20
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
21 21
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
22
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
22
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
23 23
 			}
24 24
 		}
25 25
 		// reset our data so we can easily use it
26
-		$list_data = $list_data['data'][0];
26
+		$list_data = $list_data[ 'data' ][ 0 ];
27 27
 		
28
-		if( $dash_position !== false ) {
28
+		if ( $dash_position !== false ) {
29 29
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
30 30
 		}
31 31
 		$merge_variables = wp_remote_post( $api_endpoint, array( 
32 32
 			'body' => array( 
33 33
 				'apikey' => $api_key, 
34
-				'id' => array( $list_id ) ,
34
+				'id' => array( $list_id ),
35 35
 			),
36 36
 			'timeout' => 10,
37 37
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
38 38
 		) );
39 39
 		$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
40
-		if( isset( $merge_variables['error'] ) ) {	
41
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
40
+		if ( isset( $merge_variables[ 'error' ] ) ) {	
41
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
42 42
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
43 43
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
44
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
44
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
45 45
 			}
46 46
 		}
47 47
 		// re-store our data
48
-		$merge_variables = $merge_variables['data'][0]['merge_vars'];
48
+		$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
49 49
 		
50 50
 		// get the interest group data
51
-		if( $dash_position !== false ) {
51
+		if ( $dash_position !== false ) {
52 52
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/interest-groupings.json';
53 53
 		}
54 54
 		$interest_groupings = wp_remote_post( $api_endpoint, array( 
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 		) );
63 63
 		$interest_groupings = json_decode( wp_remote_retrieve_body( $interest_groupings ), true );
64 64
 		
65
-		if( isset( $interest_groupings['error'] ) ) {	
66
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
65
+		if ( isset( $interest_groupings[ 'error' ] ) ) {	
66
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
67 67
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
68 68
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
69
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings['error'], __( "Get Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
69
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings[ 'error' ], __( "Get Interest Groups", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
70 70
 			}
71 71
 		}
72 72
 	
73 73
 		$no_interest_groupings = '<p class="description">' . __( 'Interest groups are not enabled for this list.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
74 74
 		
75 75
 		
76
-		$no_segments = __( 'No segments set up for this list.' , 'yikes-inc-easy-mailchimp-extender' );
76
+		$no_segments = __( 'No segments set up for this list.', 'yikes-inc-easy-mailchimp-extender' );
77 77
 		// get the segment data
78
-		if( $dash_position !== false ) {
78
+		if ( $dash_position !== false ) {
79 79
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/segments.json';
80 80
 		}
81 81
 		$segments = wp_remote_post( $api_endpoint, array( 
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 		
91 91
 		
92 92
 		// setup pagination variables
93
-		$paged = isset( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : '0';
93
+		$paged = isset( $_REQUEST[ 'paged' ] ) ? $_REQUEST[ 'paged' ] : '0';
94 94
 		
95
-		$limit = apply_filters( 'yikes_admin_list_subscriber_limit' , '20' );
95
+		$limit = apply_filters( 'yikes_admin_list_subscriber_limit', '20' );
96 96
 		
97
-		$sort_dir = isset( $_REQUEST['sort'] ) ? $_REQUEST['sort'] : 'DESC';
98
-		$column = isset( $_REQUEST['column'] ) ? $_REQUEST['column'] : 'optin_time';
97
+		$sort_dir = isset( $_REQUEST[ 'sort' ] ) ? $_REQUEST[ 'sort' ] : 'DESC';
98
+		$column = isset( $_REQUEST[ 'column' ] ) ? $_REQUEST[ 'column' ] : 'optin_time';
99 99
 		
100
-		if( $sort_dir == 'DESC' ) {
100
+		if ( $sort_dir == 'DESC' ) {
101 101
 			$opposite_sort_dir = 'ASC';
102 102
 			$icon = '<span class="dashicons dashicons-arrow-down"></span>';
103 103
 		} else {
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 			$icon = '<span class="dashicons dashicons-arrow-up"></span>';
106 106
 		}
107 107
 		
108
-		if( !isset( $_REQUEST['sort'] ) ) {	
108
+		if ( ! isset( $_REQUEST[ 'sort' ] ) ) {	
109 109
 			$icon = '';
110 110
 		}
111 111
 		
112 112
 		// get all subscribed members
113
-		if( $dash_position !== false ) {
113
+		if ( $dash_position !== false ) {
114 114
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/members.json';
115 115
 		}
116 116
 		$subscribers_list = wp_remote_post( $api_endpoint, array( 
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
129 129
 		) );
130 130
 		$subscribers_list = json_decode( wp_remote_retrieve_body( $subscribers_list ), true );	
131
-		if( isset( $subscribers_list['error'] ) ) {	
132
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
131
+		if ( isset( $subscribers_list[ 'error' ] ) ) {	
132
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
133 133
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
134 134
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
135
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribers_list['error'], __( "Get Subscriber Count" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
135
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribers_list[ 'error' ], __( "Get Subscriber Count", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
136 136
 			}
137 137
 		}
138 138
 		
139
-		$total_pages = ceil( $subscribers_list['total'] / $limit );
140
-		if( $total_pages == 0 ) {
139
+		$total_pages = ceil( $subscribers_list[ 'total' ] / $limit );
140
+		if ( $total_pages == 0 ) {
141 141
 			$total_pages = '1';
142 142
 		}
143 143
 		
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 ?>
147 147
 <div class="wrap">
148 148
 	<!-- Freddie Logo -->
149
-	<img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
149
+	<img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
150 150
 		
151
-	<h1>YIKES Easy Forms for MailChimp | <?php echo $list_data['name']; ?></h1>				
151
+	<h1>YIKES Easy Forms for MailChimp | <?php echo $list_data[ 'name' ]; ?></h1>				
152 152
 		
153 153
 	<!-- Settings Page Description -->
154
-	<p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
155
-	<!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> -->
154
+	<p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
155
+	<!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> -->
156 156
 	
157 157
 	<?php
158 158
 		/* Display our admin notices here */
159 159
 		// Unsubscribe user confirmation message
160
-		if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'true' ) {
160
+		if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'true' ) {
161 161
 			?>
162 162
 			<div class="updated manage-form-admin-notice">
163 163
 				<p><?php _e( 'User successfully unsubscribed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
164 164
 			</div>
165 165
 			<?php
166 166
 		}
167
-		if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'false' ) {
167
+		if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'false' ) {
168 168
 			?>
169 169
 			<div class="error manage-form-admin-notice">
170 170
 				<p><?php _e( "We've encountered an error trying to remove the subscriber. Please try again. If the error persists please get in contact with the YIKES Inc. support staff.", 'yikes-inc-easy-mailchimp-extender' ); ?></p>
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	?>
175 175
 	
176 176
 	<section class="add-new-subscriber-form-container">
177
-		<h4><?php _e( 'Add New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></h4>
177
+		<h4><?php _e( 'Add New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></h4>
178 178
 		<form id="add-new-subcscriber">
179
-			<input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p>
179
+			<input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p>
180 180
 			<p><?php echo submit_button( 'Add Subscriber' ); ?></p>
181 181
 		</form>
182 182
 	</section>
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 									<!-- TABLE HEAD -->
199 199
 									<thead>
200 200
 										<tr>
201
-											<th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email' , 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); echo $icon;?></a></th>
202
-											<th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
201
+											<th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email', 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); echo $icon; ?></a></th>
202
+											<th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
203 203
 										</tr>
204 204
 									</thead>
205 205
 									<!-- end header -->
@@ -207,38 +207,38 @@  discard block
 block discarded – undo
207 207
 									<!-- FOOTER -->
208 208
 									<tfoot>
209 209
 										<tr>
210
-											<th class="manage-column column-columnname" scope="col"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
211
-											<th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
210
+											<th class="manage-column column-columnname" scope="col"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
211
+											<th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
212 212
 										</tr>
213 213
 									</tfoot>
214 214
 									<!-- end footer -->
215 215
 									
216 216
 									<!-- TABLE BODY -->
217 217
 									<tbody>
218
-										<?php if( $subscribers_list['total'] > 0 ) {
218
+										<?php if ( $subscribers_list[ 'total' ] > 0 ) {
219 219
 												$i = 1;
220
-												foreach( $subscribers_list['data'] as $subscriber ) { 
221
-													$user_id = $subscriber['leid'];
220
+												foreach ( $subscribers_list[ 'data' ] as $subscriber ) { 
221
+													$user_id = $subscriber[ 'leid' ];
222 222
 													// setup the email client name and icon
223
-													if( !empty( $subscriber['clients'] ) ) {
224
-														$user_email_client_name = $subscriber['clients']['name'];
225
-														$user_email_client_icon = "<img src='" . esc_url_raw( $subscriber['clients']['icon_url'] ) . "' alt=" . $user_email_client_name . " title=" . $user_email_client_name . ">";
223
+													if ( ! empty( $subscriber[ 'clients' ] ) ) {
224
+														$user_email_client_name = $subscriber[ 'clients' ][ 'name' ];
225
+														$user_email_client_icon = "<img src='" . esc_url_raw( $subscriber[ 'clients' ][ 'icon_url' ] ) . "' alt=" . $user_email_client_name . " title=" . $user_email_client_name . ">";
226 226
 													} else {
227 227
 														$path = YIKES_MC_URL . "includes/images/na.png";
228
-														$user_email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set' , 'yikes-inc-easy-mailchimp-extender' ) . "' title='" .  __( 'not set' , 'yikes-inc-easy-mailchimp-extender' ) . "'>";
228
+														$user_email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "' title='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "'>";
229 229
 													}
230 230
 													
231 231
 										?>
232
-											<tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>">
232
+											<tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>">
233 233
 												<td class="column-columnname">	
234
-													<a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber['email'] ); ?>">
235
-														<?php echo sanitize_email( $subscriber['email'] ); ?>
234
+													<a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber[ 'email' ] ); ?>">
235
+														<?php echo sanitize_email( $subscriber[ 'email' ] ); ?>
236 236
 													</a>
237 237
 													<div class="row-actions">
238
-														<?php $view_user_info_url = esc_url_raw( add_query_arg( array( 'mailchimp-list' => $list_id , 'email-id' => $user_id ), admin_url() . 'admin.php?page=yikes-mailchimp-view-user' ) ); ?>
239
-														<span><a href="<?php echo $view_user_info_url; ?>"><?php _e( "View Info." , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span>
240
-														<?php $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id , 'nonce' => wp_create_nonce( 'unsubscribe-user-'.$user_id ), 'email_id' => $user_id ) ) ); ?>
241
-														<span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?" , 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber['email'] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe" , 'yikes-inc-easy-mailchimp-extender' ); ?></a>													
238
+														<?php $view_user_info_url = esc_url_raw( add_query_arg( array( 'mailchimp-list' => $list_id, 'email-id' => $user_id ), admin_url() . 'admin.php?page=yikes-mailchimp-view-user' ) ); ?>
239
+														<span><a href="<?php echo $view_user_info_url; ?>"><?php _e( "View Info.", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span>
240
+														<?php $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id, 'nonce' => wp_create_nonce( 'unsubscribe-user-' . $user_id ), 'email_id' => $user_id ) ) ); ?>
241
+														<span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?", 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber[ 'email' ] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe", 'yikes-inc-easy-mailchimp-extender' ); ?></a>													
242 242
 													</div>
243 243
 												</td>
244 244
 												<td class="column-columnname num"><?php echo $user_email_client_icon; ?></td>
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 												}
249 249
 											} else { ?>
250 250
 											<tr class="no-items"> 
251
-												<td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td>
251
+												<td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td>
252 252
 											</tr>
253 253
 										<?php } ?>
254 254
 									</tbody>
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 						<!-- pagination -->
261 261
 						<div class="tablenav">
262 262
 							<div class="tablenav-pages">
263
-								<a class='first-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>&laquo;</a>
264
-								<a class='prev-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>&lsaquo;</a>
265
-								<span class="paging-input"><input class='current-page' title='<?php _e( "Current page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span>
266
-								<a class='next-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>&rsaquo;</a>
267
-								<a class='last-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>&raquo;</a>
263
+								<a class='first-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>&laquo;</a>
264
+								<a class='prev-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>&lsaquo;</a>
265
+								<span class="paging-input"><input class='current-page' title='<?php _e( "Current page", 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if ( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span>
266
+								<a class='next-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>&rsaquo;</a>
267
+								<a class='last-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>&raquo;</a>
268 268
 							</div>
269 269
 						</div>
270 270
 						
@@ -279,21 +279,21 @@  discard block
 block discarded – undo
279 279
 						
280 280
 						<div class="postbox yikes-easy-mc-postbox">
281 281
 																		
282
-							<h3><?php _e( 'List Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
282
+							<h3><?php _e( 'List Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
283 283
 							
284 284
 							<?php 
285 285
 								// store list rating
286
-								$list_rating = $list_data['list_rating'];
287
-								if( $list_rating > 0 ) {
288
-									$list_rating_explosion = explode( '.' , $list_rating );
286
+								$list_rating = $list_data[ 'list_rating' ];
287
+								if ( $list_rating > 0 ) {
288
+									$list_rating_explosion = explode( '.', $list_rating );
289 289
 									$star_array = array();
290 290
 									$x = 1; 
291
-									while( $list_rating_explosion[0] >= $x ) {
292
-										$star_array[] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>';
291
+									while ( $list_rating_explosion[ 0 ] >= $x ) {
292
+										$star_array[ ] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>';
293 293
 										$x++;
294 294
 									}
295
-									if( $list_rating_explosion[1] == '5' ) {
296
-										$star_array[] = '<span class="dashicons dashicons-star-half list-rating-star"></span>';
295
+									if ( $list_rating_explosion[ 1 ] == '5' ) {
296
+										$star_array[ ] = '<span class="dashicons dashicons-star-half list-rating-star"></span>';
297 297
 									}
298 298
 								} else {
299 299
 									$star_array = array( 'n/a' );
@@ -301,40 +301,40 @@  discard block
 block discarded – undo
301 301
 							?>
302 302
 							<table class="form-table">
303 303
 								<tr valign="top">
304
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Rating' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
305
-									<td><?php echo implode( ' ' , $star_array ); ?></td>
304
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Rating', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
305
+									<td><?php echo implode( ' ', $star_array ); ?></td>
306 306
 								</tr>
307 307
 								<tr valign="top">
308
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Average Subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
309
-									<td><?php echo $list_data['stats']['avg_sub_rate']; ?><small> / <?php  _e( 'month' , 'yikes-inc-easy-mailchimp-extender' ); ?></small></td>
308
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Average Subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
309
+									<td><?php echo $list_data[ 'stats' ][ 'avg_sub_rate' ]; ?><small> / <?php  _e( 'month', 'yikes-inc-easy-mailchimp-extender' ); ?></small></td>
310 310
 								</tr>
311 311
 								<tr valign="top">
312
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
313
-									<td><?php echo intval( $list_data['stats']['member_count'] ); ?></td>
312
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
313
+									<td><?php echo intval( $list_data[ 'stats' ][ 'member_count' ] ); ?></td>
314 314
 								</tr>
315 315
 								<tr valign="top">
316
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'New Since Last Campaign' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
317
-									<td><?php echo intval( $list_data['stats']['member_count_since_send'] ); ?></td>
316
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'New Since Last Campaign', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
317
+									<td><?php echo intval( $list_data[ 'stats' ][ 'member_count_since_send' ] ); ?></td>
318 318
 								</tr>
319 319
 								<tr valign="top">
320
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Created' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
321
-									<td><?php echo date( get_option('date_format') , strtotime( $list_data['date_created'] ) ); ?></td>
320
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Created', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
321
+									<td><?php echo date( get_option( 'date_format' ), strtotime( $list_data[ 'date_created' ] ) ); ?></td>
322 322
 								</tr>
323 323
 								<tr valign="top">
324
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
325
-									<td><?php echo intval( $list_data['stats']['merge_var_count'] + 1 ); // add 1 for our email field.. ?></td>
324
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
325
+									<td><?php echo intval( $list_data[ 'stats' ][ 'merge_var_count' ] + 1 ); // add 1 for our email field.. ?></td>
326 326
 								</tr>
327 327
 								<tr valign="top">
328
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Short Signup URL' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
329
-									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data['subscribe_url_short'] ); ?>" readonly onclick="jQuery(this).select();"></td>
328
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Short Signup URL', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
329
+									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data[ 'subscribe_url_short' ] ); ?>" readonly onclick="jQuery(this).select();"></td>
330 330
 								</tr>
331 331
 								<tr valign="top">
332
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
333
-									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data['default_from_email'] ); ?>" readonly onclick="jQuery(this).select();"></td>
332
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
333
+									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data[ 'default_from_email' ] ); ?>" readonly onclick="jQuery(this).select();"></td>
334 334
 								</tr>
335 335
 								<tr valign="top">
336
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
337
-									<td><?php echo $list_data['default_from_name']; ?></td>
336
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Name', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
337
+									<td><?php echo $list_data[ 'default_from_name' ]; ?></td>
338 338
 								</tr>
339 339
 							</table>
340 340
 					
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
 						<!-- Merge Field Info -->
345 345
 						<div class="postbox yikes-easy-mc-postbox">
346 346
 																		
347
-							<h3><?php _e( 'Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
347
+							<h3><?php _e( 'Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
348 348
 							<?php
349
-								if( count( $merge_variables ) >= 1 ) {
349
+								if ( count( $merge_variables ) >= 1 ) {
350 350
 									?><ul class="merge-variable-ul"><?php
351 351
 										echo '<li class="interest-group-count">' . sprintf( _n( '%d Field', '%d Fields', intval( count( $merge_variables ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $merge_variables ) ) ) . '</li>';
352
-										foreach( $merge_variables as $merge_variable ) {
352
+										foreach ( $merge_variables as $merge_variable ) {
353 353
 											// new action hook @since 6.0.3.8
354
-											echo '<li class="' . $merge_variable['tag'] . '"><span class="dashicons dashicons-marker"></span>' . $merge_variable['name'] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_variable ) . '</li>';
354
+											echo '<li class="' . $merge_variable[ 'tag' ] . '"><span class="dashicons dashicons-marker"></span>' . $merge_variable[ 'name' ] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_variable ) . '</li>';
355 355
 										}
356 356
 									?></ul><?php
357 357
 								}
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
 						<div class="postbox yikes-easy-mc-postbox">
369 369
 							
370 370
 							
371
-							<h3><?php _e( 'Interest Groups Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
371
+							<h3><?php _e( 'Interest Groups Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
372 372
 							<?php
373
-								if( isset( $interest_groupings ) && ! isset( $interest_groupings['error'] ) ) {
373
+								if ( isset( $interest_groupings ) && ! isset( $interest_groupings[ 'error' ] ) ) {
374 374
 									?><ul class="interest-group-ul"><?php
375 375
 										echo '<li class="interest-group-count">' . sprintf( _n( '%d Interest Group', '%d Interest Groups', intval( count( $interest_groupings ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $interest_groupings ) ) ) . '</li>';
376
-									foreach( $interest_groupings as $interest_group ) {
377
-										echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group['name'] . '<span class="interest-group-title"></span><small title="' . $interest_group['groups'][0]['subscribers'] . ' ' . __( "subscribers assigned to this group" , 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $interest_group['groups'][0]['subscribers'] . ')</small></li>';
376
+									foreach ( $interest_groupings as $interest_group ) {
377
+										echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group[ 'name' ] . '<span class="interest-group-title"></span><small title="' . $interest_group[ 'groups' ][ 0 ][ 'subscribers' ] . ' ' . __( "subscribers assigned to this group", 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $interest_group[ 'groups' ][ 0 ][ 'subscribers' ] . ')</small></li>';
378 378
 									}
379 379
 									?></ul><?php
380 380
 								} else {
@@ -397,17 +397,17 @@  discard block
 block discarded – undo
397 397
 						<div class="postbox yikes-easy-mc-postbox">
398 398
 							
399 399
 							
400
-							<h3><?php _e( 'Segments Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
400
+							<h3><?php _e( 'Segments Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
401 401
 							<?php
402
-								if( isset( $segments['saved'] ) && count( $segments['saved'] ) >= 1 ) {
402
+								if ( isset( $segments[ 'saved' ] ) && count( $segments[ 'saved' ] ) >= 1 ) {
403 403
 									$i = 1;
404 404
 									?><ul class="segment-ul"><?php
405
-										echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments['saved'] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments['saved'] ) ) ) . '</li>';
406
-									foreach( $segments['saved'] as $segment ) {
407
-										echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment['name'] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions" , 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>';
405
+										echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments[ 'saved' ] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments[ 'saved' ] ) ) ) . '</li>';
406
+									foreach ( $segments[ 'saved' ] as $segment ) {
407
+										echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment[ 'name' ] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions", 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>';
408 408
 										?><div class="conditionals yikes-easy-mc-hidden"><?php
409
-										foreach( $segment['segment_opts']['conditions'] as $condition ) {
410
-											echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition['field'],  $condition['op'], $condition['value'] ) . '</small></li>';
409
+										foreach ( $segment[ 'segment_opts' ][ 'conditions' ] as $condition ) {
410
+											echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition[ 'field' ], $condition[ 'op' ], $condition[ 'value' ] ) . '</small></li>';
411 411
 											$i++;
412 412
 										}
413 413
 										?></div><?php
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 								}
423 423
 							?>
424 424
 							<!--
425
-								<a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments' , 'yikes-inc-easy-mailchimp-extender' ); ?></a>
425
+								<a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments', 'yikes-inc-easy-mailchimp-extender' ); ?></a>
426 426
 							-->
427
-							<p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to' , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" target="_blank">MailChimp</a></p>
427
+							<p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to', 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" target="_blank">MailChimp</a></p>
428 428
 							
429 429
 						</div>
430 430
 						
Please login to merge, or discard this patch.
admin/partials/upgrade-helpers/upgrade-migrate-options.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -9,30 +9,30 @@  discard block
 block discarded – undo
9 9
 	*/
10 10
 		
11 11
 	// enqueue the styles for our migration page..
12
-	wp_enqueue_style( 'yikes_mc_migrate_option_styles' , YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' );
13
-	wp_enqueue_style( 'animate-css' , YIKES_MC_URL . 'admin/css/animate.min.css' );
12
+	wp_enqueue_style( 'yikes_mc_migrate_option_styles', YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' );
13
+	wp_enqueue_style( 'animate-css', YIKES_MC_URL . 'admin/css/animate.min.css' );
14 14
 	
15 15
 	// store our old options
16 16
 	$old_plugin_options = get_option( 'ykseme_storage' );
17 17
 	
18 18
 	$global_error_messages = array(
19
-		'success' => __( $old_plugin_options['single-optin-message'] , 'yikes-inc-easy-mailchimp-extender' ),
20
-		'general-error' => __( "Whoops! It looks like something went wrong. Please try again." , 'yikes-inc-easy-mailchimp-extender' ),
21
-		'invalid-email' => __( "Please provide a valid email address." , 'yikes-inc-easy-mailchimp-extender' ),
22
-		'email-exists-error' => __( "The provided email is already subscribed to this list." , 'yikes-inc-easy-mailchimp-extender' )
19
+		'success' => __( $old_plugin_options[ 'single-optin-message' ], 'yikes-inc-easy-mailchimp-extender' ),
20
+		'general-error' => __( "Whoops! It looks like something went wrong. Please try again.", 'yikes-inc-easy-mailchimp-extender' ),
21
+		'invalid-email' => __( "Please provide a valid email address.", 'yikes-inc-easy-mailchimp-extender' ),
22
+		'email-exists-error' => __( "The provided email is already subscribed to this list.", 'yikes-inc-easy-mailchimp-extender' )
23 23
 	);
24 24
 	
25 25
 	// if old options are defined...
26
-	if( $old_plugin_options ) {
26
+	if ( $old_plugin_options ) {
27 27
 		
28 28
 		// Verify the NONCE is valid
29
-		check_admin_referer( 'yikes-mc-migrate-options' , 'migrate_options_nonce' );
29
+		check_admin_referer( 'yikes-mc-migrate-options', 'migrate_options_nonce' );
30 30
 		
31 31
 		?>
32 32
 			
33 33
 		<div class="wrap" style="text-align:center;">
34
-			<h3><?php _e( 'Migrating old plugin options' , 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3>
35
-			<p><?php _e( 'please be patient while your options are updated and the process has completed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
34
+			<h3><?php _e( 'Migrating old plugin options', 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3>
35
+			<p><?php _e( 'please be patient while your options are updated and the process has completed', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
36 36
 			<!-- empty list, populate when options  get updated -->
37 37
 			<ul id="options-updated" class="yikes-easy-mc-hidden">
38 38
 				<hr />
@@ -46,82 +46,82 @@  discard block
 block discarded – undo
46 46
 				
47 47
 					// loop over our old options, and store them in a new option value
48 48
 					$do_not_migrate_options = array(
49
-						'ssl_verify_peer', 'api_validation' , 'widget_yikes_mc_widget' , 'flavor' , 'single-optin-message' , 'double-optin-message' ,
50
-						'mailchimp-optIn-default-list' , 'version' , 'yks-mailchimp-jquery-datepicker' , 'ssl_verify_peer' , 'optIn-checkbox' , 'yks-mailchimp-optin-checkbox-text',
51
-						'yks-mailchimp-required-text' , 'optin'
49
+						'ssl_verify_peer', 'api_validation', 'widget_yikes_mc_widget', 'flavor', 'single-optin-message', 'double-optin-message',
50
+						'mailchimp-optIn-default-list', 'version', 'yks-mailchimp-jquery-datepicker', 'ssl_verify_peer', 'optIn-checkbox', 'yks-mailchimp-optin-checkbox-text',
51
+						'yks-mailchimp-required-text', 'optin'
52 52
 					);
53 53
 							
54
-					foreach( $old_plugin_options as $option_name => $option_value ) {
54
+					foreach ( $old_plugin_options as $option_name => $option_value ) {
55 55
 												
56
-						if( ! in_array( $option_name , $do_not_migrate_options ) ) {
56
+						if ( ! in_array( $option_name, $do_not_migrate_options ) ) {
57 57
 							// ajax request to update our options one by one..
58 58
 							// if its an array, we need to json encode it
59
-							if( is_array( $option_value ) ) {
59
+							if ( is_array( $option_value ) ) {
60 60
 								
61
-								if( $option_name == 'lists' ) {
61
+								if ( $option_name == 'lists' ) {
62 62
 																	
63
-									if( ! empty( $option_value ) ) {
63
+									if ( ! empty( $option_value ) ) {
64 64
 										$settings = 1;
65 65
 										$form_length = count( $option_value );
66
-										foreach( $option_value as $mailchimp_form ) {
66
+										foreach ( $option_value as $mailchimp_form ) {
67 67
 											// update and pass our placeholder value
68 68
 											reset( $mailchimp_form );
69
-											$form_id = $mailchimp_form['id'];
69
+											$form_id = $mailchimp_form[ 'id' ];
70 70
 											
71
-											$fields = $mailchimp_form['fields'];	
71
+											$fields = $mailchimp_form[ 'fields' ];	
72 72
 											reset( $fields );
73 73
 											$first_field_key = key( $fields );
74 74
 											$array_keys = array_keys( $fields );
75 75
 											
76 76
 											$x = 1;								
77 77
 					
78
-											foreach( $array_keys as $parent_key ) {
78
+											foreach ( $array_keys as $parent_key ) {
79 79
 												
80 80
 												// alter the field keys so they show up after an import
81 81
 												$split_parent_key = explode( '-', $parent_key );
82 82
 
83
-												$new_parent_key = ( isset( $split_parent_key[1] ) ) ? strtoupper( $split_parent_key[1] ) : $parent_key;
83
+												$new_parent_key = ( isset( $split_parent_key[ 1 ] ) ) ? strtoupper( $split_parent_key[ 1 ] ) : $parent_key;
84 84
 
85
-												$mailchimp_form['fields'][$new_parent_key] = $mailchimp_form['fields'][$parent_key];
85
+												$mailchimp_form[ 'fields' ][ $new_parent_key ] = $mailchimp_form[ 'fields' ][ $parent_key ];
86 86
 
87
-												unset( $mailchimp_form['fields'][$parent_key] );			
87
+												unset( $mailchimp_form[ 'fields' ][ $parent_key ] );			
88 88
 										
89 89
 												// update our placeholder key to be 'placeholder'
90
-												$mailchimp_form['fields'][$new_parent_key]['placeholder'] = isset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] : '';
90
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] : '';
91 91
 												// update field classes
92
-												$mailchimp_form['fields'][$new_parent_key]['additional-classes'] = isset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] : '';
92
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'additional-classes' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] : '';
93 93
 												// update help field - populate description
94
-												$mailchimp_form['fields'][$new_parent_key]['description'] = isset( $mailchimp_form['fields'][$new_parent_key]['help'] ) ? $mailchimp_form['fields'][$new_parent_key]['help'] : ''; 
94
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'description' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] : ''; 
95 95
 												// remove the old placeholder structure
96
-												unset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] );
96
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] );
97 97
 												// remove old custom class structure
98
-												unset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] );
98
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] );
99 99
 												// remove old help/description 
100
-												unset( $mailchimp_form['fields'][$new_parent_key]['help'] );
100
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] );
101 101
 																							
102 102
 												// check if choices is set, and encode them
103
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['choices'] ) && ! empty( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) {
104
-													$mailchimp_form['fields'][$new_parent_key]['choices'] = addslashes( addslashes( json_encode( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) );
103
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) && ! empty( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) {
104
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] = addslashes( addslashes( json_encode( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) );
105 105
 												}	
106 106
 
107 107
 												// update 'default' to 'default-choice' for radio/dropdown
108
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'radio', 'dropdown' ) ) ) {
109
-													$mailchimp_form['fields'][$new_parent_key]['default_choice'] = $mailchimp_form['fields'][$new_parent_key]['default'];
110
-													unset( $mailchimp_form['fields'][$new_parent_key]['default'] );
108
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'radio', 'dropdown' ) ) ) {
109
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default_choice' ] = $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ];
110
+													unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ] );
111 111
 												}
112 112
 												
113 113
 												// update 'date_format' on 'birthday' and 'date' fields
114
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) {
115
-													if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date
116
-														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered)
114
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'date', 'birthday' ) ) ) {
115
+													if ( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] == 'date' ) { // date
116
+														$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD'; // mailchimp default (can be altered)
117 117
 													} else { // birthday 
118
-														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
118
+														$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
119 119
 													}
120 120
 												}
121 121
 												
122 122
 												// update 'phone_format' on 'phone'
123
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'phone' ) ) ) {
124
-													$mailchimp_form['fields'][$new_parent_key]['phone_format'] = 'phone_format '; // phone format
123
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'phone' ) ) ) {
124
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'phone_format' ] = 'phone_format '; // phone format
125 125
 												}
126 126
 												
127 127
 												$x++;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 																								
139 139
 												$.post( ajaxurl, mc_data, function(response) {
140 140
 													jQuery( '#options-updated' ).show();
141
-													jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
141
+													jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
142 142
 													if( response.completed_import ) {
143 143
 														setTimeout( function() {
144 144
 															// finished with the loop...lets let the user know....and then redirect them....
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 															jQuery( '.upgrading-ellipse-two' ).remove();
148 148
 															jQuery( '.upgrading-ellipse-three' ).remove();
149 149
 															jQuery( '.wrap' ).find( 'h3' ).next().fadeOut();
150
-															jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait..." , 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' );
150
+															jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait...", 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' );
151 151
 															// redirect our user to the main plugin page...
152 152
 															setTimeout( function() {
153 153
 																<?php 
154 154
 																	// migrate options that didnt make it (they were never stored in the 'ykseme_storage' options array)
155
-																	add_option( 'yikes-mc-api-validation' , get_option( 'api_validation' , 'invalid_api_key' ) );
156
-																	add_option( 'yikes-mc-error-messages' , $global_error_messages );
155
+																	add_option( 'yikes-mc-api-validation', get_option( 'api_validation', 'invalid_api_key' ) );
156
+																	add_option( 'yikes-mc-error-messages', $global_error_messages );
157 157
 																	// delete our old options after a successful migration (and some new ones that are no longer needed)
158 158
 																	delete_option( 'widget_yikes_mc_widget' );
159 159
 																	delete_option( 'api_validation' );
@@ -174,26 +174,26 @@  discard block
 block discarded – undo
174 174
 							}
175 175
 							/* Rename our ReCaptcha Options */
176 176
 								/* Public Site Key */
177
-								if( $option_name == 'recaptcha-api-key' ) {
177
+								if ( $option_name == 'recaptcha-api-key' ) {
178 178
 									$option_name = 'recaptcha-site-key';
179 179
 								}
180 180
 								/* Private Key */
181
-								if( $option_name == 'recaptcha-private-api-key'  ) {
181
+								if ( $option_name == 'recaptcha-private-api-key' ) {
182 182
 									$option_name = 'recaptcha-secret-key';
183 183
 								}
184 184
 								/* Change 'recaptcha-setting' to 'recaptcha-status' */
185 185
 								/* Status */
186
-								if( $option_name == 'recaptcha-setting' ) {
186
+								if ( $option_name == 'recaptcha-setting' ) {
187 187
 									$option_name = 'recaptcha-status';
188 188
 								}
189 189
 							/* End  re-name ReCaptcha options */
190 190
 							
191 191
 
192
-							if( is_array( $option_value ) ) {
192
+							if ( is_array( $option_value ) ) {
193 193
 								$option_value = json_encode( $option_value );
194 194
 							}
195 195
 							// do noit migrate the lists option, it's not useful to us
196
-							if( $option_name != 'lists' ) {
196
+							if ( $option_name != 'lists' ) {
197 197
 								?>
198 198
 									var data = {
199 199
 										'action': 'migrate_old_plugin_settings',
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 													
204 204
 									$.post( ajaxurl, data, function(response) {
205 205
 										jQuery( '#options-updated' ).show();
206
-										jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_' , ' ' , str_replace( '-' , ' ' , $option_name ) ) ) . '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
206
+										jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_', ' ', str_replace( '-', ' ', $option_name ) ) ) . '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
207 207
 									});
208 208
 								<?php
209 209
 								
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 					}, 2000 );
228 228
 			</script>
229 229
 		<?php
230
-			wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>' , 500 );
230
+			wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>', 500 );
231 231
 		?>
232 232
 		</div>
233 233
 		<?php
Please login to merge, or discard this patch.
public/partials/shortcodes/yikes-mailchimp-subscriber-count.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,42 +12,42 @@  discard block
 block discarded – undo
12 12
 		array(
13 13
 			'form' => '', // pass in a form, which will retreive the associated list ID -- takes precendence
14 14
 			'list' => '', // pass in a specific list ID
15
-		), $attributes , 'yikes-mailchimp-subscriber-count' )
15
+		), $attributes, 'yikes-mailchimp-subscriber-count' )
16 16
 	);
17 17
 	
18 18
 	/* If the user hasn't authenticated yet - bail */
19
-	if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
20
-		if( WP_DEBUG ) {
19
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) {
20
+		if ( WP_DEBUG ) {
21 21
 			return '<strong>' . __( "You don't appear to be connected to MailChimp.", "yikes-inc-easy-mailchimp-extender" ) . '</strong>';
22 22
 		} 
23 23
 		return;
24 24
 	}
25 25
 	
26
-	$form = ( ! empty( $attributes['form'] ) ) ? str_replace( '&quot;', '', $attributes['form'] ) : false; // replace the sanitize quotes to perform a proper query
27
-	$list_id = ( ! empty( $attributes['list'] ) ) ? $attributes['list'] : false;
26
+	$form = ( ! empty( $attributes[ 'form' ] ) ) ? str_replace( '&quot;', '', $attributes[ 'form' ] ) : false; // replace the sanitize quotes to perform a proper query
27
+	$list_id = ( ! empty( $attributes[ 'list' ] ) ) ? $attributes[ 'list' ] : false;
28 28
 		
29 29
 	/* If no list ID was passed into the shortcode - bail */
30
-	if( ! $list_id  && ! $form) {
31
-		if( WP_DEBUG ) {
30
+	if ( ! $list_id && ! $form ) {
31
+		if ( WP_DEBUG ) {
32 32
 			return '<strong>' . __( 'You forgot to include the list or form ID.', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>';
33 33
 		} 
34 34
 		return;	
35 35
 	}
36 36
 
37 37
 	/* if a form ID and a list ID were passed in, use the form ID */
38
-	if( ( $form ) || ( $form && $list_id ) ) {
38
+	if ( ( $form ) || ( $form && $list_id ) ) {
39 39
 		global $wpdb;
40 40
 		// return it as an array, so we can work with it to build our form below
41 41
 		$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A );
42 42
 		// confirm we have some results, or return an error
43
-		if( ! $form_results ) {
44
-			if( WP_DEBUG ) {	
45
-				return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' );
43
+		if ( ! $form_results ) {
44
+			if ( WP_DEBUG ) {	
45
+				return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' );
46 46
 			}
47 47
 			return;
48 48
 		}
49
-		$form_data = $form_results[0];
50
-		$list_id = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list)
49
+		$form_data = $form_results[ 0 ];
50
+		$list_id = sanitize_key( $form_data[ 'list_id' ] ); // associated list id (users who fill out the form will be subscribed to this list)
51 51
 	}
52 52
 	
53 53
 	// object buffer 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	try {
58 58
 	
59 59
 		// get the api key
60
-		$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
60
+		$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
61 61
 		$dash_position = strpos( $api_key, '-' );
62
-		if( $dash_position !== false ) {
62
+		if ( $dash_position !== false ) {
63 63
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json';
64 64
 		}
65 65
 		
@@ -76,23 +76,23 @@  discard block
 block discarded – undo
76 76
 		) );
77 77
 		
78 78
 		$subscriber_count_response = json_decode( wp_remote_retrieve_body( $subscriber_count_response ), true );
79
-		if( isset( $subscriber_count_response['error'] ) ) {		
80
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
79
+		if ( isset( $subscriber_count_response[ 'error' ] ) ) {		
80
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
81 81
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
82 82
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
83
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_count_response['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "yikes-mailchimp-subscriber-count.php" );
83
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_count_response[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "yikes-mailchimp-subscriber-count.php" );
84 84
 			}
85 85
 		}
86 86
 		// if more than one list is returned, something went wrong - bail
87
-		if( $subscriber_count_response['total'] != 1 ) {
88
-			if( WP_DEBUG ) {
87
+		if ( $subscriber_count_response[ 'total' ] != 1 ) {
88
+			if ( WP_DEBUG ) {
89 89
 				return '<strong>' . sprintf( __( "It looks like this list wasn't found. Double check the list with with ID '%s' exists.", "yikes-inc-easy-mailchimp-extender" ), $list_id ) . '</strong>';
90 90
 			} 
91 91
 			return;
92 92
 		}
93 93
 				
94 94
 		/* type cast the returned value as an integer */
95
-		echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $subscriber_count_response['data'][0]['stats']['member_count'] );
95
+		echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $subscriber_count_response[ 'data' ][ 0 ][ 'stats' ][ 'member_count' ] );
96 96
 		
97 97
 	} catch ( Exception $error ) {
98 98
 		echo $error->getMessage();
Please login to merge, or discard this patch.
public/partials/shortcodes/process_form_shortcode_depracated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 		), $atts )
19 19
 	);
20 20
 	
21
-	return '<p><em>' . __( 'This MailChimp shortcode is now deprecated. Please insert the new shortcode to display this form.' , 'yikes-inc-easy-mailchimp-extender' ) . '</em></p>';
21
+	return '<p><em>' . __( 'This MailChimp shortcode is now deprecated. Please insert the new shortcode to display this form.', 'yikes-inc-easy-mailchimp-extender' ) . '</em></p>';
22 22
 	
23 23
 }
24 24
 add_shortcode( 'yks-mailchimp-list', 'process_depracated_mailchimp_shortcode' ); ?>
25 25
\ No newline at end of file
Please login to merge, or discard this patch.