Completed
Pull Request — master (#747)
by Steve
19:06
created
includes/admin/field-types/type_hidden.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 			return;
16 16
 		}
17 17
 
18
-        $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
18
+		$class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
19 19
 
20 20
 		?>
21 21
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" />
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
 
11 11
 	function render_input( $override_input = null ) {
12 12
 
13
-		if( isset( $override_input ) ) {
13
+		if ( isset( $override_input ) ) {
14 14
 			echo $override_input;
15 15
 			return;
16 16
 		}
17 17
 
18
-        $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
18
+        $class = ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat';
19 19
 
20 20
 		?>
21 21
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" />
Please login to merge, or discard this patch.
includes/admin/field-types/type_text.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32
-            $class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
33
-        }
34
-        $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
31
+		if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32
+			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
33
+		}
34
+		$class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
35 35
 
36 36
 		?>
37 37
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>">
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		?>
9 9
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
10 10
 
11
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
11
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
12 12
 			echo $this->get_tooltip() . $this->get_field_desc();
13 13
 		?><div>
14 14
 				<?php $this->render_input(); ?>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	function render_input( $override_input = null ) {
21 21
 
22
-		if( isset( $override_input ) ) {
22
+		if ( isset( $override_input ) ) {
23 23
 			echo $override_input;
24 24
 			return;
25 25
 		}
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
31
+        if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
32 32
             $class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
33 33
         }
34
-        $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
34
+        $class .= ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat';
35 35
 
36 36
 		?>
37 37
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>">
Please login to merge, or discard this patch.
includes/admin/field-types/type_textarea.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32
-            $class = ' merge-tag-support mt-position-right ';
33
-
34
-            if( empty( $this->field['show_all_fields'] ) ) {
35
-            	$class .= ' mt-hide_all_fields';
36
-            }
37
-        }
38
-        $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat';
31
+		if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32
+			$class = ' merge-tag-support mt-position-right ';
33
+
34
+			if( empty( $this->field['show_all_fields'] ) ) {
35
+				$class .= ' mt-hide_all_fields';
36
+			}
37
+		}
38
+		$class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat';
39 39
 
40 40
 		?>
41 41
 		<textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea(  $this->value ); ?></textarea>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 		?>
10 10
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
11 11
 
12
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
12
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
13 13
 			echo $this->get_tooltip() . $this->get_field_desc();
14 14
 		?><div>
15 15
 				<?php $this->render_input(); ?>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	}
20 20
 
