Completed
Push — develop ( b30a9b...fddcc1 )
by Zack
07:54
created
includes/extensions/edit-entry/class-edit-entry-user-registration.php 2 patches
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'WPINC' ) ) {
14
-    die;
14
+	die;
15 15
 }
16 16
 
17 17
 /**
@@ -22,104 +22,104 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @var GravityView_Edit_Entry
24 24
 	 */
25
-    protected $loader;
25
+	protected $loader;
26 26
 
27
-    /**
28
-     * @var WP_User|null Temporary storage used by restore_user_details()
29
-     */
30
-    private $_user_before_update = null;
27
+	/**
28
+	 * @var WP_User|null Temporary storage used by restore_user_details()
29
+	 */
30
+	private $_user_before_update = null;
31 31
 
32
-    function __construct( GravityView_Edit_Entry $loader ) {
33
-        $this->loader = $loader;
34
-    }
32
+	function __construct( GravityView_Edit_Entry $loader ) {
33
+		$this->loader = $loader;
34
+	}
35 35
 
36 36
 	/**
37 37
 	 * @since 1.11
38 38
 	 */
39 39
 	public function load() {
40 40
 		add_action( 'wp', array( $this, 'add_hooks' ), 10 );
41
-    }
41
+	}
42 42
 
43 43
 	/**
44 44
 	 * Add hooks to trigger updating the user
45 45
 	 *
46 46
 	 * @since 1.18
47 47
 	 */
48
-    public function add_hooks() {
49
-
50
-	    /**
51
-	     * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated?
52
-	     * @since 1.11
53
-	     * @param boolean $boolean Whether to trigger update on user registration (default: true)
54
-	     */
55
-	    if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56
-
57
-	    	add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
58
-
59
-		    // last resort in case the current user display name don't match any of the defaults
60
-		    add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
61
-	    }
62
-    }
63
-
64
-    /**
65
-     * Update the WordPress user profile based on the GF User Registration create feed
66
-     *
67
-     * @since 1.11
68
-     *
69
-     * @param array $form Gravity Forms form array
70
-     * @param string $entry_id Gravity Forms entry ID
71
-     * @return void
72
-     */
73
-    public function update_user( $form = array(), $entry_id = 0 ) {
74
-
75
-        if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76
-	        do_action( 'gravityview_log_error', __METHOD__ . ': GFAPI or User Registration class not found; not updating the user' );
77
-	        return;
78
-        } elseif( empty( $entry_id ) ) {
79
-        	do_action( 'gravityview_log_error', __METHOD__ . ': Entry ID is empty; not updating the user', $entry_id );
80
-	        return;
81
-        }
82
-
83
-        /** @var GF_User_Registration $gf_user_registration */
84
-        $gf_user_registration = GF_User_Registration::get_instance();
85
-
86
-        $entry = GFAPI::get_entry( $entry_id );
87
-
88
-	    /**
89
-	     * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
90
-	     * @since 1.11
91
-	     * @param array $entry Gravity Forms entry
92
-	     * @param array $form Gravity Forms form
93
-	     */
94
-        $entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form );
95
-
96
-	    $config = $this->get_feed_configuration( $entry, $form );
97
-
98
-        // Make sure the feed is active
99
-	    if ( ! rgar( $config, 'is_active', false ) ) {
48
+	public function add_hooks() {
49
+
50
+		/**
51
+		 * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated?
52
+		 * @since 1.11
53
+		 * @param boolean $boolean Whether to trigger update on user registration (default: true)
54
+		 */
55
+		if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56
+
57
+			add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
58
+
59
+			// last resort in case the current user display name don't match any of the defaults
60
+			add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
61
+		}
62
+	}
63
+
64
+	/**
65
+	 * Update the WordPress user profile based on the GF User Registration create feed
66
+	 *
67
+	 * @since 1.11
68
+	 *
69
+	 * @param array $form Gravity Forms form array
70
+	 * @param string $entry_id Gravity Forms entry ID
71
+	 * @return void
72
+	 */
73
+	public function update_user( $form = array(), $entry_id = 0 ) {
74
+
75
+		if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76
+			do_action( 'gravityview_log_error', __METHOD__ . ': GFAPI or User Registration class not found; not updating the user' );
100 77
 			return;
101
-	    }
78
+		} elseif( empty( $entry_id ) ) {
79
+			do_action( 'gravityview_log_error', __METHOD__ . ': Entry ID is empty; not updating the user', $entry_id );
80
+			return;
81
+		}
82
+
83
+		/** @var GF_User_Registration $gf_user_registration */
84
+		$gf_user_registration = GF_User_Registration::get_instance();
85
+
86
+		$entry = GFAPI::get_entry( $entry_id );
102 87
 
103
-	    // If an Update feed, make sure the conditions are met.
104
-	    if( rgars( $config, 'meta/feedType' ) === 'update' ) {
105
-	    	if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
106
-			    return;
107
-		    }
108
-	    }
88
+		/**
89
+		 * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
90
+		 * @since 1.11
91
+		 * @param array $entry Gravity Forms entry
92
+		 * @param array $form Gravity Forms form
93
+		 */
94
+		$entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form );
95
+
96
+		$config = $this->get_feed_configuration( $entry, $form );
97
+
98
+		// Make sure the feed is active
99
+		if ( ! rgar( $config, 'is_active', false ) ) {
100
+			return;
101
+		}
109 102
 
110
-        // The priority is set to 3 so that default priority (10) will still override it
111
-        add_filter( 'send_password_change_email', '__return_false', 3 );
112
-        add_filter( 'send_email_change_email', '__return_false', 3 );
103
+		// If an Update feed, make sure the conditions are met.
104
+		if( rgars( $config, 'meta/feedType' ) === 'update' ) {
105
+			if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
106
+				return;
107
+			}
108
+		}
113 109
 
114
-        // Trigger the User Registration update user method
115
-        $gf_user_registration->update_user( $entry, $form, $config );
110
+		// The priority is set to 3 so that default priority (10) will still override it
111
+		add_filter( 'send_password_change_email', '__return_false', 3 );
112
+		add_filter( 'send_email_change_email', '__return_false', 3 );
116 113
 
117
-        remove_filter( 'send_password_change_email', '__return_false', 3 );
118
-        remove_filter( 'send_email_change_email', '__return_false', 3 );
114
+		// Trigger the User Registration update user method
115
+		$gf_user_registration->update_user( $entry, $form, $config );
119 116
 
120
-        // Prevent double-triggering by removing the hook
121
-	    remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
122
-    }
117
+		remove_filter( 'send_password_change_email', '__return_false', 3 );
118
+		remove_filter( 'send_email_change_email', '__return_false', 3 );
119
+
120
+		// Prevent double-triggering by removing the hook
121
+		remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
122
+	}
123 123
 
124 124
 	/**
125 125
 	 * Get the User Registration feed configuration for the entry & form
@@ -134,185 +134,185 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return array
136 136
 	 */
