Completed
Push — develop ( a51e55...3fe4ef )
by Zack
27:39 queued 07:46
created
future/includes/class-gv-shortcode-gravityview.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 			'detail' => null,
42 42
 		) );
43 43
 		
44
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
45
-			if ( $atts['detail'] && $view = $request->is_view() ) {
44
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
45
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
46 46
 				$view_id = $view->ID;
47 47
 			}
48 48
 		}
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 			}
112 112
 		}
113 113
 
114
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
114
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
115 115
 
116 116
 		/**
117 117
 		 * View details.
118 118
 		 */
119
-		if ( $atts['detail'] ) {
119
+		if ( $atts[ 'detail' ] ) {
120 120
 			$entries = $view->get_entries( $request );
121 121
 			return self::_return( $this->detail( $view, $entries, $atts ) );
122 122
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 				return self::_return( '' );
134 134
 			}
135 135
 
136
-			if ( $entry['status'] != 'active' ) {
136
+			if ( $entry[ 'status' ] != 'active' ) {
137 137
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
138 138
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
139 139
 			}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			}
145 145
 
146 146
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
147
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
147
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
148 148
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
149 149
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
150 150
 				}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				return self::_return( '' );
165 165
 			}
166 166
 
167
-			if ( $entry['status'] != 'active' ) {
167
+			if ( $entry[ 'status' ] != 'active' ) {
168 168
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
169 169
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
170 170
 			}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			}
176 176
 
177 177
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
178
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
178
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
179 179
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
180 180
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
181 181
 				}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			$error = \GVCommon::check_entry_display( $entry->as_entry(), $view );
185 185
 
186
-			if( is_wp_error( $error ) ) {
186
+			if ( is_wp_error( $error ) ) {
187 187
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
188 188
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
189 189
 			}
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 				
200 200
 				// Mock the request with the actual View, not the global one
201 201
 				$mock_request = new \GV\Mock_Request();
202
-				$mock_request->returns['is_view'] = $view;
203
-				$mock_request->returns['is_entry'] = $request->is_entry( $view->form ? $view->form->ID : 0 );
204
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 );
205
-				$mock_request->returns['is_search'] = $request->is_search();
202
+				$mock_request->returns[ 'is_view' ] = $view;
203
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry( $view->form ? $view->form->ID : 0 );
204
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 );
205
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
206 206
 
207 207
 				$request = $mock_request;
208 208
 			}
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
239 239
 
240 240
 		// Only keep the passed attributes after making sure that they're valid pairs
241
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
241
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
242 242
 
243 243
 		$atts = array();
244 244
 
245
-		foreach( $filtered_atts as $key => $passed_value ) {
245
+		foreach ( $filtered_atts as $key => $passed_value ) {
246 246
 
247 247
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
248 248
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
249 249
 
250
-			switch( $defaults[ $key ]['type'] ) {
250
+			switch ( $defaults[ $key ][ 'type' ] ) {
251 251
 
252 252
 				/**
253 253
 				 * Make sure number fields are numeric.
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
256 256
 				 */
257 257
 				case 'number':
258
-					if( is_numeric( $passed_value ) ) {
258
+					if ( is_numeric( $passed_value ) ) {
259 259
 						$atts[ $key ] = ( $passed_value + 0 );
260 260
 					}
261 261
 					break;
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 				 */
271 271
 				case 'select':
272 272
 				case 'radio':
273
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
274
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
273
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
274
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
275 275
 						$atts[ $key ] = $passed_value;
276 276
 					}
277 277
 					break;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 			}
284 284
 		}
285 285
 
286
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
286
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
287 287
 
288 288
 		return $atts;
289 289
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	private function detail( $view, $entries, $atts ) {
301 301
 		$output = '';
302 302
 
303
-		switch ( $key = $atts['detail'] ):
303
+		switch ( $key = $atts[ 'detail' ] ):
304 304
 			case 'total_entries':
305 305
 				$output = number_format_i18n( $entries->total() );
306 306
 				break;
Please login to merge, or discard this patch.
includes/class-admin-views.php 1 patch
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@  discard block
 block discarded – undo
27 27
 		add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 );
28 28
 
29 29
 		// Tooltips
30
-		add_filter( 'gform_tooltips', array( $this, 'tooltips') );
30
+		add_filter( 'gform_tooltips', array( $this, 'tooltips' ) );
31 31
 
32 32
 		// adding styles and scripts
33
-		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 );
34
-		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') );
35
-		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') );
36
-		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') );
37
-		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') );
38
-
39
-		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 );
40
-		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 );
41
-		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers') );
42
-		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 );
43
-		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') );
44
-		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 );
33
+		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 );
34
+		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) );
35
+		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) );
36
+		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) );
37
+		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
38
+
39
+		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 );
40
+		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 );
41
+		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ) );
42
+		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 );
43
+		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) );
44
+		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 );
45 45
 
46 46
 		// @todo check if this hook is needed..
47 47
 		//add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 );
48 48
 
49 49
 		// Add Connected Form column
50
-		add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) );
50
+		add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) );
51 51
 
52 52
 		add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
53 53
 		add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
54 54
 
55
-		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );
55
+		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 );
56 56
 
57 57
 		add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) );
