Completed
Push — develop ( 47c1de...5901ab )
by Zack
19:00 queued 11s
created
class-gravityview-plugin-hooks-gravity-forms-chainedselects.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 			return $searchable_fields;
60 60
 		}
61 61
 
62
-		foreach( $searchable_fields as $searchable_field ) {
62
+		foreach ( $searchable_fields as $searchable_field ) {
63 63
 
64 64
 			if ( self::INPUT_TYPE !== \GV\Utils::get( $searchable_field, 'input' ) ) {
65 65
 				continue;
66 66
 			}
67 67
 
68
-			$field = GFAPI::get_field( $searchable_field['form_id'], $searchable_field['field'] );
68
+			$field = GFAPI::get_field( $searchable_field[ 'form_id' ], $searchable_field[ 'field' ] );
69 69
 
70
-			foreach( $field->get_entry_inputs() as $input ) {
71
-				$searchable_fields[] = array(
72
-					'field' => $input['id'],
70
+			foreach ( $field->get_entry_inputs() as $input ) {
71
+				$searchable_fields[ ] = array(
72
+					'field' => $input[ 'id' ],
73 73
 				);
74 74
 			}
75 75
 		}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function print_styles( $search_widget, $search_field ) {
89 89
 
90
-		if( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) {
90
+		if ( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) {
91 91
 			return;
92 92
 		}
93 93
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function print_scripts( $search_widget, $search_field ) {
140 140
 
141
-		if( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) {
141
+		if ( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) {
142 142
 			return;
143 143
 		}
144 144
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 		foreach ( $gf_field->get_entry_inputs() as $input ) {
179 179
 
180 180
 			// Inputs are converted from . to _
181
-			$input_url_arg = 'input_' . str_replace( '.', '_', $input['id'] );
181
+			$input_url_arg = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
182 182
 
183
-			$field_values[ $input['id'] ] = \GV\Utils::_REQUEST( $input_url_arg );
183
+			$field_values[ $input[ 'id' ] ] = \GV\Utils::_REQUEST( $input_url_arg );
184 184
 		}
185 185
 
186 186
 		return $field_values;
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	function modify_searchable_fields( $fields, $form_id ) {
207 207
 
208
-		foreach( $fields as $key => $field ) {
209
-			if( 'chainedselect' === $field['type'] && ! empty( $field['parent'] ) ) {
208
+		foreach ( $fields as $key => $field ) {
209
+			if ( 'chainedselect' === $field[ 'type' ] && ! empty( $field[ 'parent' ] ) ) {
210 210
 				unset( $fields[ $key ] );
211 211
 			}
212 212
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return string
237 237
 	 */
238
-	public function set_input_type( $input_type, $field_type, $field_id  ) {
238
+	public function set_input_type( $input_type, $field_type, $field_id ) {
239 239
 
240 240
 		if ( ! in_array( $field_type, array( 'chainedselect' ) ) ) {
241 241
 			return $input_type;
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 2 patches
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -18,84 +18,84 @@  discard block
 block discarded – undo
18 18
 
19 19
 class GravityView_Edit_Entry {
20 20
 
21
-    /**
22
-     * @var string
23
-     */
21
+	/**
22
+	 * @var string
23
+	 */
24 24
 	static $file;
25 25
 
26 26
 	static $instance;
27 27
 
28
-    /**
29
-     * Component instances.
30
-     * @var array
31
-     */
32
-    public $instances = array();
28
+	/**
29
+	 * Component instances.
30
+	 * @var array
31
+	 */
32
+	public $instances = array();
33 33
 
34 34
 
35 35
 	function __construct() {
36 36
 
37
-        self::$file = plugin_dir_path( __FILE__ );
37
+		self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
40
-            $this->load_components( 'admin' );
41
-        }
39
+		if( is_admin() ) {
40
+			$this->load_components( 'admin' );
41
+		}
42 42
 
43 43
 		$this->load_components( 'locking' );
44 44
 
45
-        $this->load_components( 'render' );
45
+		$this->load_components( 'render' );
46 46
 
47
-        // If GF User Registration Add-on exists
48
-        $this->load_components( 'user-registration' );
47
+		// If GF User Registration Add-on exists
48
+		$this->load_components( 'user-registration' );
49 49
 
50
-        $this->add_hooks();
50
+		$this->add_hooks();
51 51
 
52 52
 		// Process hooks for addons that may or may not be present
53 53
 		$this->addon_specific_hooks();
54 54
 	}
55 55
 
56 56
 
57
-    static function getInstance() {
57
+	static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
60
-            self::$instance = new GravityView_Edit_Entry;
61
-        }
59
+		if( empty( self::$instance ) ) {
60
+			self::$instance = new GravityView_Edit_Entry;
61
+		}
62 62
 
63
-        return self::$instance;
64
-    }
63
+		return self::$instance;
64
+	}
65 65
 
66 66
 
67
-    private function load_components( $component ) {
67
+	private function load_components( $component ) {
68 68
 
69
-        $dir = trailingslashit( self::$file );
69
+		$dir = trailingslashit( self::$file );
70 70
 
71
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
71
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
73 73
 
74
-        // Loads component and pass extension's instance so that component can
75
-        // talk each other.
76
-        require_once $filename;
77
-        $this->instances[ $component ] = new $classname( $this );
78
-        $this->instances[ $component ]->load();
74
+		// Loads component and pass extension's instance so that component can
75
+		// talk each other.
76
+		require_once $filename;
77
+		$this->instances[ $component ] = new $classname( $this );
78
+		$this->instances[ $component ]->load();
79 79
 
80
-    }
80
+	}
81 81
 
82
-    private function add_hooks() {
82
+	private function add_hooks() {
83 83
 
84
-        // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') );
84
+		// Add front-end access to Gravity Forms delete file action
85
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') );
86 86
 
87
-        // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') );
87
+		// Make sure this hook is run for non-admins
88
+		add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') );
89 89
 
90
-        add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
90
+		add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
91 91
 
92
-        // add template path to check for field
93
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
92
+		// add template path to check for field
93
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
94 94
 
95 95
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
96 96
 
97 97
 		add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) );
98
-    }
98
+	}
99 99
 
100 100
 	/**
101 101
 	 * Adds "edit" to the list of internal reserved query args
@@ -166,74 +166,74 @@  discard block
 block discarded – undo
166 166
 		return false;
167 167
 	}
168 168
 
169
-    /**
170
-     * Include this extension templates path
171
-     * @param array $file_paths List of template paths ordered
172
-     */
173
-    public function add_template_path( $file_paths ) {
174
-
175
-        // Index 100 is the default GravityView template path.
176
-        $file_paths[ 110 ] = self::$file;
177
-
178
-        return $file_paths;
179
-    }
180
-
181
-    /**
182
-     *
183
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
-     *
185
-     * @param $view_id int GravityView view id
186
-     * @param $form_id int Gravity Forms form id
187
-     * @param $entry_id int Gravity Forms entry id
188
-     * @return string
189
-     */
190
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
-    }
193
-
194
-
195
-    /**
196
-     * The edit entry link creates a secure link with a nonce
197
-     *
198
-     * It also mimics the URL structure Gravity Forms expects to have so that
199
-     * it formats the display of the edit form like it does in the backend, like
200
-     * "You can edit this post from the post page" fields, for example.
201
-     *
202
-     * @param $entry array Gravity Forms entry object
203
-     * @param $view_id int GravityView view id
204
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
-     * @return string
207
-     */
208
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
-
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
-
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
-
214
-        $url = add_query_arg( array(
215
-            'edit' => wp_create_nonce( $nonce_key )
216
-        ), $base );
217
-
218
-        if( $post_id ) {
219
-	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
-        }
221
-
222
-	    /**
223
-	     * Allow passing params to dynamically populate entry with values
224
-	     * @since 1.9.2
225
-	     */
226
-	    if( !empty( $field_values ) ) {
227
-
228
-		    if( is_array( $field_values ) ) {
229
-			    // If already an array, no parse_str() needed
230
-			    $params = $field_values;
231
-		    } else {
232
-			    parse_str( $field_values, $params );
233
-		    }
234
-
235
-		    $url = add_query_arg( $params, $url );
236
-	    }
169
+	/**
170
+	 * Include this extension templates path
171
+	 * @param array $file_paths List of template paths ordered
172
+	 */
173
+	public function add_template_path( $file_paths ) {
174
+
175
+		// Index 100 is the default GravityView template path.
176
+		$file_paths[ 110 ] = self::$file;
177
+
178
+		return $file_paths;
179
+	}
180
+
181
+	/**
182
+	 *
183
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
+	 *
185
+	 * @param $view_id int GravityView view id
186
+	 * @param $form_id int Gravity Forms form id
187
+	 * @param $entry_id int Gravity Forms entry id
188
+	 * @return string
189
+	 */
190
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
+	}
193
+
194
+
195
+	/**
196
+	 * The edit entry link creates a secure link with a nonce
197
+	 *
198
+	 * It also mimics the URL structure Gravity Forms expects to have so that
199
+	 * it formats the display of the edit form like it does in the backend, like
200
+	 * "You can edit this post from the post page" fields, for example.
201
+	 *
202
+	 * @param $entry array Gravity Forms entry object
203
+	 * @param $view_id int GravityView view id
204
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
+	 * @return string
207
+	 */
208
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
+
210
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
+
212
+		$base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
+
214
+		$url = add_query_arg( array(
215
+			'edit' => wp_create_nonce( $nonce_key )
216
+		), $base );
217
+
218
+		if( $post_id ) {
219
+			$url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
+		}
221
+
222
+		/**
223
+		 * Allow passing params to dynamically populate entry with values
224
+		 * @since 1.9.2
225
+		 */
226
+		if( !empty( $field_values ) ) {
227
+
228
+			if( is_array( $field_values ) ) {
229
+				// If already an array, no parse_str() needed
230
+				$params = $field_values;
231
+			} else {
232
+				parse_str( $field_values, $params );
233
+			}
234
+
235
+			$url = add_query_arg( $params, $url );
236
+		}
237 237
 
238 238
 		/**
239 239
 		 * @filter `gravityview/edit/link` Filter the edit URL link.
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244 244
 		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
245
-    }
245
+	}
246 246
 
247 247
 	/**
248 248
 	 * @depecated 2.14 Use {@see GravityView_Edit_Entry::modify_field_blocklist()}
@@ -333,19 +333,19 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 
336
-    /**
337
-     * checks if user has permissions to edit a specific entry
338
-     *
339
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
340
-     *
341
-     * @param  array $entry Gravity Forms entry array
342
-     * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
343
-     * @return bool
344
-     */
345
-    public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
336
+	/**
337
+	 * checks if user has permissions to edit a specific entry
338
+	 *
339
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
340
+	 *
341
+	 * @param  array $entry Gravity Forms entry array
342
+	 * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
343
+	 * @return bool
344
+	 */
345
+	public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
346 346
 
347
-        // No permission by default
348
-        $user_can_edit = false;
347
+		// No permission by default
348
+		$user_can_edit = false;
349 349
 
350 350
 		// get user_edit setting
351 351
 		if ( empty( $view ) ) {
@@ -363,60 +363,60 @@  discard block
 block discarded – undo
363 363
 			$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
364 364
 		}
365 365
 
366
-        // If they can edit any entries (as defined in Gravity Forms)
367
-        // Or if they can edit other people's entries
368
-        // Then we're good.
369
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
366
+		// If they can edit any entries (as defined in Gravity Forms)
367
+		// Or if they can edit other people's entries
368
+		// Then we're good.
369
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
370 370
 
371
-            gravityview()->log->debug( 'User has ability to edit all entries.' );
371
+			gravityview()->log->debug( 'User has ability to edit all entries.' );
372 372
 
373
-            $user_can_edit = true;
373
+			$user_can_edit = true;
374 374
 
375
-        } else if( !isset( $entry['created_by'] ) ) {
375
+		} else if( !isset( $entry['created_by'] ) ) {
376 376
 
377
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
377
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
378 378
 
379
-            $user_can_edit = false;
379
+			$user_can_edit = false;
380 380
 
381
-        } else {
381
+		} else {
382 382
 
383
-            $current_user = wp_get_current_user();
383
+			$current_user = wp_get_current_user();
384 384
 
385
-            // User edit is disabled
386
-            if( empty( $user_edit ) ) {
385
+			// User edit is disabled
386
+			if( empty( $user_edit ) ) {
387 387
 
388
-                gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
388
+				gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
389 389
 
390
-                $user_can_edit = false;
391
-            }
390
+				$user_can_edit = false;
391
+			}
392 392
 
393
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
393
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
395 395
 
396
-                gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
396
+				gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
397 397
 
398
-                $user_can_edit = true;
398
+				$user_can_edit = true;
399 399
 
400
-            } else if( ! is_user_logged_in() ) {
400
+			} else if( ! is_user_logged_in() ) {
401 401
 
402
-                gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
402
+				gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
403 403
 
404
-	            $user_can_edit = false; // Here just for clarity
405
-            }
404
+				$user_can_edit = false; // Here just for clarity
405
+			}
406 406
 
407
-        }
407
+		}
408 408
 
409
-        /**
410
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
411
-         * @since 1.15 Added `$entry` and `$view_id` parameters
412
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
413
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
414
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
415
-         */
416
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
409
+		/**
410
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
411
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
412
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
413
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
414
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
415
+		 */
416
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
417 417
 
418
-        return (bool) $user_can_edit;
419
-    }
418
+		return (bool) $user_can_edit;
419
+	}
420 420
 
421 421
 	/**
422 422
 	 * Deletes a file.
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
59
+        if ( empty( self::$instance ) ) {
60 60
             self::$instance = new GravityView_Edit_Entry;
61 61
         }
62 62
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     private function add_hooks() {
83 83
 
84 84
         // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') );
85
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file' ) );
86 86
 
87 87
         // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') );
88
+        add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file' ) );
89 89
 
90 90
         add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
91 91
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function add_reserved_arg( $args ) {
110 110
 
111
-		$args[] = 'edit';
111
+		$args[ ] = 'edit';
112 112
 
113 113
 		return $args;
114 114
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	private function addon_specific_hooks() {
121 121
 
122
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
122
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
124 124
 		}
125 125
 
126 126
 	}
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209 209
 
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
210
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
211 211
 
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
212
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
213 213
 
214 214
         $url = add_query_arg( array(
215 215
             'edit' => wp_create_nonce( $nonce_key )
216 216
         ), $base );
217 217
 
218
-        if( $post_id ) {
218
+        if ( $post_id ) {
219 219
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220 220
         }
221 221
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	     * Allow passing params to dynamically populate entry with values
224 224
 	     * @since 1.9.2
225 225
 	     */
226
-	    if( !empty( $field_values ) ) {
226
+	    if ( ! empty( $field_values ) ) {
227 227
 
228
-		    if( is_array( $field_values ) ) {
228
+		    if ( is_array( $field_values ) ) {
229 229
 			    // If already an array, no parse_str() needed
230 230
 			    $params = $field_values;
231 231
 		    } else {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * @param array $entry The entry.
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
244
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
245 245
     }
246 246
 
247 247
 	/**
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	public function modify_field_blocklist( $fields = array(), $context = NULL ) {
271 271
 
272
-		if( empty( $context ) || $context !== 'edit' ) {
272
+		if ( empty( $context ) || $context !== 'edit' ) {
273 273
 			return $fields;
274 274
 		}
275 275
 
@@ -366,15 +366,15 @@  discard block
 block discarded – undo
366 366
         // If they can edit any entries (as defined in Gravity Forms)
367 367
         // Or if they can edit other people's entries
368 368
         // Then we're good.
369
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
369
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
370 370
 
371 371
             gravityview()->log->debug( 'User has ability to edit all entries.' );
372 372
 
373 373
             $user_can_edit = true;
374 374
 
375
-        } else if( !isset( $entry['created_by'] ) ) {
375
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
376 376
 
377
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
377
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
378 378
 
379 379
             $user_can_edit = false;
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             $current_user = wp_get_current_user();
384 384
 
385 385
             // User edit is disabled
386
-            if( empty( $user_edit ) ) {
386
+            if ( empty( $user_edit ) ) {
387 387
 
388 388
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
389 389
 
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
             }
392 392
 
393 393
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
394
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
395 395
 
396 396
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
397 397
 
398 398
                 $user_can_edit = true;
399 399
 
400
-            } else if( ! is_user_logged_in() ) {
400
+            } else if ( ! is_user_logged_in() ) {
401 401
 
402 402
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
403 403
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
          */
416 416
         $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
417 417
 
418
-        return (bool) $user_can_edit;
418
+        return (bool)$user_can_edit;
419 419
     }
420 420
 
421 421
 	/**
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @uses   GFForms::delete_file()
427 427
 	 */
428 428
 	public function delete_file() {
429
-		add_filter( 'user_has_cap', function ( $caps ) {
430
-			$caps['gravityforms_delete_entries'] = true;
429
+		add_filter( 'user_has_cap', function( $caps ) {
430
+			$caps[ 'gravityforms_delete_entries' ] = true;
431 431
 
432 432
 			return $caps;
433 433
 
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-no-conflict.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		if( ! is_admin() ) { return; }
21
+		if ( ! is_admin() ) { return; }
22 22
 		
23 23
 		$this->add_hooks();
24 24
 	}
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	private function add_hooks() {
34 34
 		//Hooks for no-conflict functionality
35
-		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
36
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
35
+		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 );
36
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 );
37 37
 
38
-		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
39
-		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11);
40
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
41
-		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
38
+		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 );
39
+		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 );
40
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 );
41
+		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 );
42 42
 	}
43 43
 
44 44
 	/**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	function no_conflict_scripts() {
52 52
 		global $wp_scripts;
53 53
 
54
-		if( ! gravityview()->request->is_admin( '', null ) ) {
54
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
55 55
 			return;
56 56
 		}
57 57
 
58 58
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
59 59
 
60
-		if( empty( $no_conflict_mode ) ) {
60
+		if ( empty( $no_conflict_mode ) ) {
61 61
 			return;
62 62
 		}
63 63
 
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 	function no_conflict_styles() {
117 117
 		global $wp_styles;
118 118
 
119
-		if( ! gravityview()->request->is_admin( '', null ) ) {
119
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
120 120
 			return;
121 121
 		}
122 122
 
123 123
 		// Dequeue other jQuery styles even if no-conflict is off.
124 124
 		// Terrible-looking tabs help no one.
125
-		if( !empty( $wp_styles->registered ) )  {
126
-			foreach ($wp_styles->registered as $key => $style) {
127
-				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
125
+		if ( ! empty( $wp_styles->registered ) ) {
126
+			foreach ( $wp_styles->registered as $key => $style ) {
127
+				if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
128 128
 					wp_dequeue_style( $key );
129 129
 				}
130 130
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
134 134
 
135 135
 		// If no conflict is off, jQuery will suffice.
136
-		if( empty( $no_conflict_mode ) ) {
136
+		if ( empty( $no_conflict_mode ) ) {
137 137
 			return;
138 138
 		}
139 139
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		/**
162 162
 		 * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here.
163 163
 		 */
164
-		do_action('gravityview_remove_conflicts_after');
164
+		do_action( 'gravityview_remove_conflicts_after' );
165 165
 	}
