Completed
Pull Request — master (#641)
by Zack
23:52 queued 19:59
created
includes/admin/metaboxes/views/select-template.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @file select-template.php
4
- * @package GravityView
5
- * @subpackage Gravityview/admin/metaboxes/partials
6
- * @global WP_Post $post
7
- */
3
+	 * @file select-template.php
4
+	 * @package GravityView
5
+	 * @subpackage Gravityview/admin/metaboxes/partials
6
+	 * @global WP_Post $post
7
+	 */
8 8
 
9 9
 global $post;
10 10
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,27 +22,27 @@
 block discarded – undo
22 22
 
23 23
 <?php // list all the available templates (type= fresh or custom ) ?>
24 24
 <div class="gv-grid">
25
-	<?php foreach( $templates as $id => $template ) {
25
+	<?php foreach ( $templates as $id => $template ) {
26 26
 		$selected = ( $id == $current_template ) ? ' gv-selected' : ''; ?>
27 27
 
28 28
 		<div class="gv-grid-col-1-3">
29
-			<div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>">
29
+			<div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>">
30 30
 				<div class="gv-view-types-hover">
31 31
 					<div>
32
-						<?php if( !empty( $template['buy_source'] ) ) { ?>
33
-							<p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p>
32
+						<?php if ( ! empty( $template[ 'buy_source' ] ) ) { ?>
33
+							<p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p>
34 34
 						<?php } else { ?>
35
-							<p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p>
36
-							<?php if( !empty( $template['preview'] ) ) { ?>
37
-								<a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a>
35
+							<p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p>
36
+							<?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
37
+								<a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a>
38 38
 							<?php } ?>
39 39
 						<?php } ?>
40 40
 					</div>
41 41
 				</div>
42 42
 				<div class="gv-view-types-normal">
43
-					<img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>">
44
-					<h5><?php echo esc_attr( $template['label'] ); ?></h5>
45
-					<p class="description"><?php echo esc_attr( $template['description'] ); ?></p>
43
+					<img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>">
44
+					<h5><?php echo esc_attr( $template[ 'label' ] ); ?></h5>
45
+					<p class="description"><?php echo esc_attr( $template[ 'description' ] ); ?></p>
46 46
 				</div>
47 47
 			</div>
48 48
 		</div>
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/shortcode-hint.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package GravityView
4
- * @subpackage Gravityview/admin/metaboxes/partials
5
- * @global $post
6
- */
3
+		 * @package GravityView
4
+		 * @subpackage Gravityview/admin/metaboxes/partials
5
+		 * @global $post
6
+		 */
7 7
 
8 8
 global $post;
9 9
 ?>
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/sort-filter.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package GravityView
4
- * @subpackage Gravityview/admin/metaboxes/partials
5
- * @global WP_Post $post
6
- */
3
+	 * @package GravityView
4
+	 * @subpackage Gravityview/admin/metaboxes/partials
5
+	 * @global WP_Post $post
6
+	 */
7 7
 global $post;
8 8
 
9 9
 $curr_form = gravityview_get_form_id( $post->ID );
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	 */
27 27
 	GravityView_Render_Settings::render_setting_row( 'sort_columns', $current_settings );
28 28
 
29
-	$sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">'.gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ).'</select>';
29
+	$sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">' . gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ] ) . '</select>';
30 30
 
31 31
 	GravityView_Render_Settings::render_setting_row( 'sort_field', $current_settings, $sort_fields_input );
32 32
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/view-settings.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package GravityView
4
- * @subpackage Gravityview/admin/metaboxes/views
5
- * @global $post
6
- */
3
+				 * @package GravityView
4
+				 * @subpackage Gravityview/admin/metaboxes/views
5
+				 * @global $post
6
+				 */
7 7
 global $post;
8 8
 
9 9
 $curr_form = gravityview_get_form_id( $post->ID );
Please login to merge, or discard this patch.
includes/class-admin-add-shortcode.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Adds a button to add the View shortcode into the post content
4
- *
5
- * @package   GravityView
6
- * @license   GPL2+
7
- * @author    Katz Web Services, Inc.
8
- * @link      http://gravityview.co
9
- * @copyright Copyright 2014, Katz Web Services, Inc.
10
- *
11
- * @since 1.0.0
12
- */
3
+	 * Adds a button to add the View shortcode into the post content
4
+	 *
5
+	 * @package   GravityView
6
+	 * @license   GPL2+
7
+	 * @author    Katz Web Services, Inc.
8
+	 * @link      http://gravityview.co
9
+	 * @copyright Copyright 2014, Katz Web Services, Inc.
10
+	 *
11
+	 * @since 1.0.0
12
+	 */
13 13
 
14 14
 /** If this file is called directly, abort. */
15 15
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 
21 21
 	function __construct() {
22 22
 
23
-			add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30);
23
+			add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 );
24 24
 
25
-			add_action( 'admin_footer',	array( $this, 'add_shortcode_popup') );
25
+			add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) );
26 26
 
27 27
 			// adding styles and scripts
28
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
28
+			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
29 29
 
30 30
 			// ajax - populate sort fields based on the selected view
31 31
 			add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) );
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	function is_post_editor_screen() {
42 42
 		global $current_screen, $pagenow;
43
-		return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) );
43
+		return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) );
44 44
 	}
45 45
 
46 46
 
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 		/**
56 56
 		 * @since 1.15.3
57 57
 		 */
58
-		if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) {
58
+		if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) {
59 59
 			return;
60 60
 		}
61 61
 
62
-		if( !$this->is_post_editor_screen() ) {
62
+		if ( ! $this->is_post_editor_screen() ) {
63 63
 			return;
64 64
 		}
65 65
 		?>
66
-		<a href="#TB_inline?width=480&amp;inlineId=select_gravityview_view&amp;width=600&amp;height=800" class="thickbox button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a>
66
+		<a href="#TB_inline?width=480&amp;inlineId=select_gravityview_view&amp;width=600&amp;height=800" class="thickbox button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a>
67 67
 		<?php
68 68
 
69 69
 	}
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	function add_shortcode_popup() {
80 80
 		global $post;
81 81
 
82
-		if( !$this->is_post_editor_screen() ) {
82
+		if ( ! $this->is_post_editor_screen() ) {
83 83
 			return;
84 84
 		}
85 85
 
86
-		$post_type = get_post_type_object($post->post_type);
86
+		$post_type = get_post_type_object( $post->post_type );
87 87
 
88
-		$views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) );
88
+		$views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) );
89 89
 
90 90
 		// If there are no views set up yet, we get outta here.
91
-		if( empty( $views ) ) {
92
-			echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>';
91
+		if ( empty( $views ) ) {
92
+			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Post_Types::no_views_text() . '</div></div>';
93 93
 			return;
94 94
 		}
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				<div class="wrap">
100 100
 
101 101
 					<h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2>
102
-					<p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://gravityview.co/support/documentation/202934188/" target="_blank">', '</a>' ); ?></p>
102
+					<p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://gravityview.co/support/documentation/202934188/" target="_blank">', '</a>' ); ?></p>
103 103
 
104 104
 					<div>
105 105
 						<h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3>
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 						<select name="gravityview_id" id="gravityview_id">
108 108
 							<option value=""><?php esc_html_e( '&mdash; Select a View to Insert &mdash;', 'gravityview' ); ?></option>
109 109
 							<?php
110
-							foreach( $views as $view ) {
111
-								$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
112
-								echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
110
+							foreach ( $views as $view ) {
111
+								$title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title;
112
+								echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>';
113 113
 							}
114 114
 							?>
115 115
 						</select>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 						foreach ( $settings as $key => $setting ) {
127 127
 
128
-							if( empty( $setting['show_in_shortcode'] ) ) { continue; }
128
+							if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; }
129 129
 
130 130
 							GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' );
131 131
 						}
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 					</table>
135 135
 
136 136
 					<div class="submit">
137
-						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" />
138
-						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" />
137
+						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" />
138
+						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" />
139 139
 					</div>
140 140
 
141 141
 				</div>
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	function add_scripts_and_styles() {
158 158
 
159
-		if( ! $this->is_post_editor_screen() ) {
159
+		if ( ! $this->is_post_editor_screen() ) {
160 160
 			return;
161 161
 		}
162 162
 
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
 
168 168
 		$protocol = is_ssl() ? 'https://' : 'http://';
169 169
 
170
-		wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version );
170
+		wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version );
171 171
 
172 172
 		//enqueue styles
173
-		wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
173
+		wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
174 174
 		wp_enqueue_style( 'gravityview_postedit_styles' );
175 175
 
176
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
176
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
177 177
 
178 178
 		// custom js
179
-		wp_register_script( 'gravityview_postedit_scripts',  plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version );
179
+		wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version );
180 180
 		wp_enqueue_script( 'gravityview_postedit_scripts' );