137
-    public function get_feed_configuration( $entry, $form ) {
138
-
139
-	    /** @var GF_User_Registration $gf_user_registration */
140
-	    $gf_user_registration = GF_User_Registration::get_instance();
141
-
142
-	    $config = $gf_user_registration->get_single_submission_feed( $entry, $form );
143
-
144
-	    /**
145
-	     * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
146
-	     * @since 1.15
147
-	     * @param[in,out] boolean $preserve_role Preserve current user role Default: true
148
-	     * @param[in] array $config Gravity Forms User Registration feed configuration for the form
149
-	     * @param[in] array $form Gravity Forms form array
150
-	     * @param[in] array $entry Gravity Forms entry being edited
151
-	     */
152
-	    $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
153
-
154
-	    if( $preserve_role ) {
155
-		    $config['meta']['role'] = 'gfur_preserve_role';
156
-	    }
157
-
158
-	    $displayname = $this->match_current_display_name( $entry['created_by'] );
159
-
160
-	    /**
161
-	     * Make sure the current display name is not changed with the update user method.
162
-	     * @since 1.15
163
-	     */
164
-	    $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
165
-
166
-	    /**
167
-	     * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
168
-	     * @since 1.14
169
-	     * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
170
-	     * @param[in] array $form Gravity Forms form array
171
-	     * @param[in] array $entry Gravity Forms entry being edited
172
-	     */
173
-	    $config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry );
174
-
175
-	    return $config;
176
-    }
177
-
178
-    /**
179
-     * Calculate the user display name format
180
-     *
181
-     * @since 1.15
182
-     * @since 1.20 Returns false if user not found at $user_id
183
-     *
184
-     * @param int $user_id WP User ID
185
-     * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.
186
-     */
187
-    public function match_current_display_name( $user_id ) {
188
-
189
-        $user = get_userdata( $user_id );
190
-
191
-        if( ! $user ) {
192
-        	return false;
193
-        }
194
-
195
-        $names = $this->generate_display_names( $user );
196
-
197
-        $format = array_search( $user->display_name, $names, true );
198
-
199
-        /**
200
-         * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
201
-         * @see restore_display_name
202
-         */
203
-        if( false === $format ) {
204
-            $this->_user_before_update = $user;
205
-        }
206
-
207
-        return $format;
208
-    }
209
-
210
-    /**
211
-     * Generate an array of all the user display names possibilities
212
-     *
213
-     * @since 1.15
214
-     *
215
-     * @param object $profileuser WP_User object
216
-     * @return array List all the possible display names for a certain User object
217
-     */
218
-    public function generate_display_names( $profileuser ) {
219
-
220
-        $public_display = array();
221
-        $public_display['nickname']  = $profileuser->nickname;
222
-        $public_display['username']  = $profileuser->user_login;
223
-
224
-        if ( !empty($profileuser->first_name) ) {
225
-	        $public_display['firstname'] = $profileuser->first_name;
226
-        }
227
-
228
-        if ( !empty($profileuser->last_name) ) {
229
-	        $public_display['lastname'] = $profileuser->last_name;
230
-        }
231
-
232
-        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
233
-            $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
234
-            $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
235
-        }
236
-
237
-        $public_display = array_map( 'trim', $public_display );
238
-        $public_display = array_unique( $public_display );
239
-
240
-        return $public_display;
241
-    }
242
-
243
-
244
-    /**
245
-     * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon
246
-     *
247
-     * @see GFUser::update_user()
248
-     * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon
249
-     * @param array $config Gravity Forms User Registration Addon form feed configuration
250
-     * @param array $entry The Gravity Forms entry that was just updated
251
-     * @param string $password User password
252
-     * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
253
-     */
254
-    public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) {
255
-
256
-        /**
257
-         * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry.
258
-         * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
259
-         * @since 1.14.4
260
-         * @param boolean $restore_display_name Restore Display Name? Default: true
261
-         */
262
-        $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
263
-
264
-        $is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' );
265
-
266
-        /**
267
-         * Don't restore display name:
268
-         *   - either disabled,
269
-         *   - or it is an Update feed (we only care about Create feed)
270
-         *   - or we don't need as we found the correct format before updating user.
271
-         * @since 1.14.4
272
-         */
273
-        if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
274
-            return null;
275
-        }
276
-
277
-        $user_after_update = get_userdata( $user_id );
278
-
279
-        // User not found
280
-	    if ( ! $user_after_update ) {
281
-	    	do_action('gravityview_log_error', __METHOD__ . sprintf( ' - User not found at $user_id #%d', $user_id ) );
282
-		    return false;
283
-	    }
284
-
285
-        $restored_user = $user_after_update;
286
-
287
-	    // Restore previous display_name
288
-        $restored_user->display_name = $this->_user_before_update->display_name;
289
-
290
-	    // Don't have WP update the password.
291
-	    unset( $restored_user->data->user_pass, $restored_user->user_pass );
292
-
293
-        /**
294
-         * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
295
-         * @since 1.14
296
-         * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user()
297
-         * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration
298
-         * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration
299
-         * @param array   $entry The Gravity Forms entry that was just updated
300
-         */
301
-        $restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry );
302
-
303
-        $updated = wp_update_user( $restored_user );
304
-
305
-        if( is_wp_error( $updated ) ) {
306
-            do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated );
307
-        } else {
308
-            do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) );
309
-        }
310
-
311
-        $this->_user_before_update = null;
312
-
313
-        unset( $restored_user, $user_after_update );
314
-
315
-        return $updated;
316
-    }
137
+	public function get_feed_configuration( $entry, $form ) {
138
+
139
+		/** @var GF_User_Registration $gf_user_registration */
140
+		$gf_user_registration = GF_User_Registration::get_instance();
141
+
142
+		$config = $gf_user_registration->get_single_submission_feed( $entry, $form );
143
+
144
+		/**
145
+		 * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
146
+		 * @since 1.15
147
+		 * @param[in,out] boolean $preserve_role Preserve current user role Default: true
148
+		 * @param[in] array $config Gravity Forms User Registration feed configuration for the form
149
+		 * @param[in] array $form Gravity Forms form array
150
+		 * @param[in] array $entry Gravity Forms entry being edited
151
+		 */
152
+		$preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
153
+
154
+		if( $preserve_role ) {
155
+			$config['meta']['role'] = 'gfur_preserve_role';
156
+		}
157
+
158
+		$displayname = $this->match_current_display_name( $entry['created_by'] );
159
+
160
+		/**
161
+		 * Make sure the current display name is not changed with the update user method.
162
+		 * @since 1.15
163
+		 */
164
+		$config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
165
+
166
+		/**
167
+		 * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
168
+		 * @since 1.14
169
+		 * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
170
+		 * @param[in] array $form Gravity Forms form array
171
+		 * @param[in] array $entry Gravity Forms entry being edited
172
+		 */
173
+		$config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry );
174
+
175
+		return $config;
176
+	}
177
+
178
+	/**
179
+	 * Calculate the user display name format
180
+	 *
181
+	 * @since 1.15
182
+	 * @since 1.20 Returns false if user not found at $user_id
183
+	 *
184
+	 * @param int $user_id WP User ID
185
+	 * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.
186
+	 */
187
+	public function match_current_display_name( $user_id ) {
188
+
189
+		$user = get_userdata( $user_id );
190
+
191
+		if( ! $user ) {
192
+			return false;
193
+		}
194
+
195
+		$names = $this->generate_display_names( $user );
196
+
197
+		$format = array_search( $user->display_name, $names, true );
198
+
199
+		/**
200
+		 * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
201
+		 * @see restore_display_name
202
+		 */
203
+		if( false === $format ) {
204
+			$this->_user_before_update = $user;
205
+		}
206
+
207
+		return $format;
208
+	}
209
+
210
+	/**
211
+	 * Generate an array of all the user display names possibilities
212
+	 *
213
+	 * @since 1.15
214
+	 *
215
+	 * @param object $profileuser WP_User object
216
+	 * @return array List all the possible display names for a certain User object
217
+	 */
218
+	public function generate_display_names( $profileuser ) {
219
+
220
+		$public_display = array();
221
+		$public_display['nickname']  = $profileuser->nickname;
222
+		$public_display['username']  = $profileuser->user_login;
223
+
224
+		if ( !empty($profileuser->first_name) ) {
225
+			$public_display['firstname'] = $profileuser->first_name;
226
+		}
227
+
228
+		if ( !empty($profileuser->last_name) ) {
229
+			$public_display['lastname'] = $profileuser->last_name;
230
+		}
231
+
232
+		if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
233
+			$public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
234
+			$public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
235
+		}
236
+
237
+		$public_display = array_map( 'trim', $public_display );
238
+		$public_display = array_unique( $public_display );
239
+
240
+		return $public_display;
241
+	}
242
+
243
+
244
+	/**
245
+	 * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon
246
+	 *
247
+	 * @see GFUser::update_user()
248
+	 * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon
249
+	 * @param array $config Gravity Forms User Registration Addon form feed configuration
250
+	 * @param array $entry The Gravity Forms entry that was just updated
251
+	 * @param string $password User password
252
+	 * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
253
+	 */
254
+	public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) {
255
+
256
+		/**
257
+		 * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry.
258
+		 * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
259
+		 * @since 1.14.4
260
+		 * @param boolean $restore_display_name Restore Display Name? Default: true
261
+		 */
262
+		$restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
263
+
264
+		$is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' );
265
+
266
+		/**
267
+		 * Don't restore display name:
268
+		 *   - either disabled,
269
+		 *   - or it is an Update feed (we only care about Create feed)
270
+		 *   - or we don't need as we found the correct format before updating user.
271
+		 * @since 1.14.4
272
+		 */
273
+		if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
274
+			return null;
275
+		}
276
+
277
+		$user_after_update = get_userdata( $user_id );
278
+
279
+		// User not found
280
+		if ( ! $user_after_update ) {
281
+			do_action('gravityview_log_error', __METHOD__ . sprintf( ' - User not found at $user_id #%d', $user_id ) );
282
+			return false;
283
+		}
284
+
285
+		$restored_user = $user_after_update;
286
+
287
+		// Restore previous display_name
288
+		$restored_user->display_name = $this->_user_before_update->display_name;
289
+
290
+		// Don't have WP update the password.
291
+		unset( $restored_user->data->user_pass, $restored_user->user_pass );
292
+
293
+		/**
294
+		 * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
295
+		 * @since 1.14
296
+		 * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user()
297
+		 * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration
298
+		 * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration
299
+		 * @param array   $entry The Gravity Forms entry that was just updated
300
+		 */
301
+		$restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry );
302
+
303
+		$updated = wp_update_user( $restored_user );
304
+
305
+		if( is_wp_error( $updated ) ) {
306
+			do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated );
307
+		} else {
308
+			do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) );
309
+		}
310
+
311
+		$this->_user_before_update = null;
312
+
313
+		unset( $restored_user, $user_after_update );
314
+
315
+		return $updated;
316
+	}
317 317
 
318 318
 } //end class
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	     * @since 1.11
53 53
 	     * @param boolean $boolean Whether to trigger update on user registration (default: true)
54 54
 	     */
55
-	    if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
55
+	    if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56 56
 
57
-	    	add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
57
+	    	add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 );
58 58
 
59 59
 		    // last resort in case the current user display name don't match any of the defaults
60 60
 		    add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function update_user( $form = array(), $entry_id = 0 ) {
74 74
 
75
-        if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
75
+        if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76 76
 	        do_action( 'gravityview_log_error', __METHOD__ . ': GFAPI or User Registration class not found; not updating the user' );
77 77
 	        return;
78
-        } elseif( empty( $entry_id ) ) {
78
+        } elseif ( empty( $entry_id ) ) {
79 79
         	do_action( 'gravityview_log_error', __METHOD__ . ': Entry ID is empty; not updating the user', $entry_id );
80 80
 	        return;
81 81
         }
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	    }
102 102
 
103 103
 	    // If an Update feed, make sure the conditions are met.
104
-	    if( rgars( $config, 'meta/feedType' ) === 'update' ) {
105
-	    	if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
104
+	    if ( rgars( $config, 'meta/feedType' ) === 'update' ) {
105
+	    	if ( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
106 106
 			    return;
107 107
 		    }
108 108
 	    }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         remove_filter( 'send_email_change_email', '__return_false', 3 );
119 119
 
120 120
         // Prevent double-triggering by removing the hook
121
-	    remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
121
+	    remove_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10 );
122 122
     }
123 123
 
124 124
 	/**
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 	     */
152 152
 	    $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
153 153
 
154
-	    if( $preserve_role ) {
155
-		    $config['meta']['role'] = 'gfur_preserve_role';
154
+	    if ( $preserve_role ) {
155
+		    $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role';
156 156
 	    }
157 157
 
158
-	    $displayname = $this->match_current_display_name( $entry['created_by'] );
158
+	    $displayname = $this->match_current_display_name( $entry[ 'created_by' ] );
159 159
 
160 160
 	    /**
161 161
 	     * Make sure the current display name is not changed with the update user method.
162 162
 	     * @since 1.15
163 163
 	     */
164
-	    $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
164
+	    $config[ 'meta' ][ 'displayname' ] = $displayname ? $displayname : $config[ 'meta' ][ 'displayname' ];
165 165
 
166 166
 	    /**
167 167
 	     * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
         $user = get_userdata( $user_id );
190 190
 
191
-        if( ! $user ) {
191
+        if ( ! $user ) {
192 192
         	return false;
193 193
         }
194 194
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
          * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
201 201
          * @see restore_display_name
202 202
          */
203
-        if( false === $format ) {
203
+        if ( false === $format ) {
204 204
             $this->_user_before_update = $user;
205 205
         }
206 206
 
@@ -218,20 +218,20 @@  discard block
 block discarded – undo
218 218
     public function generate_display_names( $profileuser ) {
219 219
 
220 220
         $public_display = array();
221
-        $public_display['nickname']  = $profileuser->nickname;
222
-        $public_display['username']  = $profileuser->user_login;
221
+        $public_display[ 'nickname' ]  = $profileuser->nickname;
222
+        $public_display[ 'username' ]  = $profileuser->user_login;
223 223
 
224
-        if ( !empty($profileuser->first_name) ) {
225
-	        $public_display['firstname'] = $profileuser->first_name;
224
+        if ( ! empty( $profileuser->first_name ) ) {
225
+	        $public_display[ 'firstname' ] = $profileuser->first_name;
226 226
         }
227 227
 
228
-        if ( !empty($profileuser->last_name) ) {
229
-	        $public_display['lastname'] = $profileuser->last_name;
228
+        if ( ! empty( $profileuser->last_name ) ) {
229
+	        $public_display[ 'lastname' ] = $profileuser->last_name;
230 230
         }
231 231
 
232
-        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
233
-            $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
234
-            $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
232
+        if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) {
233
+            $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name;
234
+            $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name;
235 235
         }
236 236
 
237 237
         $public_display = array_map( 'trim', $public_display );
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
          */
262 262
         $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
263 263
 
264
-        $is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' );
264
+        $is_update_feed = ( $config && rgars( $config, 'meta/feed_type' ) === 'update' );
265 265
 
266 266
         /**
267 267
          * Don't restore display name:
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
          *   - or we don't need as we found the correct format before updating user.
271 271
          * @since 1.14.4
272 272
          */
273
-        if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
273
+        if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
274 274
             return null;
275 275
         }
276 276
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
         // User not found
280 280
 	    if ( ! $user_after_update ) {
281
-	    	do_action('gravityview_log_error', __METHOD__ . sprintf( ' - User not found at $user_id #%d', $user_id ) );
281
+	    	do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - User not found at $user_id #%d', $user_id ) );
282 282
 		    return false;
283 283
 	    }
284 284
 
@@ -302,10 +302,10 @@  discard block
 block discarded – undo
302 302
 
303 303
         $updated = wp_update_user( $restored_user );
304 304
 
305
-        if( is_wp_error( $updated ) ) {
306
-            do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated );
305
+        if ( is_wp_error( $updated ) ) {
306
+            do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated );
307 307
         } else {
308
-            do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) );
308
+            do_action( 'gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) );
309 309
         }
310 310
 
311 311
         $this->_user_before_update = null;
Please login to merge, or discard this patch.
includes/class-gv-license-handler.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 			// Call the custom API.
117 117
 			$response = wp_remote_post( self::url, array(
118 118
 				'timeout'   => 15,
119
-			    'sslverify' => false,
120
-			    'body'      =>  array(
121
-				    'edd_action' => 'check_license',
122
-				    'license'    => trim( $this->Addon->get_app_setting( 'license_key' ) ),
123
-				    'item_name'  => self::name,
124
-				    'url'        => home_url(),
125
-				    'site_data'  => $this->get_site_data(),
126
-			    ),
119
+				'sslverify' => false,
120
+				'body'      =>  array(
121
+					'edd_action' => 'check_license',
122
+					'license'    => trim( $this->Addon->get_app_setting( 'license_key' ) ),
123
+					'item_name'  => self::name,
124
+					'url'        => home_url(),
125
+					'site_data'  => $this->get_site_data(),
126
+				),
127 127
 			));
128 128
 
129 129
 			// make sure the response came back okay
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			'author'    => self::author,
386 386
 			'language'  => get_locale(),
387 387
 			'url'       => home_url(),
388
-		    'beta'      => $this->Addon->get_app_setting( 'beta' ),
388
+			'beta'      => $this->Addon->get_app_setting( 'beta' ),
389 389
 		);