58 58
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	function suggest_support_articles( $localization_data = array() ) {
73 73
 
74
-	    if( ! gravityview()->request->is_view() ) {
74
+	    if ( ! gravityview()->request->is_view() ) {
75 75
 	        return $localization_data;
76 76
         }
77 77
 
78
-		$localization_data['suggest'] = array(
78
+		$localization_data[ 'suggest' ] = array(
79 79
             '57ef23539033602e61d4a560',
80 80
             '54c67bb9e4b0512429885513',
81 81
             '54c67bb9e4b0512429885512',
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	public function filter_pre_get_posts_by_gravityview_form_id( &$query ) {
97 97
 		global $pagenow;
98 98
 
99
-		if ( !is_admin() ) {
99
+		if ( ! is_admin() ) {
100 100
 			return;
101 101
 		}
102 102
 
103
-		$form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false;
103
+		$form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false;
104 104
 
105
-		if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) {
105
+		if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) {
106 106
 			return;
107 107
 		}
108 108
 
@@ -119,18 +119,18 @@  discard block
 block discarded – undo
119 119
 	function add_view_dropdown() {
120 120
 		$current_screen = get_current_screen();
121 121
 
122
-		if( 'gravityview' !== $current_screen->post_type ) {
122
+		if ( 'gravityview' !== $current_screen->post_type ) {
123 123
 			return;
124 124
 		}
125 125
 
126 126
 		$forms = gravityview_get_forms();
127 127
 		$current_form = \GV\Utils::_GET( 'gravityview_form_id' );
128 128
 		// If there are no forms to select, show no forms.
129
-		if( !empty( $forms ) ) { ?>
129
+		if ( ! empty( $forms ) ) { ?>
130 130
 			<select name="gravityview_form_id" id="gravityview_form_id">
131 131
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
132
-				<?php foreach( $forms as $form ) { ?>
133
-					<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
132
+				<?php foreach ( $forms as $form ) { ?>
133
+					<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
134 134
 				<?php } ?>
135 135
 			</select>
136 136
 		<?php }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
145 145
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
146
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
146
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
147 147
 	}
148 148
 
149 149
 	/**
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 
169 169
 		$priority = 0;
170 170
 
171
-		if( 'form_list' === GFForms::get_page() ) {
171
+		if ( 'form_list' === GFForms::get_page() ) {
172 172
 			$priority = 790;
173 173
         }
174 174
 
175
-		if( empty( $connected_views ) ) {
175
+		if ( empty( $connected_views ) ) {
176 176
 
177
-		    $menu_items['gravityview'] = array(
177
+		    $menu_items[ 'gravityview' ] = array(
178 178
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
179 179
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
180 180
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -190,22 +190,22 @@  discard block
 block discarded – undo
190 190
 		$sub_menu_items = array();
191 191
 		foreach ( (array)$connected_views as $view ) {
192 192
 
193
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
193
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
194 194
 				continue;
195 195
 			}
196 196
 
197
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
197
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
198 198
 
199
-			$sub_menu_items[] = array(
199
+			$sub_menu_items[ ] = array(
200 200
 				'label' => esc_attr( $label ),
201
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
201
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
202 202
 			);
203 203
 		}
204 204
 
205 205
 		// If there were no items added, then let's create the parent menu
206
-		if( $sub_menu_items ) {
206
+		if ( $sub_menu_items ) {
207 207
 
208
-		    $sub_menu_items[] = array(
208
+		    $sub_menu_items[ ] = array(
209 209
 			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
210 210
                 'link_class' => 'gv-create-view',
211 211
 			    'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
             );
215 215
 
216 216
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
217
-			$sub_menu_items[] = array(
217
+			$sub_menu_items[ ] = array(
218 218
 				'url' => '#',
219 219
 				'label' => '',
220 220
 				'menu_class' => 'hidden',
221 221
 				'capabilities' => '',
222 222
 			);
223 223
 
224
-			$menu_items['gravityview'] = array(
224
+			$menu_items[ 'gravityview' ] = array(
225 225
 				'label'          => __( 'Connected Views', 'gravityview' ),
226 226
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
227 227
 				'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 		$add = array( 'captcha', 'page' );
251 251
 
252 252
 		// Don't allowing editing the following values:
253
-		if( $context === 'edit' ) {
254
-			$add[] = 'post_id';
253
+		if ( $context === 'edit' ) {
254
+			$add[ ] = 'post_id';
255 255
 		}
256 256
 
257 257
 		$return = array_merge( $array, $add );
@@ -274,32 +274,32 @@  discard block
 block discarded – undo
274 274
 		foreach ( $default_args as $key => $arg ) {
275 275
 
276 276
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
277
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
277
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
278 278
 
279 279
 			// By default, use `tooltip` if defined.
280
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
280
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
281 281
 
282 282
 			// Otherwise, use the description as a tooltip.
283
-			if( empty( $tooltip ) && !empty( $arg['desc'] ) ) {
284
-				$tooltip = $arg['desc'];
283
+			if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) {
284
+				$tooltip = $arg[ 'desc' ];
285 285
 			}
286 286
 
287 287
 			// If there's no tooltip set, continue
288
-			if( empty( $tooltip ) ) {
288
+			if ( empty( $tooltip ) ) {
289 289
 				continue;
290 290
 			}
291 291
 
292 292
 			// Add the tooltip
293
-			$gv_tooltips[ 'gv_'.$key ] = array(
294
-				'title'	=> $arg['label'],
293
+			$gv_tooltips[ 'gv_' . $key ] = array(
294
+				'title'	=> $arg[ 'label' ],
295 295
 				'value'	=> $tooltip,
296 296
 			);
297 297
 
298 298
 		}
299 299
 
300
-		$gv_tooltips['gv_css_merge_tags'] = array(
301
-			'title' => __('CSS Merge Tags', 'gravityview'),
302
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
300
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
301
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
302
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
303 303
 		);
304 304
 
305 305
 		/**
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 
318 318
 		foreach ( $gv_tooltips as $key => $tooltip ) {
319 319
 
320
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
320
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
321 321
 
322
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
322
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
323 323
 		}
324 324
 
325 325
 		return $tooltips;
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 *
334 334
 	 * @return void
335 335
 	 */
336
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
336
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
337 337
 
338 338
 		$output = '';
339 339
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
356 356
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
357 357
 
358
-				$output = $template ? $template['label'] : $template_id_pretty;
358
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
359 359
 
360 360
 				break;
361 361
 
@@ -396,44 +396,44 @@  discard block
 block discarded – undo
396 396
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
397 397
 
398 398
 		// Either the form is empty or the form ID is 0, not yet set.
399
-		if( empty( $form ) ) {
399
+		if ( empty( $form ) ) {
400 400
 			return '';
401 401
 		}
402 402
 
403 403
 		// The $form is passed as the form ID
404
-		if( !is_array( $form ) ) {
404
+		if ( ! is_array( $form ) ) {
405 405
 			$form = gravityview_get_form( $form );
406 406
 		}
407 407
 
408
-		$form_id = $form['id'];
408
+		$form_id = $form[ 'id' ];
409 409
 		$links = array();
410 410
 
411
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
411
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
412 412
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
413
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
414
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
413
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
414
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
415 415
 		} else {
416
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
416
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
417 417
 		}
418 418
 
419
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
419
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
420 420
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
421
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
421
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
422 422
 		}
423 423
 
424
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
424
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
425 425
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
426
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
426
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
427 427
 		}
428 428
 
429
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
429
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
430 430
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
431
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
431
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
432 432
 		}
433 433
 
434 434
 		$output = '';
435 435
 
436
-		if( !empty( $include_form_link ) ) {
436
+		if ( ! empty( $include_form_link ) ) {
437 437
 			$output .= $form_link;
438 438
 		}
439 439
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		 */
446 446
 		$links = apply_filters( 'gravityview_connected_form_links', $links, $form );
447 447
 
448
-		$output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>';
448
+		$output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>';
449 449
 
450 450
 		return $output;
451 451
 	}
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 		// Get the date column and save it for later to add back in.
460 460
 		// This adds it after the Data Source column.
461 461
 		// This way, we don't need to do array_slice, array_merge, etc.
462
-		$date = $columns['date'];
463
-		unset( $columns['date'] );
462
+		$date = $columns[ 'date' ];
463
+		unset( $columns[ 'date' ] );
464 464
 
465 465
 		$data_source_required_caps = array(
466 466
 			'gravityforms_edit_forms',
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
 			'gravityforms_preview_forms',
472 472
 		);
473 473
 
474
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
475
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
474
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
475
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
476 476
 		}
477 477
 
478
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
478
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
479 479
 
480 480
 		// Add the date back in.
481
-		$columns['date'] = $date;
481
+		$columns[ 'date' ] = $date;
482 482
 
483 483
 		return $columns;
484 484
 	}
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 	 */
493 493
 	function save_postdata( $post_id ) {
494 494
 
495
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
495
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
496 496
 			return;
497 497
 		}
498 498
 
499 499
 		// validate post_type
500
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
500
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
501 501
 			return;
502 502
 		}
503 503
 
@@ -512,65 +512,65 @@  discard block
 block discarded – undo
512 512
 		$statii = array();
513 513
 
514 514
 		// check if this is a start fresh View
515
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
515
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
516 516
 
517
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
517
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
518 518
 			// save form id
519
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
519
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
520 520
 
521 521
 		}
522 522
 
523
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
523
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
524 524
 			gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) );
525 525
 			return;
526 526
 		}
527 527
 
528 528
 		// Was this a start fresh?
