Completed
Push — master ( 2adc18...d10a7f )
by Zack
30:36 queued 26:56
created
includes/admin/metaboxes/views/sort-filter.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package GravityView
4
- * @subpackage Gravityview/admin/metaboxes/partials
5
- * @global WP_Post $post
6
- */
3
+	 * @package GravityView
4
+	 * @subpackage Gravityview/admin/metaboxes/partials
5
+	 * @global WP_Post $post
6
+	 */
7 7
 global $post;
8 8
 
9 9
 $curr_form = gravityview_get_form_id( $post->ID );
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	 */
27 27
 	GravityView_Render_Settings::render_setting_row( 'sort_columns', $current_settings );
28 28
 
29
-	$sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">'.gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ).'</select>';
29
+	$sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">' . gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ] ) . '</select>';
30 30
 
31 31
 	GravityView_Render_Settings::render_setting_row( 'sort_field', $current_settings, $sort_fields_input );
32 32
 
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 4 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 			if( class_exists( 'GravityView_Entry_Notes' ) ){
323 323
 				global $current_user;
324
-      			get_currentuserinfo();
324
+	  			get_currentuserinfo();
325 325
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
326 326
 			}
327 327
 
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 
357 357
 		$approvedcolumn = self::get_approved_column( $form['id'] );
358 358
 
359
-        /**
360
-         * If the form doesn't contain the approve field, don't assume anything.
361
-         */
362
-        if( empty( $approvedcolumn ) ) {
363
-            return;
364
-        }
359
+		/**
360
+		 * If the form doesn't contain the approve field, don't assume anything.
361
+		 */
362
+		if( empty( $approvedcolumn ) ) {
363
+			return;
364
+		}
365 365
 
366 366
 		$entry = GFAPI::get_entry( $entry_id );
367 367
 
@@ -474,17 +474,17 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	static public function get_approved_column( $form ) {
476 476
 
477
-        if( empty( $form ) ) {
478
-            return null;
479
-        }
477
+		if( empty( $form ) ) {
478
+			return null;
479
+		}
480 480
 
481
-        if( !is_array( $form ) ) {
482
-            $form = GVCommon::get_form( $form );
483
-        }
481
+		if( !is_array( $form ) ) {
482
+			$form = GVCommon::get_form( $form );
483
+		}
484 484
 
485 485
 		foreach( $form['fields'] as $key => $field ) {
486 486
 
487
-            $field = (array) $field;
487
+			$field = (array) $field;
488 488
 
489 489
 			if( !empty( $field['gravityview_approved'] ) ) {
490 490
 				if( !empty($field['inputs'][0]['id']) ) {
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 				}
493 493
 			}
494 494
 
495
-            // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
496
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
497
-                foreach ( $field['inputs'] as $key2 => $input ) {
498
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
499
-                        return $input['id'];
500
-                    }
501
-                }
502
-            }
495
+			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
496
+			if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
497
+				foreach ( $field['inputs'] as $key2 => $input ) {
498
+					if ( strtolower( $input['label'] ) == 'approved' ) {
499
+						return $input['id'];
500
+					}
501
+				}
502
+			}
503 503
 		}
504 504
 
505 505
 		return null;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @uses  GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request.
172 172
 	 * @access public
173
-	 * @return void|boolean
173
+	 * @return null|false
174 174
 	 */