390 390
 
391 391
 		if( !empty( $action ) ) {
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		// Update option with passed data license
679 679
 		$settings = $this->Addon->get_app_settings();
680 680
 
681
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
681
+		$settings['license_key'] = $license_data->license_key = trim( $data['license'] );
682 682
 		$settings['license_key_status'] = $license_data->license;
683 683
 		$settings['license_key_response'] = (array)$license_data;
684 684
 
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @return GV_License_Handler
48 48
 	 */
49 49
 	public static function get_instance( GravityView_Settings $GFAddOn ) {
50
-		if( empty( self::$instance ) ) {
50
+		if ( empty( self::$instance ) ) {
51 51
 			self::$instance = new self( $GFAddOn );
52 52
 		}
53 53
 		return self::$instance;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				    'url'        => home_url(),
125 125
 				    'site_data'  => $this->get_site_data(),
126 126
 			    ),
127
-			));
127
+			) );
128 128
 
129 129
 			// make sure the response came back okay
130 130
 			if ( is_wp_error( $response ) ) {
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	public function refresh_license_status() {
152 152
 
153
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
153
+		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
154 154
 			return;
155 155
 		}
156 156
 
157 157
 		// The transient is fresh; don't fetch.
158
-		if( $status = get_transient( self::status_transient_key ) ) {
158
+		if ( $status = get_transient( self::status_transient_key ) ) {
159 159
 			return;
160 160
 		}
161 161
 
@@ -188,48 +188,48 @@  discard block
 block discarded – undo
188 188
 		$theme_data = wp_get_theme();
189 189
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
190 190
 
191
-		$data['gv_version']  = GravityView_Plugin::version;
192
-		$data['php_version']  = phpversion();
193
-		$data['wp_version']   = get_bloginfo( 'version' );
194
-		$data['gf_version']  = GFForms::$version;
195
-		$data['server']       = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
196
-		$data['multisite']    = is_multisite();
197
-		$data['theme']        = $theme;
198
-		$data['url']          = home_url();
199
-		$data['license_key']  = GravityView_Settings::get_instance()->get_app_setting( 'license_key' );
191
+		$data[ 'gv_version' ]  = GravityView_Plugin::version;
192
+		$data[ 'php_version' ]  = phpversion();
193
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
194
+		$data[ 'gf_version' ]  = GFForms::$version;
195
+		$data[ 'server' ]       = isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) ? $_SERVER[ 'SERVER_SOFTWARE' ] : '';
196
+		$data[ 'multisite' ]    = is_multisite();
197
+		$data[ 'theme' ]        = $theme;
198
+		$data[ 'url' ]          = home_url();
199
+		$data[ 'license_key' ]  = GravityView_Settings::get_instance()->get_app_setting( 'license_key' );
200 200
 
201 201
 		// View Data
202
-		$gravityview_posts = get_posts('numberposts=-1&post_type=gravityview&post_status=publish&order=ASC');
202
+		$gravityview_posts = get_posts( 'numberposts=-1&post_type=gravityview&post_status=publish&order=ASC' );
203 203
 
204 204
 		if ( ! empty( $gravityview_posts ) ) {
205 205
 			$first = array_shift( $gravityview_posts );
206 206
 			$latest = array_pop( $gravityview_posts );
207
-			$data['view_count'] = count( $gravityview_posts );
208
-			$data['view_first'] = $first->post_date;
209
-			$data['view_latest'] = $latest->post_date;
207
+			$data[ 'view_count' ] = count( $gravityview_posts );
208
+			$data[ 'view_first' ] = $first->post_date;
209
+			$data[ 'view_latest' ] = $latest->post_date;
210 210
 		}
211 211
 
212 212
 		// Form counts
213 213
 		if ( class_exists( 'GFFormsModel' ) ) {
214 214
 			$form_data = GFFormsModel::get_form_count();
215
-			$data['forms_total'] = rgar( $form_data, 'total', 0 );
216
-			$data['forms_active'] = rgar( $form_data, 'active', 0 );
217
-			$data['forms_inactive'] = rgar( $form_data, 'inactive', 0 );
218
-			$data['forms_trash'] = rgar( $form_data, 'inactive', 0 );
215
+			$data[ 'forms_total' ] = rgar( $form_data, 'total', 0 );
216
+			$data[ 'forms_active' ] = rgar( $form_data, 'active', 0 );
217
+			$data[ 'forms_inactive' ] = rgar( $form_data, 'inactive', 0 );
218
+			$data[ 'forms_trash' ] = rgar( $form_data, 'inactive', 0 );
219 219
 		}
220 220
 
221 221
 		// Retrieve current plugin information
222
-		if( ! function_exists( 'get_plugins' ) ) {
222
+		if ( ! function_exists( 'get_plugins' ) ) {
223 223
 			include ABSPATH . '/wp-admin/includes/plugin.php';
224 224
 		}
225 225
 
226
-		$data['integrations']     = self::get_related_plugins_and_extensions();
227
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
228
-		$data['inactive_plugins'] = array();
229
-		$data['locale']           = get_locale();
226
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
227
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
228
+		$data[ 'inactive_plugins' ] = array();
229
+		$data[ 'locale' ]           = get_locale();
230 230
 
231 231
 		// Validate request on the GV server
232
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
232
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
233 233
 
234 234
 		return $data;
235 235
 	}
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 
262 262
 				$plugin_data = get_plugin_data( $active_plugin );
263 263
 
264
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
264
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
265 265
 			}
266 266
 
267
-			if( ! empty( $extensions ) ) {
267
+			if ( ! empty( $extensions ) ) {
268 268
 				set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS );
269 269
 			} else {
270 270
 				return 'There was an error fetching related plugins.';
@@ -283,37 +283,37 @@  discard block
 block discarded – undo
283 283
 		$status = trim( $this->Addon->get_app_setting( 'license_key_status' ) );
284 284
 		$key = trim( $this->Addon->get_app_setting( 'license_key' ) );
285 285
 
286
-		if( !empty( $key ) ) {
286
+		if ( ! empty( $key ) ) {
287 287
 			$response = $this->Addon->get_app_setting( 'license_key_response' );
288
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
288
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
289 289
 		} else {
290 290
 			$response = array();
291 291
 		}
292 292
 
293 293
 		wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array(
294 294
 			'license_box' => $this->get_license_message( $response )
295
-		));
295
+		) );
296 296
 
297 297
 
298 298
 		$fields = array(
299 299
 			array(
300 300
 				'name'  => 'edd-activate',
301
-				'value' => __('Activate License', 'gravityview'),
302
-				'data-pending_text' => __('Verifying license…', 'gravityview'),
301
+				'value' => __( 'Activate License', 'gravityview' ),
302
+				'data-pending_text' => __( 'Verifying license…', 'gravityview' ),
303 303
 				'data-edd_action' => 'activate_license',
304 304
 				'class' => 'button-primary',
305 305
 			),
306 306
 			array(
307 307
 				'name'  => 'edd-deactivate',
308
-				'value' => __('Deactivate License', 'gravityview'),
309
-				'data-pending_text' => __('Deactivating license…', 'gravityview'),
308
+				'value' => __( 'Deactivate License', 'gravityview' ),
309
+				'data-pending_text' => __( 'Deactivating license…', 'gravityview' ),
310 310
 				'data-edd_action' => 'deactivate_license',
311 311
 				'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ),
312 312
 			),
313 313
 			array(
314 314
 				'name'  => 'edd-check',
315
-				'value' => __('Check License', 'gravityview'),
316
-				'data-pending_text' => __('Verifying license…', 'gravityview'),
315
+				'value' => __( 'Check License', 'gravityview' ),
316
+				'data-pending_text' => __( 'Verifying license…', 'gravityview' ),
317 317
 				'title' => 'Check the license before saving it',
318 318
 				'data-edd_action' => 'check_license',
319 319
 				'class' => 'button-secondary',
@@ -323,17 +323,17 @@  discard block
 block discarded – undo
323 323
 
324 324
 		$class = 'button gv-edd-action';
325 325
 
326
-		$class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
326
+		$class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
327 327
 
328 328
 		$disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled';
329 329
 
330 330
 		$submit = '<div class="gv-edd-button-wrapper">';
331 331
 		foreach ( $fields as $field ) {
332
-			$field['type'] = 'button';
333
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
334
-			$field['style'] = 'margin-left: 10px;';
335
-			if( $disabled_attribute ) {
336
-				$field['disabled'] = $disabled_attribute;
332
+			$field[ 'type' ] = 'button';
333
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
334
+			$field[ 'style' ] = 'margin-left: 10px;';
335
+			if ( $disabled_attribute ) {
336
+				$field[ 'disabled' ] = $disabled_attribute;
337 337
 			}
338 338
 			$submit .= $this->Addon->settings_submit( $field, $echo );
339 339
 		}
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	private function setup_edd() {
351 351
 
352
-		if( !class_exists('EDD_SL_Plugin_Updater') ) {
353
-			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php');
352
+		if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
353
+			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' );
354 354
 		}
355 355
 
356 356
 		// setup the updater
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
 		    'beta'      => $this->Addon->get_app_setting( 'beta' ),
389 389
 		);
390 390
 
391
-		if( !empty( $action ) ) {
392
-			$settings['edd_action'] = esc_attr( $action );
391
+		if ( ! empty( $action ) ) {
392
+			$settings[ 'edd_action' ] = esc_attr( $action );
393 393
 		}
394 394
 
395 395
 		$settings = array_map( 'urlencode', $settings );
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	private function _license_get_remote_response( $data, $license = '' ) {
405 405
 
406
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
406
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
407 407
 
408 408
 		$url = add_query_arg( $api_params, self::url );
409 409
 
410 410
 		$response = wp_remote_get( $url, array(
411 411
 			'timeout'   => 15,
412 412
 			'sslverify' => false,
413
-		));
413
+		) );
414 414
 
415 415
 		if ( is_wp_error( $response ) ) {
416 416
 			return array();
@@ -443,11 +443,11 @@  discard block
 block discarded – undo
443 443
 	 */
444 444
 	function get_license_message( $license_data ) {
445 445
 
446
-		if( empty( $license_data ) ) {
446
+		if ( empty( $license_data ) ) {
447 447
 			$message = '';
448 448
 		} else {
449 449
 
450
-			if( ! empty( $license_data->error ) ) {
450
+			if ( ! empty( $license_data->error ) ) {
451 451
 				$class = 'error';
452 452
 				$string_key = $license_data->error;
453 453
 			} else {
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 				$string_key = $license_data->license;
456 456
 			}
457 457
 
458
-			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) );
458
+			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) );
459 459
 
460 460
 			$message = $this->generate_license_box( $message, $class );
461 461
 		}
@@ -492,18 +492,18 @@  discard block
 block discarded – undo
492 492
 	 */
493 493
 	public function license_details( $response = array() ) {
494 494
 
495
-		$response = (array) $response;
495
+		$response = (array)$response;
496 496
 
497 497
 		$return = '';
498 498
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
499 499
 
500
-		if( ! empty( $response['license_key'] ) ) {
500
+		if ( ! empty( $response[ 'license_key' ] ) ) {
501 501
 
502 502
 			$return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>';
503 503
 
504 504
 			if ( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
505
-				$return .= $this->strings( $response['license'], $response );
506
-			} elseif ( ! empty( $response['license_name'] ) ) {
505
+				$return .= $this->strings( $response[ 'license' ], $response );
506
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
507 507
 
508 508
 				$response_keys = array(
509 509
 					'license_name'   => '',
@@ -518,19 +518,19 @@  discard block
 block discarded – undo
518 518
 				// Make sure all the keys are set
519 519
 				$response = wp_parse_args( $response, $response_keys );
520 520
 
521
-				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
522
-				$local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
521
+				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
522
+				$local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
523 523
 				$details    = array(
524
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ),
525
-					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link,
526
-					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text,
527
-					'expires'     => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ),
528
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
524
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ),
525
+					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link,
526
+					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text,
527
+					'expires'     => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ),
528
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
529 529
 				);
530 530
 
531
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
532
-					unset( $details['upgrade'] );
533
-					$details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
531
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
532
+					unset( $details[ 'upgrade' ] );
533
+					$details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
534 534
 				}
535 535
 
536 536
 				$return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>';
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
 
554 554
 		$output = '';
555 555
 
556
-		if( ! empty( $upgrades ) ) {
556
+		if ( ! empty( $upgrades ) ) {
557 557
 
558 558
 			$locale_parts = explode( '_', get_locale() );
559 559
 
560
-			$is_english = ( 'en' === $locale_parts[0] );
560
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
561 561
 
562 562
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
563 563
 
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
 
566 566
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
567 567
 
568
-				$upgrade = (object) $upgrade;
568
+				$upgrade = (object)$upgrade;
569 569
 
570 570
 				$anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) );
571 571
 
572
-				if( $is_english && isset( $upgrade->description ) ) {
572
+				if ( $is_english && isset( $upgrade->description ) ) {
573 573
 					$message = esc_html( $upgrade->description );
574 574
 				} else {
575
-					switch( $upgrade->price_id ) {
575
+					switch ( $upgrade->price_id ) {
576 576
 						// Interstellar
577 577
 						case 1:
578 578
 						default:
@@ -610,16 +610,16 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	public function license_call( $array = array() ) {
612 612
 
613
-		$is_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
614
-		$data = empty( $array ) ? $_POST['data'] : $array;
613
+		$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
614
+		$data = empty( $array ) ? $_POST[ 'data' ] : $array;
615 615
 		$has_cap = GVCommon::has_cap( 'gravityview_edit_settings' );
616 616
 
617
-		if ( $is_ajax && empty( $data['license'] ) ) {
618
-			die( - 1 );
617
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
618
+			die( -1 );
619 619
 		}
620 620
 
621 621
 		// If the user isn't allowed to edit settings, show an error message
622
-		if( ! $has_cap && empty( $data['all_caps'] ) ) {
622
+		if ( ! $has_cap && empty( $data[ 'all_caps' ] ) ) {
623 623
 			$license_data = new stdClass();
624 624
 			$license_data->error = 'capability';
625 625
 			$license_data->message = $this->get_license_message( $license_data );
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 
644 644
 			$json = json_encode( $license_data );
645 645
 
646
-			$update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) );
646
+			$update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) );
647 647
 
648
-			$is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX );
648
+			$is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX );
649 649
 
650 650
 			// Failed is the response from trying to de-activate a license and it didn't work.
651 651
 			// This likely happened because people entered in a different key and clicked "Deactivate",
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 			// most likely a mistake.
654 654
 			if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) {
655 655
 
656
-				if ( ! empty( $data['field_id'] ) ) {
656
+				if ( ! empty( $data[ 'field_id' ] ) ) {
657 657
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
658 658
 				}
659 659
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		if ( $is_ajax ) {
665 665
 			exit( $json );
666 666
 		} else { // Non-ajax call
667
-			return ( rgget('format', $data ) === 'object' ) ? $license_data : $json;
667
+			return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json;
668 668
 		}
669 669
 	}
670 670
 
@@ -678,9 +678,9 @@  discard block
 block discarded – undo
678 678
 		// Update option with passed data license
679 679
 		$settings = $this->Addon->get_app_settings();
680 680
 
681
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
682
-		$settings['license_key_status'] = $license_data->license;
683
-		$settings['license_key_response'] = (array)$license_data;
681
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
682
+		$settings[ 'license_key_status' ] = $license_data->license;
683
+		$settings[ 'license_key_response' ] = (array)$license_data;
684 684
 
685 685
 		$this->Addon->update_app_settings( $settings );
686 686
 	}
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 */
694 694
 	private function get_license_renewal_url( $license_data ) {
695 695
 		$license_data = is_array( $license_data ) ? (object)$license_data : $license_data;
696
-		$renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/';
696
+		$renew_license_url = ( ! empty( $license_data ) && ! empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/';
697 697
 		return $renew_license_url;
698 698
 	}
699 699
 
@@ -708,31 +708,31 @@  discard block
 block discarded – undo
708 708
 
709 709
 
710 710
 		$strings = array(
711
-			'status' => esc_html__('Status', 'gravityview'),
712
-			'error' => esc_html__('There was an error processing the request.', 'gravityview'),
713
-			'failed'  => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'),
714
-			'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
715
-			'inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
716
-			'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
717
-			'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'),
718
-			'valid' => esc_html__('The license key is valid and active.', 'gravityview'),
719
-			'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'),
720
-			'missing' => esc_html__('Invalid license key.', 'gravityview'),
721
-			'revoked' => esc_html__('This license key has been revoked.', 'gravityview'),
722
-			'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
711
+			'status' => esc_html__( 'Status', 'gravityview' ),
712
+			'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ),
713
+			'failed'  => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ),
714
+			'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ),
715
+			'inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ),
716
+			'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
717
+			'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ),
718
+			'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ),
719
+			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
720
+			'missing' => esc_html__( 'Invalid license key.', 'gravityview' ),
721
+			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
722
+			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ),
723 723
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
724 724
 
725
-			'verifying_license' => esc_html__('Verifying license&hellip;', 'gravityview'),
726
-			'activate_license' => esc_html__('Activate License', 'gravityview'),
727
-			'deactivate_license' => esc_html__('Deactivate License', 'gravityview'),
728
-			'check_license' => esc_html__('Verify License', 'gravityview'),
725
+			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
726
+			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
727
+			'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ),
728
+			'check_license' => esc_html__( 'Verify License', 'gravityview' ),
729 729
 		);