529
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
530
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
529
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
530
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
531 531
 		} else {
532
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
532
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
533 533
 		}
534 534
 
535 535
 		// Check if we have a template id
536
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
536
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
537 537
 
538
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
538
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
539 539
 
540 540
 			// now save template id
541
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
541
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
542 542
 		}
543 543
 
544 544
 
545 545
 		// save View Configuration metabox
546
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
546
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
547 547
 
548 548
 			// template settings
549
-			if( empty( $_POST['template_settings'] ) ) {
550
-				$_POST['template_settings'] = array();
549
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
550
+				$_POST[ 'template_settings' ] = array();
551 551
 			}
552
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
552
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
553 553
 
554 554
 			$fields = array();
555 555
 
556 556
 			// Directory&single Visible Fields
557
-			if( !empty( $preset_fields ) ) {
557
+			if ( ! empty( $preset_fields ) ) {
558 558
 
559 559
 				$fields = $preset_fields;
560 560
 
561
-			} elseif( !empty( $_POST['gv_fields'] ) ) {
561
+			} elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) {
562 562
 				$fields = _gravityview_process_posted_fields();
563 563
 			}
564 564
 
565 565
 			$fields = wp_slash( $fields );
566 566
 
567
-			$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
567
+			$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
568 568
 
569 569
 			// Directory Visible Widgets
570
-			if( empty( $_POST['widgets'] ) ) {
571
-				$_POST['widgets'] = array();
570
+			if ( empty( $_POST[ 'widgets' ] ) ) {
571
+				$_POST[ 'widgets' ] = array();
572 572
 			}
573
-			$statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] );
573
+			$statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] );
574 574
 
575 575
 		} // end save view configuration
576 576
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 		 * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false.
581 581
 		 * @since 1.17.2
582 582
 		 */
583
-		do_action('gravityview_view_saved', $post_id, $statii );
583
+		do_action( 'gravityview_view_saved', $post_id, $statii );
584 584
 
585 585
 		gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) );
586 586
 	}
@@ -624,20 +624,20 @@  discard block
 block discarded – undo
624 624
 
625 625
 		$output = '';
626 626
 
627
-		if( !empty( $fields ) ) {
627
+		if ( ! empty( $fields ) ) {
628 628
 
629
-			foreach( $fields as $id => $details ) {
629
+			foreach ( $fields as $id => $details ) {
630 630
 
631
-				if( in_array( $details['type'], (array) $blacklist_field_types ) ) {
631
+				if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) {
632 632
 					continue;
633 633
 				}
634 634
 
635 635
 				// Edit mode only allows editing the parent fields, not single inputs.
636
-				if( $context === 'edit' && !empty( $details['parent'] ) ) {
636
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
637 637
 					continue;
638 638
 				}
639 639
 
640
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, $settings = array(), $form );
640
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, $settings = array(), $form );
641 641
 
642 642
 			} // End foreach
643 643
 		}
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 		echo $output;
646 646
 
647 647
 		// For the EDIT view we only want to allow the form fields.
648
-		if( $context === 'edit' ) {
648
+		if ( $context === 'edit' ) {
649 649
 			return;
650 650
 		}
651 651
 
@@ -669,16 +669,16 @@  discard block
 block discarded – undo
669 669
 		$additional_fields = apply_filters( 'gravityview_additional_fields', array(
670 670
 			array(
671 671
 				'label_text' => __( '+ Add All Fields', 'gravityview' ),
672
-				'desc' => __('Add all the available fields at once.', 'gravityview'),
672
+				'desc' => __( 'Add all the available fields at once.', 'gravityview' ),
673 673
 				'field_id' => 'all-fields',
674 674
 				'label_type' => 'field',
675 675
 				'input_type' => NULL,
676 676
 				'field_options' => NULL,
677 677
 				'settings_html'	=> NULL,
678 678
 			)
679
-		));
679
+		) );
680 680
 
681
-		if( !empty( $additional_fields )) {
681
+		if ( ! empty( $additional_fields ) ) {
682 682
 			foreach ( (array)$additional_fields as $item ) {
683 683
 
684 684
 				// Prevent items from not having index set
@@ -689,16 +689,16 @@  discard block
 block discarded – undo
689 689
 					'input_type' => NULL,
690 690
 					'field_options' => NULL,
691 691
 					'settings_html'	=> NULL,
692
-				));
692
+				) );
693 693
 
694 694
 				// Backward compat.
695
-				if( !empty( $item['field_options'] ) ) {
695
+				if ( ! empty( $item[ 'field_options' ] ) ) {
696 696
 					// Use settings_html from now on.
697
-					$item['settings_html'] = $item['field_options'];
697
+					$item[ 'settings_html' ] = $item[ 'field_options' ];
698 698
 				}
699 699
 
700 700
 				// Render a label for each of them
701
-				echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form );
701
+				echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form );
702 702
 
703 703
 			}
704 704
 		}
@@ -711,54 +711,54 @@  discard block
 block discarded – undo
711 711
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
712 712
 	 * @return array
713 713
 	 */