181
-		wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array(
182
-			'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'),
181
+		wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array(
182
+			'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ),
183 183
 			'loading_text' => esc_html__( 'Loading&hellip;', 'gravityview' ),
184
-			'alert_1' => esc_html__( 'Please select a View', 'gravityview'),
185
-		));
184
+			'alert_1' => esc_html__( 'Please select a View', 'gravityview' ),
185
+		) );
186 186
 
187 187
 	}
188 188
 
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
 	function get_sortable_fields() {
199 199
 
200 200
 		// Not properly formatted request
201
-		if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) {
201
+		if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) {
202 202
 			exit( false );
203 203
 		}
204 204
 
205 205
 		// Not valid request
206
-		if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) {
206
+		if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) {
207 207
 			exit( false );
208 208
 		}
209 209
 
210
-		$viewid = (int)$_POST['viewid'];
210
+		$viewid = (int)$_POST[ 'viewid' ];
211 211
 
212 212
 		// fetch form id assigned to the view
213 213
 		$formid = gravityview_get_form_id( $viewid );
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 4 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 			if( class_exists( 'GravityView_Entry_Notes' ) ){
323 323
 				global $current_user;
324
-      			get_currentuserinfo();
324
+	  			get_currentuserinfo();
325 325
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
326 326
 			}
327 327
 
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 
357 357
 		$approvedcolumn = self::get_approved_column( $form['id'] );
358 358
 
359
-        /**
360
-         * If the form doesn't contain the approve field, don't assume anything.
361
-         */
362
-        if( empty( $approvedcolumn ) ) {
363
-            return;
364
-        }
359
+		/**
360
+		 * If the form doesn't contain the approve field, don't assume anything.
361
+		 */
362
+		if( empty( $approvedcolumn ) ) {
363
+			return;
364
+		}
365 365
 
366 366
 		$entry = GFAPI::get_entry( $entry_id );
367 367
 
@@ -474,17 +474,17 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	static public function get_approved_column( $form ) {
476 476
 
477
-        if( empty( $form ) ) {
478
-            return null;
479
-        }
477
+		if( empty( $form ) ) {
478
+			return null;
479
+		}
480 480
 
481
-        if( !is_array( $form ) ) {
482
-            $form = GVCommon::get_form( $form );
483
-        }
481
+		if( !is_array( $form ) ) {
482
+			$form = GVCommon::get_form( $form );
483
+		}
484 484
 
485 485
 		foreach( $form['fields'] as $key => $field ) {
486 486
 
487
-            $field = (array) $field;
487
+			$field = (array) $field;
488 488
 
489 489
 			if( !empty( $field['gravityview_approved'] ) ) {
490 490
 				if( !empty($field['inputs'][0]['id']) ) {
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 				}
493 493
 			}
494 494
 
495
-            // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
496
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
497
-                foreach ( $field['inputs'] as $key2 => $input ) {
498
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
499
-                        return $input['id'];
500
-                    }
501
-                }
502
-            }
495
+			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
496
+			if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
497
+				foreach ( $field['inputs'] as $key2 => $input ) {
498
+					if ( strtolower( $input['label'] ) == 'approved' ) {
499
+						return $input['id'];
500
+					}
501
+				}
502
+			}
503 503
 		}
504 504
 
505 505
 		return null;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @uses  GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request.
172 172
 	 * @access public
173
-	 * @return void|boolean
173
+	 * @return null|false
174 174
 	 */