730 730
 
731
-		if( empty( $status ) ) {
731
+		if ( empty( $status ) ) {
732 732
 			return $strings;
733 733
 		}
734 734
 
735
-		if( isset( $strings[ $status ] ) ) {
735
+		if ( isset( $strings[ $status ] ) ) {
736 736
 			return $strings[ $status ];
737 737
 		}
738 738
 
Please login to merge, or discard this patch.
includes/class-gvlogic-shortcode.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function get_instance() {
87 87
 
88
-		if( empty( self::$instance ) ) {
88
+		if ( empty( self::$instance ) ) {
89 89
 			self::$instance = new self;
90 90
 		}
91 91
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS );
120 120
 
121
-		if( $with_values ) {
121
+		if ( $with_values ) {
122 122
 			$operators_with_values = array();
123
-			foreach( $operators as $key ) {
123
+			foreach ( $operators as $key ) {
124 124
 				$operators_with_values[ $key ] = '';
125 125
 			}
126 126
 			return $operators_with_values;
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	function set_operation( $operation = '' ) {
139 139
 
140
-		if( empty( $operation ) ) {
140
+		if ( empty( $operation ) ) {
141 141
 			return false;
142 142
 		}
143 143
 
144 144
 		$operators = $this->get_operators( false );
145 145
 
146
-		if( !in_array( $operation, $operators ) ) {
147
-			do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation );
146
+		if ( ! in_array( $operation, $operators ) ) {
147
+			do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation );
148 148
 			return false;
149 149
 		}
150 150
 
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	private function setup_operation_and_comparison() {
166 166
 
167
-		foreach( $this->atts as $key => $value ) {
167
+		foreach ( $this->atts as $key => $value ) {
168 168
 
169 169
 			$valid = $this->set_operation( $key );
170 170
 
171
-			if( $valid ) {
171
+			if ( $valid ) {
172 172
 				$this->comparison = $value;
173 173
 				return true;
174 174
 			}
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 			return null;
195 195
 		}
196 196
 
197
-		if( empty( $atts ) ) {
198
-			do_action( 'gravityview_log_error', __METHOD__.' $atts are empty.', $atts );
197
+		if ( empty( $atts ) ) {
198
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts are empty.', $atts );
199 199
 			return null;
200 200
 		}
201 201
 
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
 		$this->parse_atts();
207 207
 
208 208
 		// We need an "if"
209
-		if( false === $this->if ) {
210
-			do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts );
209
+		if ( false === $this->if ) {
210
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts );
211 211
 			return null;
212 212
 		}
213 213
 
214 214
 		$setup = $this->setup_operation_and_comparison();
215 215
 
216 216
 		// We need an operation and comparison value
217
-		if( ! $setup ) {
218
-			do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts );
217
+		if ( ! $setup ) {
218
+			do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts );
219 219
 			return null;
220 220
 		}
221 221
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	private function get_output() {
250 250
 
251
-		if( $this->is_match ) {
251
+		if ( $this->is_match ) {
252 252
 			$output = $this->content;
253 253
 		} else {
254 254
 			$output = $this->else_content;
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 		 * @param string $output HTML/text output
263 263
 		 * @param GVLogic_Shortcode $this This class
264 264
 		 */
265
-		$output = apply_filters('gravityview/gvlogic/output', $output, $this );
265
+		$output = apply_filters( 'gravityview/gvlogic/output', $output, $this );
266 266
 
267
-		do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output );
267
+		do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output );
268 268
 
269 269
 		return $output;
270 270
 	}
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 
281 281
 		$content = explode( '[else]', $this->passed_content );
282 282
 
283
-		$this->content = $content[0];
283
+		$this->content = $content[ 0 ];
284 284
 
285
-		$else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL;
285
+		$else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL;
286 286
 
287
-		$this->else_content = isset( $content[1] ) ? $content[1] : $else_attr;
287
+		$this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr;
288 288
 	}
289 289
 
290 290
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		$this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts;
308 308
 
309 309
 		// Strip whitespace if it's not default false
310
-		$this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false;
310
+		$this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false;
311 311
 
312 312
 		/**
313 313
 		 * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		do_action( 'gravityview/gvlogic/parse_atts/after', $this );
319 319
 
320 320
 		// Make sure the "if" isn't processed in self::setup_operation_and_comparison()
321
-		unset( $this->atts['if'] );
321
+		unset( $this->atts[ 'if' ] );
322 322
 	}
323 323
 }
324 324
 
Please login to merge, or discard this patch.
includes/class-frontend-views.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89 89
 		add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 );
90
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
90
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
91 91
 
92 92
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
93 93
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
 
238 238
 			$this->context_view_id = $view_id;
239 239
 
240
-		} elseif ( isset( $_GET['gvid'] ) && $multiple_views ) {
240
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) {
241 241
 			/**
242 242
 			 * used on a has_multiple_views context
243 243
 			 * @see GravityView_API::entry_link
244 244
 			 */
245
-			$this->context_view_id = $_GET['gvid'];
245
+			$this->context_view_id = $_GET[ 'gvid' ];
246 246
 
247 247
 		} elseif ( ! $multiple_views ) {
248 248
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
@@ -285,25 +285,25 @@  discard block
 block discarded – undo
285 285
 		global $wp_rewrite;
286 286
 
287 287
 		$is_front_page = ( $query->is_home || $query->is_page );
288
-		$show_on_front = ( 'page' === get_option('show_on_front') );
289
-		$front_page_id = get_option('page_on_front');
288
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
289
+		$front_page_id = get_option( 'page_on_front' );
290 290
 
291
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
291
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
292 292
 
293 293
 			// Force to be an array, potentially a query string ( entry=16 )
294 294
 			$_query = wp_parse_args( $query->query );
295 295
 
296 296
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
297
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
298
-				unset( $_query['pagename'] );
297
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
298
+				unset( $_query[ 'pagename' ] );
299 299
 			}
300 300
 
301 301
 			// this is where will break from core wordpress
302 302
 			/** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */
303 303
 			$ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query );
304 304
 			$endpoints = rgobj( $wp_rewrite, 'endpoints' );
305
-			foreach ( (array) $endpoints as $endpoint ) {
306
-				$ignore[] = $endpoint[1];
305
+			foreach ( (array)$endpoints as $endpoint ) {
306
+				$ignore[ ] = $endpoint[ 1 ];
307 307
 			}
308 308
 			unset( $endpoints );
309 309
 
@@ -313,21 +313,21 @@  discard block
 block discarded – undo
313 313
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
314 314
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
315 315
 
316
-				$qv =& $query->query_vars;
316
+				$qv = & $query->query_vars;
317 317
 
318 318
 				// Prevent redirect when on the single entry endpoint
319
-				if( self::is_single_entry() ) {
319
+				if ( self::is_single_entry() ) {
320 320
 					add_filter( 'redirect_canonical', '__return_false' );
321 321
 				}
322 322
 
323 323
 				$query->is_page = true;
324 324
 				$query->is_home = false;
325
-				$qv['page_id']  = $front_page_id;
325
+				$qv[ 'page_id' ]  = $front_page_id;
326 326
 
327 327
 				// Correct <!--nextpage--> for page_on_front
328
-				if ( ! empty( $qv['paged'] ) ) {
329
-					$qv['page'] = $qv['paged'];
330
-					unset( $qv['paged'] );
328
+				if ( ! empty( $qv[ 'paged' ] ) ) {
329
+					$qv[ 'page' ] = $qv[ 'paged' ];
330
+					unset( $qv[ 'paged' ] );
331 331
 				}
332 332
 			}
333 333
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
362 362
 
363
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
363
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
364 364
 		$this->setPostId( $post_id );
365 365
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
366 366
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
398 398
 
399
-		if( 'post' === $search_method ) {
399
+		if ( 'post' === $search_method ) {
400 400
 			$get = $_POST;
401 401
 		} else {
402 402
 			$get = $_GET;
@@ -452,20 +452,20 @@  discard block
 block discarded – undo
452 452
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
453 453
 		 * @param array $entry Current entry
454 454
 		 */
455
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
455
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
456 456
 
457 457
 		if ( ! $apply_outside_loop ) {
458 458
 			return $title;
459 459
 		}
460 460
 
461 461
 		// User reported WooCommerce doesn't pass two args.
462
-		if ( empty( $passed_post_id ) )  {
462
+		if ( empty( $passed_post_id ) ) {
463 463
 			return $title;
464 464
 		}
465 465
 
466 466
 		// Don't modify the title for anything other than the current view/post.
467 467
 		// This is true for embedded shortcodes and Views.
468
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
468
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
469 469
 			return $title;
470 470
 		}
471 471
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		} else {
489 489
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
490 490
 				foreach ( gravityview()->views->all() as $_view ) {
491
-					if ( intval( $_view->form->ID ) === intval( $entry['form_id'] ) ) {
491
+					if ( intval( $_view->form->ID ) === intval( $entry[ 'form_id' ] ) ) {
492 492
 						$view = $_view;
493 493
 						break;
494 494
 					}
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 			} else {
501 501
 				/** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */
502 502
 				foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
503
-					if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
503
+					if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
504 504
 						$view_meta = $view_data;
505 505
 						break;
506 506
 					}
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 			}
516 516
 		} else {
517 517
 			/** Deprecated stuff in the future. See the branch above. */
518
-			if ( ! empty( $view_meta['atts']['single_title'] ) ) {
518
+			if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
519 519
 
520
-				$title = $view_meta['atts']['single_title'];
520
+				$title = $view_meta[ 'atts' ][ 'single_title' ];
521 521
 
522 522
 				// We are allowing HTML in the fields, so no escaping the output
523
-				$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
523
+				$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
524 524
 
525 525
 				$title = do_shortcode( $title );
526 526
 			}
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 		}
559 559
 
560 560
 		// Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar
561
-		if( ! in_the_loop() ) {
561
+		if ( ! in_the_loop() ) {
562 562
 			return $content;
563 563
 		}
564 564
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 		$context = GravityView_View::getInstance()->getContext();
635 635
 
636
-		switch( $context ) {
636
+		switch ( $context ) {
637 637
 			case 'directory':
638 638
 				$tab = __( 'Multiple Entries', 'gravityview' );
639 639
 				break;
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
 		}
648 648
 
649 649
 
650
-		$title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
650
+		$title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
651 651
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
652
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
652
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
653 653
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
654 654
 
655
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
655
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
656 656
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
657 657
 
658 658
 		echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id );
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 	public function render_view( $passed_args ) {
684 684
 
685 685
 		// validate attributes
686
-		if ( empty( $passed_args['id'] ) ) {
686
+		if ( empty( $passed_args[ 'id' ] ) ) {
687 687
 			do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args );
688 688
 			return null;
689 689
 		}
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 			return null;
706 706
 		}
707 707
 
708
-		$view_id = $passed_args['id'];
708
+		$view_id = $passed_args[ 'id' ];
709 709
 
710 710
 		if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
711 711
 			$view = gravityview()->views->get( $view_id );
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 			$passed_args = array_filter( $passed_args, 'strlen' );
736 736
 
737 737
 			//Override shortcode args over View template settings
738
-			$atts = wp_parse_args( $passed_args, $view_data['atts'] );
738
+			$atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] );
739 739
 
740 740
 			do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts );
741 741
 		}
@@ -759,14 +759,14 @@  discard block
 block discarded – undo
759 759
 		 * @since 1.15
760 760
 		 * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out.
761 761
 		 */
762
-		if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
762
+		if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
763 763
 
764 764
 			do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) );
765 765
 
766 766
 			return null;
767 767
 		}
768 768
 
769
-		if( $this->isGravityviewPostType() ) {
769
+		if ( $this->isGravityviewPostType() ) {
770 770
 
771 771
 			/**
772 772
 			 * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode?
@@ -782,10 +782,10 @@  discard block
 block discarded – undo
782 782
 				$embed_only = $view->settings->get( 'embed_only' );
783 783
 			} else {
784 784
 				/** Deprecated. View attributes moved to \GV\View::$settings. */
785
-				$embed_only = ! empty( $atts['embed_only'] );
785
+				$embed_only = ! empty( $atts[ 'embed_only' ] );
786 786
 			}
787 787
 
788
-			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
788
+			if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
789 789
 				return __( 'You are not allowed to view this content.', 'gravityview' );
790 790
 			}
791 791
 		}
@@ -801,13 +801,13 @@  discard block
 block discarded – undo
801 801
 		if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
802 802
 			$view_data = $view->as_data();
803 803
 			$gravityview_view = new GravityView_View( $view_data );
804
-			$post_id = intval( $view->settings->get( 'post_id' ) ? : get_the_ID() );
804
+			$post_id = intval( $view->settings->get( 'post_id' ) ?: get_the_ID() );
805 805
 			$template_id = $view->template ? $view->template->ID : null;
806 806
 		} else {
807 807
 			/** These constructs are deprecated. Use the new gravityview() wrapper. */
808 808
 			$gravityview_view = new GravityView_View( $view_data );
809
-			$post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID();
810
-			$template_id = $view_data['template_id'];
809
+			$post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID();
810
+			$template_id = $view_data[ 'template_id' ];
811 811
 		}
812 812
 
813 813
 		$gravityview_view->setPostId( $post_id );
@@ -818,20 +818,20 @@  discard block
 block discarded – undo
818 818
 			do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' );
819 819
 
820 820
 			//fetch template and slug
821
-			$view_slug = apply_filters( 'gravityview_template_slug_'. $template_id, 'table', 'directory' );
821
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $template_id, 'table', 'directory' );
822 822
 