714
-	function get_entry_default_fields($form, $zone) {
714
+	function get_entry_default_fields( $form, $zone ) {
715 715
 
716 716
 		$entry_default_fields = array();
717 717
 
718
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
718
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
719 719
 
720 720
 			$entry_default_fields = array(
721 721
 				'id' => array(
722
-					'label' => __('Entry ID', 'gravityview'),
722
+					'label' => __( 'Entry ID', 'gravityview' ),
723 723
 					'type' => 'id',
724
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
724
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
725 725
 				),
726 726
 				'date_created' => array(
727
-					'label' => __('Entry Date', 'gravityview'),
728
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
727
+					'label' => __( 'Entry Date', 'gravityview' ),
728
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
729 729
 					'type' => 'date_created',
730 730
 				),
731 731
 				'source_url' => array(
732
-					'label' => __('Source URL', 'gravityview'),
732
+					'label' => __( 'Source URL', 'gravityview' ),
733 733
 					'type' => 'source_url',
734
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
734
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
735 735
 				),
736 736
 				'ip' => array(
737
-					'label' => __('User IP', 'gravityview'),
737
+					'label' => __( 'User IP', 'gravityview' ),
738 738
 					'type' => 'ip',
739
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
739
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
740 740
 				),
741 741
 				'created_by' => array(
742
-					'label' => __('User', 'gravityview'),
742
+					'label' => __( 'User', 'gravityview' ),
743 743
 					'type' => 'created_by',
744
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
744
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
745 745
 				),
746 746
 
747 747
 				/**
748 748
 				 * @since 1.7.2
749 749
 				 */
750 750
 			    'other_entries' => array(
751
-				    'label'	=> __('Other Entries', 'gravityview'),
751
+				    'label'	=> __( 'Other Entries', 'gravityview' ),
752 752
 				    'type'	=> 'other_entries',
753
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
753
+				    'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
754 754
 			    ),
755 755
 	        );
756 756
 
757
-			if( 'single' !== $zone) {
757
+			if ( 'single' !== $zone ) {
758 758
 
759
-				$entry_default_fields['entry_link'] = array(
760
-					'label' => __('Link to Entry', 'gravityview'),
761
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
759
+				$entry_default_fields[ 'entry_link' ] = array(
760
+					'label' => __( 'Link to Entry', 'gravityview' ),
761
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
762 762
 					'type' => 'entry_link',
763 763
 				);
764 764
 			}
@@ -768,10 +768,10 @@  discard block
 block discarded – undo
768 768
 		/**
769 769
 		 * @since  1.2
770 770
 		 */
771
-		$entry_default_fields['custom']	= array(
772
-			'label'	=> __('Custom Content', 'gravityview'),
771
+		$entry_default_fields[ 'custom' ] = array(
772
+			'label'	=> __( 'Custom Content', 'gravityview' ),
773 773
 			'type'	=> 'custom',
774
-			'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
774
+			'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
775 775
 		);
776 776
 
777 777
 		/**
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 		 * @param  string|array $form form_ID or form object
781 781
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
782 782
 		 */
783
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
783
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
784 784
 	}
785 785
 
786 786
 	/**
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 */
792 792
 	function get_available_fields( $form = '', $zone = NULL ) {
793 793
 
794
-		if( empty( $form ) ) {
794
+		if ( empty( $form ) ) {
795 795
 			gravityview()->log->error( '$form is empty' );
796 796
 			return array();
797 797
 		}
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 		$fields = gravityview_get_form_fields( $form, true );
801 801
 
802 802
 		// get meta fields ( only if form was already created )
803
-		if( !is_array( $form ) ) {
803
+		if ( ! is_array( $form ) ) {
804 804
 			$meta_fields = gravityview_get_entry_meta( $form );
805 805
 		} else {
806 806
 			$meta_fields = array();
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		$fields = $fields + $meta_fields + $default_fields;
814 814
 
815 815
 		// Move Custom Content to top
816
-		$fields = array( 'custom' => $fields['custom'] ) + $fields;
816
+		$fields = array( 'custom' => $fields[ 'custom' ] ) + $fields;
817 817
 
818 818
 		return $fields;
819 819
 	}
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 
828 828
 		$widgets = $this->get_registered_widgets();
829 829
 
830
-		if( !empty( $widgets ) ) {
830
+		if ( ! empty( $widgets ) ) {
831 831
 
832
-			foreach( $widgets as $id => $details ) {
832
+			foreach ( $widgets as $id => $details ) {
833 833
 
834
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
834
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
835 835
 
836 836
 			}
837 837
 		}
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
861 861
 		global $post;
862 862
 
863
-		if( $type === 'widget' ) {
863
+		if ( $type === 'widget' ) {
864 864
 			$button_label = __( 'Add Widget', 'gravityview' );
865 865
 		} else {
866 866
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -872,10 +872,10 @@  discard block
 block discarded – undo
872 872
 		$form_id = null;
873 873
 
874 874
 		// if saved values, get available fields to label everyone
875
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
875
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
876 876
 
877
-			if( !empty( $_POST['template_id'] ) ) {
878
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
877
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
878
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
879 879
 			} else {
880 880
 				$form_id = $form = gravityview_get_form_id( $post->ID );
881 881
 			}
@@ -893,44 +893,44 @@  discard block
 block discarded – undo
893 893
 			}
894 894
 		}
895 895
 
896
-		foreach( $rows as $row ) :
897
-			foreach( $row as $col => $areas ) :
898
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
896
+		foreach ( $rows as $row ) :
897
+			foreach ( $row as $col => $areas ) :
898
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
899 899
 
900 900
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
901 901
 
902
-					<?php foreach( $areas as $area ) : 	?>
902
+					<?php foreach ( $areas as $area ) : 	?>
903 903
 
904
-						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
905
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
904
+						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
905
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
906 906
 
907 907
 								<?php // render saved fields
908 908
 
909
-								if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
909
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
910 910
 
911
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
911
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
912 912
 
913 913
 										// Maybe has a form ID
914
-										$form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id'];
914
+										$form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ];
915 915
 
916 916
 										$input_type = NULL;
917 917
 
918 918
 										if ( $form_id ) {
919
-											$original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ;
919
+											$original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false;
920 920
                                         } else {
921
-											$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
921
+											$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
922 922
                                         }
923 923
 
924
-										if ( !$original_item ) {
925
-											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) );
924
+										if ( ! $original_item ) {
925
+											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) );
926 926
 
927 927
 											$original_item = $field;
928 928
 										} else {
929
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
929
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
930 930
 										}
931 931
 
932 932
 										// Field options dialog box
933
-										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item );
933
+										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item );
934 934
 
935 935
 										$item = array(
936 936
 											'input_type' => $input_type,
@@ -943,23 +943,23 @@  discard block
 block discarded – undo
943 943
 											$item = wp_parse_args( $item, $original_item );
944 944
 										}
945 945
 
946
-										switch( $type ) {
946
+										switch ( $type ) {
947 947
 											case 'widget':
948
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
948
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
949 949
 												break;
950 950
 											default:
951
-												echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id );
951
+												echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id );
952 952
 										}
953 953
 									}
954 954
 
955 955
 								} // End if zone is not empty ?>
956 956
 
957
-								<span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span>
957
+								<span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span>
958 958
 							</div>
959 959
 							<div class="gv-droppable-area-action">
960
-								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a>
960
+								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a>
961 961
 
962
-								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p>
962
+								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p>
963 963
 							</div>
964 964
 						</div>
965 965
 
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 		$default_widget_areas = GravityView_Widget::get_default_widget_areas();
982 982
 
983 983
 		$widgets = array();
984
-		if( !empty( $post_id ) ) {
984
+		if ( ! empty( $post_id ) ) {
985 985
 			$widgets = gravityview_get_directory_widgets( $post_id );
986 986
 		}
987 987
 
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 		// list of available fields to be shown in the popup
1015 1015
 		$forms = gravityview_get_forms( 'any' );
1016 1016
 
1017
-		$form_ids = array_map( function ($form) { return $form['id']; }, $forms);
1017
+		$form_ids = array_map( function( $form ) { return $form[ 'id' ]; }, $forms );
1018 1018
 
1019 1019
 		foreach ( $form_ids as $form_id ) {
1020 1020
 			$filter_field_id = sprintf( 'gv-field-filter-%s-%d', $context, $form_id );
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
                 </div>
1028 1028
 
1029 1029
                 <div id="available-fields-<?php echo $filter_field_id; ?>" aria-live="polite" role="listbox">
1030
-                <?php do_action('gravityview_render_available_fields', $form_id, $context ); ?>
1030
+                <?php do_action( 'gravityview_render_available_fields', $form_id, $context ); ?>
1031 1031
                 </div>
1032 1032
 
1033 1033
                 <div class="gv-no-results hidden description"><?php esc_html_e( 'No fields were found matching the search.', 'gravityview' ); ?></div>
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 	 * @return string HTML of the active areas
1047 1047
 	 */
1048 1048
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
1049
-		if( empty( $template_id ) ) {
1049
+		if ( empty( $template_id ) ) {
1050 1050
 			gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) );
1051 1051
 			return '';
1052 1052
 		}
@@ -1060,12 +1060,12 @@  discard block
 block discarded – undo
1060 1060
 		 */
1061 1061
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
1062 1062
 
1063
-		if( empty( $template_areas ) ) {
1063
+		if ( empty( $template_areas ) ) {
1064 1064
 
1065 1065
 			gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) );
1066 1066
 			$output = '<div>';
1067
-			$output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>';
1068
-			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>';
1067
+			$output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>';
1068
+			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>';
1069 1069
 			$output .= '</div>';
1070 1070
 		} else {
1071 1071
 
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
 		}
1082 1082
 