175 175
 	public function process_bulk_action() {
176 176
 		if ( ! class_exists( 'RGForms' ) ) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries.
253 253
 	 * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved`
254 254
 	 * @param int $form_id The Gravity Forms Form ID
255
-	 * @return boolean|void
255
+	 * @return false|null
256 256
 	 */
257 257
 	private static function update_bulk( $entries, $approved, $form_id ) {
258 258
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 * @access public
471 471
 	 * @static
472 472
 	 * @param mixed $form GF Form or Form ID
473
-	 * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
473
+	 * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
474 474
 	 */
475 475
 	static public function get_approved_column( $form ) {
476 476
 
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 		/** gf_entries page - entries table screen */
35 35
 
36 36
 		// capture bulk actions
37
-		add_action( 'init', array( $this, 'process_bulk_action') );
37
+		add_action( 'init', array( $this, 'process_bulk_action' ) );
38 38
 		// add hidden field with approve status
39 39
 		add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
40 40
 		// process ajax approve entry requests
41
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
41
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
42 42
 
43 43
 		// in case entry is edited (on admin or frontend)
44
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
44
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
45 45
 
46 46
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
47 47
 
48 48
 		// adding styles and scripts
49
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
49
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
50 50
 		// bypass Gravity Forms no-conflict mode
51 51
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
52 52
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	function tooltips( $tooltips ) {
63 63
 
64
-		$tooltips['form_gravityview_fields'] = array(
65
-			'title' => __('GravityView Fields', 'gravityview'),
66
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
64
+		$tooltips[ 'form_gravityview_fields' ] = array(
65
+			'title' => __( 'GravityView Fields', 'gravityview' ),
66
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
67 67
 		);
68 68
 
69 69
 		return $tooltips;
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 		}
179 179
 
180 180
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
181
-		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) {
181
+		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
182 182
 
183 183
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
184 184
 
185 185
 			// The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form.
186
-			$bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2'];
186
+			$bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ];
187 187
 
188 188
 			/**
189 189
 			 * The extra '-' is to make sure that there are at *least* two items in array.
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 			}
200 200
 
201 201
 			// All entries are set to be updated, not just the visible ones
202
-			if ( ! empty( $_POST['all_entries'] ) ) {
202
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
203 203
 
204 204
 				// Convert the current entry search into GF-formatted search criteria
205 205
 				$search = array(
206
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
207
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
208
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
206
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
207
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
208
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
209 209
 				);
210 210
 
211 211
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 			} else {
217 217
 
218
-				$entries = $_POST['lead'];
218
+				$entries = $_POST[ 'lead' ];
219 219
 
220 220
 			}
221 221
 
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private static function update_bulk( $entries, $approved, $form_id ) {
258 258
 
259
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
259
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
260 260
 			do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries );
261 261
 			return false;
262 262
 		}
263 263
 
264
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
264
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
265 265
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
266 266
 			return false;
267 267
 		}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		// calculate approved field id
272 272
 		$approved_column_id = self::get_approved_column( $form_id );
273 273
 
274
-		foreach( $entries as $entry_id ) {
274
+		foreach ( $entries as $entry_id ) {
275 275
 			self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
276 276
 		}
277 277
 	}
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 	 * @param int $approvedcolumn (default: 0)
291 291
 	 * @return boolean True: It worked; False: it failed
292 292
 	 */
293
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
293
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
294 294
 
295
-		if( !class_exists( 'GFAPI' ) ) {
295
+		if ( ! class_exists( 'GFAPI' ) ) {
296 296
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
297 297
 			return false;
298 298
 		}
299 299
 
300
-		if( empty( $approvedcolumn ) ) {
300
+		if ( empty( $approvedcolumn ) ) {
301 301
 			$approvedcolumn = self::get_approved_column( $form_id );
302 302
 		}
303 303
 
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 		self::update_approved_meta( $entry_id, $approved );
317 317
 
318 318
 		// add note to entry
319
-		if( $result === true ) {
319
+		if ( $result === true ) {
320 320
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
321 321
 
322
-			if( class_exists( 'GravityView_Entry_Notes' ) ){
322
+			if ( class_exists( 'GravityView_Entry_Notes' ) ) {
323 323
 				global $current_user;
324 324
       			get_currentuserinfo();
325 325
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			 */
333 333
 			do_action( 'gravityview_clear_form_cache', $form_id );
334 334
 
335
-		} else if( is_wp_error( $result ) ) {
335
+		} else if ( is_wp_error( $result ) ) {
336 336
 
337 337
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
338 338
 
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 	 */
355 355
 	public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
356 356
 
357
-		$approvedcolumn = self::get_approved_column( $form['id'] );
357
+		$approvedcolumn = self::get_approved_column( $form[ 'id' ] );
358 358
 
359 359
         /**
360 360
          * If the form doesn't contain the approve field, don't assume anything.
361 361
          */
362
-        if( empty( $approvedcolumn ) ) {
362
+        if ( empty( $approvedcolumn ) ) {
363 363
             return;
364 364
         }
365 365
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	private static function update_approved_meta( $entry_id, $is_approved ) {
382 382
 
383 383
 		// update entry meta
384
-		if( function_exists('gform_update_meta') ) {
384
+		if ( function_exists( 'gform_update_meta' ) ) {
385 385
 
386 386
 			gform_update_meta( $entry_id, 'is_approved', $is_approved );
387 387
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			 */
394 394
 			do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved );
395 395
 
396
-			if( empty( $is_approved ) ) {
396
+			if ( empty( $is_approved ) ) {
397 397
 
398 398
 				/**
399 399
 				 * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
 		} else {
417 417
 
418
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
418
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
419 419
 
420 420
 		}
421 421
 	}
@@ -427,21 +427,21 @@  discard block
 block discarded – undo
427 427
 	 */
428 428
 	public function ajax_update_approved() {
429 429
 
430
-		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) {
430
+		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) {
431 431
 
432 432
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
433 433
 
434 434
 			$result = false;
435 435
 		}
436 436
 
437
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
437
+		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) {
438 438
 
439 439
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
440 440
 
441 441
 			$result = false;
442 442
 		}
443 443
 
444
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
444
+		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) {
445 445
 
446 446
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
447 447
 
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 
451 451
 		else {
452 452
 
453
-			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
453
+			$result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] );
454 454
 
455
-			if( is_wp_error( $result ) ) {
455
+			if ( is_wp_error( $result ) ) {
456 456
 				/** @var WP_Error $result */
457
-				do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() );
457
+				do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() );
458 458
 				$result = false;
459 459
 			}
460 460
 
@@ -474,29 +474,29 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	static public function get_approved_column( $form ) {
476 476
 
477
-        if( empty( $form ) ) {
477
+        if ( empty( $form ) ) {
478 478
             return null;
479 479
         }
480 480
 
481
-        if( !is_array( $form ) ) {
481
+        if ( ! is_array( $form ) ) {
482 482
             $form = GVCommon::get_form( $form );
483 483
         }
484 484
 
485
-		foreach( $form['fields'] as $key => $field ) {
485
+		foreach ( $form[ 'fields' ] as $key => $field ) {
486 486
 
487
-            $field = (array) $field;
487
+            $field = (array)$field;
488 488
 
489
-			if( !empty( $field['gravityview_approved'] ) ) {
490
-				if( !empty($field['inputs'][0]['id']) ) {
491
-					return $field['inputs'][0]['id'];
489
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
490
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
491
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
492 492
 				}
493 493
 			}
494 494
 
495 495
             // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
496
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
497
-                foreach ( $field['inputs'] as $key2 => $input ) {
498
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
499
-                        return $input['id'];
496
+            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
497
+                foreach ( $field[ 'inputs' ] as $key2 => $input ) {
498
+                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
499
+                        return $input[ 'id' ];
500 500
                     }
501 501
                 }
502 502
             }
@@ -507,18 +507,18 @@  discard block
 block discarded – undo
507 507
 
508 508
 
509 509
 
510
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
510
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
511 511
 
512
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
512
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
513 513
 			return;
514 514
 		}
515 515
 
516
-		if( empty( $entry['id'] ) ) {
516
+		if ( empty( $entry[ 'id' ] ) ) {
517 517
 			return;
518 518
 		}
519 519
 
520
-		if( gform_get_meta( $entry['id'], 'is_approved' ) ) {
521
-			echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />';
520
+		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
521
+			echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />';
522 522
 		}
523 523
 	}
524 524
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 
528 528
 	function add_scripts_and_styles( $hook ) {
529 529
 
530
-		if( !class_exists( 'RGForms' ) ) {
530
+		if ( ! class_exists( 'RGForms' ) ) {
531 531
 
532 532
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
533 533
 
@@ -536,40 +536,40 @@  discard block
 block discarded – undo
536 536
 
537 537
 		// enqueue styles & scripts gf_entries
538 538
 		// But only if we're on the main Entries page, not on reports pages
539
-		if( RGForms::get_page() === 'entry_list' ) {
539
+		if ( RGForms::get_page() === 'entry_list' ) {
540 540
 
541
-			$form_id = RGForms::get('id');
541
+			$form_id = RGForms::get( 'id' );
542 542
 
543 543
 			// If there are no forms identified, use the first form. That's how GF does it.
544
-			if( empty( $form_id ) && class_exists('RGFormsModel') ) {
544
+			if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
545 545
 				$forms = gravityview_get_forms();
546
-				if( !empty( $forms ) ) {
547
-					$form_id = $forms[0]['id'];
546
+				if ( ! empty( $forms ) ) {
547
+					$form_id = $forms[ 0 ][ 'id' ];
548 548
 				}
549 549
 			}
550 550
 
551 551
 			$approvedcolumn = self::get_approved_column( $form_id );
552 552
 
553
-			wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
553
+			wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
554 554
 			wp_enqueue_style( 'gravityview_entries_list' );
555 555
 
556
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
556
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
557 557
 
558
-			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
558
+			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
559 559
 			wp_enqueue_script( 'gravityview_gf_entries_scripts' );
560 560
 
561 561
 			wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
562
-				'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'),
562
+				'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ),
563 563
 				'form_id' => $form_id,
564 564
 				'show_column' => (int)$this->show_approve_entry_column( $form_id ),
565 565
 				'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
566
-				'label_approve' => __( 'Approve', 'gravityview' ) ,
566
+				'label_approve' => __( 'Approve', 'gravityview' ),
567 567
 				'label_disapprove' => __( 'Disapprove', 'gravityview' ),
568 568
 				'bulk_message' => $this->bulk_update_message,
569
-				'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'),
570
-				'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'),
571
-				'column_title' => __( 'Show entry in directory view?', 'gravityview'),
572
-				'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ),
569
+				'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ),
570
+				'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ),
571
+				'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
572
+				'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ),
573 573
 			) );
574 574
 
575 575
 		}
@@ -594,13 +594,13 @@  discard block
 block discarded – undo
594 594
 		 * @since 1.7.2
595 595
 		 * @param boolean $hide_if_no_connections
596 596
 		 */
597
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
597
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
598 598
 
599
-		if( $hide_if_no_connections ) {
599
+		if ( $hide_if_no_connections ) {
600 600
 
601 601
 			$connected_views = gravityview_get_connected_views( $form_id );
602 602
 
603
-			if( empty( $connected_views ) ) {
603
+			if ( empty( $connected_views ) ) {
604 604
 				$show_approve_column = false;
605 605
 			}
606 606
 		}
@@ -610,18 +610,18 @@  discard block
 block discarded – undo
610 610
 		 * @param boolean $show_approve_column Whether the column will be shown
611 611
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
612 612
 		 */
613
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
613
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
614 614
 
615 615
 		return $show_approve_column;
616 616
 	}
617 617
 
618 618
 	function register_gform_noconflict_script( $scripts ) {
619
-		$scripts[] = 'gravityview_gf_entries_scripts';
619
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
620 620
 		return $scripts;
621 621
 	}
622 622
 
623 623
 	function register_gform_noconflict_style( $styles ) {
624
-		$styles[] = 'gravityview_entries_list';
624
+		$styles[ ] = 'gravityview_entries_list';
625 625
 		return $styles;
626 626
 	}
627 627
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -10 removed lines patch added patch discarded remove patch
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		if( $result === true ) {
320 320
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
321 321
 
322
-			if( class_exists( 'GravityView_Entry_Notes' ) ){
322
+			if( class_exists( 'GravityView_Entry_Notes' ) ) {
323 323
 				global $current_user;
324 324
       			get_currentuserinfo();
325 325
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
@@ -432,23 +432,17 @@  discard block
 block discarded – undo
432 432
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
433 433
 
434 434
 			$result = false;
435
-		}
436
-
437
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
435
+		} else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
438 436
 
439 437
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
440 438
 
441 439
 			$result = false;
442
-		}
443
-
444
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
440
+		} else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
445 441
 
446 442
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
447 443
 
448 444
 			$result = false;
449
-		}
450
-
451
-		else {
445
+		} else {
452 446
 
453 447
 			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
454 448
 
Please login to merge, or discard this patch.
includes/class-admin.php 3 patches
Indentation   +59 added lines, -60 removed lines patch added patch discarded remove patch
@@ -215,39 +215,39 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 
217 217
 		$wp_allowed_scripts = array(
218
-            'common',
219
-            'admin-bar',
220
-            'autosave',
221
-            'post',
218
+			'common',
219
+			'admin-bar',
220
+			'autosave',
221
+			'post',
222 222
 			'inline-edit-post',
223
-            'utils',
224
-            'svg-painter',
225
-            'wp-auth-check',
226
-            'heartbeat',
223
+			'utils',
224
+			'svg-painter',
225
+			'wp-auth-check',
226
+			'heartbeat',
227 227
 			'media-editor',
228 228
 			'media-upload',
229
-            'thickbox',
229
+			'thickbox',
230 230
 			'wp-color-picker',
231 231
 
232
-            // Settings
232
+			// Settings
233 233
 			'gv-admin-edd-license',
234 234
 
235
-            // Common
236
-            'select2-js',
237
-            'qtip-js',
235
+			// Common
236
+			'select2-js',
237
+			'qtip-js',
238 238
 
239
-            // jQuery
239
+			// jQuery
240 240
 			'jquery',
241
-            'jquery-ui-core',
242
-            'jquery-ui-sortable',
243
-            'jquery-ui-datepicker',
244
-            'jquery-ui-dialog',
245
-            'jquery-ui-slider',
241
+			'jquery-ui-core',
242
+			'jquery-ui-sortable',
243
+			'jquery-ui-datepicker',
244
+			'jquery-ui-dialog',
245
+			'jquery-ui-slider',
246 246
 			'jquery-ui-dialog',
247 247
 			'jquery-ui-tabs',
248 248
 			'jquery-ui-draggable',
249 249
 			'jquery-ui-droppable',
250
-            'jquery-ui-accordion',
250
+			'jquery-ui-accordion',
251 251
 		);
252 252
 
253 253
 		$this->remove_conflicts( $wp_scripts, $wp_allowed_scripts, 'scripts' );
@@ -281,23 +281,23 @@  discard block
 block discarded – undo
281 281
 			return;
282 282
 		}
283 283
 
284
-        $wp_allowed_styles = array(
285
-	        'admin-bar',
286
-        	'colors',
287
-	        'ie',
288
-	        'wp-auth-check',
289
-	        'media-views',
284
+		$wp_allowed_styles = array(
285
+			'admin-bar',
286
+			'colors',
287
+			'ie',
288
+			'wp-auth-check',
289
+			'media-views',
290 290
 			'thickbox',
291 291
 			'dashicons',
292
-	        'wp-jquery-ui-dialog',
293
-	        'jquery-ui-sortable',
292
+			'wp-jquery-ui-dialog',
293
+			'jquery-ui-sortable',
294 294
 
295
-            // Settings
296
-	        'gravityview_settings',
295
+			// Settings
296
+			'gravityview_settings',
297 297
 
298
-	        // @todo qTip styles not loading for some reason!
299
-	        'jquery-qtip.js',
300
-	    );
298
+			// @todo qTip styles not loading for some reason!
299
+			'jquery-qtip.js',
300
+		);
301 301
 
302 302
 		$this->remove_conflicts( $wp_styles, $wp_allowed_styles, 'styles' );
303 303
 
@@ -317,32 +317,32 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	private function remove_conflicts( &$wp_objects, $required_objects, $type = 'scripts' ) {
319 319
 
320
-        /**
321
-         * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n
322
-         * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles`
323
-         * @param array $required_objects
324
-         */
325
-        $required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects );
326
-
327
-        //reset queue
328
-        $queue = array();
329
-        foreach( $wp_objects->queue as $object ) {
330
-	        if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) {
331
-                $queue[] = $object;
332
-            }
333
-        }
334
-        $wp_objects->queue = $queue;
335
-
336
-        $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects );
337
-
338
-        //unregistering scripts
339
-        $registered = array();
340
-        foreach( $wp_objects->registered as $handle => $script_registration ){
341
-            if( in_array( $handle, $required_objects ) ){
342
-                $registered[ $handle ] = $script_registration;
343
-            }
344
-        }
345
-        $wp_objects->registered = $registered;
320
+		/**
321
+		 * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n
322
+		 * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles`
323
+		 * @param array $required_objects
324
+		 */
325
+		$required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects );
326
+
327
+		//reset queue
328
+		$queue = array();
329
+		foreach( $wp_objects->queue as $object ) {
330
+			if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) {
331
+				$queue[] = $object;
332
+			}
333
+		}
334
+		$wp_objects->queue = $queue;
335
+
336
+		$required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects );
337
+
338
+		//unregistering scripts
339
+		$registered = array();
340
+		foreach( $wp_objects->registered as $handle => $script_registration ){
341
+			if( in_array( $handle, $required_objects ) ){
342
+				$registered[ $handle ] = $script_registration;
343
+			}
344
+		}
345
+		$wp_objects->registered = $registered;
346 346
 	}