175 175
 	public function process_bulk_action() {
176 176
 		if ( ! class_exists( 'RGForms' ) ) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries.
253 253
 	 * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved`
254 254
 	 * @param int $form_id The Gravity Forms Form ID
255
-	 * @return boolean|void
255
+	 * @return false|null
256 256
 	 */
257 257
 	private static function update_bulk( $entries, $approved, $form_id ) {
258 258
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 * @access public
471 471
 	 * @static
472 472
 	 * @param mixed $form GF Form or Form ID
473
-	 * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
473
+	 * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
474 474
 	 */
475 475
 	static public function get_approved_column( $form ) {
476 476
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -10 removed lines patch added patch discarded remove patch
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		if( $result === true ) {
320 320
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
321 321
 
322
-			if( class_exists( 'GravityView_Entry_Notes' ) ){
322
+			if( class_exists( 'GravityView_Entry_Notes' ) ) {
323 323
 				global $current_user;
324 324
       			get_currentuserinfo();
325 325
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
@@ -432,23 +432,17 @@  discard block
 block discarded – undo
432 432
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
433 433
 
434 434
 			$result = false;
435
-		}
436
-
437
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
435
+		} else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
438 436
 
439 437
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
440 438
 
441 439
 			$result = false;
442
-		}
443
-
444
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
440
+		} else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
445 441
 
446 442
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
447 443
 
448 444
 			$result = false;
449
-		}
450
-
451
-		else {
445
+		} else {
452 446
 
453 447
 			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
454 448
 
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 		/** gf_entries page - entries table screen */
35 35
 
36 36
 		// capture bulk actions
37
-		add_action( 'init', array( $this, 'process_bulk_action') );
37
+		add_action( 'init', array( $this, 'process_bulk_action' ) );
38 38
 		// add hidden field with approve status
39 39
 		add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
40 40
 		// process ajax approve entry requests
41
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
41
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
42 42
 
43 43
 		// in case entry is edited (on admin or frontend)
44
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
44
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
45 45
 
46 46
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
47 47
 
48 48
 		// adding styles and scripts
49
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
49
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
50 50
 		// bypass Gravity Forms no-conflict mode
51 51
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
52 52
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	function tooltips( $tooltips ) {
63 63
 
64
-		$tooltips['form_gravityview_fields'] = array(
65
-			'title' => __('GravityView Fields', 'gravityview'),
66
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
64
+		$tooltips[ 'form_gravityview_fields' ] = array(
65
+			'title' => __( 'GravityView Fields', 'gravityview' ),
66
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
67 67
 		);
68 68
 
69 69
 		return $tooltips;
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 		}
179 179
 
180 180
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
181
-		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) {
181
+		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
182 182
 
183 183
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
184 184
 
185 185
 			// The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form.
186
-			$bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2'];
186
+			$bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ];
187 187
 
188 188
 			/**
189 189
 			 * The extra '-' is to make sure that there are at *least* two items in array.
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 			}
200 200
 
201 201
 			// All entries are set to be updated, not just the visible ones
202
-			if ( ! empty( $_POST['all_entries'] ) ) {
202
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
203 203
 
204 204
 				// Convert the current entry search into GF-formatted search criteria
205 205
 				$search = array(
206
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
207
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
208
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
206
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
207
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
208
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
209 209
 				);
210 210
 
211 211
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 			} else {
217 217
 
218
-				$entries = $_POST['lead'];
218
+				$entries = $_POST[ 'lead' ];
219 219
 
220 220
 			}
221 221
 
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private static function update_bulk( $entries, $approved, $form_id ) {
258 258
 
259
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
259
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
260 260
 			do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries );
261 261
 			return false;
262 262
 		}
263 263
 
264
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
264
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
265 265
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
266 266
 			return false;
267 267
 		}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		// calculate approved field id
272 272
 		$approved_column_id = self::get_approved_column( $form_id );
273 273
 
274
-		foreach( $entries as $entry_id ) {
274
+		foreach ( $entries as $entry_id ) {
275 275
 			self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
276 276
 		}
277 277
 	}
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 	 * @param int $approvedcolumn (default: 0)
291 291
 	 * @return boolean True: It worked; False: it failed
292 292
 	 */
293
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
293
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
294 294
 
295
-		if( !class_exists( 'GFAPI' ) ) {
295
+		if ( ! class_exists( 'GFAPI' ) ) {
296 296
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
297 297
 			return false;
298 298
 		}
299 299
 
300
-		if( empty( $approvedcolumn ) ) {
300
+		if ( empty( $approvedcolumn ) ) {
301 301
 			$approvedcolumn = self::get_approved_column( $form_id );
302 302
 		}
303 303
 
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 		self::update_approved_meta( $entry_id, $approved );
317 317
 
318 318
 		// add note to entry
319
-		if( $result === true ) {
319
+		if ( $result === true ) {
320 320
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
321 321
 
322
-			if( class_exists( 'GravityView_Entry_Notes' ) ){
322
+			if ( class_exists( 'GravityView_Entry_Notes' ) ) {
323 323
 				global $current_user;
324 324
       			get_currentuserinfo();
325 325
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			 */
333 333
 			do_action( 'gravityview_clear_form_cache', $form_id );
334 334
 
335
-		} else if( is_wp_error( $result ) ) {
335
+		} else if ( is_wp_error( $result ) ) {
336 336
 
337 337
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
338 338
 
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 	 */
355 355
 	public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
356 356
 
357
-		$approvedcolumn = self::get_approved_column( $form['id'] );
357
+		$approvedcolumn = self::get_approved_column( $form[ 'id' ] );
358 358
 
359 359
         /**
360 360
          * If the form doesn't contain the approve field, don't assume anything.
361 361
          */
362
-        if( empty( $approvedcolumn ) ) {
362
+        if ( empty( $approvedcolumn ) ) {
363 363
             return;
364 364
         }
365 365
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	private static function update_approved_meta( $entry_id, $is_approved ) {
382 382
 
383 383
 		// update entry meta
384
-		if( function_exists('gform_update_meta') ) {
384
+		if ( function_exists( 'gform_update_meta' ) ) {
385 385
 
386 386
 			gform_update_meta( $entry_id, 'is_approved', $is_approved );
387 387
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			 */
394 394
 			do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved );
395 395
 
396
-			if( empty( $is_approved ) ) {
396
+			if ( empty( $is_approved ) ) {
397 397
 
398 398
 				/**
399 399
 				 * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
 		} else {
417 417
 
418
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
418
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
419 419
 
420 420
 		}
421 421
 	}
@@ -427,21 +427,21 @@  discard block
 block discarded – undo
427 427
 	 */
428 428
 	public function ajax_update_approved() {
429 429
 
430
-		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) {
430
+		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) {
431 431
 
432 432
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
433 433
 
434 434
 			$result = false;
435 435
 		}
436 436
 
437
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
437
+		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) {
438 438
 
439 439
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
440 440
 
441 441
 			$result = false;
442 442
 		}
443 443
 
444
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
444
+		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) {
445 445
 
446 446
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
447 447
 
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 
451 451
 		else {
452 452
 
453
-			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
453
+			$result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] );
454 454
 
455
-			if( is_wp_error( $result ) ) {
455
+			if ( is_wp_error( $result ) ) {
456 456
 				/** @var WP_Error $result */
457
-				do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() );
457
+				do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() );
458 458
 				$result = false;
459 459
 			}
460 460
 
@@ -474,29 +474,29 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	static public function get_approved_column( $form ) {
476 476
 
477
-        if( empty( $form ) ) {
477
+        if ( empty( $form ) ) {
478 478
             return null;
479 479
         }
480 480
 
481
-        if( !is_array( $form ) ) {
481
+        if ( ! is_array( $form ) ) {
482 482
             $form = GVCommon::get_form( $form );
483 483
         }
484 484
 
485
-		foreach( $form['fields'] as $key => $field ) {
485
+		foreach ( $form[ 'fields' ] as $key => $field ) {
486 486
 
487
-            $field = (array) $field;
487
+            $field = (array)$field;
488 488
 
489
-			if( !empty( $field['gravityview_approved'] ) ) {
490
-				if( !empty($field['inputs'][0]['id']) ) {
491
-					return $field['inputs'][0]['id'];
489
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
490
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
491
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
492 492
 				}
493 493
 			}
494 494
 
495 495
             // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
496
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
497
-                foreach ( $field['inputs'] as $key2 => $input ) {
498
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
499
-                        return $input['id'];
496
+            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
497
+                foreach ( $field[ 'inputs' ] as $key2 => $input ) {
498
+                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
499
+                        return $input[ 'id' ];
500 500
                     }
501 501
                 }
502 502
             }
@@ -507,18 +507,18 @@  discard block
 block discarded – undo
507 507
 
508 508
 
509 509
 
510
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
510
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
511 511
 
512
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
512
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
513 513
 			return;
514 514
 		}
515 515
 
516
-		if( empty( $entry['id'] ) ) {
516
+		if ( empty( $entry[ 'id' ] ) ) {
517 517
 			return;
518 518
 		}
519 519
 
520
-		if( gform_get_meta( $entry['id'], 'is_approved' ) ) {
521
-			echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />';
520
+		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
521
+			echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />';
522 522
 		}
523 523
 	}
524 524
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 
528 528
 	function add_scripts_and_styles( $hook ) {
529 529
 
530
-		if( !class_exists( 'RGForms' ) ) {
530
+		if ( ! class_exists( 'RGForms' ) ) {
531 531
 
532 532
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
533 533
 
@@ -536,39 +536,39 @@  discard block
 block discarded – undo
536 536
 
537 537
 		// enqueue styles & scripts gf_entries
538 538
 		// But only if we're on the main Entries page, not on reports pages
539
-		if( RGForms::get_page() === 'entry_list' ) {
539
+		if ( RGForms::get_page() === 'entry_list' ) {
540 540
 
541
-			$form_id = RGForms::get('id');
541
+			$form_id = RGForms::get( 'id' );
542 542
 
543 543
 			// If there are no forms identified, use the first form. That's how GF does it.
544
-			if( empty( $form_id ) && class_exists('RGFormsModel') ) {
544
+			if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
545 545
 				$forms = gravityview_get_forms();
546
-				if( !empty( $forms ) ) {
547
-					$form_id = $forms[0]['id'];
546
+				if ( ! empty( $forms ) ) {
547
+					$form_id = $forms[ 0 ][ 'id' ];
548 548
 				}
549 549
 			}
550 550
 
551 551
 			$approvedcolumn = self::get_approved_column( $form_id );
552 552
 
553
-			wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
553
+			wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
554 554
 			wp_enqueue_style( 'gravityview_entries_list' );
555 555
 
556
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
556
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
557 557
 
558
-			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
558
+			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
559 559
 			wp_enqueue_script( 'gravityview_gf_entries_scripts' );
560 560
 
561 561
 			wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
562
-				'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'),
562
+				'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ),
563 563
 				'form_id' => $form_id,
564 564
 				'show_column' => (int)$this->show_approve_entry_column( $form_id ),
565 565
 				'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
566 566
 				'bulk_actions' => $this->get_bulk_actions( $form_id ),
567 567
 				'bulk_message' => $this->bulk_update_message,
568
-				'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'),
569
-				'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'),
570
-				'column_title' => __( 'Show entry in directory view?', 'gravityview'),
571
-				'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ),
568
+				'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ),
569
+				'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ),
570
+				'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
571
+				'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ),
572 572
 			) );
573 573
 
574 574
 		}
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 		// Sanitize the values, just to be sure.
612 612
 		foreach ( $bulk_actions as $key => $group ) {
613 613
 			foreach ( $group as $i => $action ) {
614
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
615
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
614
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
615
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
616 616
 			}
617 617
 		}
618 618
 
@@ -637,13 +637,13 @@  discard block
 block discarded – undo
637 637
 		 * @since 1.7.2
638 638
 		 * @param boolean $hide_if_no_connections
639 639
 		 */
640
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
640
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
641 641
 
642
-		if( $hide_if_no_connections ) {
642
+		if ( $hide_if_no_connections ) {
643 643
 
644 644
 			$connected_views = gravityview_get_connected_views( $form_id );
645 645
 
646
-			if( empty( $connected_views ) ) {
646
+			if ( empty( $connected_views ) ) {
647 647
 				$show_approve_column = false;
648 648
 			}
649 649
 		}
@@ -653,18 +653,18 @@  discard block
 block discarded – undo
653 653
 		 * @param boolean $show_approve_column Whether the column will be shown
654 654
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
655 655
 		 */
656
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
656
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
657 657
 
658 658
 		return $show_approve_column;
659 659
 	}
660 660
 
661 661
 	function register_gform_noconflict_script( $scripts ) {
662
-		$scripts[] = 'gravityview_gf_entries_scripts';
662
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
663 663
 		return $scripts;
664 664
 	}
665 665
 
666 666
 	function register_gform_noconflict_style( $styles ) {
667
-		$styles[] = 'gravityview_entries_list';
667
+		$styles[ ] = 'gravityview_entries_list';
668 668
 		return $styles;
669 669
 	}
670 670
 
Please login to merge, or discard this patch.
includes/class-admin.php 3 patches
Indentation   +59 added lines, -60 removed lines patch added patch discarded remove patch
@@ -215,39 +215,39 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 
217 217
 		$wp_allowed_scripts = array(
218
-            'common',
219
-            'admin-bar',
220
-            'autosave',
221
-            'post',
218
+			'common',
219
+			'admin-bar',
220
+			'autosave',
221
+			'post',
222 222
 			'inline-edit-post',
223
-            'utils',
224
-            'svg-painter',
225
-            'wp-auth-check',
226
-            'heartbeat',
223
+			'utils',
224
+			'svg-painter',
225
+			'wp-auth-check',
226
+			'heartbeat',
227 227
 			'media-editor',
228 228
 			'media-upload',
229
-            'thickbox',
229
+			'thickbox',
230 230
 			'wp-color-picker',
231 231
 
232
-            // Settings
232
+			// Settings
233 233
 			'gv-admin-edd-license',
234 234
 
235
-            // Common
236
-            'select2-js',
237
-            'qtip-js',
235
+			// Common
236
+			'select2-js',
237
+			'qtip-js',
238 238
 
239
-            // jQuery
239
+			// jQuery
240 240
 			'jquery',
241
-            'jquery-ui-core',
242
-            'jquery-ui-sortable',
243
-            'jquery-ui-datepicker',
244
-            'jquery-ui-dialog',
245
-            'jquery-ui-slider',
241
+			'jquery-ui-core',
242
+			'jquery-ui-sortable',
243
+			'jquery-ui-datepicker',
244
+			'jquery-ui-dialog',
245
+			'jquery-ui-slider',
246 246
 			'jquery-ui-dialog',
247 247
 			'jquery-ui-tabs',
248 248
 			'jquery-ui-draggable',
249 249
 			'jquery-ui-droppable',
250
-            'jquery-ui-accordion',
250
+			'jquery-ui-accordion',
251 251
 		);
252 252
 
253 253
 		$this->remove_conflicts( $wp_scripts, $wp_allowed_scripts, 'scripts' );
@@ -281,23 +281,23 @@  discard block
 block discarded – undo
281 281
 			return;
282 282
 		}
283 283
 
284
-        $wp_allowed_styles = array(
285
-	        'admin-bar',
286
-        	'colors',
287
-	        'ie',
288
-	        'wp-auth-check',
289
-	        'media-views',
284
+		$wp_allowed_styles = array(
285
+			'admin-bar',
286
+			'colors',
287
+			'ie',
288
+			'wp-auth-check',
289
+			'media-views',
290 290
 			'thickbox',
291 291
 			'dashicons',
292
-	        'wp-jquery-ui-dialog',
293
-	        'jquery-ui-sortable',
292
+			'wp-jquery-ui-dialog',
293
+			'jquery-ui-sortable',
294 294
 
295
-            // Settings
296
-	        'gravityview_settings',
295
+			// Settings
296
+			'gravityview_settings',
297 297
 
298
-	        // @todo qTip styles not loading for some reason!
299
-	        'jquery-qtip.js',
300
-	    );
298
+			// @todo qTip styles not loading for some reason!
299
+			'jquery-qtip.js',
300
+		);
301 301
 
302 302
 		$this->remove_conflicts( $wp_styles, $wp_allowed_styles, 'styles' );
303 303
 
@@ -317,32 +317,32 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	private function remove_conflicts( &$wp_objects, $required_objects, $type = 'scripts' ) {
319 319
 
320
-        /**
321
-         * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n
322
-         * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles`
323
-         * @param array $required_objects
324
-         */
325
-        $required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects );
326
-
327
-        //reset queue
328
-        $queue = array();
329
-        foreach( $wp_objects->queue as $object ) {
330
-	        if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) {
331
-                $queue[] = $object;
332
-            }
333
-        }
334
-        $wp_objects->queue = $queue;
335
-
336
-        $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects );
337
-
338
-        //unregistering scripts
339
-        $registered = array();
340
-        foreach( $wp_objects->registered as $handle => $script_registration ){
341
-            if( in_array( $handle, $required_objects ) ){
342
-                $registered[ $handle ] = $script_registration;
343
-            }
344
-        }
345
-        $wp_objects->registered = $registered;
320
+		/**
321
+		 * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n
322
+		 * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles`
323
+		 * @param array $required_objects
324
+		 */
325
+		$required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects );
326
+
327
+		//reset queue
328
+		$queue = array();
329
+		foreach( $wp_objects->queue as $object ) {
330
+			if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) {
331
+				$queue[] = $object;
332
+			}
333
+		}
334
+		$wp_objects->queue = $queue;
335
+
336
+		$required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects );
337
+
338
+		//unregistering scripts
339
+		$registered = array();
340
+		foreach( $wp_objects->registered as $handle => $script_registration ){
341
+			if( in_array( $handle, $required_objects ) ){
342
+				$registered[ $handle ] = $script_registration;
343
+			}
344
+		}
345
+		$wp_objects->registered = $registered;
346 346
 	}
347 347
 
348 348
 	/**
@@ -405,7 +405,6 @@  discard block
 block discarded – undo
405 405
 	 *
406 406
 	 * @deprecated since 1.12
407 407
 	 * @see GravityView_Compatibility::get_plugin_status()
408
-
409 408
 	 * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive
410 409
 	 */
411 410
 	static function get_plugin_status( $location = '' ) {
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@  discard block
 block discarded – undo
4 4
 
5 5
 	function __construct() {
6 6
 
7
-		if( ! is_admin() ) { return; }
7
+		if ( ! is_admin() ) { return; }
8 8
 
9 9
 		// If Gravity Forms isn't active or compatibile, stop loading
10
-		if( false === GravityView_Compatibility::is_valid() ) {
10
+		if ( false === GravityView_Compatibility::is_valid() ) {
11 11
 			return;
12 12
 		}
13 13
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' );
26 26
 
27 27
 		// Don't load tooltips if on Gravity Forms, otherwise it overrides translations
28
-		if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) {
28
+		if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) {
29 29
 			require_once( GFCommon::get_base_path() . '/tooltips.php' );
30 30
 		}
31 31
 
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 		add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
51 51
 		add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) );
52 52
 
53
-		add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) );
53
+		add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) );
54 54
 
55 55
 		add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 );
56 56
 
57 57
 		//Hooks for no-conflict functionality
58
-		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
59
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
58
+		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 );
59
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 );
60 60
 
61
-		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
62
-		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11);
63
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
64
-		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
61
+		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 );
62
+		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 );
63
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 );
64
+		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 );
65 65
 
66 66
 	}
67 67
 
@@ -74,20 +74,20 @@  discard block
 block discarded – undo
74 74
 	public function backend_actions() {
75 75
 
76 76
 		/** @define "GRAVITYVIEW_DIR" "../" */
77
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' );
78
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' );
79
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' );
80
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' );
81
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' );
82
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' );
83
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
77
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' );
78
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' );
79
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' );
80
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' );
81
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' );
82
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' );
83
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
84 84
 
85 85
 		/**
86 86
 		 * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded
87 87
 		 *
88 88
 		 * Nice place to insert extensions' backend stuff
89 89
 		 */
90
-		do_action('gravityview_include_backend_actions');
90
+		do_action( 'gravityview_include_backend_actions' );
91 91
 	}
92 92
 