166 166
 
167 167
 	/**
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 
195 195
 		//reset queue
196 196
 		$queue = array();
197
-		foreach( $wp_objects->queue as $object ) {
198
-			if( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) {
199
-				$queue[] = $object;
197
+		foreach ( $wp_objects->queue as $object ) {
198
+			if ( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) {
199
+				$queue[ ] = $object;
200 200
 			}
201 201
 		}
202 202
 		$wp_objects->queue = $queue;
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
 		//unregistering scripts
207 207
 		$registered = array();
208
-		foreach( $wp_objects->registered as $handle => $script_registration ){
209
-			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){
208
+		foreach ( $wp_objects->registered as $handle => $script_registration ) {
209
+			if ( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) {
210 210
 				$registered[ $handle ] = $script_registration;
211 211
 			}
212 212
 		}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @param array $registered [description]
222 222
 	 * @param array $scripts    [description]
223 223
 	 */
224
-	private function add_script_dependencies($registered, $scripts) {
224
+	private function add_script_dependencies( $registered, $scripts ) {
225 225
 
226 226
 		//gets all dependent scripts linked to the $scripts array passed
227 227
 		do {
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 				$deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array();
231 231
 				foreach ( $deps as $dep ) {
232 232
 					if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) {
233
-						$dependents[] = $dep;
233
+						$dependents[ ] = $dep;
234 234
 					}
235 235
 				}
236 236
 			}
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 		// Dequeue other jQuery styles even if no-conflict is off.
124 124
 		// Terrible-looking tabs help no one.
125
-		if( !empty( $wp_styles->registered ) )  {
125
+		if( !empty( $wp_styles->registered ) ) {
126 126
 			foreach ($wp_styles->registered as $key => $style) {
127 127
 				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
128 128
 					wp_dequeue_style( $key );
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
 		//unregistering scripts
207 207
 		$registered = array();
208
-		foreach( $wp_objects->registered as $handle => $script_registration ){
209
-			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){
208
+		foreach( $wp_objects->registered as $handle => $script_registration ) {
209
+			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) {
210 210
 				$registered[ $handle ] = $script_registration;
211 211
 			}
212 212
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-license-handler.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 			'author'    => self::author,
99 99
 			'language'  => get_locale(),
100 100
 			'url'       => home_url(),
101
-		    'beta'      => $this->settings->get( 'beta' ),
101
+			'beta'      => $this->settings->get( 'beta' ),
102 102
 			'php_version' => phpversion(),
103 103
 			'wp_version' => get_bloginfo( 'version' ),
104 104
 			'gv_version' => \GV\Plugin::$version,
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	private function license_call_update_settings( $license_data, $data ) {
523 523
 		$settings = array();
524 524
 
525
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
525
+		$settings['license_key'] = $license_data->license_key = trim( $data['license'] );
526 526
 		$settings['license_key_status'] = $license_data->license;
527 527
 		$settings['license_key_response'] = (array)$license_data;
528 528
 
@@ -663,14 +663,14 @@  discard block
 block discarded – undo
663 663
 			// Call the custom API.
664 664
 			$response = wp_remote_post( self::url, array(
665 665
 				'timeout'   => 15,
666
-			    'sslverify' => false,
667
-			    'body'      =>  array(
668
-				    'edd_action' => 'check_license',
669
-				    'license'    => trim( $this->settings->get( 'license_key' ) ),
670
-				    'item_name'  => self::name,
671
-				    'url'        => home_url(),
672
-				    'site_data'  => $this->get_site_data(),
673
-			    ),
666
+				'sslverify' => false,
667
+				'body'      =>  array(
668
+					'edd_action' => 'check_license',
669
+					'license'    => trim( $this->settings->get( 'license_key' ) ),
670
+					'item_name'  => self::name,
671
+					'url'        => home_url(),
672
+					'site_data'  => $this->get_site_data(),
673
+				),
674 674
 			));
675 675
 
676 676
 			// make sure the response came back okay
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		);
107 107
 
108 108
 		if ( ! empty( $action ) ) {
109
-			$settings['edd_action'] = esc_attr( $action );
109
+			$settings[ 'edd_action' ] = esc_attr( $action );
110 110
 		}
111 111
 
112 112
 		return array_map( 'urlencode', $settings );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		}
127 127
 
128 128
 		// If doing ajax, get outta here.
129
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
129
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) {
130 130
 			return;
131 131
 		}
132 132
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			'format' => 'json',
174 174
 		) );
175 175
 
176
-		if ( $is_ajax && empty( $data['license'] ) ) {
176
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
177 177
 			die( -1 );
178 178
 		}
179 179
 
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 
202 202
 			$json = json_encode( $license_data );
203 203
 
204
-			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action');
204
+			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' );
205 205
 
206 206
 			$is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX );
207 207
 
208
-			do_action('gravityview/admin_installer/delete_downloads_data', true );
208
+			do_action( 'gravityview/admin_installer/delete_downloads_data', true );
209 209
 
210 210
 			if ( $is_check_action_button ) {
211 211
 				delete_transient( self::status_transient_key );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			// most likely a mistake.
217 217
 			} else if ( $license_data->license !== 'failed' && $update_license ) {
218 218
 
219
-				if ( ! empty( $data['field_id'] ) ) {
219
+				if ( ! empty( $data[ 'field_id' ] ) ) {
220 220
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
221 221
 				}
222 222
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			$class   = 'hide';
245 245
 			$message = '';
246 246
 		} else {
247
-			if( ! empty( $license_data->error ) ) {
247
+			if ( ! empty( $license_data->error ) ) {
248 248
 				$class = 'error';
249 249
 				$string_key = $license_data->error;
250 250
 			} else { $class = $license_data->license;
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	public function license_details( $response = array() ) {
270 270
 
271
-		$response = (array) $response;
271
+		$response = (array)$response;
272 272
 
273 273
 		$return  = '';
274 274
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
275 275
 
276
-		if ( ! empty( $response['license_key'] ) ) {
276
+		if ( ! empty( $response[ 'license_key' ] ) ) {
277 277
 			$return .= '<h3>' . rtrim( esc_html__( 'License Details:', 'gravityview' ), ':' ) . '</h3>';
278 278
 
279 279
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 				}
283 283
 
284 284
 
285
-				$return .= $this->strings( $response['license'], $response );
286
-			} elseif ( ! empty( $response['license_name'] ) ) {
285
+				$return .= $this->strings( $response[ 'license' ], $response );
286
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
287 287
 				$response_keys = array(
288 288
 					'license_name'   => '',
289 289
 					'license_limit'  => '',
@@ -298,22 +298,22 @@  discard block
 block discarded – undo
298 298
 				$response = wp_parse_args( $response, $response_keys );
299 299
 
300 300
 				$login_link_class = gravityview()->plugin->is_GF_25() ? 'button button-outline outline' : 'text-link';
301
-				$renews_on = ( 'lifetime' === $response['expires'] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) );
302
-				$login_link       = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" 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' ) );
303
-				$local_text       = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
304
-				$license_limit    = empty( $response['license_limit'] ) ? __( 'Unlimited', 'gravityview' ) : (int) $response['license_limit'];
301
+				$renews_on = ( 'lifetime' === $response[ 'expires' ] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) );
302
+				$login_link       = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" 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' ) );
303
+				$local_text       = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
304
+				$license_limit    = empty( $response[ 'license_limit' ] ) ? __( 'Unlimited', 'gravityview' ) : (int)$response[ 'license_limit' ];
305 305
 
306 306
 
307 307
 				$details = array(
308
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response['license_name'] ) . '</span>' ),
309
-					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), '<span class="gv-license-detail">' . esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . '</span>' . $renews_on . $login_link,
310
-					'activations' => sprintf( str_replace( '%d', '%s', esc_html__( 'Activations: %d of %s sites', 'gravityview' ) ), '<span class="gv-license-detail">' . intval( $response['site_count'] ), esc_html( $license_limit ) ) . '</span>' . $local_text,
311
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
308
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response[ 'license_name' ] ) . '</span>' ),
309
+					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), '<span class="gv-license-detail">' . esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . '</span>' . $renews_on . $login_link,
310
+					'activations' => sprintf( str_replace( '%d', '%s', esc_html__( 'Activations: %d of %s sites', 'gravityview' ) ), '<span class="gv-license-detail">' . intval( $response[ 'site_count' ] ), esc_html( $license_limit ) ) . '</span>' . $local_text,
311
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
312 312
 				);