823 823
 			do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug );
824 824
 
825 825
 			/**
826 826
 			 * Disable fetching initial entries for views that don't need it (DataTables)
827 827
 			 */
828
-			$get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true );
828
+			$get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true );
829 829
 
830 830
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
831 831
 				$hide_until_searched = $view->settings->get( 'hide_until_searched' );
832 832
 			} else {
833 833
 				/** $atts is deprecated, use \GV\View:$settings */
834
-				$hide_until_searched = ! empty( $atts['hide_until_searched'] );
834
+				$hide_until_searched = ! empty( $atts[ 'hide_until_searched' ] );
835 835
 			}
836 836
 
837 837
 			/**
@@ -849,12 +849,12 @@  discard block
 block discarded – undo
849 849
 					$sort_columns = $view->settings->get( 'sort_columns' );
850 850
 				} else {
851 851
 					/** $atts is deprecated, use \GV\View:$settings */
852
-					$sort_columns = ! empty( $atts['sort_columns'] );
852
+					$sort_columns = ! empty( $atts[ 'sort_columns' ] );
853 853
 				}
854 854
 
855 855
 				if ( $sort_columns ) {
856 856
 					// add filter to enable column sorting
857
-					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 );
857
+					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 );
858 858
 				}
859 859
 
860 860
 				if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
@@ -862,19 +862,19 @@  discard block
 block discarded – undo
862 862
 				} else {
863 863
 					/** $atts is deprecated, use \GV\View:$settings */
864 864
 					/** $view_data is depreacted, use \GV\View properties */
865
-					$view_entries = self::get_view_entries( $atts, $view_data['form_id'] );
865
+					$view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] );
866 866
 				}
867 867
 
868
-				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) );
868
+				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) );
869 869
 
870 870
 			} else {
871 871
 
872 872
 				$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null );
873 873
 
874
-				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' );
874
+				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' );
875 875
 			}
876 876
 
877
-			$gravityview_view->setPaging( $view_entries['paging'] );
877
+			$gravityview_view->setPaging( $view_entries[ 'paging' ] );
878 878
 			$gravityview_view->setContext( 'directory' );
879 879
 			$sections = array( 'header', 'body', 'footer' );
880 880
 
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 				do_action( 'gravityview_render_entry_' . $view->ID );
892 892
 			} else {
893 893
 				/** $view_data is depreacted, use \GV\View properties */
894
-				do_action( 'gravityview_render_entry_'.$view_data['id'] );
894
+				do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] );
895 895
 			}
896 896
 
897 897
 			$entry = $this->getEntry();
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 				do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' );
903 903
 
904 904
 				// Only display warning once when multiple Views are embedded
905
-				if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) {
905
+				if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) {
906 906
 					ob_end_clean();
907 907
 					return null;
908 908
 				}
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 			// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms
928 928
 			$multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $this->getGvOutputData()->has_multiple_views();
929 929
 			if ( $multiple_views && $view_id != $this->get_context_view_id() ) {
930
-				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id );
930
+				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id );
931 931
 				ob_end_clean();
932 932
 				return null;
933 933
 			}
@@ -937,14 +937,14 @@  discard block
 block discarded – undo
937 937
 			do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug );
938 938
 
939 939
 			//fetch entry detail
940
-			$view_entries['count'] = 1;
941
-			$view_entries['entries'][] = $entry;
942
-			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] );
940
+			$view_entries[ 'count' ] = 1;
941
+			$view_entries[ 'entries' ][ ] = $entry;
942
+			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] );
943 943
 
944 944
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
945 945
 				$back_link_label = $view->settings->get( 'back_link_label', null );
946 946
 			} else {
947
-				$back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null;
947
+				$back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null;
948 948
 			}
949 949
 
950 950
 			// set back link label
@@ -958,8 +958,8 @@  discard block
 block discarded – undo
958 958
 		self::add_style( $template_id );
959 959
 
960 960
 		// Prepare to render view and set vars
961
-		$gravityview_view->setEntries( $view_entries['entries'] );
962
-		$gravityview_view->setTotalEntries( $view_entries['count'] );
961
+		$gravityview_view->setEntries( $view_entries[ 'entries' ] );
962
+		$gravityview_view->setTotalEntries( $view_entries[ 'count' ] );
963 963
 
964 964
 		// If Edit
965 965
 		if ( 'edit' === gravityview_get_context() ) {
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 
977 977
 			do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections );
978 978
 			foreach ( $sections as $section ) {
979
-				do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' );
979
+				do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' );
980 980
 				$gravityview_view->render( $view_slug, $section, false );
981 981
 			}
982 982
 		}
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 				$datetime_format = 'Y-m-d H:i:s';
1031 1031
 				$search_is_outside_view_bounds = false;
1032 1032
 
1033
-				if( ! empty( $search_criteria[ $key ] ) ) {
1033
+				if ( ! empty( $search_criteria[ $key ] ) ) {
1034 1034
 
1035 1035
 					$search_date = strtotime( $search_criteria[ $key ] );
1036 1036
 
@@ -1058,14 +1058,14 @@  discard block
 block discarded – undo
1058 1058
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
1059 1059
 
1060 1060
 					// Then we override the search and re-set the start date
1061
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
1061
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
1062 1062
 				}
1063 1063
 			}
1064 1064
 		}
1065 1065
 
1066
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
1066
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
1067 1067
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
1068
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
1068
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
1069 1069
 				do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria );
1070 1070
 			}
1071 1071
 		}
@@ -1084,19 +1084,19 @@  discard block
 block discarded – undo
1084 1084
 	public static function process_search_only_approved( $args, $search_criteria ) {
1085 1085
 
1086 1086
 		/** @since 1.19 */
1087
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
1087
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
1088 1088
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' );
1089 1089
 			return $search_criteria;
1090 1090
 		}
1091 1091
 
1092
-		if ( ! empty( $args['show_only_approved'] ) ) {
1092
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
1093 1093
 
1094
-			$search_criteria['field_filters'][] = array(
1094
+			$search_criteria[ 'field_filters' ][ ] = array(
1095 1095
 				'key' => GravityView_Entry_Approval::meta_key,
1096 1096
 				'value' => GravityView_Entry_Approval_Status::APPROVED
1097 1097
 			);
1098 1098
 
1099
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
1099
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
1100 1100
 
1101 1101
 			do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria );
1102 1102
 		}
@@ -1123,18 +1123,18 @@  discard block
 block discarded – undo
1123 1123
 	 */
1124 1124
 	public static function is_entry_approved( $entry, $args = array() ) {
1125 1125
 
1126
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
1126
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
1127 1127
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
1128 1128
 			return true;
1129 1129
 		}
1130 1130
 
1131 1131
 		/** @since 1.19 */
1132
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
1132
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
1133 1133
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' );
1134 1134
 			return true;
1135 1135
 		}
1136 1136
 
1137
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
1137
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
1138 1138
 
1139 1139
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
1140 1140
 	}
@@ -1168,29 +1168,29 @@  discard block
 block discarded – undo
1168 1168
 		do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria );
1169 1169
 
1170 1170
 		// implicity search
1171
-		if ( ! empty( $args['search_value'] ) ) {
1171
+		if ( ! empty( $args[ 'search_value' ] ) ) {
1172 1172
 
1173 1173
 			// Search operator options. Options: `is` or `contains`
1174
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
1174
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
1175 1175
 
1176
-			$search_criteria['field_filters'][] = array(
1176
+			$search_criteria[ 'field_filters' ][ ] = array(
1177 1177
 				'key' => rgget( 'search_field', $args ), // The field ID to search
1178
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
1178
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
1179 1179
 				'operator' => $operator,
1180 1180
 			);
1181 1181
 
1182 1182
 			// Lock search mode to "all" with implicit presearch filter.
1183
-			$search_criteria['field_filters']['mode'] = 'all';
1183
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
1184 1184
 		}
1185 1185
 
1186
-		if( $search_criteria !== $original_search_criteria ) {
1186
+		if ( $search_criteria !== $original_search_criteria ) {
1187 1187
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria );
1188 1188
 		}
1189 1189
 
1190 1190
 		// Handle setting date range
1191 1191
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
1192 1192
 
1193
-		if( $search_criteria !== $original_search_criteria ) {
1193
+		if ( $search_criteria !== $original_search_criteria ) {
1194 1194
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria );
1195 1195
 		}
1196 1196
 
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
1202 1202
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
1203 1203
 		 */
1204
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
1204
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
1205 1205
 
1206 1206
 		return $search_criteria;
1207 1207
 	}
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
 			'search_criteria' => $search_criteria,
1326 1326
 			'sorting' => self::updateViewSorting( $args, $form_id ),
1327 1327
 			'paging' => $paging,
1328
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
1328
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
1329 1329
 		);
1330 1330
 
1331 1331
 		/**
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1351 1351
 		 * @param array $args View configuration args.
1352 1352
 		 */
1353
-		$parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id );
1353
+		$parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id );
1354 1354
 
1355 1355
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters );
1356 1356
 
@@ -1375,17 +1375,17 @@  discard block
 block discarded – undo
1375 1375
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1376 1376
 
1377 1377
 		// Paging & offset
1378
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1378
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1379 1379
 
1380 1380
 		if ( -1 === $page_size ) {
1381 1381
 			$page_size = PHP_INT_MAX;
1382 1382
 		}
1383 1383
 
1384
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1384
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1385 1385
 		$offset = ( $curr_page - 1 ) * $page_size;
1386 1386
 
1387
-		if ( ! empty( $args['offset'] ) ) {
1388
-			$offset += intval( $args['offset'] );
1387
+		if ( ! empty( $args[ 'offset' ] ) ) {
1388
+			$offset += intval( $args[ 'offset' ] );
1389 1389
 		}
1390 1390
 
1391 1391
 		$paging = array(
@@ -1409,8 +1409,8 @@  discard block
 block discarded – undo
1409 1409
 	 */
1410 1410
 	public static function updateViewSorting( $args, $form_id ) {
1411 1411
 		$sorting = array();
1412
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' );
1413
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' );
1412
+		$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' );
1413
+		$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' );
1414 1414
 
1415 1415
 		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1416 1416
 
@@ -1450,11 +1450,11 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1452 1452
 
1453
-		if( ! $sort_field ) {
1453
+		if ( ! $sort_field ) {
1454 1454
 			return $sort_field_id;
1455 1455
 		}
1456 1456
 
1457
-		switch ( $sort_field['type'] ) {
1457
+		switch ( $sort_field[ 'type' ] ) {
1458 1458
 
1459 1459
 			case 'address':
1460 1460
 				// Sorting by full address
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
 					 */
1472 1472
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1473 1473
 
1474
-					switch( strtolower( $address_part ) ){
1474
+					switch ( strtolower( $address_part ) ) {
1475 1475
 						case 'street':
1476 1476
 							$sort_field_id .= '.1';
1477 1477
 							break;
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
 		 */
1557 1557
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1558 1558
 
1559
-		if ( empty( $single_entry ) ){
1559
+		if ( empty( $single_entry ) ) {
1560 1560
 			return false;
1561 1561
 		} else {
1562 1562
 			return $single_entry;
@@ -1589,14 +1589,14 @@  discard block
 block discarded – undo
1589 1589
 					$template_id = $view->template ? $view->template->ID : null;
1590 1590
 					$data = $view->as_data();
1591 1591
 				} else {
1592
-					$template_id = $data['template_id'];
1592
+					$template_id = $data[ 'template_id' ];
1593 1593
 				}
1594 1594
 
1595 1595
 				/**
1596 1596
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1597 1597
 				 * @since 1.15
1598 1598
 				 */
1599
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1599
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1600 1600
 					continue;
1601 1601
 				}
1602 1602
 
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 					$lightbox = $view->settings->get( 'lightbox' );
1609 1609
 				} else {
1610 1610
 					/** View data attributes are now stored in \GV\View::$settings */
1611
-					$lightbox = ! empty( $data['atts']['lightbox'] );
1611
+					$lightbox = ! empty( $data[ 'atts' ][ 'lightbox' ] );
1612 1612
 				}
1613 1613
 
1614 1614
 				// If the thickbox is enqueued, add dependencies
@@ -1618,13 +1618,13 @@  discard block
 block discarded – undo
1618 1618
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1619 1619
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1620 1620
 					 */
1621
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1621
+					$js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1622 1622
 
1623 1623
 					/**
1624 1624
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1625 1625
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1626 1626
 					 */
1627
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1627
+					$css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1628 1628
 				}
1629 1629
 
1630 1630
 				/**
@@ -1632,19 +1632,19 @@  discard block
 block discarded – undo
1632 1632
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1633 1633
 				 * @since 1.15
1634 1634
 				 */
1635
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1636
-					$css_dependencies[] = 'dashicons';
1635
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1636
+					$css_dependencies[ ] = 'dashicons';
1637 1637
 				}
1638 1638
 
1639 1639
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1640 1640
 
1641 1641
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1642 1642
 
1643
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1643
+				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true );
1644 1644
 
1645 1645
 				wp_enqueue_script( 'gravityview-fe-view' );
1646 1646
 
1647
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1647
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1648 1648
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1649 1649
 				}
1650 1650
 
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 		} elseif ( empty( $template_id ) ) {
1713 1713
 			do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' );
1714 1714
 		} else {
1715
-			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) );
1715
+			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) );
1716 1716
 		}
1717 1717
 
1718 1718
 	}
@@ -1737,11 +1737,11 @@  discard block
 block discarded – undo
1737 1737
 		 * Not a table-based template; don't add sort icons
1738 1738
 		 * @since 1.12
1739 1739
 		 */
1740
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1740
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1741 1741
 			return $label;
1742 1742
 		}
1743 1743
 
1744
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1744
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1745 1745
 			return $label;
1746 1746
 		}
1747 1747
 
@@ -1749,29 +1749,29 @@  discard block
 block discarded – undo
1749 1749
 
1750 1750
 		$class = 'gv-sort';
1751 1751
 
1752
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1752
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1753 1753
 
1754 1754
 		$sort_args = array(
1755
-			'sort' => $field['id'],
1755
+			'sort' => $field[ 'id' ],
1756 1756
 			'dir' => 'asc',
1757 1757
 		);
1758 1758
 
1759
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1759
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1760 1760
 			//toggle sorting direction.
1761
-			if ( 'asc' === $sorting['direction'] ) {
1762
-				$sort_args['dir'] = 'desc';
1761
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1762
+				$sort_args[ 'dir' ] = 'desc';
1763 1763
 				$class .= ' gv-icon-sort-desc';
1764 1764
 			} else {
1765
-				$sort_args['dir'] = 'asc';
1765
+				$sort_args[ 'dir' ] = 'asc';
1766 1766
 				$class .= ' gv-icon-sort-asc';
1767 1767
 			}
1768 1768
 		} else {
1769 1769
 			$class .= ' gv-icon-caret-up-down';
1770 1770
 		}
1771 1771
 
1772
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1772
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1773 1773
 
1774
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1774
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1775 1775
 
1776 1776
 	}
1777 1777
 
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 
1790 1790
 		$field_type = $field_id;
1791 1791
 
1792
-		if( is_numeric( $field_id ) ) {
1792
+		if ( is_numeric( $field_id ) ) {
1793 1793
 			$field = GFFormsModel::get_field( $form, $field_id );
1794 1794
 			$field_type = $field->type;
1795 1795
 		}
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
 			return false;
1813 1813
 		}
1814 1814
 
1815
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1815
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1816 1816
 
1817 1817
 	}
1818 1818
 
Please login to merge, or discard this patch.
includes/class-gravityview-settings.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 	}
123 123
 
124 124
 	/**
125
-     * Uninstall all traces of GravityView
126
-     *
127
-     * Note: method is public because parent method is public
128
-     *
125
+	 * Uninstall all traces of GravityView
126
+	 *
127
+	 * Note: method is public because parent method is public
128
+	 *
129 129
 	 * @return bool
130 130
 	 */
131 131
 	public function uninstall() {
@@ -137,53 +137,53 @@  discard block
 block discarded – undo
137 137
 		$uninstaller->fire_everything();
138 138
 
139 139
 		/**
140
-         * Set the path so that Gravity Forms can de-activate GravityView
141
-         * @see GFAddOn::uninstall_addon
142
-         * @uses deactivate_plugins()
143
-         */
140
+		 * Set the path so that Gravity Forms can de-activate GravityView
141
+		 * @see GFAddOn::uninstall_addon
142
+		 * @uses deactivate_plugins()
143
+		 */
144 144
 		$this->_path = GRAVITYVIEW_FILE;
145 145
 
146 146
 		return true;
147 147
 	}
148 148
 
149 149
 	/**
150
-     * Get an array of reasons why the plugin might be uninstalled
151
-     *
152
-     * @since 1.17.5
153
-     *
150
+	 * Get an array of reasons why the plugin might be uninstalled
151
+	 *
152
+	 * @since 1.17.5
153
+	 *
154 154
 	 * @return array Array of reasons with the label and followup questions for each uninstall reason
155 155
 	 */
156 156
 	private function get_uninstall_reasons() {
157 157
 
158 158
 		$reasons = array(
159 159
 			'will-continue' => array(
160
-                'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
161
-            ),
160
+				'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
161
+			),
162 162
 			'no-longer-need' => array(
163
-                'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
164
-            ),
163
+				'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
164
+			),
165 165
 			'doesnt-work' => array(
166
-                'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
167
-            ),
166
+				'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
167
+			),
168 168
 			'found-other' => array(
169
-                'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
170
-                'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'),
171
-            ),
169
+				'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
170
+				'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'),
171
+			),
172 172
 			'other' => array(
173
-                'label' => esc_html__( 'Other', 'gravityview' ),
174
-            ),
173
+				'label' => esc_html__( 'Other', 'gravityview' ),
174
+			),
175 175
 		);