1083
-		if( $echo ) {
1083
+		if ( $echo ) {
1084 1084
 			echo $output;
1085 1085
 		}
1086 1086
 
@@ -1100,32 +1100,32 @@  discard block
 block discarded – undo
1100 1100
 		$is_widgets_page = ( $pagenow === 'widgets.php' );
1101 1101
 
1102 1102
 		// Add the GV font (with the Astronaut)
1103
-        wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version );
1103
+        wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version );
1104 1104
 		wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version );
1105 1105
 
1106
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true );
1106
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true );
1107 1107
 
1108
-		if( GFForms::get_page() === 'form_list' ) {
1108
+		if ( GFForms::get_page() === 'form_list' ) {
1109 1109
 			wp_enqueue_style( 'gravityview_views_styles' );
1110 1110
 			return;
1111 1111
         }
1112 1112
 
1113 1113
 		// Don't process any scripts below here if it's not a GravityView page.
1114
-		if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1114
+		if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1115 1115
 		    return;
1116 1116
 		}
1117 1117
 
1118 1118
         wp_enqueue_script( 'jquery-ui-datepicker' );
1119
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version );
1119
+        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version );
1120 1120
 
1121
-        $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1121
+        $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1122 1122
 
1123 1123
         //enqueue scripts
1124 1124
         wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version );
1125 1125
 
1126
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1126
+        wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
1127 1127
             'cookiepath' => COOKIEPATH,
1128
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1128
+            'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ),
1129 1129
             'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1130 1130
             'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1131 1131
             'label_close' => __( 'Close', 'gravityview' ),
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
             'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1138 1138
             'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1139 1139
             'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ),
1140
-        ));
1140
+        ) );
1141 1141
 
1142 1142
 		wp_enqueue_style( 'gravityview_views_styles' );
1143 1143
 
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 		);
1165 1165
 
1166 1166
 		if ( wp_is_mobile() ) {
1167
-		    $scripts[] = 'jquery-touch-punch';
1167
+		    $scripts[ ] = 'jquery-touch-punch';
1168 1168
 		}
1169 1169
 
1170 1170
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 
25 25
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
26 26
 
27
-		unset( $field_options['search_filter'] );
27
+		unset( $field_options[ 'search_filter' ] );
28 28
 
29
-		if( 'edit' === $context ) {
29
+		if ( 'edit' === $context ) {
30 30
 			return $field_options;
31 31
 		}
32 32
 
33
-		$add_options['link_to_file'] = array(
33
+		$add_options[ 'link_to_file' ] = array(
34 34
 			'type' => 'checkbox',
35 35
 			'label' => __( 'Display as a Link:', 'gravityview' ),
36
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
36
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
37 37
 			'value' => false,
38 38
 			'merge_tags' => false,
39 39
 		);
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 			$base_id = null;
120 120
 
121 121
 			$is_single = gravityview_get_context() === 'single';
122
-			$lightbox = ! empty( $gravityview_view->atts['lightbox'] );
122
+			$lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] );
123 123
 			$field_compat = $gravityview_view->getCurrentField();
124 124
 		}
125 125
 
126 126
 		$output_arr = array();
127 127
 
128 128
 		// Get an array of file paths for the field.
129
-		$file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
129
+		$file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
130 130
 
131 131
 		// The $value JSON was probably truncated; let's check lead_detail_long.
132 132
 		if ( ! is_array( $file_paths ) ) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			$rendered = null;
146 146
 
147 147
 			// If the site is HTTPS, use HTTPS
148
-			if ( function_exists('set_url_scheme') ) {
148
+			if ( function_exists( 'set_url_scheme' ) ) {
149 149
 				$file_path = set_url_scheme( $file_path );
150 150
 			}
151 151
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 			$file_path_info = pathinfo( $file_path );
157 157
 
158 158
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
159
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
160
-			$basename = $file_path_info['basename'];
159
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
160
+			$basename = $file_path_info[ 'basename' ];
161 161
 
162 162
 			// Get the secure download URL
163 163
 			$is_secure = false;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 					 */
195 195
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
196 196
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
197
-						'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
197
+						'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
198 198
 					), $context );
199 199
 
200 200
 					/**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 					 */
231 231
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
232 232
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
233
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
233
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
234 234
 					), $context );
235 235
 
236 236
 					/**
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 			} else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) {
263 263
 				$image_atts = array(
264 264
 					'src'   => $file_path,
265
-					'class' => 'gv-image gv-field-id-' . $field_settings['id'],
266
-					'alt'   => $field_settings['label'],
265
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
266
+					'alt'   => $field_settings[ 'label' ],
267 267
 					'width' => ( $is_single ? null : 250 )
268 268
 				);
269 269
 
270 270
 				if ( $is_secure ) {
271
-					$image_atts['validate_src'] = false;
271
+					$image_atts[ 'validate_src' ] = false;
272 272
 				}
273 273
 
274 274
 				/**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
 				$image = new GravityView_Image( $image_atts );
285 285
 
286
-				$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
286
+				$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
287 287
 
288 288
 				/**
289 289
 				 * @filter `gravityview/fields/fileupload/allow_insecure_lightbox` Allow insecure links to be shown for the lighbox.
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 				 */
295 295
 				$override_security = apply_filters( 'gravityview/fields/fileupload/allow_insecure_lightbox', false, $file_path, $field_settings, $context );
296 296
 
297
-				if ( $lightbox && empty( $field_settings['show_as_link'] ) && ( ! $is_secure || $override_security ) ) {
297
+				if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) && ( ! $is_secure || $override_security ) ) {
298 298
 					$lightbox_link_atts = array(
299 299
 						'rel'   => sprintf( "%s-%s", $gv_class, $entry_slug ),
300 300
 						'class' => 'thickbox',
301 301
 					);
302 302
 
303 303
 					if ( $override_security ) {
304
-						$image_atts['src'] = $insecure_file_path;
304
+						$image_atts[ 'src' ] = $insecure_file_path;
305 305
 						$image = new GravityView_Image( $image_atts );
306 306
 						$file_path = $insecure_file_path;
307 307
 						// :( a kitten died somewhere
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 				}
314 314
 
315 315
 				// Show as link should render the image regardless.
316
-				if ( ! empty( $field_settings['show_as_link'] ) ) {
316
+				if ( ! empty( $field_settings[ 'show_as_link' ] ) ) {
317 317
 					$text = $rendered;
318 318
 				}
319 319
 			}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
331 331
 
332 332
 			// Output textualized content where 
333
-			if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) {
333
+			if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) {
334 334
 				/**
335 335
 				 * Modify the link text (defaults to the file name)
336 336
 				 *
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 				 */
344 344
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context );
345 345
 
346
-				if ( empty( $field_settings['show_as_link'] ) ) {
346
+				if ( empty( $field_settings[ 'show_as_link' ] ) ) {
347 347
 					/**
348 348
 					 * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field
349 349
 					 * @param array|string $link_atts Array or attributes string
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 				$content = empty( $rendered ) ? $text : $rendered;
360 360
 			}
361 361
 
362
-			$output_arr[] = array(
362
+			$output_arr[ ] = array(
363 363
 				'file_path' => $file_path,
364 364
 				'content' => $content
365 365
 			);
Please login to merge, or discard this patch.
future/includes/class-gv-utils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		 * Try subkeys after split.
92 92
 		 */
93 93
 		if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) {
94
-			return self::get( self::get( $array, $parts[0] ), $parts[1], $default );
94
+			return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default );
95 95
 		}