313 313
 
314
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
315
-					unset( $details['upgrade'] );
316
-					$details['licensed_to'] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
314
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
315
+					unset( $details[ 'upgrade' ] );
316
+					$details[ 'licensed_to' ] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
317 317
 				}
318 318
 
319 319
 				$return .= '<ul>';
@@ -345,20 +345,20 @@  discard block
 block discarded – undo
345 345
 		if ( ! empty( $upgrades ) ) {
346 346
 
347 347
 			$locale_parts = explode( '_', get_locale() );
348
-			$is_english = ( 'en' === $locale_parts[0] );
348
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
349 349
 
350 350
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
351 351
 			$output .= '<ul>';
352 352
 
353 353
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
354
-				$upgrade = (object) $upgrade;
354
+				$upgrade = (object)$upgrade;
355 355
 
356 356
 				$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 ) );
357 357
 
358 358
 				if ( $is_english && isset( $upgrade->description ) ) {
359 359
 					$message = esc_html( $upgrade->description );
360 360
 				} else {
361
-					switch( $upgrade->price_id ) {
361
+					switch ( $upgrade->price_id ) {
362 362
 						// Interstellar
363 363
 						case 1:
364 364
 						default:
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 			'invalid_item_id' => esc_html__( 'This license key does not have access to this plugin.', 'gravityview' ),
438 438
 			'missing' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), // Missing is "the license couldn't be found", not "you submitted an empty license"
439 439
 			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
440
-			'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>' ),
440
+			'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>' ),
441 441
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
442 442
 			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