347 347
 
348 348
 	/**
@@ -405,7 +405,6 @@  discard block
 block discarded – undo
405 405
 	 *
406 406
 	 * @deprecated since 1.12
407 407
 	 * @see GravityView_Compatibility::get_plugin_status()
408
-
409 408
 	 * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive
410 409
 	 */
411 410
 	static function get_plugin_status( $location = '' ) {
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@  discard block
 block discarded – undo
4 4
 
5 5
 	function __construct() {
6 6
 
7
-		if( ! is_admin() ) { return; }
7
+		if ( ! is_admin() ) { return; }
8 8
 
9 9
 		// If Gravity Forms isn't active or compatibile, stop loading
10
-		if( false === GravityView_Compatibility::is_valid() ) {
10
+		if ( false === GravityView_Compatibility::is_valid() ) {
11 11
 			return;
12 12
 		}
13 13
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' );
26 26
 
27 27
 		// Don't load tooltips if on Gravity Forms, otherwise it overrides translations
28
-		if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) {
28
+		if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) {
29 29
 			require_once( GFCommon::get_base_path() . '/tooltips.php' );
30 30
 		}
31 31
 
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 		add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
51 51
 		add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) );
52 52
 
53
-		add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) );
53
+		add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) );
54 54
 
55 55
 		add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 );
56 56
 
57 57
 		//Hooks for no-conflict functionality
58
-		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
59
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
58
+		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 );
59
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 );
60 60
 
61
-		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
62
-		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11);
63
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
64
-		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
61
+		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 );
62
+		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 );
63
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 );
64
+		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 );
65 65
 
66 66
 	}
67 67
 
@@ -74,20 +74,20 @@  discard block
 block discarded – undo
74 74
 	public function backend_actions() {
75 75
 
76 76
 		/** @define "GRAVITYVIEW_DIR" "../" */
77
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' );
78
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' );
79
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' );
80
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' );
81
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' );
82
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' );
83
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
77
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' );
78
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' );
79
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' );
80
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' );
81
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' );
82
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' );
83
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
84 84
 
85 85
 		/**
86 86
 		 * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded
87 87
 		 *
88 88
 		 * Nice place to insert extensions' backend stuff
89 89
 		 */
90
-		do_action('gravityview_include_backend_actions');
90
+		do_action( 'gravityview_include_backend_actions' );
91 91
 	}
92 92
 