176 176
 
177 177
 		shuffle( $reasons );
178 178
 
179 179
 		return $reasons;
180
-    }
180
+	}
181 181
 
182 182
 	/**
183
-     * Display a feedback form when the plugin is uninstalled
184
-     *
185
-     * @since 1.17.5
186
-     *
183
+	 * Display a feedback form when the plugin is uninstalled
184
+	 *
185
+	 * @since 1.17.5
186
+	 *
187 187
 	 * @return string HTML of the uninstallation form
188 188
 	 */
189 189
 	public function uninstall_form() {
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2>
264 264
             <ul>
265 265
 				<?php
266
-                $reasons = $this->get_uninstall_reasons();
266
+				$reasons = $this->get_uninstall_reasons();
267 267
 				foreach ( $reasons as $reason ) {
268 268
 					printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', rgar( $reason, 'followup' ), rgar( $reason, 'label' ) );
269 269
 				}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$license_key = self::getSetting('license_key');
432 432
 		if( '' === $license_key ) {
433 433
 			$license_status = 'inactive';
434
-        }
434
+		}
435 435
 		$license_id = empty( $license_key ) ? 'license' : $license_key;
436 436
 
437 437
 		$message = esc_html__('Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview');
@@ -569,12 +569,12 @@  discard block
 block discarded – undo
569 569
 	}
570 570
 
571 571
 	public function app_settings_tab() {
572
-	    parent::app_settings_tab();
572
+		parent::app_settings_tab();
573 573
 
574 574
 		if ( $this->maybe_uninstall() ) {
575
-            echo $this->uninstall_form();
575
+			echo $this->uninstall_form();
576 576
 		}
577
-    }
577
+	}
578 578
 
579 579
 	/**
580 580
 	 * Make protected public
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
                     type="' . $field['type'] . '"
698 698
                     name="' . esc_attr( $name ) . '"
699 699
                     value="' . $value . '" ' .
700
-		        implode( ' ', $attributes ) .
701
-		        ' />';
700
+				implode( ' ', $attributes ) .
701
+				' />';
702 702
 
703 703
 		if ( $echo ) {
704 704
 			echo $html;
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 					array(
925 925
 						'label' => _x('Show me beta versions if they are available.', 'gravityview'),
926 926
 						'value' => '1',
927
-                        'name'  => 'beta',
927
+						'name'  => 'beta',
928 928
 					),
929 929
 				),
930 930
 				'description'   => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview'),
@@ -949,36 +949,36 @@  discard block
 block discarded – undo
949 949
 		}
950 950
 
951 951
 
952
-        $sections = array(
953
-            array(
954
-                'description' =>      sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ),
955
-                'fields'      => $fields,
956
-            )
957
-        );
952
+		$sections = array(
953
+			array(
954
+				'description' =>      sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ),
955
+				'fields'      => $fields,
956
+			)
957
+		);
958 958
 
959
-        // custom 'update settings' button
960
-        $button = array(
961
-            'class' => 'button button-primary button-hero',
962
-            'type'     => 'save',
963
-        );
959
+		// custom 'update settings' button
960
+		$button = array(
961
+			'class' => 'button button-primary button-hero',
962
+			'type'     => 'save',
963
+		);
964 964
 
965 965
 		if( $disabled_attribute ) {
966 966
 			$button['disabled'] = $disabled_attribute;
967 967
 		}
968 968
 
969 969
 
970
-        /**
971
-         * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
972
-         * Extensions can tap in here to insert their own section and settings.
973
-         * <code>
974
-         *   $sections[] = array(
975
-         *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
976
-         *      'fields' => $settings,
977
-         *   );
978
-         * </code>
979
-         * @param array $extension_settings Empty array, ready for extension settings!
980
-         */
981
-        $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
970
+		/**
971
+		 * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
972
+		 * Extensions can tap in here to insert their own section and settings.
973
+		 * <code>
974
+		 *   $sections[] = array(
975
+		 *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
976
+		 *      'fields' => $settings,
977
+		 *   );
978
+		 * </code>
979
+		 * @param array $extension_settings Empty array, ready for extension settings!
980
+		 */
981
+		$extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
982 982
 
983 983
 		// If there are extensions, add a section for them
984 984
 		if ( ! empty( $extension_sections ) ) {
@@ -991,13 +991,13 @@  discard block
 block discarded – undo
991 991
 				}
992 992
 			}
993 993
 
994
-            $k = count( $extension_sections ) - 1 ;
995
-            $extension_sections[ $k ]['fields'][] = $button;
994
+			$k = count( $extension_sections ) - 1 ;
995
+			$extension_sections[ $k ]['fields'][] = $button;
996 996
 			$sections = array_merge( $sections, $extension_sections );
997 997
 		} else {
998
-            // add the 'update settings' button to the general section
999
-            $sections[0]['fields'][] = $button;
1000
-        }
998
+			// add the 'update settings' button to the general section
999
+			$sections[0]['fields'][] = $button;
1000
+		}
1001 1001
 
1002 1002
 		return $sections;