443 443
 			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
 		if ( ! empty( $license_data->renewal_url ) ) {
467 467
 			$renew_license_url = $license_data->renewal_url;
468
-		} elseif( ! empty( $license_data->license_key ) ) {
468
+		} elseif ( ! empty( $license_data->license_key ) ) {
469 469
 			$renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
470 470
 		} else {
471 471
 			$renew_license_url = 'https://gravityview.co/account/';
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 * @return array|\WP_Error
483 483
 	 */
484 484
 	private function _license_get_remote_response( $data, $license = '' ) {
485
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
485
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
486 486
 
487 487
 		$url = add_query_arg( $api_params, self::url );
488 488
 
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 	private function license_call_update_settings( $license_data, $data ) {
523 523
 		$settings = array();
524 524
 
525
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
526
-		$settings['license_key_status'] = $license_data->license;
527
-		$settings['license_key_response'] = (array)$license_data;
525
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
526
+		$settings[ 'license_key_status' ] = $license_data->license;
527
+		$settings[ 'license_key_response' ] = (array)$license_data;
528 528
 
529 529
 		$this->settings->set( $settings );
530 530
 	}
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 		$status = trim( $this->settings->get( 'license_key_status' ) );
545 545
 		$key = trim( $this->settings->get( 'license_key' ) );
546 546
 
547
-		if (  !empty( $key ) ) {
547
+		if ( ! empty( $key ) ) {
548 548
 			$response = $this->settings->get( 'license_key_response' );
549
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
549
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
550 550
 		} else {
551 551
 			$response = array();
552 552
 		}
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
 
590 590
 		$submit = '<div class="gv-edd-button-wrapper">';
591 591
 		foreach ( $fields as $field ) {
592
-			$field['type'] = 'button';
593
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
594
-			$field['style'] = 'margin-left: 10px;';
595
-			if( $disabled_attribute ) {
596
-				$field['disabled'] = $disabled_attribute;
592
+			$field[ 'type' ] = 'button';
593
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
594
+			$field[ 'style' ] = 'margin-left: 10px;';
595
+			if ( $disabled_attribute ) {
596
+				$field[ 'disabled' ] = $disabled_attribute;
597 597
 			}
598 598
 			$submit .= $this->settings->as_html( $field, $echo );
599 599
 		}
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 				    'url'        => home_url(),
672 672
 				    'site_data'  => $this->get_site_data(),
673 673
 			    ),
674
-			));
674
+			) );
675 675
 
676 676
 			// make sure the response came back okay
677 677
 			if ( is_wp_error( $response ) ) {
@@ -701,45 +701,45 @@  discard block
 block discarded – undo
701 701
 		$theme_data = wp_get_theme();
702 702
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
703 703
 
704
-		$data['gv_version']  = Plugin::$version;
705
-		$data['php_version']  = phpversion();
706
-		$data['wp_version']   = get_bloginfo( 'version' );
707
-		$data['gf_version']  = \GFForms::$version;
708
-		$data['server']       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
709
-		$data['multisite']    = is_multisite();
710
-		$data['theme']        = $theme;
711
-		$data['url']          = home_url();
712
-		$data['license_key']  = $this->settings->get( 'license_key' );
713
-		$data['beta']         = $this->settings->get( 'beta' );
704
+		$data[ 'gv_version' ]  = Plugin::$version;
705
+		$data[ 'php_version' ]  = phpversion();
706
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
707
+		$data[ 'gf_version' ]  = \GFForms::$version;
708
+		$data[ 'server' ]       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
709
+		$data[ 'multisite' ]    = is_multisite();
710
+		$data[ 'theme' ]        = $theme;
711
+		$data[ 'url' ]          = home_url();
712
+		$data[ 'license_key' ]  = $this->settings->get( 'license_key' );
713
+		$data[ 'beta' ]         = $this->settings->get( 'beta' );
714 714
 
715 715
 		// View Data
716 716
 		$gravityview_posts = wp_count_posts( 'gravityview', 'readable' );
717 717
 
718
-		$data['view_count'] = null;
719
-		$data['view_first'] = null;
720
-		$data['view_latest'] = null;
718
+		$data[ 'view_count' ] = null;
719
+		$data[ 'view_first' ] = null;
720
+		$data[ 'view_latest' ] = null;
721 721
 
722 722
 		if ( $gravityview_posts->publish ) {
723
-			$data['view_count'] = $gravityview_posts->publish;
723
+			$data[ 'view_count' ] = $gravityview_posts->publish;
724 724
 
725 725
 			$first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' );
726 726
 			$latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' );
727 727
 
728 728
 			if ( $first = array_shift( $first ) ) {
729
-				$data['view_first'] = $first->post_date;
729
+				$data[ 'view_first' ] = $first->post_date;
730 730
 			}
731 731
 			if ( $latest = array_pop( $latest ) ) {
732
-				$data['view_latest'] = $latest->post_date;
732
+				$data[ 'view_latest' ] = $latest->post_date;
733 733
 			}
734 734
 		}
735 735
 
736 736
 		// Form counts
737 737
 		if ( class_exists( 'GFFormsModel' ) ) {
738 738
 			$form_data = \GFFormsModel::get_form_count();
739
-			$data['forms_total'] = Utils::get( $form_data, 'total', 0 );
740
-			$data['forms_active'] = Utils::get( $form_data, 'active', 0 );
741
-			$data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 );
742
-			$data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 );
739
+			$data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 );
740
+			$data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 );
741
+			$data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 );
742
+			$data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 );
743 743
 		}
744 744
 
745 745
 		// Retrieve current plugin information
@@ -747,13 +747,13 @@  discard block
 block discarded – undo
747 747
 			include ABSPATH . '/wp-admin/includes/plugin.php';
748 748
 		}
749 749
 
750
-		$data['integrations']     = self::get_related_plugins_and_extensions();
751
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
752
-		$data['inactive_plugins'] = array();
753
-		$data['locale']           = get_locale();
750
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
751
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
752
+		$data[ 'inactive_plugins' ] = array();
753
+		$data[ 'locale' ]           = get_locale();
754 754
 
755 755
 		// Validate request on the GV server
756
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
756
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
757 757
 
758 758
 		return $data;
759 759
 	}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 
784 784
 				$plugin_data = get_plugin_data( $active_plugin );
785 785
 
786
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
786
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
787 787
 			}
788 788
 
789 789
 			if ( ! empty( $extensions ) ) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		}
127 127
 
128 128
 		// If doing ajax, get outta here.
129
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
129
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) {
130 130
 			return;
131 131
 		}
132 132
 
@@ -191,7 +191,8 @@  discard block
 block discarded – undo
191 191
 			if ( empty( $license_data ) ) {
192 192
 				if ( $is_ajax ) {
193 193
 					exit( json_encode( array() ) );
194
-				} else { // Non-ajax call
194
+				} else {
195
+// Non-ajax call
195 196
 					return json_encode( array() );
196 197
 				}
197 198
 			}
@@ -226,7 +227,8 @@  discard block
 block discarded – undo
226 227
 
227 228
 		if ( $is_ajax ) {
228 229
 			exit( $json );
229
-		} else { // Non-ajax call
230
+		} else {
231
+// Non-ajax call
230 232
 			return ( Utils::_GET( 'format', Utils::get( $data, 'format' ) ) === 'object' ) ? $license_data : $json;
231 233
 		}
232 234
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-extension.php 3 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 		$tab = wp_parse_args( $tab_settings, $tab_defaults );
181 181
 
182 182
 		// Force the screen to be GravityView
183
-		$tab['screen'] = 'gravityview';
183
+		$tab[ 'screen' ] = 'gravityview';
184 184
 
185 185
 		if ( class_exists( 'GravityView_Metabox_Tab' ) ) {
186
-			$metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] );
186
+			$metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] );
187 187
 			\GravityView_Metabox_Tabs::add( $metabox );
188 188
 		} else {
189
-			add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] );
189
+			add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] );
190 190
 		}
191 191
 	}
192 192
 
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	protected function is_extension_supported() {
213 213
 
214
-		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible );
214
+		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible );
215 215
 
216 216
 		if ( ! function_exists( 'gravityview' ) ) {
217 217
 			$message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) );
218
-		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) {
219
-			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' );
220
-		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) {
221
-			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' );
218
+		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) {
219
+			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' );
220
+		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) {
221
+			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' );
222 222
 		} else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) {
223 223
 			$message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) );