93 93
 	/**
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 
104 104
 		$actions = array();
105 105
 
106
-		if( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
107
-			$actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
106
+		if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
107
+			$actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
108 108
 		}
109 109
 
110
-		if( GVCommon::has_cap( 'gravityview_support_port' ) ) {
111
-			$actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
110
+		if ( GVCommon::has_cap( 'gravityview_support_port' ) ) {
111
+			$actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
112 112
 		}
113 113
 
114 114
 		return array_merge( $actions, $links );
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 	function post_updated_messages( $messages, $bulk_counts = NULL ) {
132 132
 		global $post;
133 133
 
134
-		$post_id = isset($_GET['post']) ? intval($_GET['post']) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL );
134
+		$post_id = isset( $_GET[ 'post' ] ) ? intval( $_GET[ 'post' ] ) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL );
135 135
 
136 136
 		// By default, there will only be one item being modified.
137 137
 		// When in the `bulk_post_updated_messages` filter, there will be passed a number
138 138
 		// of modified items that will override this array.
139
-		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
139
+		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
140 140
 
141 141
 
142 142
 		// If we're starting fresh, a new form was created.
@@ -145,53 +145,53 @@  discard block
 block discarded – undo
145 145
 
146 146
 		$new_form_text = '';
147 147
 
148
-		if( !empty( $start_fresh ) ) {
148
+		if ( ! empty( $start_fresh ) ) {
149 149
 
150 150
 			// Get the form that was created
151 151
 			$connected_form = gravityview_get_form_id( $post_id );
152 152
 
153
-			if( !empty( $connected_form ) ) {
153
+			if ( ! empty( $connected_form ) ) {
154 154
 				$form = gravityview_get_form( $connected_form );
155
-				$form_name = esc_attr( $form['title'] );
155
+				$form_name = esc_attr( $form[ 'title' ] );
156 156
 				$image = self::get_floaty();
157
-				$new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>';
158
-				$new_form_text .=  sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
157
+				$new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>';
158
+				$new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
159 159
 
160 160
 					You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don&rsquo;t forget to %scustomize the form settings%s.
161
-					', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&amp;id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id='.$connected_form ).'">', '</a>');
161
+					', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&amp;id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=' . $connected_form ) . '">', '</a>' );
162 162
 				$new_form_text = wpautop( $new_form_text );
163 163
 
164 164
 				delete_post_meta( $post_id, '_gravityview_start_fresh' );
165 165
 			}
166 166
 		}
167 167
 
168
-		$messages['gravityview'] = array(
168
+		$messages[ 'gravityview' ] = array(
169 169
 			0  => '', // Unused. Messages start at index 1.
170
-			1  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
171
-			2  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
170
+			1  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
171
+			2  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
172 172
 			3  => __( 'View deleted.', 'gravityview' ),
173
-			4  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
173
+			4  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
174 174
 			/* translators: %s: date and time of the revision */
175
-			5  => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
176
-			6  => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
177
-			7  => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
175
+			5  => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false,
176
+			6  => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
177
+			7  => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
178 178
 			8  => __( 'View submitted.', 'gravityview' ),
179 179
 			9  => sprintf(
180 180
 				__( 'View scheduled for: %1$s.', 'gravityview' ),
181 181
 				// translators: Publish box date format, see http://php.net/date
182
-				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL )  ) )
182
+				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) )
183 183
 			) . $new_form_text,
184
-			10  => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
184
+			10  => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
185 185
 
186 186
 			/**
187 187
 			 * These apply to `bulk_post_updated_messages`
188 188
 			 * @file wp-admin/edit.php
189 189
 			 */
190
-			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ),
191
-			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ),
192
-			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ),
193
-			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ),
194
-			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ),
190
+			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ),
191
+			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ),
192
+			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ),
193
+			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ),
194
+			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ),
195 195
 		);
196 196
 