93 93
 	/**
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 
104 104
 		$actions = array();
105 105
 
106
-		if( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
107
-			$actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
106
+		if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
107
+			$actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
108 108
 		}
109 109
 
110
-		if( GVCommon::has_cap( 'gravityview_support_port' ) ) {
111
-			$actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
110
+		if ( GVCommon::has_cap( 'gravityview_support_port' ) ) {
111
+			$actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
112 112
 		}
113 113
 
114 114
 		return array_merge( $actions, $links );
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 	function post_updated_messages( $messages, $bulk_counts = NULL ) {
132 132
 		global $post;
133 133
 
134
-		$post_id = isset($_GET['post']) ? intval($_GET['post']) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL );
134
+		$post_id = isset( $_GET[ 'post' ] ) ? intval( $_GET[ 'post' ] ) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL );
135 135
 
136 136
 		// By default, there will only be one item being modified.
137 137
 		// When in the `bulk_post_updated_messages` filter, there will be passed a number
138 138
 		// of modified items that will override this array.
139
-		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
139
+		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
140 140
 
141 141
 
142 142
 		// If we're starting fresh, a new form was created.
@@ -145,53 +145,53 @@  discard block
 block discarded – undo
145 145
 
146 146
 		$new_form_text = '';
147 147
 
148
-		if( !empty( $start_fresh ) ) {
148
+		if ( ! empty( $start_fresh ) ) {
149 149
 
150 150
 			// Get the form that was created
151 151
 			$connected_form = gravityview_get_form_id( $post_id );
152 152
 
153
-			if( !empty( $connected_form ) ) {
153
+			if ( ! empty( $connected_form ) ) {
154 154
 				$form = gravityview_get_form( $connected_form );
155
-				$form_name = esc_attr( $form['title'] );
155
+				$form_name = esc_attr( $form[ 'title' ] );
156 156
 				$image = self::get_floaty();
157
-				$new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>';
158
-				$new_form_text .=  sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
157
+				$new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>';
158
+				$new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
159 159
 
160 160
 					You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don&rsquo;t forget to %scustomize the form settings%s.
161
-					', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&amp;id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id='.$connected_form ).'">', '</a>');
161
+					', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&amp;id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=' . $connected_form ) . '">', '</a>' );
162 162
 				$new_form_text = wpautop( $new_form_text );
163 163
 
164 164
 				delete_post_meta( $post_id, '_gravityview_start_fresh' );
165 165
 			}
166 166
 		}
167 167
 
168
-		$messages['gravityview'] = array(
168
+		$messages[ 'gravityview' ] = array(
169 169
 			0  => '', // Unused. Messages start at index 1.
170
-			1  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
171
-			2  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
170
+			1  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
171
+			2  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
172 172
 			3  => __( 'View deleted.', 'gravityview' ),
173
-			4  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
173
+			4  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
174 174
 			/* translators: %s: date and time of the revision */
175
-			5  => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
176
-			6  => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
177
-			7  => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
175
+			5  => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false,
176
+			6  => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
177
+			7  => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
178 178
 			8  => __( 'View submitted.', 'gravityview' ),
179 179
 			9  => sprintf(
180 180
 				__( 'View scheduled for: %1$s.', 'gravityview' ),
181 181
 				// translators: Publish box date format, see http://php.net/date
182
-				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL )  ) )
182
+				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) )
183 183
 			) . $new_form_text,
184
-			10  => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
184
+			10  => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
185 185
 
186 186
 			/**
187 187
 			 * These apply to `bulk_post_updated_messages`
188 188
 			 * @file wp-admin/edit.php
189 189
 			 */
190
-			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ),
191
-			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ),
192
-			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ),
193
-			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ),
194
-			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ),
190
+			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ),
191
+			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ),
192
+			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ),
193
+			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ),
194
+			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ),
195 195
 		);
196 196
 