224 224
 		} else {
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$locale = get_locale();
260 260
 
261
-		if ( function_exists('get_user_locale') && is_admin() ) {
261
+		if ( function_exists( 'get_user_locale' ) && is_admin() ) {
262 262
 			$locale = get_user_locale();
263 263
 		}
264 264
 
265 265
 		// Traditional WordPress plugin locale filter
266
-		$locale = apply_filters( 'plugin_locale',  $locale, $this->_text_domain );
266
+		$locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain );
267 267
 
268 268
 		$mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale );
269 269
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	public function settings() {
292 292
 
293 293
 		// If doing ajax, get outta here.
294
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
294
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) {
295 295
 			return;
296 296
 		}
297 297
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
             	'version'	=> $this->_version, // current version number
315 315
             	'license'	=> \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ),
316 316
 	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
317
-            	'item_name' => $this->_title,  // name of this plugin
318
-            	'author' 	=> strip_tags( $this->_author ),  // author of this plugin
317
+            	'item_name' => $this->_title, // name of this plugin
318
+            	'author' 	=> strip_tags( $this->_author ), // author of this plugin
319 319
 	            'php_version' => phpversion(),
320 320
 	            'wp_version' => get_bloginfo( 'version' ),
321 321
 	            'gv_version' => \GV\Plugin::$version,
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	public static function add_notice( $notice = array() ) {
349 349
 
350
-		if ( is_array( $notice ) && empty( $notice['message'] ) ) {
350
+		if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) {
351 351
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
352 352
 			return;
353 353
 		} else if ( is_string( $notice ) ) {
354 354
 			$notice = array( 'message' => $notice );
355 355
 		}
356 356
 
357
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
357
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
358 358
 
359
-		self::$admin_notices []= $notice;
359
+		self::$admin_notices [ ] = $notice;
360 360
 	}
361 361
 
362 362
 	/**
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 		}
371 371
 
372 372
 		foreach ( self::$admin_notices as $key => $notice ) {
373
-			echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">';
374
-			echo wpautop( $notice['message'] );
373
+			echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">';
374
+			echo wpautop( $notice[ 'message' ] );
375 375
 			echo '<div class="clear"></div>';
376 376
 			echo '</div>';
377 377
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -291,7 +291,7 @@
 block discarded – undo
291 291
 	public function settings() {
292 292
 
293 293
 		// If doing ajax, get outta here.
294
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
294
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) {
295 295
 			return;
296 296
 		}
297 297
 
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -311,17 +311,17 @@
 block discarded – undo
311 311
 			$this->_remote_update_url,
312 312
 			$this->_path,
313 313
 			array(
314
-            	'version'	=> $this->_version, // current version number
315
-            	'license'	=> \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ),
316
-	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
317
-            	'item_name' => $this->_title,  // name of this plugin
318
-            	'author' 	=> strip_tags( $this->_author ),  // author of this plugin
319
-	            'php_version' => phpversion(),
320
-	            'wp_version' => get_bloginfo( 'version' ),
321
-	            'gv_version' => \GV\Plugin::$version,
322
-	            'environment' => function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : 'production',
323
-          	)
324
-        );
314
+				'version'	=> $this->_version, // current version number
315
+				'license'	=> \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ),
316
+				'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
317
+				'item_name' => $this->_title,  // name of this plugin
318
+				'author' 	=> strip_tags( $this->_author ),  // author of this plugin
319
+				'php_version' => phpversion(),
320
+				'wp_version' => get_bloginfo( 'version' ),
321
+				'gv_version' => \GV\Plugin::$version,
322
+				'environment' => function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : 'production',
323
+		  	)
324
+		);
325 325
 	}
326 326
 
327 327
 	/**
Please login to merge, or discard this patch.
includes/wordpress-widgets/class-gravityview-recent-entries-widget.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 	function __construct( ) {
14 14
 
15
-		$name = __('GravityView Recent Entries', 'gravityview');
15
+		$name = __( 'GravityView Recent Entries', 'gravityview' );
16 16
 
17 17
 		$widget_options = array(
18 18
 			'description' => __( 'Display the most recent entries for a View', 'gravityview' ),
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	private function initialize() {
27 27
 
28
-		add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') );
28
+		add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
29 29
 
30 30
 		add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) );
31 31
 
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	function ajax_get_view_merge_tag_data() {
40 40
 
41
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) {
41
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) {
42 42
 			exit( false );
43 43
 		}
44 44
 
45
-		$form_id  = gravityview_get_form_id( $_POST['view_id'] );
45
+		$form_id = gravityview_get_form_id( $_POST[ 'view_id' ] );
46 46
 
47 47
 		$form = RGFormsModel::get_form_meta( $form_id );
48 48
 
49 49
 		$output = array(
50 50
 			'form' => array(
51
-				'id' => $form['id'],
52
-				'title' => $form['title'],
53
-				'fields' => $form['fields'],
51
+				'id' => $form[ 'id' ],
52
+				'title' => $form[ 'title' ],
53
+				'fields' => $form[ 'fields' ],
54 54
 			),
55
-			'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ),
55
+			'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ),
56 56
 		);
57 57
 
58 58
 		echo json_encode( $output );
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 	function admin_enqueue_scripts() {
69 69
 		global $pagenow;
70 70
 
71
-		if( $pagenow === 'widgets.php' ) {
71
+		if ( $pagenow === 'widgets.php' ) {
72 72
 
73
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
73
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
74 74
 
75
-			wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
75
+			wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
76 76
 
77 77
 			wp_localize_script( 'gravityview_widgets', 'GVWidgets', array(
78 78
 				'nonce' => wp_create_nonce( 'gravityview_ajax_widget' )
79
-			));
79
+			) );
80 80
 
81
-			wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version );
81
+			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version );
82 82
 		}
83 83
 
84 84
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	function widget( $args, $instance ) {
94 94
 
95 95
 		// Don't have the Customizer render too soon.
96
-		if( empty( $instance['view_id'] ) ) {
96
+		if ( empty( $instance[ 'view_id' ] ) ) {
97 97
 			return;
98 98
 		}
99 99
 
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 			return false;
102 102
 		}
103 103
 
104
-		$args['id']        = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries';
105
-		$instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : '';
104
+		$args[ 'id' ]        = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries';
105
+		$instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : '';
106 106
 
107
-		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] );
107
+		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] );
108 108
 
109
-		echo $args['before_widget'];
109
+		echo $args[ 'before_widget' ];
110 110
 
111
-		if ( !empty( $title ) ) {
112
-			echo $args['before_title'] . $title . $args['after_title'];
111
+		if ( ! empty( $title ) ) {
112
+			echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
113 113
 		}
114 114
 
115 115
 		/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		 */
130 130
 		do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance );
131 131
 
132
-		echo $args['after_widget'];
132
+		echo $args[ 'after_widget' ];
133 133
 	}
134 134
 
135 135
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	private function get_output( $instance ) {
145 145
 
146
-		$form_id = gravityview_get_form_id( $instance['view_id'] );
146
+		$form_id = gravityview_get_form_id( $instance[ 'view_id' ] );
147 147
 
148 148
 		$form = gravityview_get_form( $form_id );
149 149
 
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 		 * @since 1.6.1
154 154
 		 * @var int $entry_link_post_id The ID to use as the parent post for the entry
155 155
 		 */
156
-		$entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id'];
156
+		$entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ];
157 157
 
158 158
 		/**
159 159
 		 * Generate list output
160 160
 		 * @since 1.7.2
161 161
 		 */
162
-		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget', null, $instance['view_id'] );
162
+		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget', null, $instance[ 'view_id' ] );
163 163
 
164 164
 		$output = $List->get_output();