197 197
 		return $messages;
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
 	function no_conflict_scripts() {
205 205
 		global $wp_scripts;
206 206
 
207
-		if( ! gravityview_is_admin_page() ) {
207
+		if ( ! gravityview_is_admin_page() ) {
208 208
 			return;
209 209
 		}
210 210
 
211
-		$no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode');
211
+		$no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' );
212 212
 
213
-		if( empty( $no_conflict_mode ) ) {
213
+		if ( empty( $no_conflict_mode ) ) {
214 214
 			return;
215 215
 		}
216 216
 
@@ -260,24 +260,24 @@  discard block
 block discarded – undo
260 260
 	function no_conflict_styles() {
261 261
 		global $wp_styles;
262 262
 
263
-		if( ! gravityview_is_admin_page() ) {
263
+		if ( ! gravityview_is_admin_page() ) {
264 264
 			return;
265 265
 		}
266 266
 
267 267
 		// Dequeue other jQuery styles even if no-conflict is off.
268 268
 		// Terrible-looking tabs help no one.
269
-		if( !empty( $wp_styles->registered ) )  {
270
-			foreach ($wp_styles->registered as $key => $style) {
271
-				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
269
+		if ( ! empty( $wp_styles->registered ) ) {
270
+			foreach ( $wp_styles->registered as $key => $style ) {
271
+				if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
272 272
 					wp_dequeue_style( $key );
273 273
 				}
274 274
 			}
275 275
 		}
276 276
 
277
-		$no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode');
277
+		$no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' );
278 278
 
279 279
 		// If no conflict is off, jQuery will suffice.
280
-		if( empty( $no_conflict_mode ) ) {
280
+		if ( empty( $no_conflict_mode ) ) {
281 281
 			return;
282 282
 		}
283 283
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		/**
305 305
 		 * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here.
306 306
 		 */
307
-		do_action('gravityview_remove_conflicts_after');
307
+		do_action( 'gravityview_remove_conflicts_after' );
308 308
 	}
309 309
 
310 310
 	/**
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
 
327 327
         //reset queue
328 328
         $queue = array();
329
-        foreach( $wp_objects->queue as $object ) {
330
-	        if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) {
331
-                $queue[] = $object;
329
+        foreach ( $wp_objects->queue as $object ) {
330
+	        if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) {
331
+                $queue[ ] = $object;
332 332
             }
333 333
         }
334 334
         $wp_objects->queue = $queue;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 
338 338
         //unregistering scripts
339 339
         $registered = array();
340
-        foreach( $wp_objects->registered as $handle => $script_registration ){
341
-            if( in_array( $handle, $required_objects ) ){
340
+        foreach ( $wp_objects->registered as $handle => $script_registration ) {
341
+            if ( in_array( $handle, $required_objects ) ) {
342 342
                 $registered[ $handle ] = $script_registration;
343 343
             }
344 344
         }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 * @param [type] $registered [description]
352 352
 	 * @param [type] $scripts    [description]
353 353
 	 */
354
-	private function add_script_dependencies($registered, $scripts) {
354
+	private function add_script_dependencies( $registered, $scripts ) {
355 355
 
356 356
 		//gets all dependent scripts linked to the $scripts array passed
357 357
 		do {
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 				$deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array();
361 361
 				foreach ( $deps as $dep ) {
362 362
 					if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) {
363
-						$dependents[] = $dep;
363
+						$dependents[ ] = $dep;
364 364
 					}
365 365
 				}
366 366
 			}
@@ -424,29 +424,29 @@  discard block
 block discarded – undo
424 424
 	static function is_admin_page( $hook = '', $page = NULL ) {
425 425
 		global $current_screen, $plugin_page, $pagenow, $post;
426 426
 
427
-		if( ! is_admin() ) { return false; }
427
+		if ( ! is_admin() ) { return false; }
428 428
 
429 429
 		$is_page = false;
430 430
 
431
-		$is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview');
431
+		$is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' );
432 432
 
433
-		$is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview');
433
+		$is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' );
434 434
 
435
-		$is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings';
435
+		$is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings';
436 436
 
437
-		if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) {
438
-			$gv_post = get_post( intval( $_GET['post'] ) );
439
-			$is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview');
437
+		if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) {
438
+			$gv_post = get_post( intval( $_GET[ 'post' ] ) );
439
+			$is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' );
440 440
 		} else {
441
-			$is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview');
441
+			$is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' );
442 442
 		}
443 443
 
444
-		if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) {
444
+		if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) {
445 445
 
446 446
 			// $_GET `post_type` variable
447
-			if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) {
447
+			if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
448 448
 				$is_page = 'single';
449
-			} else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) {
449
+			} else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) {
450 450
 				$is_page = 'settings';
451 451
 			} else {
452 452
 				$is_page = 'views';
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook );
462 462
 
463 463
 		// If the current page is the same as the compared page
464
-		if( !empty( $page ) ) {
464
+		if ( ! empty( $page ) ) {
465 465
 			return $is_page === $page;
466 466
 		}
467 467
 
@@ -482,6 +482,6 @@  discard block
 block discarded – undo
482 482
  *
483 483
  * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`)
484 484
  */
485
-function gravityview_is_admin_page($hook = '', $page = NULL) {
485
+function gravityview_is_admin_page( $hook = '', $page = NULL ) {
486 486
 	return GravityView_Admin::is_admin_page( $hook, $page );
487 487
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 		// Dequeue other jQuery styles even if no-conflict is off.
268 268
 		// Terrible-looking tabs help no one.
269
-		if( !empty( $wp_styles->registered ) )  {
269
+		if( !empty( $wp_styles->registered ) ) {
270 270
 			foreach ($wp_styles->registered as $key => $style) {
271 271
 				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
272 272
 					wp_dequeue_style( $key );
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 
338 338
         //unregistering scripts
339 339
         $registered = array();
340
-        foreach( $wp_objects->registered as $handle => $script_registration ){
341
-            if( in_array( $handle, $required_objects ) ){
340
+        foreach( $wp_objects->registered as $handle => $script_registration ) {
341
+            if( in_array( $handle, $required_objects ) ) {
342 342
                 $registered[ $handle ] = $script_registration;
343 343
             }
344 344
         }
Please login to merge, or discard this patch.
includes/class-common.php 4 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 
214 214
 				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
215 215
 					foreach ( $field['inputs'] as $input ) {
216
-                        /**
217
-                         * @hack
218
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
219
-                         */
220
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
221
-                            continue;
222
-                        }
216
+						/**
217
+						 * @hack
218
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
219
+						 */
220
+						if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
221
+							continue;
222
+						}
223 223
 						$fields[ (string)$input['id'] ] = array(
224 224
 							'label' => rgar( $input, 'label' ),
225 225
 							'customLabel' => rgar( $input, 'customLabel' ),
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
467 467
 			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
468 468
 		} elseif( !isset( $criteria['context_view_id'] ) ) {
469
-            // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
469
+			// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
470 470
 			$criteria['context_view_id'] = null;
471 471
 		}
472 472
 
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 			),
1083 1083
 		);
1084 1084
 
1085
-        $fields = $date_created + $fields;
1085
+		$fields = $date_created + $fields;
1086 1086
 
1087 1087
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1088 1088
 
@@ -1094,13 +1094,13 @@  discard block
 block discarded – undo
1094 1094
 			}
1095 1095
 		}
1096 1096
 
1097
-        /**
1098
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1099
-         * @since 1.12
1100
-         * @param array $fields Sub-set of GF form fields that are sortable
1101
-         * @param int $formid The Gravity Forms form ID that the fields are from
1102
-         */
1103
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1097
+		/**
1098
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1099
+		 * @since 1.12
1100
+		 * @param array $fields Sub-set of GF form fields that are sortable
1101
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1102
+		 */
1103
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1104 1104
 
1105 1105
 		return $fields;
1106 1106
 	}
@@ -1365,17 +1365,17 @@  discard block
 block discarded – undo
1365 1365
 	}
1366 1366
 
1367 1367
 
1368
-    /**
1369
-     * Display updated/error notice
1370
-     *
1371
-     * @param string $notice text/HTML of notice
1372
-     * @param string $class CSS class for notice (`updated` or `error`)
1373
-     *
1374
-     * @return string
1375
-     */
1376
-    public static function generate_notice( $notice, $class = '' ) {
1377
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1378
-    }
1368
+	/**
1369
+	 * Display updated/error notice
1370
+	 *
1371
+	 * @param string $notice text/HTML of notice
1372
+	 * @param string $class CSS class for notice (`updated` or `error`)
1373
+	 *
1374
+	 * @return string
1375
+	 */
1376
+	public static function generate_notice( $notice, $class = '' ) {
1377
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1378
+	}
1379 1379
 
1380 1380
 
1381 1381
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,6 @@  discard block
 block discarded – undo
167 167
 	 * Returns the list of available forms
168 168
 	 *
169 169
 	 * @access public
170
-	 * @param mixed $form_id
171 170
 	 * @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys
172 171
 	 */
173 172
 	public static function get_forms() {
@@ -188,7 +187,7 @@  discard block
 block discarded – undo
188 187
 	 * Return array of fields' id and label, for a given Form ID
189 188
 	 *
190 189
 	 * @access public
191
-	 * @param string|array $form_id (default: '') or $form object
190
+	 * @param string|array $form (default: '') or $form object
192 191
 	 * @return array
193 192
 	 */
194 193
 	public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 					$has_poll_fields = true;
291 291
 				}
292 292
 
293
-				if( GFCommon::is_product_field( $field['type'] ) ){
293
+				if( GFCommon::is_product_field( $field['type'] ) ) {
294 294
 					$has_product_fields = true;
295 295
 				}
296 296
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		$fields = array();
375 375
 
376
-		foreach ( $extra_fields as $key => $field ){
376
+		foreach ( $extra_fields as $key => $field ) {
377 377
 			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
378 378
 				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
379 379
 			}
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 	 * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist
914 914
 	 */
915 915
 	public static function get_field( $form, $field_id ) {
916
-		if ( class_exists( 'GFFormsModel' ) ){
916
+		if ( class_exists( 'GFFormsModel' ) ) {
917 917
 			return GFFormsModel::get_field( $form, $field_id );
918 918
 		} else {
919 919
 			return null;
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 			$shortcodes = array();
961 961
 
962 962
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
963
-			if ( empty( $matches ) ){
963
+			if ( empty( $matches ) ) {
964 964
 				return false;
965 965
 			}
966 966
 
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) {
1424 1424
 		$merged = $array1;
1425 1425
 
1426
-		foreach ( $array2 as $key => &$value )  {
1426
+		foreach ( $array2 as $key => &$value ) {
1427 1427
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1428 1428
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1429 1429
 			} else {
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 		$entry = self::get_entry( $entry_slug, true );
126 126
 
127
-		$form = self::get_form( $entry['form_id'] );
127
+		$form = self::get_form( $entry[ 'form_id' ] );
128 128
 
129 129
 		return $form;
130 130
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$results = GFAPI::get_entries( 0, $search_criteria, null, $paging );
177 177
 
178
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
178
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
179 179
 
180 180
 		return $result;
181 181
 	}
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 		if ( class_exists( 'GFAPI' ) ) {
194 194
 			$gf_forms = GFAPI::get_forms();
195 195
 			foreach ( $gf_forms as $form ) {
196
-				$forms[] = array(
197
-					'id' => $form['id'],
198
-					'title' => $form['title'],
196
+				$forms[ ] = array(
197
+					'id' => $form[ 'id' ],
198
+					'title' => $form[ 'title' ],
199 199
 				);
200 200
 			}
201 201
 		}
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 		}
228 228
 
229 229
 		if ( $form ) {
230
-			foreach ( $form['fields'] as $field ) {
231
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
232
-					$fields[ $field['id'] ] = array(
230
+			foreach ( $form[ 'fields' ] as $field ) {
231
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
232
+					$fields[ $field[ 'id' ] ] = array(
233 233
 						'label' => rgar( $field, 'label' ),
234 234
 						'parent' => null,
235 235
 						'type' => rgar( $field, 'type' ),
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 					);
239 239
 				}
240 240
 
241
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
242
-					foreach ( $field['inputs'] as $input ) {
241
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
242
+					foreach ( $field[ 'inputs' ] as $input ) {
243 243
                         /**
244 244
                          * @hack
245 245
                          * In case of email/email confirmation, the input for email has the same id as the parent field
246 246
                          */
247
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
247
+                        if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) {
248 248
                             continue;
249 249
                         }
250
-						$fields[ (string)$input['id'] ] = array(
250
+						$fields[ (string)$input[ 'id' ] ] = array(
251 251
 							'label' => rgar( $input, 'label' ),
252 252
 							'customLabel' => rgar( $input, 'customLabel' ),
253 253
 							'parent' => $field,
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 				}
260 260
 
261 261
 				/** @since 1.14 */
262
-				if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) {
262
+				if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) {
263 263
 
264
-					foreach ( (array)$field['choices'] as $key => $input ) {
264
+					foreach ( (array)$field[ 'choices' ] as $key => $input ) {
265 265
 
266
-						$input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key}
266
+						$input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key}
267 267
 
268 268
 						$fields[ $input_id ] = array(
269 269
 							'label'       => rgar( $input, 'text' ),
@@ -279,25 +279,25 @@  discard block
 block discarded – undo
279 279
 				/**
280 280
 				 * @since 1.8
281 281
 				 */
282
-				if( 'quiz' === $field['type'] ) {
282
+				if ( 'quiz' === $field[ 'type' ] ) {
283 283
 					$has_quiz_fields = true;
284 284
 				}
285 285
 
286 286
 				/**
287 287
 				 * @since 1.8
288 288
 				 */
289
-				if( 'poll' === $field['type'] ) {
289
+				if ( 'poll' === $field[ 'type' ] ) {
290 290
 					$has_poll_fields = true;
291 291
 				}
292 292
 
293
-				if( GFCommon::is_product_field( $field['type'] ) ){
293
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
294 294
 					$has_product_fields = true;
295 295
 				}
296 296
 
297 297
 				/**
298 298
 				 * @hack Version 1.9
299 299
 				 */
300
-				$field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field;
300
+				$field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field;
301 301
 
302 302
 				if ( GFCommon::is_post_field( $field_for_is_post_field ) ) {
303 303
 					$has_post_fields = true;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		 * @since 1.7
310 310
 		 */
311 311
 		if ( $has_post_fields ) {
312
-			$fields['post_id'] = array(
312
+			$fields[ 'post_id' ] = array(
313 313
 				'label' => __( 'Post ID', 'gravityview' ),
314 314
 				'type' => 'post_id',
315 315
 			);
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 			$payment_fields = GravityView_Fields::get_all( 'pricing' );
321 321
 
322 322
 			foreach ( $payment_fields as $payment_field ) {
323
-				if( isset( $fields["{$payment_field->name}"] ) ) {
323
+				if ( isset( $fields[ "{$payment_field->name}" ] ) ) {
324 324
 					continue;
325 325
 				}
326
-				$fields["{$payment_field->name}"] = array(
326
+				$fields[ "{$payment_field->name}" ] = array(
327 327
 					'label' => $payment_field->label,
328 328
 					'desc' => $payment_field->description,
329 329
 					'type' => $payment_field->name,
@@ -334,24 +334,24 @@  discard block
 block discarded – undo
334 334
 		/**
335 335
 		 * @since 1.8
336 336
 		 */
337
-		if( $has_quiz_fields ) {
337
+		if ( $has_quiz_fields ) {
338 338
 
339
-			$fields['gquiz_score']   = array(
339
+			$fields[ 'gquiz_score' ] = array(
340 340
 				'label' => __( 'Quiz Score Total', 'gravityview' ),
341 341
 				'type'  => 'quiz_score',
342 342
 				'desc'  => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ),
343 343
 			);
344
-			$fields['gquiz_percent'] = array(
344
+			$fields[ 'gquiz_percent' ] = array(
345 345
 				'label' => __( 'Quiz Percentage Grade', 'gravityview' ),
346 346
 				'type'  => 'quiz_percent',
347 347
 				'desc'  => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ),
348 348
 			);
349
-			$fields['gquiz_grade']   = array(
349
+			$fields[ 'gquiz_grade' ] = array(
350 350
 				'label' => __( 'Quiz Letter Grade', 'gravityview' ),
351 351
 				'type'  => 'quiz_grade',
352 352
 				'desc'  => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ),
353 353
 			);
354
-			$fields['gquiz_is_pass'] = array(
354
+			$fields[ 'gquiz_is_pass' ] = array(
355 355
 				'label' => __( 'Quiz Pass/Fail', 'gravityview' ),
356 356
 				'type'  => 'quiz_is_pass',
357 357
 				'desc'  => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ),
@@ -373,9 +373,9 @@  discard block
 block discarded – undo
373 373
 
374 374
 		$fields = array();
375 375
 
376
-		foreach ( $extra_fields as $key => $field ){
377
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
378
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
376
+		foreach ( $extra_fields as $key => $field ) {
377
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
378
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
379 379
 			}
380 380
 		}
381 381
 
@@ -415,32 +415,32 @@  discard block
 block discarded – undo
415 415
 			'search_criteria' => null,
416 416
 			'sorting' => null,
417 417
 			'paging' => null,
418
-			'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true),
418
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ),
419 419
 		);
420 420
 
421 421
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
422 422
 
423
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
424
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
423
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
424
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
425 425
 
426 426
 				if ( ! is_array( $filter ) ) {
427 427
 					continue;
428 428
 				}
429 429
 
430 430
 				// By default, we want searches to be wildcard for each field.
431
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
431
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
432 432
 
433 433
 				/**
434 434
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
435 435
 				 * @param string $operator Existing search operator
436 436
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
437 437
 				 */
438
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
438
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
439 439
 			}
440 440
 
441 441
 			// don't send just the [mode] without any field filter.
442
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
443
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
442
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
443
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
444 444
 			}
445 445
 
446 446
 		}
@@ -451,21 +451,21 @@  discard block
 block discarded – undo
451 451
 		 * Prepare date formats to be in Gravity Forms DB format;
452 452
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
453 453
 		 */
454
-		foreach ( array('start_date', 'end_date' ) as $key ) {
454
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
455 455
 
456
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
456
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
457 457
 
458 458
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
459
-				$date = date_create( $criteria['search_criteria'][ $key ] );
459
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
460 460
 
461 461
 				if ( $date ) {
462 462
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
463
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
463
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
464 464
 				} else {
465 465
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
466
-					unset( $criteria['search_criteria'][ $key ] );
466
+					unset( $criteria[ 'search_criteria' ][ $key ] );
467 467
 
468
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
468
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
469 469
 				}
470 470
 			}
471 471
 		}
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
 
474 474
 		// When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter
475 475
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) {
476
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
476
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
477 477
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
478
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
479
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
478
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null;
479
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
480 480
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
481
-			$criteria['context_view_id'] = null;
481
+			$criteria[ 'context_view_id' ] = null;
482 482
 		}
483 483
 
484 484
 		/**
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		 * @param array $form_ids Forms to search
488 488
 		 * @param int $view_id ID of the view being used to search
489 489
 		 */
490
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
490
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
491 491
 
492 492
 		return (array)$criteria;
493 493
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		/** Reduce # of database calls */
519 519
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
520 520
 
521
-		if ( ! empty( $criteria['cache'] ) ) {
521
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
522 522
 
523 523
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
524 524
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 
527 527
 				// Still update the total count when using cached results
528 528
 				if ( ! is_null( $total ) ) {
529
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
529
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
530 530
 				}
531 531
 
532 532
 				$return = $entries;
@@ -546,9 +546,9 @@  discard block
 block discarded – undo
546 546
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
547 547
 
548 548
 			// No entries returned from gravityview_before_get_entries
549
-			if( is_null( $entries ) ) {
549
+			if ( is_null( $entries ) ) {
550 550
 
551
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
551
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
552 552
 
553 553
 				if ( is_wp_error( $entries ) ) {
554 554
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 				}
558 558
 			}
559 559
 
560
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
560
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
561 561
 
562 562
 				// Cache results
563 563
 				$Cache->set( $entries, 'entries' );
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 			// fetch the entry
637 637
 			$entry = GFAPI::get_entry( $entry_id );
638 638
 
639
-			if( $check_entry_display ) {
639
+			if ( $check_entry_display ) {
640 640
 				// Is the entry allowed
641 641
 				$entry = self::check_entry_display( $entry );
642 642
 			}
@@ -669,12 +669,12 @@  discard block
 block discarded – undo
669 669
 
670 670
 		$value = false;
671 671
 
672
-		if( 'context' === $val1 ) {
672
+		if ( 'context' === $val1 ) {
673 673
 
674 674
 			$matching_contexts = array( $val2 );
675 675
 
676 676
 			// We allow for non-standard contexts.
677
-			switch( $val2 ) {
677
+			switch ( $val2 ) {
678 678
 				// Check for either single or edit
679 679
 				case 'singular':
680 680
 					$matching_contexts = array( 'single', 'edit' );
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 			return false;
735 735
 		}
736 736
 
737
-		if ( empty( $entry['form_id'] ) ) {
737
+		if ( empty( $entry[ 'form_id' ] ) ) {
738 738
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
739 739
 			return false;
740 740
 		}
@@ -742,26 +742,26 @@  discard block
 block discarded – undo
742 742
 		$criteria = self::calculate_get_entries_criteria();
743 743
 
744 744
 		// Make sure the current View is connected to the same form as the Entry
745
-		if( ! empty( $criteria['context_view_id'] ) ) {
746
-			$context_view_id = intval( $criteria['context_view_id'] );
745
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
746
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
747 747
 			$context_form_id = gravityview_get_form_id( $context_view_id );
748
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
749
-				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
748
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
749
+				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
750 750
 				return false;
751 751
 			}
752 752
 		}
753 753
 
754
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
754
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
755 755
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
756 756
 			return $entry;
757 757
 		}
758 758
 
759
-		$search_criteria = $criteria['search_criteria'];
759
+		$search_criteria = $criteria[ 'search_criteria' ];
760 760
 		unset( $criteria );
761 761
 
762 762
 		// check entry status
763
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
764
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
763
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
764
+			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
765 765
 			return false;
766 766
 		}
767 767
 
@@ -769,37 +769,37 @@  discard block
 block discarded – undo
769 769
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
770 770
 
771 771
 		// field_filters
772
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
772
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
773 773
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
774 774
 			return $entry;
775 775
 		}
776 776
 
777
-		$filters = $search_criteria['field_filters'];
777
+		$filters = $search_criteria[ 'field_filters' ];
778 778
 		unset( $search_criteria );
779 779
 
780
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
781
-		unset( $filters['mode'] );
780
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
781
+		unset( $filters[ 'mode' ] );
782 782
 
783
-		$form = self::get_form( $entry['form_id'] );
783
+		$form = self::get_form( $entry[ 'form_id' ] );
784 784
 
785 785
 		foreach ( $filters as $filter ) {
786 786
 
787
-			if ( ! isset( $filter['key'] ) ) {
787
+			if ( ! isset( $filter[ 'key' ] ) ) {
788 788
 				continue;
789 789
 			}
790 790
 
791
-			$k = $filter['key'];
791
+			$k = $filter[ 'key' ];
792 792
 
793 793
 			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
794 794
 				$field_value = $entry[ $k ];
795 795
 				$field = null;
796 796
 			} else {
797 797
 				$field = self::get_field( $form, $k );
798
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
798
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
799 799
 			}
800 800
 
801
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
802
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
801
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
802
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
803 803
 
804 804
 			// verify if we are already free to go!
805 805
 			if ( ! $is_value_match && 'all' === $mode ) {
@@ -857,25 +857,25 @@  discard block
 block discarded – undo
857 857
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
858 858
 		 * @see GFCommon::format_date() for original code
859 859
 		 */
860
-		$date_gmt_time   = mysql2date( 'G', $date_string );
860
+		$date_gmt_time = mysql2date( 'G', $date_string );
861 861
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
862 862
 
863
-		$format  = rgar( $atts, 'format' );
864
-		$is_human  = ! empty( $atts['human'] );
865
-		$is_diff  = ! empty( $atts['diff'] );
866
-		$is_raw = ! empty( $atts['raw'] );
867
-		$is_timestamp = ! empty( $atts['timestamp'] );
868
-		$include_time = ! empty( $atts['time'] );
863
+		$format = rgar( $atts, 'format' );
864
+		$is_human = ! empty( $atts[ 'human' ] );
865
+		$is_diff = ! empty( $atts[ 'diff' ] );
866
+		$is_raw = ! empty( $atts[ 'raw' ] );
867
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
868
+		$include_time = ! empty( $atts[ 'time' ] );
869 869
 
870 870
 		// If we're using time diff, we want to have a different default format
871
-		if( empty( $format ) ) {
871
+		if ( empty( $format ) ) {
872 872
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
873 873
 		}
874 874
 
875 875
 		// If raw was specified, don't modify the stored value
876 876
 		if ( $is_raw ) {
877 877
 			$formatted_date = $date_string;
878
-		} elseif( $is_timestamp ) {
878
+		} elseif ( $is_timestamp ) {
879 879
 			$formatted_date = $date_local_timestamp;
880 880
 		} elseif ( $is_diff ) {
881 881
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 		}
904 904
 
905 905
 		$field = self::get_field( $form, $field_id );
906
-		return isset( $field['label'] ) ?  $field['label'] : '';
906
+		return isset( $field[ 'label' ] ) ? $field[ 'label' ] : '';
907 907
 
908 908
 	}
909 909
 
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	 * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist
922 922
 	 */
923 923
 	public static function get_field( $form, $field_id ) {
924
-		if ( class_exists( 'GFFormsModel' ) ){
924
+		if ( class_exists( 'GFFormsModel' ) ) {
925 925
 			return GFFormsModel::get_field( $form, $field_id );
926 926
 		} else {
927 927
 			return null;
@@ -968,17 +968,17 @@  discard block
 block discarded – undo
968 968
 			$shortcodes = array();
969 969
 
970 970
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
971
-			if ( empty( $matches ) ){
971
+			if ( empty( $matches ) ) {
972 972
 				return false;
973 973
 			}
974 974
 
975 975
 			foreach ( $matches as $shortcode ) {
976
-				if ( $tag === $shortcode[2] ) {
976
+				if ( $tag === $shortcode[ 2 ] ) {
977 977
 
978 978
 					// Changed this to $shortcode instead of true so we get the parsed atts.
979
-					$shortcodes[] = $shortcode;
979
+					$shortcodes[ ] = $shortcode;
980 980
 
981
-				} else if ( isset( $shortcode[5] ) && $result = self::has_shortcode_r( $shortcode[5], $tag ) ) {
981
+				} else if ( isset( $shortcode[ 5 ] ) && $result = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
982 982
 					$shortcodes = $result;
983 983
 				}
984 984
 			}
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 	 * @return string         html
1130 1130
 	 */
1131 1131
 	public static function get_sortable_fields( $formid, $current = '' ) {
1132
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1132
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1133 1133
 
1134 1134
 		if ( empty( $formid ) ) {
1135 1135
 			return $output;
@@ -1142,11 +1142,11 @@  discard block
 block discarded – undo
1142 1142
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1143 1143
 
1144 1144
 			foreach ( $fields as $id => $field ) {
1145
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1145
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1146 1146
 					continue;
1147 1147
 				}
1148 1148
 
1149
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1149
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1150 1150
 			}
1151 1151
 		}
1152 1152
 
@@ -1181,9 +1181,9 @@  discard block
 block discarded – undo
1181 1181
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1182 1182
 
1183 1183
 		// TODO: Convert to using array_filter
1184
-		foreach( $fields as $id => $field ) {
1184
+		foreach ( $fields as $id => $field ) {
1185 1185
 
1186
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1186
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1187 1187
 				unset( $fields[ $id ] );
1188 1188
 			}
1189 1189
 		}
@@ -1224,14 +1224,14 @@  discard block
 block discarded – undo
1224 1224
 	 * @param  int|array  $field field key or field array
1225 1225
 	 * @return boolean
1226 1226
 	 */
1227
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1227
+	public static function is_field_numeric( $form = null, $field = '' ) {
1228 1228
 
1229 1229
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1230 1230
 			$form = self::get_form( $form );
1231 1231
 		}
1232 1232
 
1233 1233
 		// If entry meta, it's a string. Otherwise, numeric
1234
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1234
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1235 1235
 			$type = $field;
1236 1236
 		} else {
1237 1237
 			$type = self::get_field_type( $form, $field );
@@ -1245,9 +1245,9 @@  discard block
 block discarded – undo
1245 1245
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1246 1246
 
1247 1247
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1248
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1249
-			if( true === $gv_field->is_numeric ) {
1250
-				$numeric_types[] = $gv_field->is_numeric;
1248
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1249
+			if ( true === $gv_field->is_numeric ) {
1250
+				$numeric_types[ ] = $gv_field->is_numeric;
1251 1251
 			}
1252 1252
 		}
1253 1253
 
@@ -1397,11 +1397,11 @@  discard block
 block discarded – undo
1397 1397
 		$final_atts = array_filter( $final_atts );
1398 1398
 
1399 1399
 		// If the href wasn't passed as an attribute, use the value passed to the function
1400
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1401
-			$final_atts['href'] = $href;
1400
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1401
+			$final_atts[ 'href' ] = $href;
1402 1402
 		}
1403 1403
 
1404
-		$final_atts['href'] = esc_url_raw( $href );
1404
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1405 1405
 
1406 1406
 		// For each attribute, generate the code
1407 1407
 		$output = '';
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1410 1410
 		}
1411 1411
 
1412
-		$output = '<a'. $output .'>'. $anchor_text .'</a>';
1412
+		$output = '<a' . $output . '>' . $anchor_text . '</a>';
1413 1413
 
1414 1414
 		return $output;
1415 1415
 	}
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) {
1432 1432
 		$merged = $array1;
1433 1433
 
1434
-		foreach ( $array2 as $key => &$value )  {
1434
+		foreach ( $array2 as $key => &$value ) {
1435 1435
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1436 1436
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1437 1437
 			} else {
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1467 1467
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1468 1468
 		 */
1469
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1469
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1470 1470
 
1471 1471
 		return get_users( $get_users_settings );
1472 1472
 	}
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
      * @return string
1482 1482
      */
1483 1483
     public static function generate_notice( $notice, $class = '' ) {
1484
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1484
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1485 1485
     }
1486 1486
 
1487 1487
 
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.