197 197
 		return $messages;
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
 	function no_conflict_scripts() {
205 205
 		global $wp_scripts;
206 206
 
207
-		if( ! gravityview_is_admin_page() ) {
207
+		if ( ! gravityview_is_admin_page() ) {
208 208
 			return;
209 209
 		}
210 210
 
211
-		$no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode');
211
+		$no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' );
212 212
 
213
-		if( empty( $no_conflict_mode ) ) {
213
+		if ( empty( $no_conflict_mode ) ) {
214 214
 			return;
215 215
 		}
216 216
 
@@ -260,24 +260,24 @@  discard block
 block discarded – undo
260 260
 	function no_conflict_styles() {
261 261
 		global $wp_styles;
262 262
 
263
-		if( ! gravityview_is_admin_page() ) {
263
+		if ( ! gravityview_is_admin_page() ) {
264 264
 			return;
265 265
 		}
266 266
 
267 267
 		// Dequeue other jQuery styles even if no-conflict is off.
268 268
 		// Terrible-looking tabs help no one.
269
-		if( !empty( $wp_styles->registered ) )  {
270
-			foreach ($wp_styles->registered as $key => $style) {
271
-				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
269
+		if ( ! empty( $wp_styles->registered ) ) {
270
+			foreach ( $wp_styles->registered as $key => $style ) {
271
+				if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
272 272
 					wp_dequeue_style( $key );
273 273
 				}
274 274
 			}
275 275
 		}
276 276
 
277
-		$no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode');
277
+		$no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' );
278 278
 
279 279
 		// If no conflict is off, jQuery will suffice.
280
-		if( empty( $no_conflict_mode ) ) {
280
+		if ( empty( $no_conflict_mode ) ) {
281 281
 			return;
282 282
 		}
283 283
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		/**
305 305
 		 * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here.
306 306
 		 */
307
-		do_action('gravityview_remove_conflicts_after');
307
+		do_action( 'gravityview_remove_conflicts_after' );
308 308
 	}
309 309
 
310 310
 	/**
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
 
327 327
         //reset queue
328 328
         $queue = array();
329
-        foreach( $wp_objects->queue as $object ) {
330
-	        if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) {
331
-                $queue[] = $object;
329
+        foreach ( $wp_objects->queue as $object ) {
330
+	        if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) {
331
+                $queue[ ] = $object;
332 332
             }
333 333
         }
334 334
         $wp_objects->queue = $queue;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 
338 338
         //unregistering scripts
339 339
         $registered = array();
340
-        foreach( $wp_objects->registered as $handle => $script_registration ){
341
-            if( in_array( $handle, $required_objects ) ){
340
+        foreach ( $wp_objects->registered as $handle => $script_registration ) {
341
+            if ( in_array( $handle, $required_objects ) ) {
342 342
                 $registered[ $handle ] = $script_registration;
343 343
             }
344 344
         }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 * @param [type] $registered [description]
352 352
 	 * @param [type] $scripts    [description]
353 353
 	 */
354
-	private function add_script_dependencies($registered, $scripts) {
354
+	private function add_script_dependencies( $registered, $scripts ) {
355 355
 
356 356
 		//gets all dependent scripts linked to the $scripts array passed
357 357
 		do {
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 				$deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array();
361 361
 				foreach ( $deps as $dep ) {
362 362
 					if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) {
363
-						$dependents[] = $dep;
363
+						$dependents[ ] = $dep;
364 364
 					}
365 365
 				}
366 366
 			}
@@ -424,29 +424,29 @@  discard block
 block discarded – undo
424 424
 	static function is_admin_page( $hook = '', $page = NULL ) {
425 425
 		global $current_screen, $plugin_page, $pagenow, $post;
426 426
 
427
-		if( ! is_admin() ) { return false; }
427
+		if ( ! is_admin() ) { return false; }
428 428
 
429 429
 		$is_page = false;
430 430
 
431
-		$is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview');
431
+		$is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' );
432 432
 
433
-		$is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview');
433
+		$is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' );
434 434
 
435
-		$is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings';
435
+		$is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings';
436 436
 
437
-		if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) {
438
-			$gv_post = get_post( intval( $_GET['post'] ) );
439
-			$is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview');
437
+		if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) {
438
+			$gv_post = get_post( intval( $_GET[ 'post' ] ) );
439
+			$is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' );
440 440
 		} else {
441
-			$is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview');
441
+			$is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' );
442 442
 		}
443 443
 
444
-		if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) {
444
+		if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) {
445 445
 
446 446
 			// $_GET `post_type` variable
447
-			if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) {
447
+			if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
448 448
 				$is_page = 'single';
449
-			} else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) {
449
+			} else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) {
450 450
 				$is_page = 'settings';
451 451
 			} else {
452 452
 				$is_page = 'views';
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook );
462 462
 
463 463
 		// If the current page is the same as the compared page
464
-		if( !empty( $page ) ) {
464
+		if ( ! empty( $page ) ) {
465 465
 			return $is_page === $page;
466 466
 		}
467 467
 
@@ -482,6 +482,6 @@  discard block
 block discarded – undo
482 482
  *
483 483
  * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`)
484 484
  */
485
-function gravityview_is_admin_page($hook = '', $page = NULL) {
485
+function gravityview_is_admin_page( $hook = '', $page = NULL ) {
486 486
 	return GravityView_Admin::is_admin_page( $hook, $page );
487 487
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 		// Dequeue other jQuery styles even if no-conflict is off.
268 268
 		// Terrible-looking tabs help no one.
269
-		if( !empty( $wp_styles->registered ) )  {
269
+		if( !empty( $wp_styles->registered ) ) {
270 270
 			foreach ($wp_styles->registered as $key => $style) {
271 271
 				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
272 272
 					wp_dequeue_style( $key );
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 
338 338
         //unregistering scripts
339 339
         $registered = array();
340
-        foreach( $wp_objects->registered as $handle => $script_registration ){
341
-            if( in_array( $handle, $required_objects ) ){
340
+        foreach( $wp_objects->registered as $handle => $script_registration ) {
341
+            if( in_array( $handle, $required_objects ) ) {
342 342
                 $registered[ $handle ] = $script_registration;
343 343
             }
344 344
         }
Please login to merge, or discard this patch.
includes/class-common.php 4 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 
214 214
 				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
215 215
 					foreach ( $field['inputs'] as $input ) {
216
-                        /**
217
-                         * @hack
218
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
219
-                         */
220
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
221
-                            continue;
222
-                        }
216
+						/**
217
+						 * @hack
218
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
219
+						 */
220
+						if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
221
+							continue;
222
+						}
223 223
 						$fields[ (string)$input['id'] ] = array(
224 224
 							'label' => rgar( $input, 'label' ),
225 225
 							'customLabel' => rgar( $input, 'customLabel' ),
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
467 467
 			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
468 468
 		} elseif( !isset( $criteria['context_view_id'] ) ) {
469
-            // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
469
+			// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
470 470
 			$criteria['context_view_id'] = null;
471 471
 		}
472 472
 
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 			),
1083 1083
 		);
1084 1084
 
1085
-        $fields = $date_created + $fields;
1085
+		$fields = $date_created + $fields;
1086 1086
 
1087 1087
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1088 1088
 
@@ -1094,13 +1094,13 @@  discard block
 block discarded – undo
1094 1094
 			}
1095 1095
 		}
1096 1096
 
1097
-        /**
1098
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1099
-         * @since 1.12
1100
-         * @param array $fields Sub-set of GF form fields that are sortable
1101
-         * @param int $formid The Gravity Forms form ID that the fields are from
1102
-         */
1103
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1097
+		/**
1098
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1099
+		 * @since 1.12
1100
+		 * @param array $fields Sub-set of GF form fields that are sortable
1101
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1102
+		 */
1103
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1104 1104
 
1105 1105
 		return $fields;
1106 1106
 	}
@@ -1365,17 +1365,17 @@  discard block
 block discarded – undo
1365 1365
 	}
1366 1366
 
1367 1367
 
1368
-    /**
1369
-     * Display updated/error notice
1370
-     *
1371
-     * @param string $notice text/HTML of notice
1372
-     * @param string $class CSS class for notice (`updated` or `error`)
1373
-     *
1374
-     * @return string
1375
-     */
1376
-    public static function generate_notice( $notice, $class = '' ) {
1377
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1378
-    }
1368
+	/**
1369
+	 * Display updated/error notice
1370
+	 *
1371
+	 * @param string $notice text/HTML of notice
1372
+	 * @param string $class CSS class for notice (`updated` or `error`)
1373
+	 *
1374
+	 * @return string
1375
+	 */
1376
+	public static function generate_notice( $notice, $class = '' ) {
1377
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1378
+	}
1379 1379
 
1380 1380
 
1381 1381
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,6 @@  discard block
 block discarded – undo
167 167
 	 * Returns the list of available forms
168 168
 	 *
169 169
 	 * @access public
170
-	 * @param mixed $form_id
171 170
 	 * @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys
172 171
 	 */
173 172
 	public static function get_forms() {
@@ -188,7 +187,7 @@  discard block
 block discarded – undo
188 187
 	 * Return array of fields' id and label, for a given Form ID
189 188
 	 *
190 189
 	 * @access public
191
-	 * @param string|array $form_id (default: '') or $form object
190
+	 * @param string|array $form (default: '') or $form object
192 191
 	 * @return array
193 192
 	 */
194 193
 	public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 					$has_poll_fields = true;
291 291
 				}
292 292
 
293
-				if( GFCommon::is_product_field( $field['type'] ) ){
293
+				if( GFCommon::is_product_field( $field['type'] ) ) {
294 294
 					$has_product_fields = true;
295 295
 				}
296 296
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		$fields = array();
375 375
 
376
-		foreach ( $extra_fields as $key => $field ){
376
+		foreach ( $extra_fields as $key => $field ) {
377 377
 			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
378 378
 				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
379 379
 			}
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 	 * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist
914 914
 	 */
915 915
 	public static function get_field( $form, $field_id ) {
916
-		if ( class_exists( 'GFFormsModel' ) ){
916
+		if ( class_exists( 'GFFormsModel' ) ) {
917 917
 			return GFFormsModel::get_field( $form, $field_id );
918 918
 		} else {
919 919
 			return null;
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 			$shortcodes = array();
961 961
 
962 962
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
963
-			if ( empty( $matches ) ){
963
+			if ( empty( $matches ) ) {
964 964
 				return false;
965 965
 			}
966 966
 
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) {
1424 1424
 		$merged = $array1;
1425 1425
 
1426
-		foreach ( $array2 as $key => &$value )  {
1426
+		foreach ( $array2 as $key => &$value ) {
1427 1427
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1428 1428
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1429 1429
 			} else {
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 		$entry = self::get_entry( $entry_slug, true );
126 126
 
127
-		$form = self::get_form( $entry['form_id'] );
127
+		$form = self::get_form( $entry[ 'form_id' ] );
128 128
 
129 129
 		return $form;
130 130
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$results = GFAPI::get_entries( 0, $search_criteria, null, $paging );
177 177
 
178
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
178
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
179 179
 
180 180
 		return $result;
181 181
 	}
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 		if ( class_exists( 'GFAPI' ) ) {
194 194
 			$gf_forms = GFAPI::get_forms();
195 195
 			foreach ( $gf_forms as $form ) {
196
-				$forms[] = array(
197
-					'id' => $form['id'],
198
-					'title' => $form['title'],
196
+				$forms[ ] = array(
197
+					'id' => $form[ 'id' ],
198
+					'title' => $form[ 'title' ],
199 199
 				);
200 200
 			}
201 201
 		}
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 		}
228 228
 
229 229
 		if ( $form ) {
230
-			foreach ( $form['fields'] as $field ) {
231
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
232
-					$fields[ $field['id'] ] = array(
230
+			foreach ( $form[ 'fields' ] as $field ) {
231
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
232
+					$fields[ $field[ 'id' ] ] = array(
233 233
 						'label' => rgar( $field, 'label' ),
234 234
 						'parent' => null,
235 235
 						'type' => rgar( $field, 'type' ),
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 					);
239 239
 				}
240 240
 
241
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
242
-					foreach ( $field['inputs'] as $input ) {
241
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
242
+					foreach ( $field[ 'inputs' ] as $input ) {
243 243
                         /**
244 244
                          * @hack
245 245
                          * In case of email/email confirmation, the input for email has the same id as the parent field
246 246
                          */
247
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
247
+                        if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) {
248 248
                             continue;
249 249
                         }
250
-						$fields[ (string)$input['id'] ] = array(
250
+						$fields[ (string)$input[ 'id' ] ] = array(
251 251
 							'label' => rgar( $input, 'label' ),
252 252
 							'customLabel' => rgar( $input, 'customLabel' ),
253 253
 							'parent' => $field,
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 				}
260 260
 
261 261
 				/** @since 1.14 */
262
-				if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) {
262
+				if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) {
263 263
 
264
-					foreach ( (array)$field['choices'] as $key => $input ) {
264
+					foreach ( (array)$field[ 'choices' ] as $key => $input ) {
265 265
 
266
-						$input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key}
266
+						$input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key}
267 267
 
268 268
 						$fields[ $input_id ] = array(
269 269
 							'label'       => rgar( $input, 'text' ),
@@ -279,25 +279,25 @@  discard block
 block discarded – undo
279 279
 				/**
280 280
 				 * @since 1.8
281 281
 				 */
282
-				if( 'quiz' === $field['type'] ) {
282
+				if ( 'quiz' === $field[ 'type' ] ) {
283 283
 					$has_quiz_fields = true;
284 284
 				}
285 285
 
286 286
 				/**
287 287
 				 * @since 1.8
288 288
 				 */
289
-				if( 'poll' === $field['type'] ) {
289
+				if ( 'poll' === $field[ 'type' ] ) {
290 290
 					$has_poll_fields = true;
291 291
 				}
292 292
 
293
-				if( GFCommon::is_product_field( $field['type'] ) ){
293
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
294 294
 					$has_product_fields = true;
295 295
 				}
296 296
 
297 297
 				/**
298 298
 				 * @hack Version 1.9
299 299
 				 */
300
-				$field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field;
300
+				$field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field;
301 301
 
302 302
 				if ( GFCommon::is_post_field( $field_for_is_post_field ) ) {
303 303
 					$has_post_fields = true;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		 * @since 1.7
310 310
 		 */
311 311
 		if ( $has_post_fields ) {
312
-			$fields['post_id'] = array(
312
+			$fields[ 'post_id' ] = array(
313 313
 				'label' => __( 'Post ID', 'gravityview' ),
314 314
 				'type' => 'post_id',
315 315
 			);
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 			$payment_fields = GravityView_Fields::get_all( 'pricing' );
321 321
 
322 322
 			foreach ( $payment_fields as $payment_field ) {
323
-				if( isset( $fields["{$payment_field->name}"] ) ) {
323
+				if ( isset( $fields[ "{$payment_field->name}" ] ) ) {
324 324
 					continue;
325 325
 				}
326
-				$fields["{$payment_field->name}"] = array(
326
+				$fields[ "{$payment_field->name}" ] = array(
327 327
 					'label' => $payment_field->label,
328 328
 					'desc' => $payment_field->description,
329 329
 					'type' => $payment_field->name,
@@ -334,24 +334,24 @@  discard block
 block discarded – undo
334 334
 		/**
335 335
 		 * @since 1.8
336 336
 		 */
337
-		if( $has_quiz_fields ) {
337
+		if ( $has_quiz_fields ) {
338 338
 
339
-			$fields['gquiz_score']   = array(
339
+			$fields[ 'gquiz_score' ] = array(
340 340
 				'label' => __( 'Quiz Score Total', 'gravityview' ),
341 341
 				'type'  => 'quiz_score',
342 342
 				'desc'  => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ),
343 343
 			);
344
-			$fields['gquiz_percent'] = array(
344
+			$fields[ 'gquiz_percent' ] = array(
345 345
 				'label' => __( 'Quiz Percentage Grade', 'gravityview' ),
346 346
 				'type'  => 'quiz_percent',
347 347
 				'desc'  => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ),
348 348
 			);
349
-			$fields['gquiz_grade']   = array(
349
+			$fields[ 'gquiz_grade' ] = array(
350 350
 				'label' => __( 'Quiz Letter Grade', 'gravityview' ),
351 351
 				'type'  => 'quiz_grade',
352 352
 				'desc'  => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ),
353 353
 			);
354
-			$fields['gquiz_is_pass'] = array(
354
+			$fields[ 'gquiz_is_pass' ] = array(
355 355
 				'label' => __( 'Quiz Pass/Fail', 'gravityview' ),
356 356
 				'type'  => 'quiz_is_pass',
357 357
 				'desc'  => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ),
@@ -373,9 +373,9 @@  discard block
 block discarded – undo
373 373
 
374 374
 		$fields = array();
375 375
 
376
-		foreach ( $extra_fields as $key => $field ){
377
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
378
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
376
+		foreach ( $extra_fields as $key => $field ) {
377
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
378
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
379 379
 			}
380 380
 		}
381 381
 
@@ -415,32 +415,32 @@  discard block
 block discarded – undo
415 415
 			'search_criteria' => null,
416 416
 			'sorting' => null,
417 417
 			'paging' => null,
418
-			'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true),
418
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ),
419 419
 		);
420 420
 
421 421
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
422 422
 
423
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
424
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
423
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
424
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
425 425
 
426 426
 				if ( ! is_array( $filter ) ) {
427 427
 					continue;
428 428
 				}
429 429
 
430 430
 				// By default, we want searches to be wildcard for each field.
431
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
431
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
432 432
 
433 433
 				/**
434 434
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
435 435
 				 * @param string $operator Existing search operator
436 436
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
437 437
 				 */
438
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
438
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
439 439
 			}
440 440
 
441 441
 			// don't send just the [mode] without any field filter.
442
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
443
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
442
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
443
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
444 444
 			}
445 445
 
446 446
 		}
@@ -451,21 +451,21 @@  discard block
 block discarded – undo
451 451
 		 * Prepare date formats to be in Gravity Forms DB format;
452 452
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
453 453
 		 */
454
-		foreach ( array('start_date', 'end_date' ) as $key ) {
454
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
455 455
 
456
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
456
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
457 457
 
458 458
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
459
-				$date = date_create( $criteria['search_criteria'][ $key ] );
459
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
460 460
 
461 461
 				if ( $date ) {
462 462
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
463
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
463
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
464 464
 				} else {
465 465
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
466
-					unset( $criteria['search_criteria'][ $key ] );
466
+					unset( $criteria[ 'search_criteria' ][ $key ] );
467 467
 
468
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
468
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
469 469
 				}
470 470
 			}
471 471
 		}
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
 
474 474
 		// When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter
475 475
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) {
476
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
476
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
477 477
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
478
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
479
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
478
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null;
479
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
480 480
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
481
-			$criteria['context_view_id'] = null;
481
+			$criteria[ 'context_view_id' ] = null;
482 482
 		}
483 483
 
484 484
 		/**
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		 * @param array $form_ids Forms to search
488 488
 		 * @param int $view_id ID of the view being used to search
489 489
 		 */
490
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
490
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
491 491
 
492 492
 		return (array)$criteria;
493 493
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		/** Reduce # of database calls */
519 519
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
520 520
 
521
-		if ( ! empty( $criteria['cache'] ) ) {
521
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
522 522
 
523 523
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
524 524
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 
527 527
 				// Still update the total count when using cached results
528 528
 				if ( ! is_null( $total ) ) {
529
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
529
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
530 530
 				}
531 531
 
532 532
 				$return = $entries;
@@ -546,9 +546,9 @@  discard block
 block discarded – undo
546 546
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
547 547
 
548 548
 			// No entries returned from gravityview_before_get_entries
549
-			if( is_null( $entries ) ) {
549
+			if ( is_null( $entries ) ) {
550 550
 
551
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
551
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
552 552
 
553 553
 				if ( is_wp_error( $entries ) ) {
554 554
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 				}
558 558
 			}
559 559
 
560
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
560
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
561 561
 
562 562
 				// Cache results
563 563
 				$Cache->set( $entries, 'entries' );
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 			 */
645 645
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
646 646
 
647
-			if( $check_entry_display ) {
647
+			if ( $check_entry_display ) {
648 648
 				// Is the entry allowed
649 649
 				$entry = self::check_entry_display( $entry );
650 650
 			}
@@ -677,12 +677,12 @@  discard block
 block discarded – undo
677 677
 
678 678
 		$value = false;
679 679
 
680
-		if( 'context' === $val1 ) {
680
+		if ( 'context' === $val1 ) {
681 681
 
682 682
 			$matching_contexts = array( $val2 );
683 683
 
684 684
 			// We allow for non-standard contexts.
685
-			switch( $val2 ) {
685
+			switch ( $val2 ) {
686 686
 				// Check for either single or edit
687 687
 				case 'singular':
688 688
 					$matching_contexts = array( 'single', 'edit' );
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			return false;
743 743
 		}
744 744
 
745
-		if ( empty( $entry['form_id'] ) ) {
745
+		if ( empty( $entry[ 'form_id' ] ) ) {
746 746
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
747 747
 			return false;
748 748
 		}
@@ -750,26 +750,26 @@  discard block
 block discarded – undo
750 750
 		$criteria = self::calculate_get_entries_criteria();
751 751
 
752 752
 		// Make sure the current View is connected to the same form as the Entry
753
-		if( ! empty( $criteria['context_view_id'] ) ) {
754
-			$context_view_id = intval( $criteria['context_view_id'] );
753
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
754
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
755 755
 			$context_form_id = gravityview_get_form_id( $context_view_id );
756
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
757
-				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
756
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
757
+				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
758 758
 				return false;
759 759
 			}
760 760
 		}
761 761
 
762
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
762
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
763 763
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
764 764
 			return $entry;
765 765
 		}
766 766
 
767
-		$search_criteria = $criteria['search_criteria'];
767
+		$search_criteria = $criteria[ 'search_criteria' ];
768 768
 		unset( $criteria );
769 769
 
770 770
 		// check entry status
771
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
772
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
771
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
772
+			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
773 773
 			return false;
774 774
 		}
775 775
 
@@ -777,37 +777,37 @@  discard block
 block discarded – undo
777 777
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
778 778
 
779 779
 		// field_filters
780
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
780
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
781 781
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
782 782
 			return $entry;
783 783
 		}
784 784
 
785
-		$filters = $search_criteria['field_filters'];
785
+		$filters = $search_criteria[ 'field_filters' ];
786 786
 		unset( $search_criteria );
787 787
 
788
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
789
-		unset( $filters['mode'] );
788
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
789
+		unset( $filters[ 'mode' ] );
790 790
 
791
-		$form = self::get_form( $entry['form_id'] );
791
+		$form = self::get_form( $entry[ 'form_id' ] );
792 792
 
793 793
 		foreach ( $filters as $filter ) {
794 794
 
795
-			if ( ! isset( $filter['key'] ) ) {
795
+			if ( ! isset( $filter[ 'key' ] ) ) {
796 796
 				continue;
797 797
 			}
798 798
 
799
-			$k = $filter['key'];
799
+			$k = $filter[ 'key' ];
800 800
 
801 801
 			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
802 802
 				$field_value = $entry[ $k ];
803 803
 				$field = null;
804 804
 			} else {
805 805
 				$field = self::get_field( $form, $k );
806
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
806
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
807 807
 			}
808 808
 
809
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
810
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
809
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
810
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
811 811
 
812 812
 			// verify if we are already free to go!
813 813
 			if ( ! $is_value_match && 'all' === $mode ) {
@@ -865,25 +865,25 @@  discard block
 block discarded – undo
865 865
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
866 866
 		 * @see GFCommon::format_date() for original code
867 867
 		 */
868
-		$date_gmt_time   = mysql2date( 'G', $date_string );
868
+		$date_gmt_time = mysql2date( 'G', $date_string );
869 869
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
870 870
 
871
-		$format  = rgar( $atts, 'format' );
872
-		$is_human  = ! empty( $atts['human'] );
873
-		$is_diff  = ! empty( $atts['diff'] );
874
-		$is_raw = ! empty( $atts['raw'] );
875
-		$is_timestamp = ! empty( $atts['timestamp'] );
876
-		$include_time = ! empty( $atts['time'] );
871
+		$format = rgar( $atts, 'format' );
872
+		$is_human = ! empty( $atts[ 'human' ] );
873
+		$is_diff = ! empty( $atts[ 'diff' ] );
874
+		$is_raw = ! empty( $atts[ 'raw' ] );
875
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
876
+		$include_time = ! empty( $atts[ 'time' ] );
877 877
 
878 878
 		// If we're using time diff, we want to have a different default format
879
-		if( empty( $format ) ) {
879
+		if ( empty( $format ) ) {
880 880
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
881 881
 		}
882 882
 
883 883
 		// If raw was specified, don't modify the stored value
884 884
 		if ( $is_raw ) {
885 885
 			$formatted_date = $date_string;
886
-		} elseif( $is_timestamp ) {
886
+		} elseif ( $is_timestamp ) {
887 887
 			$formatted_date = $date_local_timestamp;
888 888
 		} elseif ( $is_diff ) {
889 889
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 		}
912 912
 
913 913
 		$field = self::get_field( $form, $field_id );
914
-		return isset( $field['label'] ) ?  $field['label'] : '';
914
+		return isset( $field[ 'label' ] ) ? $field[ 'label' ] : '';
915 915
 
916 916
 	}
917 917
 
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	 * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist
930 930
 	 */
931 931
 	public static function get_field( $form, $field_id ) {
932
-		if ( class_exists( 'GFFormsModel' ) ){
932
+		if ( class_exists( 'GFFormsModel' ) ) {
933 933
 			return GFFormsModel::get_field( $form, $field_id );
934 934
 		} else {
935 935
 			return null;
@@ -976,17 +976,17 @@  discard block
 block discarded – undo
976 976
 			$shortcodes = array();
977 977
 
978 978
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
979
-			if ( empty( $matches ) ){
979
+			if ( empty( $matches ) ) {
980 980
 				return false;
981 981
 			}
982 982
 
983 983
 			foreach ( $matches as $shortcode ) {
984
-				if ( $tag === $shortcode[2] ) {
984
+				if ( $tag === $shortcode[ 2 ] ) {
985 985
 
986 986
 					// Changed this to $shortcode instead of true so we get the parsed atts.
987
-					$shortcodes[] = $shortcode;
987
+					$shortcodes[ ] = $shortcode;
988 988
 
989
-				} else if ( isset( $shortcode[5] ) && $result = self::has_shortcode_r( $shortcode[5], $tag ) ) {
989
+				} else if ( isset( $shortcode[ 5 ] ) && $result = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
990 990
 					$shortcodes = $result;
991 991
 				}
992 992
 			}
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 	 * @return string         html
1138 1138
 	 */
1139 1139
 	public static function get_sortable_fields( $formid, $current = '' ) {
1140
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1140
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1141 1141
 
1142 1142
 		if ( empty( $formid ) ) {
1143 1143
 			return $output;
@@ -1150,11 +1150,11 @@  discard block
 block discarded – undo
1150 1150
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1151 1151
 
1152 1152
 			foreach ( $fields as $id => $field ) {
1153
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1153
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1154 1154
 					continue;
1155 1155
 				}
1156 1156
 
1157
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1157
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1158 1158
 			}
1159 1159
 		}
1160 1160
 
@@ -1189,9 +1189,9 @@  discard block
 block discarded – undo
1189 1189
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1190 1190
 
1191 1191
 		// TODO: Convert to using array_filter
1192
-		foreach( $fields as $id => $field ) {
1192
+		foreach ( $fields as $id => $field ) {
1193 1193
 
1194
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1194
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1195 1195
 				unset( $fields[ $id ] );
1196 1196
 			}
1197 1197
 		}
@@ -1232,14 +1232,14 @@  discard block
 block discarded – undo
1232 1232
 	 * @param  int|array  $field field key or field array
1233 1233
 	 * @return boolean
1234 1234
 	 */
1235
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1235
+	public static function is_field_numeric( $form = null, $field = '' ) {
1236 1236
 
1237 1237
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1238 1238
 			$form = self::get_form( $form );
1239 1239
 		}
1240 1240
 
1241 1241
 		// If entry meta, it's a string. Otherwise, numeric
1242
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1242
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1243 1243
 			$type = $field;
1244 1244
 		} else {
1245 1245
 			$type = self::get_field_type( $form, $field );
@@ -1253,9 +1253,9 @@  discard block
 block discarded – undo
1253 1253
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1254 1254
 
1255 1255
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1256
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1257
-			if( true === $gv_field->is_numeric ) {
1258
-				$numeric_types[] = $gv_field->is_numeric;
1256
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1257
+			if ( true === $gv_field->is_numeric ) {
1258
+				$numeric_types[ ] = $gv_field->is_numeric;
1259 1259
 			}
1260 1260
 		}
1261 1261
 
@@ -1405,11 +1405,11 @@  discard block
 block discarded – undo
1405 1405
 		$final_atts = array_filter( $final_atts );
1406 1406
 
1407 1407
 		// If the href wasn't passed as an attribute, use the value passed to the function
1408
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1409
-			$final_atts['href'] = $href;
1408
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1409
+			$final_atts[ 'href' ] = $href;
1410 1410
 		}
1411 1411
 
1412
-		$final_atts['href'] = esc_url_raw( $href );
1412
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1413 1413
 
1414 1414
 		// Sort the attributes alphabetically, to help testing
1415 1415
 		ksort( $final_atts );
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1421 1421
 		}
1422 1422
 
1423
-		if( '' !== $output ) {
1423
+		if ( '' !== $output ) {
1424 1424
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1425 1425
 		}
1426 1426
 
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) {
1445 1445
 		$merged = $array1;
1446 1446
 
1447
-		foreach ( $array2 as $key => &$value )  {
1447
+		foreach ( $array2 as $key => &$value ) {
1448 1448
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1449 1449
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1450 1450
 			} else {
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1480 1480
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1481 1481
 		 */
1482
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1482
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1483 1483
 
1484 1484
 		return get_users( $get_users_settings );
1485 1485
 	}
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
      * @return string
1495 1495
      */
1496 1496
     public static function generate_notice( $notice, $class = '' ) {
1497
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1497
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1498 1498
     }
1499 1499
 
1500 1500
 
Please login to merge, or discard this patch.
includes/class-gravityview-change-entry-creator.php 2 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -5,220 +5,220 @@
 block discarded – undo
5 5
  */
6 6
 class GravityView_Change_Entry_Creator {
7 7
 
8
-    function __construct() {
9
-
10
-    	/**
11
-    	 * @since  1.5.1
12
-    	 */
13
-    	add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 );
14
-
15
-    	// ONLY ADMIN FROM HERE ON.
16
-    	if( !is_admin() ) { return; }
17
-
18
-	    /**
19
-         * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality
20
-	     * @since 1.7.4
21
-	     * @param boolean $disable Disable the Change Entry Creator functionality. Default: false.
22
-	     */
23
-	    if( apply_filters('gravityview_disable_change_entry_creator', false ) ) {
24
-		    return;
25
-	    }
26
-
27
-        /**
28
-         * Use `init` to fix bbPress warning
29
-         * @see https://bbpress.trac.wordpress.org/ticket/2309
30
-         */
31
-    	add_action('init', array( $this, 'load'), 100 );
32
-
33
-    	add_action('plugins_loaded', array( $this, 'prevent_conflicts') );
8
+	function __construct() {
9
+
10
+		/**
11
+		 * @since  1.5.1
12
+		 */
13
+		add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 );
14
+
15
+		// ONLY ADMIN FROM HERE ON.
16
+		if( !is_admin() ) { return; }
17
+
18
+		/**
19
+		 * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality
20
+		 * @since 1.7.4
21
+		 * @param boolean $disable Disable the Change Entry Creator functionality. Default: false.
22
+		 */
23
+		if( apply_filters('gravityview_disable_change_entry_creator', false ) ) {
24
+			return;
25
+		}
26
+
27
+		/**
28
+		 * Use `init` to fix bbPress warning
29
+		 * @see https://bbpress.trac.wordpress.org/ticket/2309
30
+		 */
31
+		add_action('init', array( $this, 'load'), 100 );
32
+
33
+		add_action('plugins_loaded', array( $this, 'prevent_conflicts') );
34 34
 
35
-    }
35
+	}
36 36
 
37
-    /**
38
-     * When an user is created using the User Registration add-on, assign the entry to them
39
-     *
40
-     * @since  1.5.1
41
-     * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field
42
-     * @param  int $user_id  WordPress User ID
43
-     * @param  array $config   User registration feed configuration
44
-     * @param  array  $entry     GF Entry array
45
-     * @param  string $password User password
46
-     * @return void
47
-     */
48
-    function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) {
37
+	/**
38
+	 * When an user is created using the User Registration add-on, assign the entry to them
39
+	 *
40
+	 * @since  1.5.1
41
+	 * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field
42
+	 * @param  int $user_id  WordPress User ID
43
+	 * @param  array $config   User registration feed configuration
44
+	 * @param  array  $entry     GF Entry array
45
+	 * @param  string $password User password
46
+	 * @return void
47
+	 */
48
+	function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) {
49 49
 
50
-    	/**
51
-    	 * Disable assigning the new user to the entry by returning false.
52
-    	 * @param  int $user_id  WordPress User ID
53
-	     * @param  array $config   User registration feed configuration
54
-	     * @param  array  $entry     GF Entry array
55
-    	 */
56
-    	$assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry );
57
-
58
-    	// If filter returns false, do not process
59
-    	if( empty( $assign_to_lead ) ) {
60
-    		return;
61
-    	}
50
+		/**
51
+		 * Disable assigning the new user to the entry by returning false.
52
+		 * @param  int $user_id  WordPress User ID
53
+		 * @param  array $config   User registration feed configuration
54
+		 * @param  array  $entry     GF Entry array
55
+		 */
56
+		$assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry );
57
+
58
+		// If filter returns false, do not process
59
+		if( empty( $assign_to_lead ) ) {
60
+			return;
61
+		}
62 62
 
63
-    	// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
64
-    	$result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true );
63
+		// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
64
+		$result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true );
65 65
 
66
-    	if( empty( $result ) ) {
67
-    		$status = __('Error', 'gravityview');
68
-    	} else {
69
-    		$status = __('Success', 'gravityview');
70
-    	}
71
-
72
-    	$note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id );
66
+		if( empty( $result ) ) {
67
+			$status = __('Error', 'gravityview');
68
+		} else {
69
+			$status = __('Success', 'gravityview');
70
+		}
71
+
72
+		$note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id );
73 73
 
74
-    	do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note );
74
+		do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note );
75 75
 
76
-        GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
76
+		GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
77 77
 
78
-    }
78
+	}
79 79
 
80
-    /**
81
-     * Disable previous functionality; use this one as the canonical.
82
-     * @return void
83
-     */
84
-    function prevent_conflicts() {
80
+	/**
81
+	 * Disable previous functionality; use this one as the canonical.
82
+	 * @return void
83
+	 */
84
+	function prevent_conflicts() {
85 85
 
86
-    	// Plugin that was provided here:
87
-    	// @link https://gravityview.co/support/documentation/201991205/
88
-    	remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2);
89
-    	remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2);
86
+		// Plugin that was provided here:
87
+		// @link https://gravityview.co/support/documentation/201991205/
88
+		remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2);
89
+		remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2);
90 90
 
91
-    	// Disable for Gravity Forms Add-ons 3.6.2 and lower
92
-    	if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
91
+		// Disable for Gravity Forms Add-ons 3.6.2 and lower
92
+		if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
93 93
 
94
-    		$Old_Lead_Creator = new KWS_GF_Change_Lead_Creator;
94
+			$Old_Lead_Creator = new KWS_GF_Change_Lead_Creator;
95 95
 
96
-    		// Now, no validation is required in the methods; let's hook in.
97
-    		remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
96
+			// Now, no validation is required in the methods; let's hook in.
97
+			remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
98 98
 
99
-    		remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2);
99
+			remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2);
100 100
 
101
-    		remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2);
102
-    	}
101
+			remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2);
102
+		}
103 103
 
104
-    }
104
+	}
105 105
 
106
-    /**
107
-     * @since  3.6.3
108
-     * @return void
109
-     */
110
-    function load() {
106
+	/**
107
+	 * @since  3.6.3
108
+	 * @return void
109
+	 */
110
+	function load() {
111 111
 
112
-    	// Does GF exist?
113
-        if( !class_exists('GFCommon') ) {
114
-            return;
115
-        }
112
+		// Does GF exist?
113
+		if( !class_exists('GFCommon') ) {
114
+			return;
115
+		}
116 116
 
117
-        // Can the user edit entries?
118
-        if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
119
-            return;
120
-        }
117
+		// Can the user edit entries?
118
+		if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
119
+			return;
120
+		}
121 121
 
122
-        // If screen mode isn't set, then we're in the wrong place.
123
-        if( empty( $_REQUEST['screen_mode'] ) ) {
124
-            return;
125
-        }
122
+		// If screen mode isn't set, then we're in the wrong place.
123
+		if( empty( $_REQUEST['screen_mode'] ) ) {
124
+			return;
125
+		}
126 126
 
127
-        // Now, no validation is required in the methods; let's hook in.
128
-        add_action('admin_init', array( &$this, 'set_screen_mode' ) );
127
+		// Now, no validation is required in the methods; let's hook in.
128
+		add_action('admin_init', array( &$this, 'set_screen_mode' ) );
129 129
 
130
-        add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
130
+		add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
131 131
 
132
-        add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
132
+		add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
133 133
 
134
-    }
134
+	}
135 135
 
136
-    /**
137
-     * Allows for edit links to work with a link instead of a form (GET instead of POST)
138
-     * @return void
139
-     */
140
-    function set_screen_mode() {
136
+	/**
137
+	 * Allows for edit links to work with a link instead of a form (GET instead of POST)
138
+	 * @return void
139
+	 */
140
+	function set_screen_mode() {
141 141
 
142
-    	// If $_GET['screen_mode'] is set to edit, set $_POST value
143
-        if( rgget('screen_mode') === 'edit' ) {
144
-            $_POST["screen_mode"] = 'edit';
145
-        }
142
+		// If $_GET['screen_mode'] is set to edit, set $_POST value
143
+		if( rgget('screen_mode') === 'edit' ) {
144
+			$_POST["screen_mode"] = 'edit';
145
+		}
146 146
 
147
-    }
147
+	}
148 148
 
149
-    /**
150
-     * When the entry creator is changed, add a note to the entry
151
-     * @param  array $form   GF entry array
152
-     * @param  int $entry_id Entry ID
153
-     * @return void
154
-     */
155
-    function update_entry_creator($form, $entry_id) {
156
-            global $current_user;
149
+	/**
150
+	 * When the entry creator is changed, add a note to the entry
151
+	 * @param  array $form   GF entry array
152
+	 * @param  int $entry_id Entry ID
153
+	 * @return void
154
+	 */
155
+	function update_entry_creator($form, $entry_id) {
156
+			global $current_user;
157 157
 
158
-        // Update the entry
159
-        $created_by = absint( rgpost('created_by') );
158
+		// Update the entry
159
+		$created_by = absint( rgpost('created_by') );
160 160
 
161
-        RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
161
+		RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
162 162
 
163
-        // If the creator has changed, let's add a note about who it used to be.
164
-        $originally_created_by = rgpost('originally_created_by');
163
+		// If the creator has changed, let's add a note about who it used to be.
164
+		$originally_created_by = rgpost('originally_created_by');
165 165
 
166
-        // If there's no owner and there didn't used to be, keep going
167
-        if( empty( $originally_created_by ) && empty( $created_by ) ) {
168
-            return;
169
-        }
166
+		// If there's no owner and there didn't used to be, keep going
167
+		if( empty( $originally_created_by ) && empty( $created_by ) ) {
168
+			return;
169
+		}
170 170
 
171
-        // If the values have changed
172
-        if( absint( $originally_created_by ) !== absint( $created_by ) ) {
171
+		// If the values have changed
172
+		if( absint( $originally_created_by ) !== absint( $created_by ) ) {
173 173
 
174
-            $user_data = get_userdata($current_user->ID);
174
+			$user_data = get_userdata($current_user->ID);
175 175
 
176
-            $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
176
+			$user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
177 177
 
178
-            $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
178
+			$original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
179 179
 
180
-            if( !empty( $originally_created_by ) ) {
181
-                $originally_created_by_user_data = get_userdata($originally_created_by);
182
-                $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
183
-            }
180
+			if( !empty( $originally_created_by ) ) {
181
+				$originally_created_by_user_data = get_userdata($originally_created_by);
182
+				$original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
183
+			}
184 184
 
185
-            if( !empty( $created_by ) ) {
186
-                $created_by_user_data =  get_userdata($created_by);
187
-                $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
188
-            }
185
+			if( !empty( $created_by ) ) {
186
+				$created_by_user_data =  get_userdata($created_by);
187
+				$created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
188
+			}
189 189
 
190
-            GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' );
191
-        }
190
+			GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' );
191
+		}
192 192
 
193
-    }
193
+	}
194 194
 
195
-    /**
196
-     * Output the select to change the entry creator
197
-     * @param int $form_id GF Form ID
198
-     * @param array $entry    GF entry array
199
-     * @return void
200
-     */
201
-    function add_select($form_id, $entry ) {
195
+	/**
196
+	 * Output the select to change the entry creator
197
+	 * @param int $form_id GF Form ID
198
+	 * @param array $entry    GF entry array
199
+	 * @return void
200
+	 */
201
+	function add_select($form_id, $entry ) {
202 202
 
203
-        if( rgpost('screen_mode') !== 'edit' ) {
204
-            return;
205
-        }
203
+		if( rgpost('screen_mode') !== 'edit' ) {
204
+			return;
205
+		}
206 206
 
207
-        $users = GVCommon::get_users( 'change_entry_creator' );
207
+		$users = GVCommon::get_users( 'change_entry_creator' );
208 208
 
209
-        $output = '<label for="change_created_by">';
210
-        $output .= esc_html__('Change Entry Creator:', 'gravityview');
211
-        $output .= '</label>
209
+		$output = '<label for="change_created_by">';
210
+		$output .= esc_html__('Change Entry Creator:', 'gravityview');
211
+		$output .= '</label>
212 212
         <select name="created_by" id="change_created_by" class="widefat">';
213
-        $output .= '<option value=""> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
214
-        foreach($users as $user) {
215
-            $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
216
-        }
217
-        $output .= '</select>';
218
-        $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
219
-        echo $output;
220
-
221
-    }
213
+		$output .= '<option value=""> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
214
+		foreach($users as $user) {
215
+			$output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
216
+		}
217
+		$output .= '</select>';
218
+		$output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
219
+		echo $output;
220
+
221
+	}
222 222
 
223 223
 }
224 224
 
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
     	/**
11 11
     	 * @since  1.5.1
12 12
     	 */
13
-    	add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 );
13
+    	add_action( 'gform_user_registered', array( $this, 'assign_new_user_to_lead' ), 10, 4 );
14 14
 
15 15
     	// ONLY ADMIN FROM HERE ON.
16
-    	if( !is_admin() ) { return; }
16
+    	if ( ! is_admin() ) { return; }
17 17
 
18 18
 	    /**
19 19
          * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality
20 20
 	     * @since 1.7.4
21 21
 	     * @param boolean $disable Disable the Change Entry Creator functionality. Default: false.
22 22
 	     */
23
-	    if( apply_filters('gravityview_disable_change_entry_creator', false ) ) {
23
+	    if ( apply_filters( 'gravityview_disable_change_entry_creator', false ) ) {
24 24
 		    return;
25 25
 	    }
26 26
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
          * Use `init` to fix bbPress warning
29 29
          * @see https://bbpress.trac.wordpress.org/ticket/2309
30 30
          */
31
-    	add_action('init', array( $this, 'load'), 100 );
31
+    	add_action( 'init', array( $this, 'load' ), 100 );
32 32
 
33
-    	add_action('plugins_loaded', array( $this, 'prevent_conflicts') );
33
+    	add_action( 'plugins_loaded', array( $this, 'prevent_conflicts' ) );
34 34
 
35 35
     }
36 36
 
@@ -56,24 +56,24 @@  discard block
 block discarded – undo
56 56
     	$assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry );
57 57
 
58 58
     	// If filter returns false, do not process
59
-    	if( empty( $assign_to_lead ) ) {
59
+    	if ( empty( $assign_to_lead ) ) {
60 60
     		return;
61 61
     	}
62 62
 
63 63
     	// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
64
-    	$result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true );
64
+    	$result = RGFormsModel::update_lead_property( $entry[ 'id' ], 'created_by', $user_id, false, true );
65 65
 
66
-    	if( empty( $result ) ) {
67
-    		$status = __('Error', 'gravityview');
66
+    	if ( empty( $result ) ) {
67
+    		$status = __( 'Error', 'gravityview' );
68 68
     	} else {
69
-    		$status = __('Success', 'gravityview');
69
+    		$status = __( 'Success', 'gravityview' );
70 70
     	}
71 71
 
72
-    	$note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id );
72
+    	$note = sprintf( _x( '%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview' ), $status, $user_id );
73 73
 
74
-    	do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note );
74
+    	do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - ' . $note );
75 75
 
76
-        GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
76
+        GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' );
77 77
 
78 78
     }
79 79
 
@@ -85,20 +85,20 @@  discard block
 block discarded – undo
85 85
 
86 86
     	// Plugin that was provided here:
87 87
     	// @link https://gravityview.co/support/documentation/201991205/
88
-    	remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2);
89
-    	remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2);
88
+    	remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2 );
89
+    	remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2 );
90 90
 
91 91
     	// Disable for Gravity Forms Add-ons 3.6.2 and lower
92
-    	if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
92
+    	if ( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
93 93
 
94 94
     		$Old_Lead_Creator = new KWS_GF_Change_Lead_Creator;
95 95
 
96 96
     		// Now, no validation is required in the methods; let's hook in.
97
-    		remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
97
+    		remove_action( 'admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
98 98
 
99
-    		remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2);
99
+    		remove_action( "gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2 );
100 100
 
101
-    		remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2);
101
+    		remove_action( "gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2 );
102 102
     	}
103 103
 
104 104
     }
@@ -110,26 +110,26 @@  discard block
 block discarded – undo
110 110
     function load() {
111 111
 
112 112
     	// Does GF exist?
113
-        if( !class_exists('GFCommon') ) {
113
+        if ( ! class_exists( 'GFCommon' ) ) {
114 114
             return;
115 115
         }
116 116
 
117 117
         // Can the user edit entries?
118
-        if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
118
+        if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
119 119
             return;
120 120
         }
121 121
 
122 122
         // If screen mode isn't set, then we're in the wrong place.
123
-        if( empty( $_REQUEST['screen_mode'] ) ) {
123
+        if ( empty( $_REQUEST[ 'screen_mode' ] ) ) {
124 124
             return;
125 125
         }
126 126
 
127 127
         // Now, no validation is required in the methods; let's hook in.
128
-        add_action('admin_init', array( &$this, 'set_screen_mode' ) );
128
+        add_action( 'admin_init', array( &$this, 'set_screen_mode' ) );
129 129
 
130
-        add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
130
+        add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 );
131 131
 
132
-        add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
132
+        add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 );
133 133
 
134 134
     }
135 135
 
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
     function set_screen_mode() {
141 141
 
142 142
     	// If $_GET['screen_mode'] is set to edit, set $_POST value
143
-        if( rgget('screen_mode') === 'edit' ) {
144
-            $_POST["screen_mode"] = 'edit';
143
+        if ( rgget( 'screen_mode' ) === 'edit' ) {
144
+            $_POST[ "screen_mode" ] = 'edit';
145 145
         }
146 146
 
147 147
     }
@@ -152,42 +152,42 @@  discard block
 block discarded – undo
152 152
      * @param  int $entry_id Entry ID
153 153
      * @return void
154 154
      */
155
-    function update_entry_creator($form, $entry_id) {
155
+    function update_entry_creator( $form, $entry_id ) {
156 156
             global $current_user;
157 157
 
158 158
         // Update the entry
159
-        $created_by = absint( rgpost('created_by') );
159
+        $created_by = absint( rgpost( 'created_by' ) );
160 160
 
161 161
         RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
162 162
 
163 163
         // If the creator has changed, let's add a note about who it used to be.
164
-        $originally_created_by = rgpost('originally_created_by');
164
+        $originally_created_by = rgpost( 'originally_created_by' );
165 165
 
166 166
         // If there's no owner and there didn't used to be, keep going
167
-        if( empty( $originally_created_by ) && empty( $created_by ) ) {
167
+        if ( empty( $originally_created_by ) && empty( $created_by ) ) {
168 168
             return;
169 169
         }
170 170
 
171 171
         // If the values have changed
172
-        if( absint( $originally_created_by ) !== absint( $created_by ) ) {
172
+        if ( absint( $originally_created_by ) !== absint( $created_by ) ) {
173 173
 
174
-            $user_data = get_userdata($current_user->ID);
174
+            $user_data = get_userdata( $current_user->ID );
175 175
 
176
-            $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
176
+            $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' );
177 177
 
178
-            $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
178
+            $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview' );
179 179
 
180
-            if( !empty( $originally_created_by ) ) {
181
-                $originally_created_by_user_data = get_userdata($originally_created_by);
180
+            if ( ! empty( $originally_created_by ) ) {
181
+                $originally_created_by_user_data = get_userdata( $originally_created_by );
182 182
                 $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
183 183
             }
184 184
 
185
-            if( !empty( $created_by ) ) {
186
-                $created_by_user_data =  get_userdata($created_by);
185
+            if ( ! empty( $created_by ) ) {
186
+                $created_by_user_data = get_userdata( $created_by );
187 187
                 $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
188 188
             }
189 189
 
190
-            GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' );
190
+            GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __( 'Changed entry creator from %s to %s', 'gravityview' ), $original_name, $created_by_name ), 'note' );
191 191
         }
192 192
 
193 193
     }
@@ -198,24 +198,24 @@  discard block
 block discarded – undo
198 198
      * @param array $entry    GF entry array
199 199
      * @return void
200 200
      */
201
-    function add_select($form_id, $entry ) {
201
+    function add_select( $form_id, $entry ) {
202 202
 
203
-        if( rgpost('screen_mode') !== 'edit' ) {
203
+        if ( rgpost( 'screen_mode' ) !== 'edit' ) {
204 204
             return;
205 205
         }
206 206
 
207 207
         $users = GVCommon::get_users( 'change_entry_creator' );
208 208
 
209 209
         $output = '<label for="change_created_by">';
210
-        $output .= esc_html__('Change Entry Creator:', 'gravityview');
210
+        $output .= esc_html__( 'Change Entry Creator:', 'gravityview' );
211 211
         $output .= '</label>
212 212
         <select name="created_by" id="change_created_by" class="widefat">';
213
-        $output .= '<option value=""> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
214
-        foreach($users as $user) {
215
-            $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
213
+        $output .= '<option value=""> &mdash; ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' &mdash; </option>';
214
+        foreach ( $users as $user ) {
215
+            $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>';
216 216
         }
217 217
         $output .= '</select>';
218
-        $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
218
+        $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />';
219 219
         echo $output;
220 220
 
221 221
     }
Please login to merge, or discard this patch.
includes/class-gravityview-image.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	var $style = NULL;
24 24
 
25 25
 	/**
26
- 	 * String representing size of image - Choose from "full", "medium", "thumb", "tiny"
26
+	 * String representing size of image - Choose from "full", "medium", "thumb", "tiny"
27 27
 	 * @var string
28 28
 	 */
29 29
 	var $size = NULL;
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 
66 66
 		$atts = wp_parse_args( $atts, $defaults );
67 67
 
68
-		foreach( $atts as $key => $val ) {
68
+		foreach ( $atts as $key => $val ) {
69 69
 			$this->{$key} = $val;
70 70
 		}
71 71
 
72
-		$this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class;
72
+		$this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class;
73 73
 
74 74
 		$this->set_image_size();
75 75
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	function validate_image_src() {
87 87
 
88
-		if ( !$this->validate_src ) { return true; }
88
+		if ( ! $this->validate_src ) { return true; }
89 89
 
90 90
 		$info = pathinfo( $this->src );
91 91
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 		 * @filter `gravityview_image_extensions` Extensions that GravityView recognizes as valid images to be shown in an `img` tag
94 94
 		 * @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico']`
95 95
 		 */
96
-		$image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ));
96
+		$image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ) );
97 97
 
98
-		return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts);
98
+		return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts );
99 99
 	}