165 165
 
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	private function get_entries( $instance, $form_id ) {
186 186
 
187
-		$view = \GV\View::by_id( $instance['view_id'] );
187
+		$view = \GV\View::by_id( $instance[ 'view_id' ] );
188 188
 
189
-		$limit = isset( $instance['limit'] ) ? $instance['limit'] : 10;
189
+		$limit = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10;
190 190
 
191 191
 		$view->settings->set( 'page_size', $limit );
192 192
 
@@ -209,23 +209,23 @@  discard block
 block discarded – undo
209 209
 		$instance = $new_instance;
210 210
 
211 211
 		// Force positive number
212
-		$instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] );
212
+		$instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] );
213 213
 
214
-		$instance['view_id'] = intval( $instance['view_id'] );
214
+		$instance[ 'view_id' ] = intval( $instance[ 'view_id' ] );
215 215
 
216
-		$instance['link_format'] = trim( rtrim( $instance['link_format'] ) );
216
+		$instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) );
217 217
 
218
-		$instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format'];
218
+		$instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ];
219 219
 
220
-		$instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] );
220
+		$instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] );
221 221
 
222
-		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true );
222
+		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true );
223 223
 
224 224
 		//check if post_id is a valid post with embedded View
225
-		$instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
225
+		$instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
226 226
 
227 227
 		// Share that the widget isn't brand new
228
-		$instance['updated']  = 1;
228
+		$instance[ 'updated' ] = 1;
229 229
 
230 230
 		/**
231 231
 		 * Modify the updated instance. This will allow for validating any added instance settings externally.
@@ -247,22 +247,22 @@  discard block
 block discarded – undo
247 247
 
248 248
 		// Set up some default widget settings.
249 249
 		$defaults = array(
250
-			'title' 			=> __('Recent Entries', 'gravityview'),
250
+			'title' 			=> __( 'Recent Entries', 'gravityview' ),
251 251
 			'view_id'           => NULL,
252 252
 			'post_id'           => NULL,
253 253
 			'limit'            => 10,
254
-			'link_format'       => __('Entry #{entry_id}', 'gravityview'),
254
+			'link_format'       => __( 'Entry #{entry_id}', 'gravityview' ),
255 255
 			'after_link'        => ''
256 256
 		);
257 257
 
258
-		$instance = wp_parse_args( (array) $instance, $defaults );
258
+		$instance = wp_parse_args( (array)$instance, $defaults );
259 259
 
260 260
 		?>
261 261
 
262 262
 		<!-- Title -->
263 263
 		<p>
264 264
 			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label>
265
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
265
+			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" />
266 266
 		</p>
267 267
 
268 268
 		<!-- Download -->
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$views = get_posts( $args );
276 276
 
277 277
 		// If there are no views set up yet, we get outta here.
278
-		if( empty( $views ) ) {
278
+		if ( empty( $views ) ) {
279 279
 			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>';
280 280
 			return;
281 281
 		}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 		 * Display errors generated for invalid embed IDs
288 288
 		 * @see GravityView_View_Data::is_valid_embed_id
289 289
 		 */
290
-		if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) {
290
+		if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) {
291 291
 			?>
292 292
 			<div class="error inline hide-on-view-change">
293
-				<p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p>
293
+				<p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p>
294 294
 			</div>
295 295
 			<?php
296 296
 			unset ( $error );
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
 		?>
299 299
 
300 300
 		<p>
301
-			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label>
301
+			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label>
302 302
 			<select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>">
303 303
 				<option value=""><?php esc_html_e( '&mdash; Select a View as Entries Source &mdash;', 'gravityview' ); ?></option>
304 304
 				<?php
305 305
 
306
-				foreach( $views as $view ) {
307
-					$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
308
-					echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
306
+				foreach ( $views as $view ) {
307
+					$title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title;
308
+					echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>';
309 309
 				}
310 310
 
311 311
 				?>
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 		 * Display errors generated for invalid embed IDs
318 318
 		 * @see GravityView_View_Data::is_valid_embed_id
319 319
 		 */
320
-		if( !empty( $instance['error_post_id'] ) ) {
320
+		if ( ! empty( $instance[ 'error_post_id' ] ) ) {
321 321
 			?>
322 322
 			<div class="error inline">
323
-				<p><?php echo $instance['error_post_id']; ?></p>
323
+				<p><?php echo $instance[ 'error_post_id' ]; ?></p>
324 324
 			</div>
325 325
 			<?php
326 326
 			unset ( $error );
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 		?>
329 329
 
330 330
 		<div>
331
-			<label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
332
-			<input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" />
331
+			<label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
332
+			<input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" />
333 333
 			<p class="description"><?php
334
-				esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
335
-				echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview' ), 'target=_blank' );
334
+				esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
335
+				echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more&hellip;', 'gravityview' ), 'target=_blank' );
336 336
 				?></p>
337 337
 		</div>
338 338
 
@@ -340,21 +340,21 @@  discard block
 block discarded – undo
340 340
 			<label for="<?php echo $this->get_field_id( 'limit' ); ?>">
341 341
 				<span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span>
342 342
 			</label>
343
-			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" />
343
+			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" />
344 344
 		</div>
345 345
 
346 346
 		<p>
347 347
 			<label for="<?php echo $this->get_field_id( 'link_format' ); ?>">
348 348
 				<span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span>
349 349
 			</label>
350
-			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
350
+			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
351 351
 		</p>
352 352
 
353 353
 		<p>
354 354
 			<label for="<?php echo $this->get_field_id( 'after_link' ); ?>">
355 355
 				<span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span>
356 356
 			</label>
357
-			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea>
357
+			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea>
358 358
 		</p>
359 359
 
360 360
 		<?php
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		 * @param GravityView_Recent_Entries_Widget $this WP_Widget object
365 365
 		 * @param array $instance Current widget instance
366 366
 		 */
367
-		do_action( 'gravityview_recent_entries_widget_form' , $this, $instance );
367
+		do_action( 'gravityview_recent_entries_widget_form', $this, $instance );
368 368
 
369 369
 		?>
370 370
 
Please login to merge, or discard this patch.
includes/wordpress-widgets/class-gravityview-search-wp-widget.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 		$widget_ops = array(
13 13
 			'classname' => 'widget_gravityview_search',
14
-			'description' => __( 'A search form for a specific GravityView.', 'gravityview')
14
+			'description' => __( 'A search form for a specific GravityView.', 'gravityview' )
15 15
 		);
16 16
 
17 17
 		$widget_display = array(
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	}
35 35
 
36 36
 	private function load_required_files() {
37
-		if( !class_exists( 'GravityView_Widget_Search' ) ) {
37
+		if ( ! class_exists( 'GravityView_Widget_Search' ) ) {
38 38
 			gravityview_register_gravityview_widgets();
39 39
 		}
40 40
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		}
58 58
 
59 59
 		// Don't show unless a View ID has been set.
60
-		if( empty( $instance['view_id'] ) ) {
60
+		if ( empty( $instance[ 'view_id' ] ) ) {
61 61
 
62 62
 			gravityview()->log->debug( 'No View ID has been defined. Not showing the widget.', array( 'data' => $instance ) );
63 63
 
@@ -70,22 +70,22 @@  discard block
 block discarded – undo
70 70
 		}
71 71
 
72 72
 		/** This filter is documented in wp-includes/default-widgets.php */
73
-		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
73
+		$title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base );
74 74
 
75
-		echo $args['before_widget'];
75
+		echo $args[ 'before_widget' ];
76 76
 
77 77
 		if ( $title ) {
78
-			echo $args['before_title'] . $title . $args['after_title'];
78
+			echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
79 79
 		}
80 80
 
81 81
 		// @todo Add to the widget configuration form
82
-		$instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance );
82
+		$instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance );
83 83
 
84
-		$instance['context'] = 'wp_widget';
84
+		$instance[ 'context' ] = 'wp_widget';
85 85
 
86 86
 		// form
87
-		$instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] );
88
-		$instance['form'] = GVCommon::get_form( $instance['form_id'] );
87
+		$instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] );
88
+		$instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] );
89 89
 