21 21
 	function render_input( $override_input = null ) {
22
-		if( isset( $override_input ) ) {
22
+		if ( isset( $override_input ) ) {
23 23
 			echo $override_input;
24 24
 			return;
25 25
 		}
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
31
+        if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
32 32
             $class = ' merge-tag-support mt-position-right ';
33 33
 
34
-            if( empty( $this->field['show_all_fields'] ) ) {
34
+            if ( empty( $this->field[ 'show_all_fields' ] ) ) {
35 35
             	$class .= ' mt-hide_all_fields';
36 36
             }
37 37
         }
38
-        $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat';
38
+        $class .= ! empty( $this->field[ 'class' ] ) ? 'widefat ' . $this->field[ 'class' ] : 'widefat';
39 39
 
40 40
 		?>
41
-		<textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea(  $this->value ); ?></textarea>
41
+		<textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea>
42 42
        	<?php
43 43
 	}
44 44
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/class-gravityview-admin-metaboxes.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 		if( !GravityView_Compatibility::is_valid() ) { return; }
16 16
 
17
-        self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/';
17
+		self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/';
18 18
 
19 19
 		include_once self::$metaboxes_dir . 'class-gravityview-metabox-tab.php';
20 20
 
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
 		$get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL;
229 229
 
230 230
 		if( isset( $form['id'] ) ) {
231
-		    $form_script = 'var form = ' . GFCommon::json_encode($form) . ';';
231
+			$form_script = 'var form = ' . GFCommon::json_encode($form) . ';';
232 232
 
233
-		    // The `gf_vars()` method needs a $_GET[id] variable set with the form ID.
234
-		    $_GET['id'] = $form['id'];
233
+			// The `gf_vars()` method needs a $_GET[id] variable set with the form ID.
234
+			$_GET['id'] = $form['id'];
235 235
 
236 236
 		} else {
237
-		    $form_script = 'var form = new Form();';
237
+			$form_script = 'var form = new Form();';
238 238
 		}
239 239
 
240 240
 		$output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>';
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	function __construct() {
19 19
 
20
-		if( !GravityView_Compatibility::is_valid() ) { return; }
20
+		if ( ! GravityView_Compatibility::is_valid() ) { return; }
21 21
 
22 22
         self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/';
23 23
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	function initialize() {
37 37
 
38
-		add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' ));
38
+		add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' ) );
39 39
 
40
-		add_action( 'add_meta_boxes_gravityview' , array( $this, 'update_priority' ) );
40
+		add_action( 'add_meta_boxes_gravityview', array( $this, 'update_priority' ) );
41 41
 
42 42
 		// information box
43 43
 		add_action( 'post_submitbox_misc_actions', array( $this, 'render_shortcode_hint' ) );
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	function update_priority() {
52 52
 		global $wp_meta_boxes;
53 53
 
54
-		if( ! empty( $wp_meta_boxes['gravityview'] ) ) {
55
-			foreach( array( 'high', 'core', 'low' ) as $position ) {
56
-				if( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) {
57
-					foreach( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) {
58
-						if( ! preg_match( '/^gravityview_/ism', $key ) ) {
59
-							$wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box;
60
-							unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] );
54
+		if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) {
55
+			foreach ( array( 'high', 'core', 'low' ) as $position ) {
56
+				if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) {
57
+					foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) {
58
+						if ( ! preg_match( '/^gravityview_/ism', $key ) ) {
59
+							$wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box;
60
+							unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] );
61 61
 						}
62 62
 					}
63 63
 				}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		global $post;
70 70
 
71 71
 		// On Comment Edit, for example, $post isn't set.
72
-		if( empty( $post ) || !is_object( $post ) || !isset( $post->ID ) ) {
72
+		if ( empty( $post ) || ! is_object( $post ) || ! isset( $post->ID ) ) {
73 73
 			return;
74 74
 		}
75 75
 
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 		 */
153 153
 		$metaboxes = apply_filters( 'gravityview/metaboxes/default', $metaboxes );
154 154
 
155
-		foreach( $metaboxes as $m ) {
155
+		foreach ( $metaboxes as $m ) {
156 156
 
157
-			$tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] );
157
+			$tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] );
158 158
 
159 159
 			GravityView_Metabox_Tabs::add( $tab );
160 160
 
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 
181 181
 		$links = GravityView_Admin_Views::get_connected_form_links( $current_form, false );
182 182
 
183
-		if( !empty( $links ) ) {
184
-			$links = '<span class="alignright gv-form-links">'. $links .'</span>';
183
+		if ( ! empty( $links ) ) {
184
+			$links = '<span class="alignright gv-form-links">' . $links . '</span>';
185 185
 		}
186 186
 
187 187
 		return __( 'Data Source', 'gravityview' ) . $links;
@@ -220,28 +220,28 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	public static function render_merge_tags_scripts( $curr_form ) {
222 222
 
223
-		if( empty( $curr_form )) {
223
+		if ( empty( $curr_form ) ) {
224 224
 			return NULL;
225 225
 		}
226 226
 
227 227
 		$form = gravityview_get_form( $curr_form );
228 228
 
229
-		$get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL;
229
+		$get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : NULL;
230 230
 
231
-		if( isset( $form['id'] ) ) {
232
-		    $form_script = 'var form = ' . GFCommon::json_encode($form) . ';';
231
+		if ( isset( $form[ 'id' ] ) ) {
232
+		    $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';';
233 233
 
234 234
 		    // The `gf_vars()` method needs a $_GET[id] variable set with the form ID.
235
-		    $_GET['id'] = $form['id'];
235
+		    $_GET[ 'id' ] = $form[ 'id' ];
236 236
 
237 237
 		} else {
238 238
 		    $form_script = 'var form = new Form();';
239 239
 		}
240 240
 
241
-		$output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>';
241
+		$output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>';
242 242
 
243 243
 		// Restore previous $_GET setting
244
-		$_GET['id'] = $get_id_backup;
244
+		$_GET[ 'id' ] = $get_id_backup;
245 245
 
246 246
 		return $output;
247 247
 	}
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 		global $post;
298 298
 
299 299
 		// Only show this on GravityView post types.
300
-		if( false === gravityview_is_admin_page() ) { return; }
300
+		if ( false === gravityview_is_admin_page() ) { return; }
301 301
 
302 302
 		// If the View hasn't been configured yet, don't show embed shortcode
303
-		if( !gravityview_get_directory_fields( $post->ID ) ) { return; }
303
+		if ( ! gravityview_get_directory_fields( $post->ID ) ) { return; }
304 304
 
305 305
 		include self::$metaboxes_dir . 'views/shortcode-hint.php';
306 306
 	}
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 4 patches
Braces   +3 added lines, -9 removed lines patch added patch discarded remove patch
@@ -432,23 +432,17 @@
 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.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 
364 364
 		$approvedcolumn = self::get_approved_column( $form['id'] );
365 365
 
366
-        /**
367
-         * If the form doesn't contain the approve field, don't assume anything.
368
-         */
369
-        if( empty( $approvedcolumn ) ) {
370
-            return;
371
-        }
366
+		/**
367
+		 * If the form doesn't contain the approve field, don't assume anything.
368
+		 */
369
+		if( empty( $approvedcolumn ) ) {
370
+			return;
371
+		}
372 372
 
373 373
 		$entry = GFAPI::get_entry( $entry_id );
374 374
 
@@ -481,17 +481,17 @@  discard block
 block discarded – undo
481 481
 	 */
482 482
 	static public function get_approved_column( $form ) {
483 483
 
484
-        if( empty( $form ) ) {
485
-            return null;
486
-        }
484
+		if( empty( $form ) ) {
485
+			return null;
486
+		}
487 487
 
488
-        if( !is_array( $form ) ) {
489
-            $form = GVCommon::get_form( $form );
490
-        }
488
+		if( !is_array( $form ) ) {
489
+			$form = GVCommon::get_form( $form );
490
+		}
491 491
 
492 492
 		foreach( $form['fields'] as $key => $field ) {
493 493
 
494
-            $field = (array) $field;
494
+			$field = (array) $field;
495 495
 
496 496
 			if( !empty( $field['gravityview_approved'] ) ) {
497 497
 				if( !empty($field['inputs'][0]['id']) ) {
@@ -499,14 +499,14 @@  discard block
 block discarded – undo
499 499
 				}
500 500
 			}
501 501
 
502
-            // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
503
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
504
-                foreach ( $field['inputs'] as $key2 => $input ) {
505
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
506
-                        return $input['id'];
507
-                    }
508
-                }
509
-            }
502
+			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
503
+			if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
504
+				foreach ( $field['inputs'] as $key2 => $input ) {
505
+					if ( strtolower( $input['label'] ) == 'approved' ) {
506
+						return $input['id'];
507
+					}
508
+				}
509
+			}
510 510
 		}
511 511
 
512 512
 		return null;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @uses  GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request.
277 277
 	 * @access public
278
-	 * @return void|boolean
278
+	 * @return false|null
279 279
 	 */
280 280
 	public function process_bulk_action() {
281 281
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries.
361 361
 	 * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved`
362 362
 	 * @param int $form_id The Gravity Forms Form ID
363
-	 * @return boolean|void
363
+	 * @return false|null
364 364
 	 */
365 365
 	private static function update_bulk( $entries, $approved, $form_id ) {
366 366
 
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	 * @access public
610 610
 	 * @static
611 611
 	 * @param mixed $form GF Form or Form ID
612
-	 * @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.
612
+	 * @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.
613 613
 	 */
614 614
 	static public function get_approved_column( $form ) {
615 615
 
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 		/** gf_entries page - entries table screen */
44 44
 
45 45
 		// capture bulk actions
46
-		add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
46
+		add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) );
47 47
 
48 48
 		// add hidden field with approve status
49 49
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
50 50
 
51 51
 		// process ajax approve entry requests
52
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
52
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
53 53
 
54 54
 		// when using the User opt-in field, check on entry submission
55 55
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
56 56
 
57 57
 		// in case entry is edited (on admin or frontend)
58
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
58
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
59 59
 
60 60
 
61 61
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
62 62
 
63 63
 		// adding styles and scripts
64
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
64
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
65 65
 		// bypass Gravity Forms no-conflict mode
66 66
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
67 67
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		 * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
91 91
 		 * @param array $form GF Form object of current form
92 92
 		 */
93
-		if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
93
+		if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
94 94
 			return $filter_links;
95 95
 		}
96 96
 
@@ -111,19 +111,19 @@  discard block
 block discarded – undo
111 111
 		$approved_count = $disapproved_count = 0;
112 112
 
113 113
 		// Only count if necessary
114
-		if( $include_counts ) {
115
-			$approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
116
-			$disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
114
+		if ( $include_counts ) {
115
+			$approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
116
+			$disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
117 117
 		}
118 118
 
119
-		$filter_links[] = array(
119
+		$filter_links[ ] = array(
120 120
 			'id'            => 'gv_approved',
121 121
 			'field_filters' => $field_filters_approved,
122 122
 			'count'         => $approved_count,
123 123
 			'label'         => esc_html__( 'Approved', 'gravityview' ),
124 124
 		);
125 125
 
126
-		$filter_links[] = array(
126
+		$filter_links[ ] = array(
127 127
 			'id'            => 'gv_disapproved',
128 128
 			'field_filters' => $field_filters_disapproved,
129 129
 			'count'         => $disapproved_count,
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	function tooltips( $tooltips ) {
144 144
 
145
-		$tooltips['form_gravityview_fields'] = array(
146
-			'title' => __('GravityView Fields', 'gravityview'),
147
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
145
+		$tooltips[ 'form_gravityview_fields' ] = array(
146
+			'title' => __( 'GravityView Fields', 'gravityview' ),
147
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
148 148
 		);
149 149
 
150 150
 		return $tooltips;
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$gv_bulk_action = false;
257 257
 
258
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
259
-			$bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2');
258
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
259
+			$bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' );
260 260
 		} else {
261 261
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
262
-			$bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2');
262
+			$bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' );
263 263
 		}
264 264
 
265 265
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
266
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
266
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
267 267
 			$gv_bulk_action = $bulk_action;
268 268
 		}
269 269
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		
289 289
 		// gforms_entry_list is the nonce that confirms we're on the right page
290 290
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
291
-		if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) {
291
+		if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
292 292
 
293 293
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
294 294
 
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
 			}
307 307
 
308 308
 			// All entries are set to be updated, not just the visible ones
309
-			if ( ! empty( $_POST['all_entries'] ) ) {
309
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
310 310
 
311 311
 				// Convert the current entry search into GF-formatted search criteria
312 312
 				$search = array(
313
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
314
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
315
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
313
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
314
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
315
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
316 316
 				);
317 317
 
318 318
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			} else {
324 324
 
325 325
 				// Changed from 'lead' to 'entry' in 2.0
326
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
326
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
327 327
 
328 328
 			}
329 329
 
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
336 336
 
337 337
 			switch ( $approved_status ) {
338
-				case $this->bulk_action_prefixes['approve']:
338
+				case $this->bulk_action_prefixes[ 'approve' ]:
339 339
 					self::update_bulk( $entries, 1, $form_id );
340 340
 					$this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
341 341
 					break;
342 342
 
343
-				case $this->bulk_action_prefixes['unapprove']:
343
+				case $this->bulk_action_prefixes[ 'unapprove' ]:
344 344
 					self::update_bulk( $entries, 0, $form_id );
345 345
 					$this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
346 346
 					break;
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	private static function update_bulk( $entries, $approved, $form_id ) {
366 366
 
367
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
367
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
368 368
 			do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries );
369 369
 			return false;
370 370
 		}
371 371
 
372
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
372
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
373 373
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
374 374
 			return false;
375 375
 		}
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		// calculate approved field id once instead of looping through in the update_approved() method
380 380
 		$approved_column_id = self::get_approved_column( $form_id );
381 381
 
382
-		foreach( $entries as $entry_id ) {
382
+		foreach ( $entries as $entry_id ) {
383 383
 			self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
384 384
 		}
385 385
 	}
@@ -398,14 +398,14 @@  discard block
 block discarded – undo
398 398
 	 * @param int $approvedcolumn (default: 0)
399 399
 	 * @return boolean True: It worked; False: it failed
400 400
 	 */
401
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
401
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
402 402
 
403
-		if( !class_exists( 'GFAPI' ) ) {
403
+		if ( ! class_exists( 'GFAPI' ) ) {
404 404
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
405 405
 			return false;
406 406
 		}
407 407
 
408
-		if( empty( $approvedcolumn ) ) {
408
+		if ( empty( $approvedcolumn ) ) {
409 409
 			$approvedcolumn = self::get_approved_column( $form_id );
410 410
 		}
411 411
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		self::update_approved_meta( $entry_id, $approved, $form_id );
425 425
 
426 426
 		// add note to entry
427
-		if( $result === true ) {
427
+		if ( $result === true ) {
428 428
 
429 429
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
430 430
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			 */
436 436
 			$add_note = apply_filters( 'gravityview/approve_entries/add-note', true );
437 437
 
438
-			if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
438
+			if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
439 439
 				$current_user = wp_get_current_user();
440 440
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
441 441
 			}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			 */
448 448
 			do_action( 'gravityview_clear_form_cache', $form_id );
449 449
 
450
-		} else if( is_wp_error( $result ) ) {
450
+		} else if ( is_wp_error( $result ) ) {
451 451
 
452 452
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
453 453
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	 * @param $form array Gravity Forms form object
469 469
 	 */
470 470
 	public function after_submission( $entry, $form ) {
471
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
471
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
472 472
 	}
473 473
 
474 474
 
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
486 486
 
487
-		$approvedcolumn = self::get_approved_column( $form['id'] );
487
+		$approvedcolumn = self::get_approved_column( $form[ 'id' ] );
488 488
 
489 489
         /**
490 490
          * If the form doesn't contain the approve field, don't assume anything.
491 491
          */
492
-        if( empty( $approvedcolumn ) ) {
492
+        if ( empty( $approvedcolumn ) ) {
493 493
             return;
494 494
         }
495 495
 
496 496
 		$entry = GFAPI::get_entry( $entry_id );
497 497
 
498
-		self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form['id'] );
498
+		self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form[ 'id' ] );
499 499
 
500 500
 	}
501 501
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		$is_approved = empty( $is_approved ) ? 0 : 'Approved';
521 521
 
522 522
 		// update entry meta
523
-		if( function_exists('gform_update_meta') ) {
523
+		if ( function_exists( 'gform_update_meta' ) ) {
524 524
 
525 525
 			gform_update_meta( $entry_id, 'is_approved', $is_approved, $form_id );
526 526
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 			 */
533 533
 			do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved );
534 534
 
535
-			if( empty( $is_approved ) ) {
535
+			if ( empty( $is_approved ) ) {
536 536
 
537 537
 				/**
538 538
 				 * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
 		} else {
556 556
 
557
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
557
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
558 558
 
559 559
 		}
560 560
 	}
@@ -566,21 +566,21 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	public function ajax_update_approved() {
568 568
 
569
-		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) {
569
+		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) {
570 570
 
571 571
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
572 572
 
573 573
 			$result = false;
574 574
 		}
575 575
 
576
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
576
+		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) {
577 577
 
578 578
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
579 579
 
580 580
 			$result = false;
581 581
 		}
582 582
 
583
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
583
+		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) {
584 584
 
585 585
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
586 586
 
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
 
590 590
 		else {
591 591
 
592
-			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
592
+			$result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] );
593 593
 
594
-			if( is_wp_error( $result ) ) {
594
+			if ( is_wp_error( $result ) ) {
595 595
 				/** @var WP_Error $result */
596
-				do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() );
596
+				do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() );
597 597
 				$result = false;
598 598
 			}
599 599
 
@@ -613,29 +613,29 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	static public function get_approved_column( $form ) {
615 615
 
616
-        if( empty( $form ) ) {
616
+        if ( empty( $form ) ) {
617 617
             return null;
618 618
         }
619 619
 
620
-        if( !is_array( $form ) ) {
620
+        if ( ! is_array( $form ) ) {
621 621
             $form = GVCommon::get_form( $form );
622 622
         }
623 623
 
624
-		foreach( $form['fields'] as $key => $field ) {
624
+		foreach ( $form[ 'fields' ] as $key => $field ) {
625 625
 
626
-            $field = (array) $field;
626
+            $field = (array)$field;
627 627
 
628
-			if( !empty( $field['gravityview_approved'] ) ) {
629
-				if( !empty($field['inputs'][0]['id']) ) {
630
-					return $field['inputs'][0]['id'];
628
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
629
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
630
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
631 631
 				}
632 632
 			}
633 633
 
634 634
             // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
635
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
636
-                foreach ( $field['inputs'] as $key2 => $input ) {
637
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
638
-                        return $input['id'];
635
+            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
636
+                foreach ( $field[ 'inputs' ] as $key2 => $input ) {
637
+                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
638
+                        return $input[ 'id' ];
639 639
                     }
640 640
                 }
641 641
             }
@@ -657,18 +657,18 @@  discard block
 block discarded – undo
657 657
 	 *
658 658
 	 * @return void
659 659
 	 */
660
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
660
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
661 661
 
662
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
662
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
663 663
 			return;
664 664
 		}
665 665
 
666
-		if( empty( $entry['id'] ) ) {
666
+		if ( empty( $entry[ 'id' ] ) ) {
667 667
 			return;
668 668
 		}
669 669
 
670
-		if( gform_get_meta( $entry['id'], 'is_approved' ) ) {
671
-			echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />';
670
+		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
671
+			echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />';
672 672
 		}
673 673
 	}
674 674
 
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
 	 */
682 682
 	private function get_form_id() {
683 683
 
684
-		$form_id = GFForms::get('id');
684
+		$form_id = GFForms::get( 'id' );
685 685
 
686 686
 		// If there are no forms identified, use the first form. That's how GF does it.
687
-		if( empty( $form_id ) && class_exists('RGFormsModel') ) {
687
+		if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
688 688
 			$form_id = $this->get_first_form_id();
689 689
 		}
690 690
 
@@ -704,14 +704,14 @@  discard block
 block discarded – undo
704 704
 
705 705
 		$forms = RGFormsModel::get_forms( null, 'title' );
706 706
 
707
-		if( ! isset( $forms[0] ) ) {
707
+		if ( ! isset( $forms[ 0 ] ) ) {
708 708
 			do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' );
709 709
 			return 0;
710 710
 		}
711 711
 
712
-		$first_form = $forms[0];
712
+		$first_form = $forms[ 0 ];
713 713
 
714
-		$form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
714
+		$form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ];
715 715
 
716 716
 		return intval( $form_id );
717 717
 	}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 
720 720
 	function add_scripts_and_styles( $hook ) {
721 721
 
722
-		if( ! class_exists( 'RGForms' ) ) {
722
+		if ( ! class_exists( 'RGForms' ) ) {
723 723
 
724 724
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
725 725
 
@@ -728,34 +728,34 @@  discard block
 block discarded – undo
728 728
 
729 729
 		// enqueue styles & scripts gf_entries
730 730
 		// But only if we're on the main Entries page, not on reports pages
731
-		if( GFForms::get_page() !== 'entry_list' ) {
731
+		if ( GFForms::get_page() !== 'entry_list' ) {
732 732
 			return;
733 733
 		}
734 734
 
735 735
 		$form_id = $this->get_form_id();
736 736
 
737 737
 		// Things are broken; no forms were found
738
-		if( empty( $form_id ) ) {
738
+		if ( empty( $form_id ) ) {
739 739
 			return;
740 740
 		}
741 741
 
742
-		wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
742
+		wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
743 743
 
744
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
744
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
745 745
 
746
-		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
746
+		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
747 747
 
748 748
 		wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
749
-			'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'),
749
+			'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ),
750 750
 			'form_id' => $form_id,
751 751
 			'show_column' => (int)$this->show_approve_entry_column( $form_id ),
752 752
 			'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
753 753
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
754 754
 			'bulk_message' => $this->bulk_update_message,
755
-			'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'),
756
-			'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'),
757
-			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
758
-			'column_link' => esc_url( add_query_arg( array('sort' => self::get_approved_column( $form_id ) ) ) ),
755
+			'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ),
756
+			'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ),
757
+			'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
758
+			'column_link' => esc_url( add_query_arg( array( 'sort' => self::get_approved_column( $form_id ) ) ) ),
759 759
 		) );
760 760
 
761 761
 	}
@@ -775,11 +775,11 @@  discard block
 block discarded – undo
775 775
 			'GravityView' => array(
776 776
 				array(
777 777
 					'label' => __( 'Approve', 'gravityview' ),
778
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
778
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ),
779 779
 				),
780 780
 				array(
781 781
 					'label' => __( 'Disapprove', 'gravityview' ),
782
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
782
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ),
783 783
 				),
784 784
 			),
785 785
 		);
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 		// Sanitize the values, just to be sure.
797 797
 		foreach ( $bulk_actions as $key => $group ) {
798 798
 			foreach ( $group as $i => $action ) {
799
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
800
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
799
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
800
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
801 801
 			}
802 802
 		}
803 803
 
@@ -822,13 +822,13 @@  discard block
 block discarded – undo
822 822
 		 * @since 1.7.2
823 823
 		 * @param boolean $hide_if_no_connections
824 824
 		 */
825
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
825
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
826 826
 
827
-		if( $hide_if_no_connections ) {
827
+		if ( $hide_if_no_connections ) {
828 828
 
829 829
 			$connected_views = gravityview_get_connected_views( $form_id );
830 830
 
831
-			if( empty( $connected_views ) ) {
831
+			if ( empty( $connected_views ) ) {
832 832
 				$show_approve_column = false;
833 833
 			}
834 834
 		}
@@ -838,18 +838,18 @@  discard block
 block discarded – undo
838 838
 		 * @param boolean $show_approve_column Whether the column will be shown
839 839
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
840 840
 		 */
841
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
841
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
842 842
 
843 843
 		return $show_approve_column;
844 844
 	}
845 845
 
846 846
 	function register_gform_noconflict_script( $scripts ) {
847
-		$scripts[] = 'gravityview_gf_entries_scripts';
847
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
848 848
 		return $scripts;
849 849
 	}
850 850
 
851 851
 	function register_gform_noconflict_style( $styles ) {
852
-		$styles[] = 'gravityview_entries_list';
852
+		$styles[ ] = 'gravityview_entries_list';
853 853
 		return $styles;
854 854
 	}
855 855
 
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.