100 100
 
101 101
 	/**
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 
112 112
 			// And there is no string size passed
113 113
 			// 		And we want to get the image size using PHP
114
-			if ( empty( $string ) && !empty( $this->getimagesize ) ) {
114
+			if ( empty( $string ) && ! empty( $this->getimagesize ) ) {
115 115
 
116 116
 				$image_size = getimagesize( $this->src );
117 117
 
118
-				if ( !empty( $image_size ) ) {
118
+				if ( ! empty( $image_size ) ) {
119 119
 					list( $width, $height ) = $image_size;
120 120
 				}
121 121
 
@@ -128,33 +128,33 @@  discard block
 block discarded – undo
128 128
 				 * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels
129 129
 				 */
130 130
 				$image_sizes = apply_filters( 'gravityview_image_sizes', array(
131
-					'tiny' => array('width' => 40, 'height' => 30),
132
-					'small' => array('width' => 100, 'height' => 75),
133
-					'medium' => array('width' => 250, 'height' => 188),
134
-					'large' => array('width' => 448, 'height' => 336),
131
+					'tiny' => array( 'width' => 40, 'height' => 30 ),
132
+					'small' => array( 'width' => 100, 'height' => 75 ),
133
+					'medium' => array( 'width' => 250, 'height' => 188 ),
134
+					'large' => array( 'width' => 448, 'height' => 336 ),
135 135
 				) );
