Completed
Pull Request — staging (#799)
by Viktor
05:05
created
includes/api/class-yikes-inc-easy-mailchimp-api-abstract-items.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 			}
80 80
 
81 81
 			// If the API gave an error or there are no more lists, break.
82
-			if ( isset( $response['error'] ) ) {
83
-				return new WP_Error( $response['title'], $response['detail'] );
82
+			if ( isset( $response[ 'error' ] ) ) {
83
+				return new WP_Error( $response[ 'title' ], $response[ 'detail' ] );
84 84
 			}
85 85
 
86 86
 			if ( empty( $response[ $item_key ] ) ) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 			// Update the total number of items if it's still zero.
91 91
 			if ( 0 === $total ) {
92
-				$total = intval( $response['total_items'] );
92
+				$total = intval( $response[ 'total_items' ] );
93 93
 			}
94 94
 
95 95
 			// Store each new list.
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 			return $response;
197 197
 		}
198 198
 
199
-		if ( isset( $response['error'] ) ) {
200
-			$title  = isset( $response['title'] )  ? $response['title']  : $response['name'];
201
-			$detail = isset( $response['detail'] ) ? $response['detail'] : $response['error'];
202
-			$data   = isset( $response['errors'] ) ? $response['errors'] : array();
199
+		if ( isset( $response[ 'error' ] ) ) {
200
+			$title  = isset( $response[ 'title' ] ) ? $response[ 'title' ] : $response[ 'name' ];
201
+			$detail = isset( $response[ 'detail' ] ) ? $response[ 'detail' ] : $response[ 'error' ];
202
+			$data   = isset( $response[ 'errors' ] ) ? $response[ 'errors' ] : array();
203 203
 
204 204
 			return new WP_Error(
205 205
 				$title,
206 206
 				$detail,
207 207
 				array(
208
-					'status' => (int) $response['status'],
208
+					'status' => (int) $response[ 'status' ],
209 209
 					'data'   => $data,
210 210
 				)
211 211
 			);
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 
235 235
 		// MailChimp uses the application/problem+json type for errors
236 236
 		$headers = wp_remote_retrieve_headers( $response );
237
-		if ( isset( $headers['content-type'] ) ) {
238
-			if ( false !== strpos( $headers['content-type'], 'application/problem+json' ) ) {
239
-				$body['error'] = true;
237
+		if ( isset( $headers[ 'content-type' ] ) ) {
238
+			if ( false !== strpos( $headers[ 'content-type' ], 'application/problem+json' ) ) {
239
+				$body[ 'error' ] = true;
240 240
 			}
241 241
 		}
242 242
 
Please login to merge, or discard this patch.
includes/api/class-yikes-inc-easy-mailchimp-api.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @return array|WP_Error
104 104
 	 */
105 105
 	public function patch( $path = '', $headers = array(), $params = array() ) {
106
-		if ( ! isset( $params['body'] ) ) {
106
+		if ( ! isset( $params[ 'body' ] ) ) {
107 107
 			return new WP_Error(
108 108
 				'yikesinc_eme_missing_body',
109 109
 				sprintf(
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return array|WP_Error
131 131
 	 */
132 132
 	public function post( $path = '', $headers = array(), $params = array() ) {
133
-		if ( ! isset( $params['body'] ) ) {
133
+		if ( ! isset( $params[ 'body' ] ) ) {
134 134
 			return new WP_Error(
135 135
 				'yikesinc_eme_missing_body',
136 136
 				sprintf(
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return array|WP_Error
158 158
 	 */
159 159
 	public function put( $path = '', $headers = array(), $params = array() ) {
160
-		if ( ! isset( $params['body'] ) ) {
160
+		if ( ! isset( $params[ 'body' ] ) ) {
161 161
 			return new WP_Error(
162 162
 				'yikesinc_eme_missing_body',
163 163
 				sprintf(
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
 		$authorized_args = $this->get_authorized_args();
289 289
 
290 290
 		// If we have body data, maybe convert it to JSON.
291
-		if ( isset( $params['body'] ) && ( is_array( $params['body'] ) || is_object( $params['body'] ) ) ) {
292
-			$params['body']          = json_encode( wp_parse_args( $authorized_args['body'], $params['body'] ) );
293
-			$headers['Content-Type'] = 'application/json';
291
+		if ( isset( $params[ 'body' ] ) && ( is_array( $params[ 'body' ] ) || is_object( $params[ 'body' ] ) ) ) {
292
+			$params[ 'body' ]          = json_encode( wp_parse_args( $authorized_args[ 'body' ], $params[ 'body' ] ) );
293
+			$headers[ 'Content-Type' ] = 'application/json';
294 294
 		}
295 295
 
296 296
 		// Combine the given headers and auth headers
297
-		$headers = wp_parse_args( $authorized_args['headers'], $headers );
297
+		$headers = wp_parse_args( $authorized_args[ 'headers' ], $headers );
298 298
 		/**
299 299
 		 * Filter the headers used for a request to the MailChimp API.
300 300
 		 *
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 
359 359
 		// Version 2.0 uses body authorization
360 360
 		if ( version_compare( '3.0', $this->api_version, '>' ) ) {
361
-			$args['body'] = $this->get_auth_body();
361
+			$args[ 'body' ] = $this->get_auth_body();
362 362
 		}
363 363
 
364 364
 		// Version 3.0 uses authorization headers.
365 365
 		if ( version_compare( '3.0', $this->api_version, '<=' ) ) {
366
-			$args['headers'] = $this->get_auth_headers();
366
+			$args[ 'headers' ] = $this->get_auth_headers();
367 367
 		}
368 368
 
369 369
 		return $args;
Please login to merge, or discard this patch.
includes/class-yikes-inc-easy-mailchimp-extender-activator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 			if ( $network_wide ) {
35 35
 				$old_blog = $wpdb->blogid;
36 36
 				// Get all blog ids
37
-				$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
37
+				$blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
38 38
 				foreach ( $blogids as $blog_id ) {
39 39
 					switch_to_blog( $blog_id );
40 40
 					self::_activate_yikes_easy_mailchimp( $wpdb );
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 		custom_fields TEXT NOT NULL,
91 91
 		UNIQUE KEY id (id)
92 92
 		) $charset_collate;";
93
-		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
94
-		dbDelta($sql);
93
+		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
94
+		dbDelta( $sql );
95 95
 
96 96
 		// create an option for the date that the user initially activated the plugin
97 97
 		// used to display a two week notice, asking for a review or to upgrade
Please login to merge, or discard this patch.
includes/third-party-integrations/visual-composer/visual-composer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 		if ( ! empty( $all_forms ) ) {
107 107
 			// build an array to pass to our javascript
108 108
 			foreach ( $all_forms as $id => $form ) {
109
-				$lists[ $form['form_name'] ] = $id;
109
+				$lists[ $form[ 'form_name' ] ] = $id;
110 110
 			}
111 111
 		} else {
112 112
 			$lists[ __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ) ] = '-';
Please login to merge, or discard this patch.
includes/class-yikes-inc-easy-mailchimp-extender-loader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @return   type                                   The collection of actions and filters registered with WordPress.
87 87
 	 */
88 88
 	private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
89
-		$hooks[] = array(
89
+		$hooks[ ] = array(
90 90
 			'hook'          => $hook,
91 91
 			'component'     => $component,
92 92
 			'callback'      => $callback,
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function run() {
104 104
 		foreach ( $this->filters as $hook ) {
105
-			add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
105
+			add_filter( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] );
106 106
 		}
107 107
 		foreach ( $this->actions as $hook ) {
108
-			add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
108
+			add_action( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] );
109 109
 		}
110 110
 	}
111 111
 }
112 112
\ No newline at end of file
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,33 +9,33 @@  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
-		'email-exists-error' => __( "The email you entered is already a subscriber to this list." , 'yikes-inc-easy-mailchimp-extender' ),
22
-		'success-single-optin' => __( 'Thank you for subscribing!' , '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
+		'email-exists-error' => __( "The email you entered is already a subscriber to this list.", 'yikes-inc-easy-mailchimp-extender' ),
22
+		'success-single-optin' => __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ),
23 23
 		'success-resubscribed' => __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' ),
24 24
 		'update-link' => __( "To update your MailChimp profile, please [link]click to send yourself an update link[/link].", 'yikes-inc-easy-mailchimp-extender' ),
25 25
 		'email-subject' => __( 'MailChimp Profile Update', 'yikes-inc-easy-mailchimp-extender' ),
26 26
 	);
27 27
 	
28 28
 	// if old options are defined...
29
-	if( $old_plugin_options ) {
29
+	if ( $old_plugin_options ) {
30 30
 		
31 31
 		// Verify the NONCE is valid
32
-		check_admin_referer( 'yikes-mc-migrate-options' , 'migrate_options_nonce' );
32
+		check_admin_referer( 'yikes-mc-migrate-options', 'migrate_options_nonce' );
33 33
 		
34 34
 		?>
35 35
 			
36 36
 		<div class="wrap" style="text-align:center;">
37
-			<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>
38
-			<p><?php _e( 'please be patient while your options are updated and the process has completed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
37
+			<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>
38
+			<p><?php _e( 'please be patient while your options are updated and the process has completed', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
39 39
 			<!-- empty list, populate when options  get updated -->
40 40
 			<ul id="options-updated" class="yikes-easy-mc-hidden">
41 41
 				<hr />
@@ -49,82 +49,82 @@  discard block
 block discarded – undo
49 49
 				
50 50
 					// loop over our old options, and store them in a new option value
51 51
 					$do_not_migrate_options = array(
52
-						'ssl_verify_peer', 'api_validation' , 'widget_yikes_mc_widget' , 'flavor' , 'single-optin-message' , 'double-optin-message' ,
53
-						'mailchimp-optIn-default-list' , 'version' , 'yks-mailchimp-jquery-datepicker' , 'ssl_verify_peer' , 'optIn-checkbox' , 'yks-mailchimp-optin-checkbox-text',
54
-						'yks-mailchimp-required-text' , 'optin'
52
+						'ssl_verify_peer', 'api_validation', 'widget_yikes_mc_widget', 'flavor', 'single-optin-message', 'double-optin-message',
53
+						'mailchimp-optIn-default-list', 'version', 'yks-mailchimp-jquery-datepicker', 'ssl_verify_peer', 'optIn-checkbox', 'yks-mailchimp-optin-checkbox-text',
54
+						'yks-mailchimp-required-text', 'optin'
55 55
 					);
56 56
 							
57
-					foreach( $old_plugin_options as $option_name => $option_value ) {
57
+					foreach ( $old_plugin_options as $option_name => $option_value ) {
58 58
 												
59
-						if( ! in_array( $option_name , $do_not_migrate_options ) ) {
59
+						if ( ! in_array( $option_name, $do_not_migrate_options ) ) {
60 60
 							// ajax request to update our options one by one..
61 61
 							// if its an array, we need to json encode it
62
-							if( is_array( $option_value ) ) {
62
+							if ( is_array( $option_value ) ) {
63 63
 								
64
-								if( $option_name == 'lists' ) {
64
+								if ( $option_name == 'lists' ) {
65 65
 																	
66
-									if( ! empty( $option_value ) ) {
66
+									if ( ! empty( $option_value ) ) {
67 67
 										$settings = 1;
68 68
 										$form_length = count( $option_value );
69
-										foreach( $option_value as $mailchimp_form ) {
69
+										foreach ( $option_value as $mailchimp_form ) {
70 70
 											// update and pass our placeholder value
71 71
 											reset( $mailchimp_form );
72
-											$form_id = $mailchimp_form['id'];
72
+											$form_id = $mailchimp_form[ 'id' ];
73 73
 											
74
-											$fields = $mailchimp_form['fields'];	
74
+											$fields = $mailchimp_form[ 'fields' ];	
75 75
 											reset( $fields );
76 76
 											$first_field_key = key( $fields );
77 77
 											$array_keys = array_keys( $fields );
78 78
 											
79 79
 											$x = 1;								
80 80
 					
81
-											foreach( $array_keys as $parent_key ) {
81
+											foreach ( $array_keys as $parent_key ) {
82 82
 												
83 83
 												// alter the field keys so they show up after an import
84 84
 												$split_parent_key = explode( '-', $parent_key );
85 85
 
86
-												$new_parent_key = ( isset( $split_parent_key[1] ) ) ? strtoupper( $split_parent_key[1] ) : $parent_key;
86
+												$new_parent_key = ( isset( $split_parent_key[ 1 ] ) ) ? strtoupper( $split_parent_key[ 1 ] ) : $parent_key;
87 87
 
88
-												$mailchimp_form['fields'][$new_parent_key] = $mailchimp_form['fields'][$parent_key];
88
+												$mailchimp_form[ 'fields' ][ $new_parent_key ] = $mailchimp_form[ 'fields' ][ $parent_key ];
89 89
 
90
-												unset( $mailchimp_form['fields'][$parent_key] );			
90
+												unset( $mailchimp_form[ 'fields' ][ $parent_key ] );			
91 91
 										
92 92
 												// update our placeholder key to be 'placeholder'
93
-												$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] : '';
93
+												$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 ] : '';
94 94
 												// update field classes
95
-												$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] : '';
95
+												$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 ] : '';
96 96
 												// update help field - populate description
97
-												$mailchimp_form['fields'][$new_parent_key]['description'] = isset( $mailchimp_form['fields'][$new_parent_key]['help'] ) ? $mailchimp_form['fields'][$new_parent_key]['help'] : ''; 
97
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'description' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] : ''; 
98 98
 												// remove the old placeholder structure
99
-												unset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] );
99
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] );
100 100
 												// remove old custom class structure
101
-												unset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] );
101
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] );
102 102
 												// remove old help/description 
103
-												unset( $mailchimp_form['fields'][$new_parent_key]['help'] );
103
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] );
104 104
 																							
105 105
 												// check if choices is set, and encode them
106
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['choices'] ) && ! empty( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) {
107
-													$mailchimp_form['fields'][$new_parent_key]['choices'] = addslashes( addslashes( json_encode( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) );
106
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) && ! empty( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) {
107
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] = addslashes( addslashes( json_encode( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) );
108 108
 												}	
109 109
 
110 110
 												// update 'default' to 'default-choice' for radio/dropdown
111
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'radio', 'dropdown' ) ) ) {
112
-													$mailchimp_form['fields'][$new_parent_key]['default_choice'] = $mailchimp_form['fields'][$new_parent_key]['default'];
113
-													unset( $mailchimp_form['fields'][$new_parent_key]['default'] );
111
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'radio', 'dropdown' ) ) ) {
112
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default_choice' ] = $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ];
113
+													unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ] );
114 114
 												}
115 115
 												
116 116
 												// update 'date_format' on 'birthday' and 'date' fields
117
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) {
118
-													if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date
119
-														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered)
117
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'date', 'birthday' ) ) ) {
118
+													if ( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] == 'date' ) { // date
119
+														$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD'; // mailchimp default (can be altered)
120 120
 													} else { // birthday 
121
-														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
121
+														$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
122 122
 													}
123 123
 												}
124 124
 												
125 125
 												// update 'phone_format' on 'phone'
126
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'phone' ) ) ) {
127
-													$mailchimp_form['fields'][$new_parent_key]['phone_format'] = 'phone_format '; // phone format
126
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'phone' ) ) ) {
127
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'phone_format' ] = 'phone_format '; // phone format
128 128
 												}
129 129
 												
130 130
 												$x++;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 																								
142 142
 												$.post( ajaxurl, mc_data, function(response) {
143 143
 													jQuery( '#options-updated' ).show();
144
-													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>' );	
144
+													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>' );	
145 145
 													if( response.completed_import ) {
146 146
 														setTimeout( function() {
147 147
 															// finished with the loop...lets let the user know....and then redirect them....
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 															jQuery( '.upgrading-ellipse-two' ).remove();
151 151
 															jQuery( '.upgrading-ellipse-three' ).remove();
152 152
 															jQuery( '.wrap' ).find( 'h3' ).next().fadeOut();
153
-															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>' );
153
+															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>' );
154 154
 															// redirect our user to the main plugin page...
155 155
 															setTimeout( function() {
156 156
 																<?php 
157 157
 																	// migrate options that didnt make it (they were never stored in the 'ykseme_storage' options array)
158
-																	add_option( 'yikes-mc-api-validation' , get_option( 'api_validation' , 'invalid_api_key' ) );
159
-																	add_option( 'yikes-mc-error-messages' , $global_error_messages );
158
+																	add_option( 'yikes-mc-api-validation', get_option( 'api_validation', 'invalid_api_key' ) );
159
+																	add_option( 'yikes-mc-error-messages', $global_error_messages );
160 160
 																	// delete our old options after a successful migration (and some new ones that are no longer needed)
161 161
 																	delete_option( 'widget_yikes_mc_widget' );
162 162
 																	delete_option( 'api_validation' );
@@ -177,26 +177,26 @@  discard block
 block discarded – undo
177 177
 							}
178 178
 							/* Rename our ReCaptcha Options */
179 179
 								/* Public Site Key */
180
-								if( $option_name == 'recaptcha-api-key' ) {
180
+								if ( $option_name == 'recaptcha-api-key' ) {
181 181
 									$option_name = 'recaptcha-site-key';
182 182
 								}
183 183
 								/* Private Key */
184
-								if( $option_name == 'recaptcha-private-api-key'  ) {
184
+								if ( $option_name == 'recaptcha-private-api-key' ) {
185 185
 									$option_name = 'recaptcha-secret-key';
186 186
 								}
187 187
 								/* Change 'recaptcha-setting' to 'recaptcha-status' */
188 188
 								/* Status */
189
-								if( $option_name == 'recaptcha-setting' ) {
189
+								if ( $option_name == 'recaptcha-setting' ) {
190 190
 									$option_name = 'recaptcha-status';
191 191
 								}
192 192
 							/* End  re-name ReCaptcha options */
193 193
 							
194 194
 
195
-							if( is_array( $option_value ) ) {
195
+							if ( is_array( $option_value ) ) {
196 196
 								$option_value = json_encode( $option_value );
197 197
 							}
198 198
 							// do noit migrate the lists option, it's not useful to us
199
-							if( $option_name != 'lists' ) {
199
+							if ( $option_name != 'lists' ) {
200 200
 								?>
201 201
 									var data = {
202 202
 										'action': 'migrate_old_plugin_settings',
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 													
207 207
 									$.post( ajaxurl, data, function(response) {
208 208
 										jQuery( '#options-updated' ).show();
209
-										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>' );	
209
+										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>' );	
210 210
 									});
211 211
 								<?php
212 212
 								
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 					}, 2000 );
231 231
 			</script>
232 232
 		<?php
233
-			wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>' , 500 );
233
+			wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>', 500 );
234 234
 		?>
235 235
 		</div>
236 236
 		<?php
Please login to merge, or discard this patch.
public/class-yikes-inc-easy-mailchimp-extender-public.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 		new YIKES_Inc_Easy_MailChimp_Public_Ajax();
57 57
 
58 58
 		// Include our error logging class
59
-		add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 );
59
+		add_action( 'init', array( $this, 'load_error_logging_class' ), 1 );
60 60
 		// load our checkbox classes
61
-		add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 );
61
+		add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 );
62 62
 		// custom front end filter
63 63
 		add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) );
64 64
 		// Process non-ajax forms in the header
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 	**/
94 94
 	public function load_checkbox_integration_classes() {
95 95
 		// store our options
96
-		$integrations = get_option( 'optin-checkbox-init' , array() );
97
-		if( ! empty( $integrations ) && is_array( $integrations ) ) {
96
+		$integrations = get_option( 'optin-checkbox-init', array() );
97
+		if ( ! empty( $integrations ) && is_array( $integrations ) ) {
98 98
 			// load our mail integrations class
99 99
 			require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php';
100 100
 			// loop over selected classes and load them up!
101
-			foreach( $integrations as $integration => $value ) {
102
-				if( isset( $value['value'] ) && $value['value'] == 'on' ) {
101
+			foreach ( $integrations as $integration => $value ) {
102
+				if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) {
103 103
 					// load our class extensions
104
-					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php';
104
+					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php';
105 105
 				}
106 106
 			}
107 107
 		}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @since 6.0.0
116 116
 	 */
117 117
 	public function load_error_logging_class() {
118
-		if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
118
+		if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
119 119
 			// if error logging is enabled we should include our error logging class
120 120
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
121 121
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging;
@@ -128,19 +128,19 @@  discard block
 block discarded – undo
128 128
 	*	@since 6.0.3.4
129 129
 	*/
130 130
 	public function yikes_process_non_ajax_forms( $form_submitted ) {
131
-		global $wpdb,$post;
132
-		$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id
133
-		if( $form_id ) {
131
+		global $wpdb, $post;
132
+		$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id
133
+		if ( $form_id ) {
134 134
 			$form_settings = self::yikes_retrieve_form_settings( $form_id );
135
-			if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) {
136
-				if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted
135
+			if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) {
136
+				if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted
137 137
 
138 138
 					// Lets include our form processing file
139 139
 					include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' );
140
-					if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) {
141
-						if( $form_submitted == 1 ) {
140
+					if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) {
141
+						if ( $form_submitted == 1 ) {
142 142
 							// decode our settings
143
-							$redirect_page = ( 'custom_url' != $form_settings['submission_settings']['redirect_page'] ) ? get_permalink( (int) $form_settings['submission_settings']['redirect_page'] ) : $form_settings['submission_settings']['custom_redirect_url'];
143
+							$redirect_page = ( 'custom_url' != $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) ? get_permalink( (int) $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) : $form_settings[ 'submission_settings' ][ 'custom_redirect_url' ];
144 144
 							wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) );
145 145
 							exit;
146 146
 						}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public static function yikes_retrieve_form_settings( $form_id ) {
170 170
 		// if no form id, abort
171
-		if( ! $form_id ) {
171
+		if ( ! $form_id ) {
172 172
 			return array();
173 173
 		}
174 174
 
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
 			return;
198 198
 		}
199 199
 		// trim trailing period
200
-		if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) {
201
-			$response_text = $form_settings['error_messages']['update-link'];
200
+		if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) {
201
+			$response_text = $form_settings[ 'error_messages' ][ 'update-link' ];
202 202
 			// extract the link text
203 203
 			preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text );
204 204
 			if ( $link_text && ! empty( $link_text ) ) {
205 205
 				// Extract the custom link text ([link]*[/link])
206
-				$custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) );
206
+				$custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) );
207 207
 				// Replace the link text, with our custom link text
208 208
 				$response_text = str_replace( $link_text, $custom_link_text, $response_text );
209 209
 			}
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 		}
233 233
 
234 234
 		// trim trailing period
235
-		if ( isset( $form_settings['error_messages']['already-subscribed'] ) && ! empty( $form_settings['error_messages']['already-subscribed'] ) ) {
236
-			$response_text = str_replace( '[email]', $email, $form_settings['error_messages']['already-subscribed'] );
235
+		if ( isset( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) {
236
+			$response_text = str_replace( '[email]', $email, $form_settings[ 'error_messages' ][ 'already-subscribed' ] );
237 237
 		}
238 238
 		// Return our new string
239 239
 		return $response_text;
Please login to merge, or discard this patch.
admin/partials/dashboard-widgets/templates/stats-list-template.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /* The template file for displaying our stats in the Admin dashboard widget */
3 3
 
4 4
 if ( isset( $list_data ) ) {
5
-	if ( isset( $list_data['id'] ) ) {
5
+	if ( isset( $list_data[ 'id' ] ) ) {
6 6
 
7 7
 	// When a user selects a list from the dropdown, capture the array value here
8 8
 	$list = $list_data;
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
 		// Get the list IDs, capture the first list ID
14 14
 		$first_list_id = '';
15 15
 		$list_ids = array_keys( $list_data );
16
-		if ( is_array( $list_ids ) && isset( $list_ids[0] ) ) {
17
-			$first_list_id = $list_ids[0];
16
+		if ( is_array( $list_ids ) && isset( $list_ids[ 0 ] ) ) {
17
+			$first_list_id = $list_ids[ 0 ];
18 18
 		}
19 19
 
20 20
 		// Set our $list value to the first list in the list_data array
21
-		if ( isset( $list_data[ $first_list_id ] ) && is_array( $list_data[ $first_list_id ] ) && isset( $list_data[ $first_list_id ]['id'] ) ) {
21
+		if ( isset( $list_data[ $first_list_id ] ) && is_array( $list_data[ $first_list_id ] ) && isset( $list_data[ $first_list_id ][ 'id' ] ) ) {
22 22
 			$list = $list_data[ $first_list_id ];
23 23
 		}
24 24
 	}
@@ -31,36 +31,36 @@  discard block
 block discarded – undo
31 31
 
32 32
 ?>
33 33
 <section id="yikes-easy-mc-widget-stat-holder">
34
-	<h3><?php echo $list['name']; ?> <small><a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $list['id'] . '' ) ); ?>" title="<?php _e( 'view List' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'view list' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></h3>
34
+	<h3><?php echo $list[ 'name' ]; ?> <small><a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $list[ 'id' ] . '' ) ); ?>" title="<?php _e( 'view List', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'view list', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></h3>
35 35
 	
36 36
 	<table class="yikes-easy-mc-stats-table">
37 37
 		<thead class="yikes-easy-mc-hidden">
38 38
 			<tr>
39
-				<th><?php _e( 'Subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
40
-				<th><?php _e( 'Unsubscribed' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
41
-				<th><?php _e( 'New Since Send' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>	
42
-				<th><?php _e( 'Avg. Sub. Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
39
+				<th><?php _e( 'Subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
40
+				<th><?php _e( 'Unsubscribed', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
41
+				<th><?php _e( 'New Since Send', 'yikes-inc-easy-mailchimp-extender' ); ?></th>	
42
+				<th><?php _e( 'Avg. Sub. Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
43 43
 			</tr>
44 44
 		</thead>
45 45
 		<tbody>
46 46
 			<tr class="yikes-easy-mc-table-stats-tr yikes-easy-mc-table-stats-tr-first">
47
-				<td title="<?php _e( 'Number of active subscribers.' , 'yikes-inc-easy-mailchimp-extender' ); ?>">
48
-					<p class="yikes-easy-mc-dashboard-stat"><?php echo $list['stats']['member_count']; ?></p>
49
-						<p class="yikes-easy-mc-stat-list-label"><?php _e( 'subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
47
+				<td title="<?php _e( 'Number of active subscribers.', 'yikes-inc-easy-mailchimp-extender' ); ?>">
48
+					<p class="yikes-easy-mc-dashboard-stat"><?php echo $list[ 'stats' ][ 'member_count' ]; ?></p>
49
+						<p class="yikes-easy-mc-stat-list-label"><?php _e( 'subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
50 50
 				</td>
51
-				<td title="<?php _e( 'Number of users who have unsusbscribed.' , 'yikes-inc-easy-mailchimp-extender' ); ?>">
52
-					<p class="yikes-easy-mc-dashboard-stat"><?php echo $list['stats']['unsubscribe_count']; ?></p>
53
-						<p class="yikes-easy-mc-stat-list-label"><?php _e( 'unsubscribed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
51
+				<td title="<?php _e( 'Number of users who have unsusbscribed.', 'yikes-inc-easy-mailchimp-extender' ); ?>">
52
+					<p class="yikes-easy-mc-dashboard-stat"><?php echo $list[ 'stats' ][ 'unsubscribe_count' ]; ?></p>
53
+						<p class="yikes-easy-mc-stat-list-label"><?php _e( 'unsubscribed', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
54 54
 				</td>
55 55
 			</tr>
56 56
 			<tr class="yikes-easy-mc-table-stats-tr  yikes-easy-mc-table-stats-tr-second">
57
-				<td title="<?php _e( 'Number of new subscribers since the last campaign was sent.' , 'yikes-inc-easy-mailchimp-extender' ); ?>">
58
-					<p class="yikes-easy-mc-dashboard-stat"><?php echo $list['stats']['member_count_since_send']; ?></p>
59
-						<p class="yikes-easy-mc-stat-list-label"><?php _e( 'new since send' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
57
+				<td title="<?php _e( 'Number of new subscribers since the last campaign was sent.', 'yikes-inc-easy-mailchimp-extender' ); ?>">
58
+					<p class="yikes-easy-mc-dashboard-stat"><?php echo $list[ 'stats' ][ 'member_count_since_send' ]; ?></p>
59
+						<p class="yikes-easy-mc-stat-list-label"><?php _e( 'new since send', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
60 60
 				</td>
61
-				<td title="<?php _e( 'Average number of subscribers per month.' , 'yikes-inc-easy-mailchimp-extender' ); ?>">
62
-					<p class="yikes-easy-mc-dashboard-stat"><?php echo $list['stats']['avg_sub_rate']; ?></p>
63
-						<p class="yikes-easy-mc-stat-list-label"><?php _e( 'avg. sub. rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
61
+				<td title="<?php _e( 'Average number of subscribers per month.', 'yikes-inc-easy-mailchimp-extender' ); ?>">
62
+					<p class="yikes-easy-mc-dashboard-stat"><?php echo $list[ 'stats' ][ 'avg_sub_rate' ]; ?></p>
63
+						<p class="yikes-easy-mc-stat-list-label"><?php _e( 'avg. sub. rate', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
64 64
 				</td>
65 65
 			</tr>
66 66
 		</tbody>
Please login to merge, or discard this patch.
includes/third-party-integrations/third-party-init.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 		// required..*
18 18
 		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
19 19
 		/* Visual Composer */
20
-		if( is_plugin_active( 'js_composer/js_composer.php' ) ) {
20
+		if ( is_plugin_active( 'js_composer/js_composer.php' ) ) {
21 21
 			new YIKES_MailChimp_Visual_Composer_Extension();
22 22
 		}
23 23
 	}
Please login to merge, or discard this patch.