96 96
 
97 97
 		return $default;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	public static function gf_query_debug( $query ) {
146 146
 		$introspect = $query->_introspect();
147 147
 		return array(
148
-			'where' => $query->_where_unwrap( $introspect['where'] )
148
+			'where' => $query->_where_unwrap( $introspect[ 'where' ] )
149 149
 		);
150 150
 	}
151 151
 }
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-directory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
 		$KWS_GF_Change_Lead_Creator = new KWS_GF_Change_Lead_Creator;
30 30
 
31 31
 		// Now, no validation is required in the methods; let's hook in.
32
-		remove_action('admin_init', array( $KWS_GF_Change_Lead_Creator, 'set_screen_mode' ) );
32
+		remove_action( 'admin_init', array( $KWS_GF_Change_Lead_Creator, 'set_screen_mode' ) );
33 33
 
34
-		remove_action("gform_entry_info", array( $KWS_GF_Change_Lead_Creator, 'add_select' ), 10 );
34
+		remove_action( "gform_entry_info", array( $KWS_GF_Change_Lead_Creator, 'add_select' ), 10 );
35 35
 
36
-		remove_action("gform_after_update_entry", array( $KWS_GF_Change_Lead_Creator, 'update_entry_creator' ), 10 );
36
+		remove_action( "gform_after_update_entry", array( $KWS_GF_Change_Lead_Creator, 'update_entry_creator' ), 10 );
37 37
 
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
includes/class-gravityview-change-entry-creator.php 1 patch
Spacing   +42 added lines, -42 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,20 +56,20 @@  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_entry_property( (int) $entry['id'], 'created_by', (int) $user_id, false, true );
64
+    	$result = RGFormsModel::update_entry_property( (int)$entry[ 'id' ], 'created_by', (int)$user_id, false, true );
65 65
 
66 66
     	if ( false === $result ) {
67
-    		$status = __('Error', 'gravityview');
67
+    		$status = __( 'Error', 'gravityview' );
68 68
     		global $wpdb;
69 69
 		    $note = sprintf( '%s: Failed to assign User ID #%d as the entry creator (Last database error: "%s")', $status, $user_id, $wpdb->last_error );
70 70
     	} else {
71
-    		$status = __('Success', 'gravityview');
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 );
71
+    		$status = __( 'Success', 'gravityview' );
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 74
 
75 75
     	gravityview()->log->debug( 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - {note}', array( 'note' => $note ) );
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 	     * @since 1.21.5
80 80
 	     * @param boolean $disable Disable the Change Entry Creator note. Default: false.
81 81
 	     */
82
-	    if( apply_filters('gravityview_disable_change_entry_creator_note', false ) ) {
82
+	    if ( apply_filters( 'gravityview_disable_change_entry_creator_note', false ) ) {
83 83
 		    return;
84 84
 	    }
85 85
 
86
-        GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
86
+        GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' );
87 87
 
88 88
     }
89 89
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 
96 96
     	// Plugin that was provided here:
97 97
     	// @link https://gravityview.co/support/documentation/201991205/
98
-    	remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10 );
99
-    	remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10 );
98
+    	remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10 );
99
+    	remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10 );
100 100
 
101 101
     }
102 102
 
@@ -107,26 +107,26 @@  discard block
 block discarded – undo
107 107
     function load() {
108 108
 
109 109
     	// Does GF exist?
110
-        if( !class_exists('GFCommon') ) {
110
+        if ( ! class_exists( 'GFCommon' ) ) {
111 111
             return;
112 112
         }
113 113
 
114 114
         // Can the user edit entries?
115
-        if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
115
+        if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
116 116
             return;
117 117
         }
118 118
 
119 119
         // If screen mode isn't set, then we're in the wrong place.
120
-        if( empty( $_REQUEST['screen_mode'] ) ) {
120
+        if ( empty( $_REQUEST[ 'screen_mode' ] ) ) {
121 121
             return;
122 122
         }
123 123
 
124 124
         // Now, no validation is required in the methods; let's hook in.
125
-        add_action('admin_init', array( &$this, 'set_screen_mode' ) );
125
+        add_action( 'admin_init', array( &$this, 'set_screen_mode' ) );
126 126
 
127
-        add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
127
+        add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 );
128 128
 
129
-        add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
129
+        add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 );
130 130
 
131 131
     }