136 136
 
137
-				switch( $this->size ) {
137
+				switch ( $this->size ) {
138 138
 					case 'tiny':
139
-						extract($image_sizes['tiny']);
139
+						extract( $image_sizes[ 'tiny' ] );
140 140
 						break;
141 141
 					case 'small':
142 142
 					case 's':
143 143
 					case 'thumb':
144
-						extract($image_sizes['small']);
144
+						extract( $image_sizes[ 'small' ] );
145 145
 						break;
146 146
 					case 'm':
147 147
 					case 'medium':
148
-						extract($image_sizes['medium']);
148
+						extract( $image_sizes[ 'medium' ] );
149 149
 						break;
150 150
 					case 'large':
151 151
 					case 'l':
152
-						extract($image_sizes['large']);
152
+						extract( $image_sizes[ 'large' ] );
153 153
 						break;
154 154
 					default:
155 155
 						// Verify that the passed sizes are integers.
156
-						$width = !empty( $width ) ? intval( $width ) : intval( $this->width );
157
-						$height = !empty( $height ) ? intval( $height ) : intval( $this->height );
156
+						$width = ! empty( $width ) ? intval( $width ) : intval( $this->width );
157
+						$height = ! empty( $height ) ? intval( $height ) : intval( $this->height );
158 158
 				}
159 159
 
160 160
 			}