1003 1003
 	}
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if( ! class_exists('GFAddOn') ) {
3
+if ( ! class_exists( 'GFAddOn' ) ) {
4 4
 	return;
5 5
 }
6 6
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function __construct( $prevent_multiple_instances = '' ) {
77 77
 
78
-		if( $prevent_multiple_instances === 'get_instance' ) {
78
+		if ( $prevent_multiple_instances === 'get_instance' ) {
79 79
 			return parent::__construct();
80 80
 		}
81 81
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public static function get_instance() {
89 89
 
90
-		if( empty( self::$instance ) ) {
90
+		if ( empty( self::$instance ) ) {
91 91
 			self::$instance = new self( 'get_instance' );
92 92
 		}
93 93
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function current_user_can_any( $caps ) {
108 108
 
109
-		if( empty( $caps ) ) {
109
+		if ( empty( $caps ) ) {
110 110
 			$caps = array( 'gravityview_full_access' );
111 111
 		}
112 112
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             ),
168 168
 			'found-other' => array(
169 169
                 'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
170
-                'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'),
170
+                'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
171 171
             ),
172 172
 			'other' => array(
173 173
                 'label' => esc_html__( 'Other', 'gravityview' ),
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                 });
255 255
 
256 256
                 function gv_feedback_append_error_message() {
257
-                    $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __('There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>');
257
+                    $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __( 'There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>');
258 258
                 }
259 259
             });
260 260
         </script>
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
             </ul>
272 272
             <div class="gv-followup widefat">
273 273
                 <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p>
274
-                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea>
274
+                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea>
275 275
             </div>
276 276
             <div class="scale-description">
277
-                <p><strong><?php esc_html_e('How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p>
277
+                <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p>
278 278
                 <ul class="inline">
279 279
 					<?php
280 280
 					$i = 0;
281
-					while( $i < 11 ) {
282
-						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>';
281
+					while ( $i < 11 ) {
282
+						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
283 283
 						$i++;
284 284
 					}
285 285
 					?>
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
             </div>
289 289
 
290 290
             <div class="gv-form-field-wrapper">
291
-                <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e('Please follow up with me about my feedback', 'gravityview'); ?></label>
291
+                <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e( 'Please follow up with me about my feedback', 'gravityview' ); ?></label>
292 292
             </div>
293 293
 
294 294
             <div class="submit">
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         <div id="gv-uninstall-thanks" class="notice notice-large notice-updated below-h2" style="display:none;">
303 303
             <h3 class="notice-title"><?php esc_html_e( 'Thank you for using GravityView!', 'gravityview' ); ?></h3>
304 304
             <p><?php echo gravityview_get_floaty(); ?>
305
-				<?php echo make_clickable( esc_html__('Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?>
305
+				<?php echo make_clickable( esc_html__( 'Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?>
306 306
             </p>
307 307
             <div class="wp-clearfix"></div>
308 308
         </div>
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) );
377 377
 
378 378
 		/** @since 1.7.6 */
379
-		add_action('network_admin_menu', array( $this, 'add_network_menu' ) );
379
+		add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) );
380 380
 
381 381
 		parent::init_admin();
382 382
 	}
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	public function modify_app_settings_menu_title( $setting_tabs ) {
392 392
 
393
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview');
393
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
394 394
 
395 395
 		return $setting_tabs;
396 396
 	}
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	 */
408 408
 	private function _load_license_handler() {
409 409
 
410
-		if( !empty( $this->License_Handler ) ) {
410
+		if ( ! empty( $this->License_Handler ) ) {
411 411
 			return;
412 412
 		}
413 413
 
414
-		require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php');
414
+		require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' );
415 415
 
416 416
 		$this->License_Handler = GV_License_Handler::get_instance( $this );
417 417
 	}
@@ -423,42 +423,42 @@  discard block
 block discarded – undo
423 423
 	function license_key_notice() {
424 424
 
425 425
 		// Only show on GravityView pages
426
-		if( ! gravityview_is_admin_page() ) {
426
+		if ( ! gravityview_is_admin_page() ) {
427 427
 			return;
428 428
 		}
429 429
 
430
-		$license_status = self::getSetting('license_key_status');
431
-		$license_key = self::getSetting('license_key');
432
-		if( '' === $license_key ) {
430
+		$license_status = self::getSetting( 'license_key_status' );
431
+		$license_key = self::getSetting( 'license_key' );
432
+		if ( '' === $license_key ) {
433 433
 			$license_status = 'inactive';
434 434
         }
435 435
 		$license_id = empty( $license_key ) ? 'license' : $license_key;
436 436
 
437
-		$message = esc_html__('Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview');
437
+		$message = esc_html__( 'Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' );
438 438
 
439 439
 		/**
440 440
 		 * I wanted to remove the period from after the buttons in the string,
441 441
 		 * but didn't want to mess up the translation strings for the translators.
442 442
 		 */
443 443
 		$message = mb_substr( $message, 0, mb_strlen( $message ) - 1 );
444
-		$title = __('Inactive License', 'gravityview');
444
+		$title = __( 'Inactive License', 'gravityview' );
445 445
 		$status = '';
446 446
 		$update_below = false;
447 447
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
448 448
 		switch ( $license_status ) {
449 449
 			/** @since 1.17 */
450 450
 			case 'expired':
451
-				$title = __('Expired License', 'gravityview');
451
+				$title = __( 'Expired License', 'gravityview' );
452 452
 				$status = 'expired';
453
-				$message = $this->get_license_handler()->strings( 'expired', self::getSetting('license_key_response') );
453
+				$message = $this->get_license_handler()->strings( 'expired', self::getSetting( 'license_key_response' ) );
454 454
 				break;
455 455
 			case 'invalid':
456
-				$title = __('Invalid License', 'gravityview');
457
-				$status = __('is invalid', 'gravityview');
456
+				$title = __( 'Invalid License', 'gravityview' );
457
+				$status = __( 'is invalid', 'gravityview' );
458 458
 				break;
459 459
 			case 'deactivated':
460
-				$status = __('is inactive', 'gravityview');
461
-				$update_below = __('Activate your license key below.', 'gravityview');
460
+				$status = __( 'is inactive', 'gravityview' );
461
+				$update_below = __( 'Activate your license key below.', 'gravityview' );
462 462
 				break;
463 463
 			/** @noinspection PhpMissingBreakStatementInspection */
464 464
 			case '':
@@ -466,27 +466,27 @@  discard block
 block discarded – undo
466 466
 				// break intentionally left blank
467 467
 			case 'inactive':
468 468
 			case 'site_inactive':
469
-				$status = __('has not been activated', 'gravityview');
470
-				$update_below = __('Activate your license key below.', 'gravityview');
469
+				$status = __( 'has not been activated', 'gravityview' );
470
+				$update_below = __( 'Activate your license key below.', 'gravityview' );
471 471
 				break;
472 472
 		}
473
-		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice';
473
+		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice';
474 474
 
475 475
 		// Show a different notice on settings page for inactive licenses (hide the buttons)
476
-		if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) {
476
+		if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) {
477 477
 			$message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' );
478 478
 		} else {
479 479
 			$message = sprintf( $message, $status, "\n\n" . '<a href="' . esc_url( $primary_button_link ) . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' );
480 480
 		}
481 481
 
482
-		if( !empty( $status ) ) {
482
+		if ( ! empty( $status ) ) {
483 483
 			GravityView_Admin_Notices::add_notice( array(
484 484
 				'message' => $message,
485 485
 				'class'	=> 'updated',
486 486
 				'title' => $title,
487 487
 				'cap' => 'gravityview_edit_settings',
488
-				'dismiss' => sha1( $license_status.'_'.$license_id ),
489
-			));
488
+				'dismiss' => sha1( $license_status . '_' . $license_id ),
489
+			) );
490 490
 		}
491 491
 	}
492 492
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 
499 499
 		$styles = parent::styles();
500 500
 
501
-		$styles[] = array(
501
+		$styles[ ] = array(
502 502
 			'handle'  => 'gravityview_settings',
503 503
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
504 504
 			'version' => GravityView_Plugin::version,
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	 * @return void
522 522
 	 */
523 523
 	public function add_network_menu() {
524
-		if( GravityView_Plugin::is_network_activated() ) {
524
+		if ( GravityView_Plugin::is_network_activated() ) {
525 525
 			add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' );
526 526
 		}
527 527
 	}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 		 * If multisite and not network admin, we don't want the settings to show.
539 539
 		 * @since 1.7.6
540 540
 		 */
541
-		$show_submenu = !is_multisite() ||  is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() );
541
+		$show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() );
542 542
 
543 543
 		/**
544 544
 		 * Override whether to show the Settings menu on a per-blog basis.
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 		 */
548 548
 		$show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu );
549 549
 
550
-		if( $show_submenu ) {
550
+		if ( $show_submenu ) {
551 551
 			add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) );
552 552
 		}
553 553
 	}
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		/**
587 587
 		 * Backward compatibility with Redux
588 588
 		 */
589
-		if( $setting_name === 'license' ) {
589
+		if ( $setting_name === 'license' ) {
590 590
 			return array(
591 591
 				'license' => parent::get_app_setting( 'license_key' ),
592 592
 				'status' => parent::get_app_setting( 'license_key_status' ),
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 
651 651
 		$return = $text . $activation;
652 652
 
653
-		if( $echo ) {
653
+		if ( $echo ) {
654 654
 			echo $return;
655 655
 		}
656 656
 
@@ -677,15 +677,15 @@  discard block
 block discarded – undo
677 677
 	 */
678 678
 	public function settings_submit( $field, $echo = true ) {
679 679
 
680
-		$field['type']  = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit';
680
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
681 681
 
682 682
 		$attributes    = $this->get_field_attributes( $field );
683 683
 		$default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' );
684
-		$value         = $this->get_setting( $field['name'], $default_value );
684
+		$value         = $this->get_setting( $field[ 'name' ], $default_value );
685 685
 
686 686
 
687
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton';
688
-		$name    = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name'];
687
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton';
688
+		$name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
689 689
 
690 690
 		if ( empty( $value ) ) {
691 691
 			$value = __( 'Update Settings', 'gravityview' );
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 		$attributes = $this->get_field_attributes( $field );
695 695
 
696 696
 		$html = '<input
697
-                    type="' . $field['type'] . '"
697
+                    type="' . $field[ 'type' ] . '"
698 698
                     name="' . esc_attr( $name ) . '"
699 699
                     value="' . $value . '" ' .
700 700
 		        implode( ' ', $attributes ) .
@@ -716,12 +716,12 @@  discard block
 block discarded – undo
716 716
 	 * @return string
717 717
 	 */
718 718
 	public function settings_save( $field, $echo = true ) {
719
-		$field['type']  = 'submit';
720
-		$field['name']  = 'gform-settings-save';
721
-		$field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton';
719
+		$field[ 'type' ]  = 'submit';
720
+		$field[ 'name' ]  = 'gform-settings-save';
721
+		$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton';
722 722
 
723 723
 		if ( ! rgar( $field, 'value' ) ) {
724
-			$field['value'] = __( 'Update Settings', 'gravityview' );
724
+			$field[ 'value' ] = __( 'Update Settings', 'gravityview' );
725 725
 		}
726 726
 
727 727
 		$output = $this->settings_submit( $field, false );
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 		$this->app_settings_uninstall_tab();
731 731
 		$output .= ob_get_clean();
732 732
 
733
-		if( $echo ) {
733
+		if ( $echo ) {
734 734
 			echo $output;
735 735
 		}
736 736
 
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
 		parent::single_setting_label( $field );
749 749
 
750 750
 		// Added by GravityView
751
-		if ( isset( $field['description'] ) ) {
752
-			echo '<span class="description">'. $field['description'] .'</span>';
751
+		if ( isset( $field[ 'description' ] ) ) {
752
+			echo '<span class="description">' . $field[ 'description' ] . '</span>';
753 753
 		}
754 754
 
755 755
 	}
@@ -812,11 +812,11 @@  discard block
 block discarded – undo
812 812
 
813 813
 		// If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response),
814 814
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
815
-		if( $local_key !== $response_key ) {
815
+		if ( $local_key !== $response_key ) {
816 816
 
817
-			unset( $posted_settings['license_key_response'] );
818
-			unset( $posted_settings['license_key_status'] );
819
-			GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
817
+			unset( $posted_settings[ 'license_key_response' ] );
818
+			unset( $posted_settings[ 'license_key_status' ] );
819
+			GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
820 820
 		}
821 821
 
822 822
 		return $posted_settings;
@@ -851,25 +851,25 @@  discard block
 block discarded – undo
851 851
 				'label'             => __( 'License Key', 'gravityview' ),
852 852
 				'description'          => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ),
853 853
 				'type'              => 'edd_license',
854
-				'data-pending-text' => __('Verifying license&hellip;', 'gravityview'),
855
-				'default_value'           => $default_settings['license_key'],
854
+				'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
855
+				'default_value'           => $default_settings[ 'license_key' ],
856 856
 				'class'             => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
857 857
 			),
858 858
 			array(
859 859
 				'name'       => 'license_key_response',
860
-				'default_value'  => $default_settings['license_key_response'],
860
+				'default_value'  => $default_settings[ 'license_key_response' ],
861 861
 				'type'     => 'hidden',
862 862
 			),
863 863
 			array(
864 864
 				'name'       => 'license_key_status',
865
-				'default_value'  => $default_settings['license_key_status'],
865
+				'default_value'  => $default_settings[ 'license_key_status' ],
866 866
 				'type'     => 'hidden',
867 867
 			),
868 868
 			array(
869 869
 				'name'       => 'support-email',
870 870
 				'type'     => 'text',
871 871
 				'validate' => 'email',
872
-				'default_value'  => $default_settings['support-email'],
872
+				'default_value'  => $default_settings[ 'support-email' ],
873 873
 				'label'    => __( 'Support Email', 'gravityview' ),
874 874
 				'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
875 875
 				'class'    => 'code regular-text',
@@ -881,53 +881,53 @@  discard block
 block discarded – undo
881 881
 				'name'         => 'support_port',
882 882
 				'type'       => 'radio',
883 883
 				'label'      => __( 'Show Support Port?', 'gravityview' ),
884
-				'default_value'    => $default_settings['support_port'],
884
+				'default_value'    => $default_settings[ 'support_port' ],
885 885
 				'horizontal' => 1,
886 886
 				'choices'    => array(
887 887
 					array(
888
-						'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'),
888
+						'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ),
889 889
 						'value' => '1',
890 890
 					),
891 891
 					array(
892
-						'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'),
892
+						'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ),
893 893
 						'value' => '0',
894 894
 					),
895 895
 				),
896
-				'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>',
896
+				'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>',
897 897
 				'description'   => __( 'Show the Support Port on GravityView pages?', 'gravityview' ),
898 898
 			),
899 899
 			array(
900 900
 				'name'         => 'no-conflict-mode',
901 901
 				'type'       => 'radio',
902 902
 				'label'      => __( 'No-Conflict Mode', 'gravityview' ),
903
-				'default_value'    => $default_settings['no-conflict-mode'],
903
+				'default_value'    => $default_settings[ 'no-conflict-mode' ],
904 904
 				'horizontal' => 1,
905 905
 				'choices'    => array(
906 906
 					array(
907
-						'label' => _x('On', 'Setting: On or off', 'gravityview'),
907
+						'label' => _x( 'On', 'Setting: On or off', 'gravityview' ),
908 908
 						'value' => '1',
909 909
 					),
910 910
 					array(
911
-						'label' => _x('Off', 'Setting: On or off', 'gravityview'),
911
+						'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ),
912 912
 						'value' => '0',
913 913
 					),
914 914
 				),
915
-				'description'   => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'),
915
+				'description'   => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ),
916 916
 			),
917 917
 			array(
918 918
 				'name'       => 'beta',
919 919
 				'type'       => 'checkbox',
920 920
 				'label'      => __( 'Become a Beta Tester', 'gravityview' ),
921
-				'default_value'    => $default_settings['beta'],
921
+				'default_value'    => $default_settings[ 'beta' ],
922 922
 				'horizontal' => 1,
923 923
 				'choices'    => array(
924 924
 					array(
925
-						'label' => _x('Show me beta versions if they are available.', 'gravityview'),
925
+						'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ),
926 926
 						'value' => '1',
927 927
                         'name'  => 'beta',
928 928
 					),
929 929
 				),
930
-				'description'   => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview'),
930
+				'description'   => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ),
931 931
 			),
932 932
 		) );
933 933
 
@@ -938,20 +938,20 @@  discard block
 block discarded – undo
938 938
 		 * @since 1.7.4
939 939
 		 */
940 940
 		foreach ( $fields as &$field ) {
941
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : rgget('id', $field );
942
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : rgget('title', $field );
943
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field );
944
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field );
941
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field );
942
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field );
943
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field );
944
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field );
945 945
 
946
-			if( $disabled_attribute ) {
947
-				$field['disabled']  = $disabled_attribute;
946
+			if ( $disabled_attribute ) {
947
+				$field[ 'disabled' ] = $disabled_attribute;
948 948
 			}
949 949
 		}
950 950
 
951 951
 
952 952
         $sections = array(
953 953
             array(
954
-                'description' =>      sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ),
954
+                'description' =>      sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ),
955 955
                 'fields'      => $fields,
956 956
             )
957 957
         );
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
             'type'     => 'save',
963 963
         );
964 964
 
965
-		if( $disabled_attribute ) {
966
-			$button['disabled'] = $disabled_attribute;
965
+		if ( $disabled_attribute ) {
966
+			$button[ 'disabled' ] = $disabled_attribute;
967 967
 		}
968 968
 
969 969
 
@@ -983,20 +983,20 @@  discard block
 block discarded – undo
983 983
 		// If there are extensions, add a section for them
984 984
 		if ( ! empty( $extension_sections ) ) {
985 985
 
986
-			if( $disabled_attribute ) {
986
+			if ( $disabled_attribute ) {
987 987
 				foreach ( $extension_sections as &$section ) {
988
-					foreach ( $section['fields'] as &$field ) {
989
-						$field['disabled'] = $disabled_attribute;
988
+					foreach ( $section[ 'fields' ] as &$field ) {
989
+						$field[ 'disabled' ] = $disabled_attribute;
990 990
 					}
991 991
 				}
992 992
 			}
993 993
 
994
-            $k = count( $extension_sections ) - 1 ;
995
-            $extension_sections[ $k ]['fields'][] = $button;
994
+            $k = count( $extension_sections ) - 1;
995
+            $extension_sections[ $k ][ 'fields' ][ ] = $button;
996 996
 			$sections = array_merge( $sections, $extension_sections );
997 997
 		} else {
998 998
             // add the 'update settings' button to the general section
999
-            $sections[0]['fields'][] = $button;
999
+            $sections[ 0 ][ 'fields' ][ ] = $button;
1000 1000
         }
1001 1001
 
1002 1002
 		return $sections;
Please login to merge, or discard this patch.