132 132
 
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
     function set_screen_mode() {
138 138
 
139 139
     	// If $_GET['screen_mode'] is set to edit, set $_POST value
140
-        if( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) {
141
-            $_POST["screen_mode"] = 'edit';
140
+        if ( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) {
141
+            $_POST[ "screen_mode" ] = 'edit';
142 142
         }
143 143
 
144 144
     }
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
      * @param  int $entry_id Entry ID
150 150
      * @return void
151 151
      */
152
-    function update_entry_creator($form, $entry_id) {
152
+    function update_entry_creator( $form, $entry_id ) {
153 153
             global $current_user;
154 154
 
155 155
         // Update the entry
156
-        $created_by = absint( \GV\Utils::_POST( 'created_by') );
156
+        $created_by = absint( \GV\Utils::_POST( 'created_by' ) );
157 157
 
158 158
         RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
159 159
 
@@ -161,30 +161,30 @@  discard block
 block discarded – undo
161 161
         $originally_created_by = \GV\Utils::_POST( 'originally_created_by' );
162 162
 
163 163
         // If there's no owner and there didn't used to be, keep going
164
-        if( empty( $originally_created_by ) && empty( $created_by ) ) {
164
+        if ( empty( $originally_created_by ) && empty( $created_by ) ) {
165 165
             return;
166 166
         }
167 167
 
168 168
         // If the values have changed
169
-        if( absint( $originally_created_by ) !== absint( $created_by ) ) {
169
+        if ( absint( $originally_created_by ) !== absint( $created_by ) ) {
170 170
 
171
-            $user_data = get_userdata($current_user->ID);
171
+            $user_data = get_userdata( $current_user->ID );
172 172
 
173
-            $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
173
+            $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' );
174 174
 
175
-            $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');
175
+            $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' );
176 176
 
177
-            if( !empty( $originally_created_by ) ) {
178
-                $originally_created_by_user_data = get_userdata($originally_created_by);
177
+            if ( ! empty( $originally_created_by ) ) {
178
+                $originally_created_by_user_data = get_userdata( $originally_created_by );
179 179
                 $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
180 180
             }
181 181
 
182
-            if( !empty( $created_by ) ) {
183
-                $created_by_user_data =  get_userdata($created_by);
182
+            if ( ! empty( $created_by ) ) {
183
+                $created_by_user_data = get_userdata( $created_by );
184 184
                 $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
185 185
             }
186 186
 
187
-            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' );
187
+            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' );
188 188
         }
189 189
 
190 190
     }
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
      * @param array $entry    GF entry array
196 196
      * @return void
197 197
      */
198
-    function add_select($form_id, $entry ) {
198
+    function add_select( $form_id, $entry ) {
199 199
 
200
-        if( \GV\Utils::_POST( 'screen_mode' ) !== 'edit' ) {
200
+        if ( \GV\Utils::_POST( 'screen_mode' ) !== 'edit' ) {
201 201
             return;
202 202
         }
203 203
 
@@ -216,23 +216,23 @@  discard block
 block discarded – undo
216 216
 	    }
217 217
 
218 218
         $output = '<label for="change_created_by">';
219
-        $output .= esc_html__('Change Entry Creator:', 'gravityview');
219
+        $output .= esc_html__( 'Change Entry Creator:', 'gravityview' );
220 220
         $output .= '</label>';
221 221
 
222 222
 	    // If there are users who are not being shown, show a warning.
223 223
 	    // TODO: Use AJAX instead of <select>
224 224
 	    $count_users = count_users();
225
-	    if( sizeof( $users ) < $count_users['total_users'] ) {
225
+	    if ( sizeof( $users ) < $count_users[ 'total_users' ] ) {
226 226
 		    $output .= '<p><i class="dashicons dashicons-warning"></i> ' . sprintf( esc_html__( 'The displayed list of users has been trimmed due to the large number of users. %sLearn how to remove this limit%s.', 'gravityview' ), '<a href="https://docs.gravityview.co/article/251-i-only-see-some-users-in-the-change-entry-creator-dropdown" rel="external">', '</a>' ) . '</p>';
227 227
 	    }
228 228
 
229 229
 	    $output .= '<select name="created_by" id="change_created_by" class="widefat">';
230
-        $output .= '<option value="' . selected( $entry['created_by'], '0', false ) . '"> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
231
-        foreach($users as $user) {
232
-            $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
230
+        $output .= '<option value="' . selected( $entry[ 'created_by' ], '0', false ) . '"> &mdash; ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' &mdash; </option>';
231
+        foreach ( $users as $user ) {
232
+            $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>';
233 233
         }
234 234
         $output .= '</select>';
235
-        $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
235
+        $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />';
236 236
 
237 237
 	    unset( $is_created_by_in_users, $created_by_user, $users, $created_by_id, $count_users );
238 238
 
Please login to merge, or discard this patch.
includes/class-admin-installer.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
56
-		$items[] = 'gravityview-admin-installer';
56
+		$items[ ] = 'gravityview-admin-installer';
57 57
 
58 58
 		return $items;
59 59
 	}
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 			return;
73 73
 		}
74 74
 
75
-		add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) {
75
+		add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) {
76 76
 			foreach ( $downloads_data as $extension ) {
77
-				if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) {
77
+				if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) {
78 78
 					continue;
79 79
 				}
80 80
 
81
-				return (object) array(
82
-					'slug'          => $extension['info']['slug'],
83
-					'name'          => $extension['info']['title'],
84
-					'version'       => $extension['licensing']['version'],
85
-					'download_link' => $extension['files'][0]['file'],
81
+				return (object)array(
82
+					'slug'          => $extension[ 'info' ][ 'slug' ],
83
+					'name'          => $extension[ 'info' ][ 'title' ],
84
+					'version'       => $extension[ 'licensing' ][ 'version' ],
85
+					'download_link' => $extension[ 'files' ][ 0 ][ 'file' ],
86 86
 				);
87 87
 			}
88 88
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 
145 145
 		foreach ( $all_plugins as $path => $plugin ) {
146 146
 
147
-			if ( empty( $plugin['TextDomain'] ) ) {
147
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
148 148
 				continue;
149 149
 			}
150 150
 
151
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
151
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
152 152
 				'path'      => $path,
153
-				'version'   => $plugin['Version'],
153
+				'version'   => $plugin[ 'Version' ],
154 154
 				'activated' => is_plugin_active( $path )
155 155
 			);
156 156
 		}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			return $downloads_data;
209 209
 		}
210 210
 
211
-		if( \GV\Plugin::is_network_activated() ) {
211
+		if ( \GV\Plugin::is_network_activated() ) {
212 212
 			$home_url = network_home_url();
213 213
 		} else {
214 214
 			$home_url = home_url();
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$downloads_data = json_decode( wp_remote_retrieve_body( $response ), true );
238 238
 
239
-		if ( empty( $downloads_data['products'] ) ) {
239
+		if ( empty( $downloads_data[ 'products' ] ) ) {
240 240
 			return array();
241 241
 		}
242 242
 
243
-		$this->set_downloads_data( $downloads_data['products'] );
243
+		$this->set_downloads_data( $downloads_data[ 'products' ] );
244 244
 
245
-		return $downloads_data['products'];
245
+		return $downloads_data[ 'products' ];
246 246
 	}
247 247
 
248 248
 	/**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 				foreach ( $downloads_data as $extension ) {
317 317
 
318
-					if ( empty( $extension['info'] ) ) {
318
+					if ( empty( $extension[ 'info' ] ) ) {
319 319
 						continue;
320 320
 					}
321 321
 
@@ -344,29 +344,29 @@  discard block
 block discarded – undo
344 344
 
345 345
         $details = $this->get_download_display_details( $download, $wp_plugins );
346 346
 
347
-        $download_info = $details['download_info'];
347
+        $download_info = $details[ 'download_info' ];
348 348
 
349 349
 		?>
350
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
350
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
351 351
             <div class="addon-inner">
352
-                <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a>
353
-                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3>
352
+                <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a>
353
+                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3>
354 354
                 <div>
355
-                    <?php if( ! empty( $details['status_label'] ) ) { ?>
356
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
357
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
355
+                    <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?>
356
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
357
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
358 358
                     </div>
359 359
 			        <?php } ?>
360 360
 
361
-                    <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>">
362
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
363
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
361
+                    <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>">
362
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
363
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
364 364
                     </a>
365 365
                 </div>
366 366
 
367 367
                 <div class="addon-excerpt"><?php
368 368
 
369
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
369
+                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] );
370 370
 
371 371
                     // Allow some pure HTML tags, but remove everything else from the excerpt.
372 372
                     $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 */
407 407
 	private function get_download_display_details( $download, $wp_plugins ) {
408 408
 
409
-		$download_info = wp_parse_args( (array) $download['info'], array(
409
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
410 410
 			'thumbnail' => '',
411 411
 			'title' => '',
412 412
 			'textdomain' => '',
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 			'installer_excerpt' => null, // May not be defined
419 419
 		) );
420 420
 
421
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
421
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
422 422
 
423
-		$has_access = ! empty( $download['files'] );
423
+		$has_access = ! empty( $download[ 'files' ] );
424 424
 		$spinner = true;
425 425
 		$href = $plugin_path = '#';
426 426
 		$status = $item_class = $button_title = $button_class = '';
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		$required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' );
431 431
 
432 432
 		// The license is not active - no matter what level, this should not work
433
-		if( ! $is_active  && empty( $base_price ) ) {
433
+		if ( ! $is_active && empty( $base_price ) ) {
434 434
 			$spinner      = false;
435 435
 			$status_label = '';
436 436
 			$button_class = 'disabled disabled-license';
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 			$status_label = '';
444 444
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
445 445
 			$button_class = 'button-primary button-large';
446
-			$href         = $download_info['link'];
446
+			$href         = $download_info[ 'link' ];
447 447
 			$item_class   = 'featured';
448 448
 		}
449 449
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
457 457
 		}
458 458
 
459
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
459
+        elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) {
460 460
 	        $spinner      = false;
461 461
 	        $status       = 'notinstalled';
462 462
 	        $status_label = __( 'Coming Soon', 'gravityview' );
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 			$href = add_query_arg(
472 472
 				array(
473 473
 					'action'   => 'install-plugin',
474
-					'plugin'   => $download_info['slug'],
475
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
474
+					'plugin'   => $download_info[ 'slug' ],
475
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
476 476
 				),
477 477
 				self_admin_url( 'update.php' )
478 478
 			);
@@ -484,25 +484,25 @@  discard block
 block discarded – undo
484 484
 		}
485 485
 
486 486
 		// Access and the plugin is installed but not active
487
-		elseif ( false === $wp_plugin['activated'] ) {
487
+		elseif ( false === $wp_plugin[ 'activated' ] ) {
488 488
 			$status = 'inactive';
489 489
 			$status_label = __( 'Inactive', 'gravityview' );
490 490
 			$button_label = __( 'Activate', 'gravityview' );
491
-			$plugin_path = $wp_plugin['path'];
491
+			$plugin_path = $wp_plugin[ 'path' ];
492 492
 
493 493
 		}
494 494
 
495 495
 		// Access and the plugin is installed and active
496 496
 		else {
497 497
 
498
-			$plugin_path = $wp_plugin['path'];
498
+			$plugin_path = $wp_plugin[ 'path' ];
499 499
 			$status = 'active';
500 500
 			$status_label = __( 'Active', 'gravityview' );
501 501
 			$button_label = __( 'Deactivate', 'gravityview' );
502 502
 
503 503
 		}
504 504
 
505
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
505
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
506 506
     }
507 507
 
508 508
 	/**
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
518 518
 		$base_price = \GFCommon::to_number( $base_price );
519 519
 
520
-		unset( $download['pricing']['amount'] );
520
+		unset( $download[ 'pricing' ][ 'amount' ] );
521 521
 
522 522
 		// Price options array, not single price
523
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
524
-			$base_price = array_shift( $download['pricing'] );
523
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
524
+			$base_price = array_shift( $download[ 'pricing' ] );
525 525
 		}
526 526
 
527 527
 		return floatval( $base_price );
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 	public function activate_download() {
536 536
 		$data = \GV\Utils::_POST( 'data', array() );
537 537
 
538
-		if ( empty( $data['path'] ) ) {
538
+		if ( empty( $data[ 'path' ] ) ) {
539 539
 			return;
540 540
 		}
541 541
 
542
-		$result = activate_plugin( $data['path'] );
542
+		$result = activate_plugin( $data[ 'path' ] );
543 543
 
544
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
544
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
545 545
 			wp_send_json_error( array(
546 546
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
547 547
             ) );
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 	public function deactivate_download() {
559 559
 		$data = \GV\Utils::_POST( 'data', array() );
560 560
 
561
-		if ( empty( $data['path'] ) ) {
561
+		if ( empty( $data[ 'path' ] ) ) {
562 562
 			return;
563 563
 		}
564 564
 
565
-		deactivate_plugins( $data['path'] );
565
+		deactivate_plugins( $data[ 'path' ] );
566 566
 
567
-		if( is_plugin_active( $data['path'] ) ) {
567
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
568 568
             wp_send_json_error( array(
569 569
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
570 570
             ) );
Please login to merge, or discard this patch.
includes/class-gravityview-gfformsmodel.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 	public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) {
41 41
 
42 42
 		if ( in_array( $source_field, array( 'date_created', 'date_updated', 'payment_date' ), true ) ) {
43
-			$field_value = is_int( $field_value )? $field_value : strtotime( $field_value );
44
-			$target_value = is_int( $target_value )? $target_value : strtotime( $target_value );
43
+			$field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value );
44
+			$target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value );
45 45
 		}
46 46
 
47 47
 		if ( $source_field instanceof GF_Field && $source_field->type == 'date' ) {
48
-			$field_value = is_int( $field_value )? $field_value : strtotime( $field_value );
49
-			$target_value = is_int( $target_value )? $target_value : strtotime( $target_value );
48
+			$field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value );
49
+			$target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value );
50 50
 		}
51 51
 
52 52
 		if ( in_array( $_operation = str_replace( ' ', '_', trim( $operation ) ), array( 'in', 'not_in' ) ) ) {
53
-			return GVCommon::matches_operation( (array) $field_value, (array) $target_value, $_operation );
53
+			return GVCommon::matches_operation( (array)$field_value, (array)$target_value, $_operation );
54 54
 		}
55 55
 
56 56
 		return parent::is_value_match( $field_value, $target_value, $operation, $source_field, $rule, $form );
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 
75 75
         $post_data = self::get_post_fields( $form, $entry );
76 76
 
77
-        $media = get_attached_media( 'image', $entry['post_id'] );
77
+        $media = get_attached_media( 'image', $entry[ 'post_id' ] );
78 78
 
79 79
         $post_images = array();
80 80
 
81 81
         foreach ( $media as $media_item ) {
82
-            foreach( (array) $post_data['images'] as $post_data_item ) {
83
-                if(
82
+            foreach ( (array)$post_data[ 'images' ] as $post_data_item ) {
83
+                if (
84 84
                     \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title &&
85 85
                     \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content &&
86 86
                     \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt
87 87
                 ) {
88
-                    $post_images["{$post_data_item['field_id']}"] = $media_item->ID;
88
+                    $post_images[ "{$post_data_item[ 'field_id' ]}" ] = $media_item->ID;
89 89
                 }
90 90
             }
91 91
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
          * If the method changes to public, use Gravity Forms' method
114 114
          * @todo: If/when the method is public, remove the unneeded copied code.
115 115
          */
116
-        if( $reflection->isPublic() ) {
116
+        if ( $reflection->isPublic() ) {
117 117
             return parent::get_post_fields( $form, $entry );
118 118
         }
119 119
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
          * If the method changes to public, use Gravity Forms' method
141 141
          * @todo: If/when the method is public, remove the unneeded copied code.
142 142
          */
143
-        if( $reflection->isPublic() ) {
143
+        if ( $reflection->isPublic() ) {
144 144
             return parent::copy_post_image( $url, $post_id );
145 145
         }
146 146
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
          * If the method changes to public, use Gravity Forms' method
176 176
          * @todo: If/when the method is public, remove the unneeded copied code.
177 177
          */
178
-        if( $reflection->isPublic() ) {
178
+        if ( $reflection->isPublic() ) {
179 179
             return parent::media_handle_upload( $url, $post_id, $post_data );
180 180
         }
181 181
 
Please login to merge, or discard this patch.
future/includes/class-gv-collection-entry.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 
105 105
 		/** Call all lazy callbacks. */
106 106
 		foreach ( $this->callbacks as $callback ) {
107
-			if ( $callback[0] != 'count' ) {
107
+			if ( $callback[ 0 ] != 'count' ) {
108 108
 				continue;
109 109
 			}
110 110
 
111
-			$total += $callback[1]( $this->filters );
111
+			$total += $callback[ 1 ]( $this->filters );
112 112
 		}
113 113
 
114 114
 		if ( ! $total ) {
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 
186 186
 		/** Call all lazy callbacks. */
187 187
 		foreach ( $this->callbacks as $i => $callback ) {
188
-			if ( $callback[0] != 'fetch' ) {
188
+			if ( $callback[ 0 ] != 'fetch' ) {
189 189
 				continue;
190 190
 			}
191 191
 
192
-			$this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) );
192
+			$this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) );
193 193
 		}
194 194
 
195 195
 		$this->fetched = parent::count();
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			return;
346 346
 		}
347 347
 
348
-		$this->callbacks []= array( $type, $callback );
348
+		$this->callbacks [ ] = array( $type, $callback );
349 349
 	}
350 350
 
351 351
 	/**
Please login to merge, or discard this patch.