Please login to merge, or discard this patch.
includes/class-gravityview-logging.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 		add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 );
13 13
 
14 14
 		// Enable debug with Gravity Forms Logging Add-on
15
-	    add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) );
15
+		add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) );
16 16
 
17
-	    // Load Debug Bar integration
18
-	    add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) );
17
+		// Load Debug Bar integration
18
+		add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) );
19 19
 
20 20
 	}
21 21
 
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param array $supported_plugins List of plugins
45 45
 	 */
46 46
 	public function enable_gform_logging( $supported_plugins ) {
47
-	    $supported_plugins['gravityview'] = 'GravityView';
48
-	    return $supported_plugins;
47
+		$supported_plugins['gravityview'] = 'GravityView';
48
+		return $supported_plugins;
49 49
 	}
50 50
 
51 51
 	/**
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 
98 98
 		if ( class_exists("GFLogging") ) {
99 99
 			GFLogging::include_logger();
100
-	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG );
101
-	    }
100
+			GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG );
101
+		}
102 102
 	}
103 103
 
104 104
 	static function log_error( $message = '', $data = null  ) {
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 		}
117 117
 
118 118
 		if ( class_exists("GFLogging") ) {
119
-		    GFLogging::include_logger();
120
-		    GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR );
119
+			GFLogging::include_logger();
120
+			GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR );
121 121
 		}
122 122
 	}
123 123
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 	function __construct() {
9 9
 
10
-		add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 );
10
+		add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 );
11 11
 
12
-		add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 );
12
+		add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 );
13 13
 
14 14
 		// Enable debug with Gravity Forms Logging Add-on
15 15
 	    add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) );
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 			include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' );
35 35
 		}
36 36
 
37
-		$panels[] = new GravityView_Debug_Bar;
37
+		$panels[ ] = new GravityView_Debug_Bar;
38 38
 
39 39
 		return $panels;
40 40
 	}
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param array $supported_plugins List of plugins
45 45
 	 */