90 90
 		// We don't want to overwrite existing context, etc.
91 91
 		$previous_view = GravityView_View::getInstance();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 */
102 102
 		new GravityView_View( $previous_view );
103 103
 
104
-		echo $args['after_widget'];
104
+		echo $args[ 'after_widget' ];
105 105
 	}
106 106
 
107 107
 	/**
@@ -111,27 +111,27 @@  discard block
 block discarded – undo
111 111
 
112 112
 		$instance = $old_instance;
113 113
 
114
-		if( $this->is_preview() ) {
114
+		if ( $this->is_preview() ) {
115 115
 			//Oh! Sorry but still not fully compatible with customizer
116 116
 			return $instance;
117 117
 		}
118 118
 
119
-		$new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() );
119
+		$new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() );
120 120
 
121
-		$instance['title'] = strip_tags( $new_instance['title'] );
122
-		$instance['view_id'] = absint( $new_instance['view_id'] );
123
-		$instance['search_fields'] = $new_instance['search_fields'];
124
-		$instance['post_id'] = $new_instance['post_id'];
125
-		$instance['search_clear'] = $new_instance['search_clear'];
126
-		$instance['search_mode'] = $new_instance['search_mode'];
121
+		$instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
122
+		$instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] );
123
+		$instance[ 'search_fields' ] = $new_instance[ 'search_fields' ];
124
+		$instance[ 'post_id' ] = $new_instance[ 'post_id' ];
125
+		$instance[ 'search_clear' ] = $new_instance[ 'search_clear' ];
126
+		$instance[ 'search_mode' ] = $new_instance[ 'search_mode' ];
127 127
 
128
-		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true );
128
+		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true );
129 129
 
130 130
 		//check if post_id is a valid post with embedded View
131
-		$instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
131
+		$instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
132 132
 
133 133
 		// Share that the widget isn't brand new
134
-		$instance['updated']  = 1;
134
+		$instance[ 'updated' ] = 1;
135 135
 
136 136
 		return $instance;
137 137
 	}
@@ -142,28 +142,28 @@  discard block
 block discarded – undo
142 142
 	public function form( $instance ) {
143 143
 
144 144
 		// @todo Make compatible with Customizer
145
-		if( $this->is_preview() ) {
145
+		if ( $this->is_preview() ) {
146 146
 
147
-			$warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' );
147
+			$warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' );
148 148
 
149 149
 			echo wpautop( GravityView_Admin::get_floaty() . $warning );
150 150
 
151 151
 			return;
152 152
 		}
153 153
 
154
-		$instance = wp_parse_args( (array) $instance, self::get_defaults() );
154
+		$instance = wp_parse_args( (array)$instance, self::get_defaults() );
155 155
 
156
-		$title    = $instance['title'];
157
-		$view_id  = $instance['view_id'];
158
-		$post_id  = $instance['post_id'];
159
-		$search_fields = $instance['search_fields'];
160
-		$search_clear = $instance['search_clear'];
161
-		$search_mode = $instance['search_mode'];
156
+		$title    = $instance[ 'title' ];
157
+		$view_id  = $instance[ 'view_id' ];
158
+		$post_id  = $instance[ 'post_id' ];
159
+		$search_fields = $instance[ 'search_fields' ];
160
+		$search_clear = $instance[ 'search_clear' ];
161
+		$search_mode = $instance[ 'search_mode' ];
162 162
 
163 163
 		$views = GVCommon::get_all_views();
164 164
 
165 165
 		// If there are no views set up yet, we get outta here.
166
-		if( empty( $views ) ) { ?>
166
+		if ( empty( $views ) ) { ?>
167 167
 			<div id="select_gravityview_view">
168 168
 				<div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div>
169 169
 			</div>
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 		?>
173 173
 
174
-		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
174
+		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
175 175
 
176 176
 		<?php
177 177
 		/**
178 178
 		 * Display errors generated for invalid embed IDs
179 179
 		 * @see GravityView_View_Data::is_valid_embed_id
180 180
 		 */
181
-		if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) {
181
+		if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) {
182 182
 			?>
183 183
 			<div class="error inline hide-on-view-change">
184
-				<p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p>
184
+				<p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p>
185 185
 			</div>
186 186
 			<?php
187 187
 			unset ( $error );
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 
191 191
 		<p>
192 192
 			<label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label>
193
-			<select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat">
193
+			<select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat">
194 194
 				<option value=""><?php esc_html_e( '&mdash; Select a View &mdash;', 'gravityview' ); ?></option>
195 195
 				<?php
196
-				foreach( $views as $view_option ) {
197
-					$title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title;
198
-					echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>';
196
+				foreach ( $views as $view_option ) {
197
+					$title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title;
198
+					echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>';
199 199
 				}
200 200
 				?>
201 201
 			</select>
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 		 * Display errors generated for invalid embed IDs
208 208
 		 * @see GravityView_View_Data::is_valid_embed_id
209 209
 		 */
210
-		if( !empty( $instance['error_post_id'] ) ) {
210
+		if ( ! empty( $instance[ 'error_post_id' ] ) ) {
211 211
 			?>
212 212
 			<div class="error inline">
213
-				<p><?php echo $instance['error_post_id']; ?></p>
213
+				<p><?php echo $instance[ 'error_post_id' ]; ?></p>
214 214
 			</div>
215 215
 			<?php
216 216
 			unset ( $error );
@@ -218,40 +218,40 @@  discard block
 block discarded – undo
218 218
 		?>
219 219
 
220 220
 		<div>
221
-			<label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
222
-			<input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" />
221
+			<label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
222
+			<input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" />
223 223
 			<p class="description"><?php
224
-				esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
225
-				echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview' ), 'target=_blank' );
224
+				esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
225
+				echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more&hellip;', 'gravityview' ), 'target=_blank' );
226 226
 				?></p>
227 227
 		</div>
228 228
 
229 229
 		<p>
230
-			<label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label>
231
-			<input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0">
232
-			<input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>>
230
+			<label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label>
231
+			<input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0">
232
+			<input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>>
233 233
 		</p>
234 234
 
235 235
 		<div>
236 236
 			<label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label>
237
-			<label for="<?php echo $this->get_field_id('search_mode'); ?>_any">
238
-				<input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>>
237
+			<label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any">
238
+				<input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>>
239 239
 				<?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?>
240 240
 			</label>
241
-			<label for="<?php echo $this->get_field_id('search_mode'); ?>_all">
242
-				<input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>>
241
+			<label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all">
242
+				<input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>>
243 243
 				<?php esc_html_e( 'Match All Fields', 'gravityview' ); ?>
244 244
 			</label>
245
-			<p class="description"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></p
245
+			<p class="description"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></p
246 246
 		</div>
247 247
 
248 248
 		<hr />
249 249
 
250 250
 		<?php // @todo: move style to CSS ?>
251 251
 		<div style="margin-bottom: 1em;">
252
-			<label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label>
253
-			<div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>">
254
-				<input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value">
252
+			<label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label>
253
+			<div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>">
254
+				<input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value">
255 255
 			</div>
256 256
 
257 257
 		</div>
Please login to merge, or discard this patch.