46 46
 	public function enable_gform_logging( $supported_plugins ) {
47
-	    $supported_plugins['gravityview'] = 'GravityView';
47
+	    $supported_plugins[ 'gravityview' ] = 'GravityView';
48 48
 	    return $supported_plugins;
49 49
 	}
50 50
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @return string "print_r" or "var_export"
73 73
 	 */
74 74
 	static function get_print_function() {
75
-		if( ob_get_level() > 0 ) {
75
+		if ( ob_get_level() > 0 ) {
76 76
 			$function = 'var_export';
77 77
 		} else {
78 78
 			$function = 'print_r';
@@ -88,36 +88,36 @@  discard block
 block discarded – undo
88 88
 		$notice = array(
89 89
 			'message' => $function( $message, true ),
90 90
 			'data' => $data,
91
-			'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '',
91
+			'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '',
92 92
 		);
93 93
 
94
-		if( !in_array( $notice, self::$notices ) ) {
95
-			self::$notices[] = $notice;
94
+		if ( ! in_array( $notice, self::$notices ) ) {
95
+			self::$notices[ ] = $notice;
96 96
 		}
97 97
 
98
-		if ( class_exists("GFLogging") ) {
98
+		if ( class_exists( "GFLogging" ) ) {
99 99
 			GFLogging::include_logger();
100
-	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG );
100
+	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG );
101 101
 	    }
102 102
 	}
103 103
 
104
-	static function log_error( $message = '', $data = null  ) {
104
+	static function log_error( $message = '', $data = null ) {
105 105
 
106 106
 		$function = self::get_print_function();
107 107
 
108 108
 		$error = array(
109 109
 			'message' => $message,
110 110
 			'data' => $data,
111
-			'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '',
111
+			'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '',
112 112
 		);
113 113
 
114
-		if( !in_array( $error, self::$errors ) ) {
115
-			self::$errors[] = $error;
114
+		if ( ! in_array( $error, self::$errors ) ) {
115
+			self::$errors[ ] = $error;
116 116
 		}
117 117
 
118
-		if ( class_exists("GFLogging") ) {
118
+		if ( class_exists( "GFLogging" ) ) {
119 119
 		    GFLogging::include_logger();
120
-		    GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR );
120
+		    GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::ERROR );
121 121
 		}
122 122
 	}
123 123
 
Please login to merge, or discard this patch.
includes/class-gravityview-migrate.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,8 +180,8 @@
 block discarded – undo
180 180
 
181 181
 					// check widget settings:
182 182
 					//  [search_free] => 1
183
-			        //  [search_date] => 1
184
-			        $search_generic = array();
183
+					//  [search_date] => 1
184
+					$search_generic = array();
185 185
 					if( !empty( $widget['search_free'] ) ) {
186 186
 						$search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' );
187 187
 					}
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 		$redux_settings = $this->get_redux_settings();
52 52
 
53 53
 		// No need to process
54
-		if( false === $redux_settings ) {
54
+		if ( false === $redux_settings ) {
55 55
 			return;
56 56
 		}
57 57
 
58
-		if( empty(  $redux_settings['license_key_status'] ) ) {
58
+		if ( empty( $redux_settings[ 'license_key_status' ] ) ) {
59 59
 			$redux_settings = $this->get_redux_license_status( $redux_settings );
60 60
 		}
61 61
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 		GravityView_Settings::get_instance()->update_app_settings( $updated_settings );
70 70
 
71 71
 		// And now remove the previous option, so this is a one-time thing.
72
-		delete_option('gravityview_settings');
73
-		delete_option('gravityview_settings-transients');
72
+		delete_option( 'gravityview_settings' );
73
+		delete_option( 'gravityview_settings-transients' );
74 74
 	}
75 75
 
76 76
 	/**
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 
87 87
 		$data = array(
88 88
 			'edd_action' => 'check_license',
89
-			'license' => rgget('license_key', $redux_settings ),
89
+			'license' => rgget( 'license_key', $redux_settings ),
90 90
 			'update' => false,
91 91
 			'format' => 'object',
92 92
 		);
93 93
 
94 94
 		$license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data );
95 95
 
96
-		if( is_object( $license_call ) && isset( $license_call->license ) ) {
97
-			$redux_settings['license_key_status'] = $license_call->license;
98
-			$redux_settings['license_key_response'] = json_encode( $license_call );
96
+		if ( is_object( $license_call ) && isset( $license_call->license ) ) {
97
+			$redux_settings[ 'license_key_status' ] = $license_call->license;
98
+			$redux_settings[ 'license_key_response' ] = json_encode( $license_call );
99 99
 		}
100 100
 
101 101
 		return $redux_settings;
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	function get_redux_settings() {
110 110
 
111 111
 		// Previous settings set by Redux
112
-		$redux_option = get_option('gravityview_settings');
112
+		$redux_option = get_option( 'gravityview_settings' );
113 113
 
114 114
 		// No Redux settings? Don't proceed.
115
-		if( false === $redux_option ) {
115
+		if ( false === $redux_option ) {
116 116
 			return false;
117 117
 		}
118 118
 
@@ -122,21 +122,21 @@  discard block
 block discarded – undo
122 122
 			'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ),
123 123
 		);
124 124
 
125
-		if( $license_array = rgget( 'license', $redux_option ) ) {
125
+		if ( $license_array = rgget( 'license', $redux_option ) ) {
126 126
 
127
-			$redux_settings['license_key'] = $license_key = rgget( 'license', $license_array );
127
+			$redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array );
128 128
 
129
-			$redux_last_changed_values = get_option('gravityview_settings-transients');
129
+			$redux_last_changed_values = get_option( 'gravityview_settings-transients' );
130 130
 
131 131
 			// This contains the last response for license validation
132
-			if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) {
132
+			if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) {
133 133
 
134
-				$saved_license = rgget('license', $saved_values );
134
+				$saved_license = rgget( 'license', $saved_values );
135 135
 
136 136
 				// Only use the last-saved values if they are for the same license
137
-				if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) {
138
-					$redux_settings['license_key_status'] = rgget( 'status', $saved_license );
139
-					$redux_settings['license_key_response'] = rgget( 'response', $saved_license );
137
+				if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) {
138
+					$redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license );
139
+					$redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license );
140 140
 				}
141 141
 			}
142 142
 		}
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	/** ----  Migrate from old search widget to new search widget  ---- */
149 149
 	function update_search_on_views() {
150 150
 
151
-		if( !class_exists('GravityView_Widget_Search') ) {
152
-			include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' );
151
+		if ( ! class_exists( 'GravityView_Widget_Search' ) ) {
152
+			include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' );
153 153
 		}
154 154
 
155 155
 		// Loop through all the views
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
 
162 162
 		$views = get_posts( $query_args );
163 163
 
164
-		foreach( $views as $view ) {
164
+		foreach ( $views as $view ) {
165 165
 
166 166
 			$widgets = get_post_meta( $view->ID, '_gravityview_directory_widgets', true );
167 167
 			$search_fields = null;
168 168
 
169
-			if( empty( $widgets ) || !is_array( $widgets ) ) { continue; }
169
+			if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; }
170 170
 
171 171
 			do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID );
172 172
 
173
-			foreach( $widgets as $area => $ws ) {
174
-				foreach( $ws as $k => $widget ) {
175
-					if( $widget['id'] !== 'search_bar' ) { continue; }
173
+			foreach ( $widgets as $area => $ws ) {
174
+				foreach ( $ws as $k => $widget ) {
175
+					if ( $widget[ 'id' ] !== 'search_bar' ) { continue; }
176 176
 
177
-					if( is_null( $search_fields ) ) {
177
+					if ( is_null( $search_fields ) ) {
178 178
 						$search_fields = $this->get_search_fields( $view->ID );
179 179
 					}
180 180
 
@@ -182,24 +182,24 @@  discard block
 block discarded – undo
182 182
 					//  [search_free] => 1
183 183
 			        //  [search_date] => 1
184 184
 			        $search_generic = array();
185
-					if( !empty( $widget['search_free'] ) ) {
186
-						$search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' );
185
+					if ( ! empty( $widget[ 'search_free' ] ) ) {
186
+						$search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' );
187 187
 					}
188
-					if( !empty( $widget['search_date'] ) ) {
189
-						$search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' );
188
+					if ( ! empty( $widget[ 'search_date' ] ) ) {
189
+						$search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' );
190 190
 					}
191 191
 
192 192
 					$search_config = array_merge( $search_generic, $search_fields );
193 193
 
194 194
 					// don't throw '[]' when json_encode an empty array
195
-					if( empty( $search_config ) ) {
195
+					if ( empty( $search_config ) ) {
196 196
 						$search_config = '';
197 197
 					} else {
198 198
 						$search_config = json_encode( $search_config );
199 199
 					}
200 200
 
201
-					$widgets[ $area ][ $k ]['search_fields'] = $search_config;
202
-					$widgets[ $area ][ $k ]['search_layout'] = 'horizontal';
201
+					$widgets[ $area ][ $k ][ 'search_fields' ] = $search_config;
202
+					$widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal';
203 203
 
204 204
 					do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] );
205 205
 				}
@@ -227,26 +227,26 @@  discard block
 block discarded – undo
227 227
 		// check view fields' settings
228 228
 		$fields = get_post_meta( $view_id, '_gravityview_directory_fields', true );
229 229
 
230
-		if( !empty( $fields ) && is_array( $fields ) ) {
230
+		if ( ! empty( $fields ) && is_array( $fields ) ) {
231 231
 
232
-			foreach( $fields as $t => $fs ) {
232
+			foreach ( $fields as $t => $fs ) {
233 233
 
234
-				foreach( $fs as $k => $field ) {
234
+				foreach ( $fs as $k => $field ) {
235 235
 					// is field a search_filter ?
236
-					if( empty( $field['search_filter'] ) ) { continue; }
236
+					if ( empty( $field[ 'search_filter' ] ) ) { continue; }
237 237
 
238 238
 					// get field type & calculate the input type (by default)
239
-					$form_field = gravityview_get_field( $form, $field['id'] );
239
+					$form_field = gravityview_get_field( $form, $field[ 'id' ] );
240 240
 
241
-					if( empty( $form_field['type'] ) ) {
241
+					if ( empty( $form_field[ 'type' ] ) ) {
242 242
 						continue;
243 243
 					}
244 244
 
245 245
 					// depending on the field type assign a group of possible search field types
246
-					$type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] );
246
+					$type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] );
247 247
 
248 248
 					// add field to config
249
-					$search_fields[] = array( 'field' => $field['id'], 'input' => $type );
249
+					$search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type );
250 250
 
251 251
 				}
252 252
 			}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/partials/form-buttons.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
 <div id="publishing-action">
8 8
 	<?php
9 9
 
10
-    /**
11
-     * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
12
-     * @since 1.11.1
13
-     * @param string $back_link Existing URL of the Cancel link
14
-     * @param array $form The Gravity Forms form
15
-     * @param array $entry The Gravity Forms entry
16
-     * @param int $view_id The current View ID
17
-     */
18
-    $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
10
+	/**
11
+	 * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
12
+	 * @since 1.11.1
13
+	 * @param string $back_link Existing URL of the Cancel link
14
+	 * @param array $form The Gravity Forms form
15
+	 * @param array $entry The Gravity Forms entry
16
+	 * @param int $view_id The current View ID
17
+	 */
18
+	$back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
19 19
 
20 20
 	/**
21 21
 	 * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container.
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 	$labels = array(
31 31
 		'cancel' => __( 'Cancel', 'gravityview' ),
32
-		'submit' => __( 'Update', 'gravityview')
32
+		'submit' => __( 'Update', 'gravityview' )
33 33
 	);
34 34
 
35 35
 	/**
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $object->form, $object->entry, $object->view_id );
44 44
 
45 45
 	?>
46
-	<input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" />
46
+	<input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" />
47 47
 
48
-	<a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a>
48
+	<a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a>
49 49
 	<?php
50 50
 
51 51
 	/**
@@ -59,5 +59,5 @@  discard block
 block discarded – undo
59 59
 
60 60
 	?>
61 61
 	<input type="hidden" name="action" value="update" />
62
-	<input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" />
62
+	<input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" />
63 63
 </div>
Please login to merge, or discard this patch.