Completed
Pull Request — develop (#1687)
by
unknown
16:12
created
future/_mocks.php 1 patch
Spacing   +40 added lines, -43 removed lines patch added patch discarded remove patch
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
 			$entries = $view->get_entries( gravityview()->request );
103 103
 		}
104 104
 
105
-		$page = \GV\Utils::get( $parameters['paging'], 'current_page' ) ?
106
-			: ( ( ( $parameters['paging']['offset'] - $view->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
105
+		$page = \GV\Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $view->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
107 106
 
108 107
 		/** Set paging, count and unwrap the entries. */
109 108
 		$paging = array(
@@ -142,17 +141,17 @@  discard block
 block discarded – undo
142 141
  * @return null|string The value of a field in an entry.
143 142
  */
144 143
 function GravityView_API_field_value( $entry, $field_settings, $format ) {
145
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
144
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
146 145
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
147 146
 		return null;
148 147
 	}
149 148
 
150
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
151
-		$multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry['_multi'] ) );
152
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
149
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
150
+		$multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry[ '_multi' ] ) );
151
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
153 152
 	}
154 153
 
155
-	if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
154
+	if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
156 155
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
157 156
 		return null;
158 157
 	}
@@ -162,18 +161,18 @@  discard block
 block discarded – undo
162 161
 	 *
163 162
 	 * Fields with a numeric ID are Gravity Forms ones.
164 163
 	 */
165
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;;
164
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ;
166 165
 
167 166
 	/** Initialize the future field. */
168 167
 	switch ( $source ):
169 168
 		/** The Gravity Forms backend. */
170 169
 		case \GV\Source::BACKEND_GRAVITYFORMS:
171
-			if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
170
+			if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
172 171
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
173 172
 				return null;
174 173
 			}
175 174
 
176
-			if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) {
175
+			if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) {
177 176
 				return null;
178 177
 			}
179 178
 
@@ -181,7 +180,7 @@  discard block
 block discarded – undo
181 180
 
182 181
 		/** Our internal backend. */
183 182
 		case \GV\Source::BACKEND_INTERNAL:
184
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
183
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
185 184
 				return null;
186 185
 			}
187 186
 
@@ -215,13 +214,13 @@  discard block
 block discarded – undo
215 214
 
216 215
 	/** A bail condition. */
217 216
 	$bail = function( $label, $field_settings, $entry, $force_show_label, $form ) {
218
-		if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) {
217
+		if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) {
219 218
 
220
-			$label = isset( $field_settings['label'] ) ? $field_settings['label'] : '';
219
+			$label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : '';
221 220
 
222 221
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
223
-			if ( ! empty( $field_settings['custom_label'] ) ) {
224
-				$label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry );
222
+			if ( ! empty( $field_settings[ 'custom_label' ] ) ) {
223
+				$label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry );
225 224
 			}
226 225
 
227 226
 			/**
@@ -247,19 +246,19 @@  discard block
 block discarded – undo
247 246
 
248 247
 	$label = '';
249 248
 
250
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
251
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
252
-		if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) {
249
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
250
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
251
+		if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) {
253 252
 			$form = $_form->form;
254 253
 		}
255 254
 	}
256 255
 
257
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
256
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
258 257
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
259 258
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
260 259
 	}
261 260
 
262
-	if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
261
+	if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
263 262
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
264 263
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
265 264
 	}
@@ -271,31 +270,31 @@  discard block
 block discarded – undo
271 270
 	 *
272 271
 	 * Fields with a numeric ID are Gravity Forms ones.
273 272
 	 */
274
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
273
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
275 274
 
276 275
 	/** Initialize the future field. */
277 276
 	switch ( $source ):
278 277
 		/** The Gravity Forms backend. */
279 278
 		case \GV\Source::BACKEND_GRAVITYFORMS:
280
-			if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
279
+			if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
281 280
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
282 281
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
283 282
 			}
284 283
 
285
-			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) {
286
-				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) );
284
+			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) {
285
+				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) );
287 286
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form );
288 287
 			}
289
-			if ( empty( $field_settings['show_label'] ) ) {
288
+			if ( empty( $field_settings[ 'show_label' ] ) ) {
290 289
 				/** The label never wins... */
291
-				$field_settings['label'] = '';
290
+				$field_settings[ 'label' ] = '';
292 291
 			}
293 292
 
294 293
 			break;
295 294
 
296 295
 		/** Our internal backend. */
297 296
 		case \GV\Source::BACKEND_INTERNAL:
298
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
297
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
299 298
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
300 299
 			}
301 300
 			break;
@@ -307,8 +306,8 @@  discard block
 block discarded – undo
307 306
 			break;
308 307
 	endswitch;
309 308
 
310
-	if( $force_show_label ) {
311
-		$field_settings['show_label'] = '1';
309
+	if ( $force_show_label ) {
310
+		$field_settings[ 'show_label' ] = '1';
312 311
 	}
313 312
 
314 313
 	/** Add the field settings. */
@@ -444,7 +443,7 @@  discard block
 block discarded – undo
444 443
 			'\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(),
445 444
 			'\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(),
446 445
 			'\GravityView_View::_current_field' => \GravityView_View::getInstance()->getCurrentField(),
447
-			'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'],
446
+			'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ],
448 447
 			'wp_query::in_the_loop' => $wp_query->in_the_loop,
449 448
 		);
450 449
 	}
@@ -532,7 +531,7 @@  discard block
 block discarded – undo
532 531
 					break;
533 532
 				case 'wp_actions[loop_start]':
534 533
 					global $wp_actions;
535
-					$wp_actions['loop_start'] = $value;
534
+					$wp_actions[ 'loop_start' ] = $value;
536 535
 					break;
537 536
 				case 'wp_query::in_the_loop':
538 537
 					global $wp_query;
@@ -629,9 +628,7 @@  discard block
 block discarded – undo
629 628
 				case 'request':
630 629
 					self::thaw( array(
631 630
 						'\GravityView_View::context' => (
632
-							$value->is_entry() ? 'single' :
633
-							( $value->is_edit_entry() ? 'edit' :
634
-									( $value->is_view() ? 'directory': null )
631
+							$value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null )
635 632
 								)
636 633
 						),
637 634
 						'\GravityView_frontend::is_search' => $value->is_search(),
@@ -685,14 +682,14 @@  discard block
 block discarded – undo
685 682
 		global $wp_query, $wp_actions;
686 683
 
687 684
 		$wp_query->in_the_loop = false;
688
-		$wp_actions['loop_start'] = 0;
685
+		$wp_actions[ 'loop_start' ] = 0;
689 686
 	}
690 687
 }
691 688
 
692 689
 
693 690
 /** Add some global fix for field capability discrepancies. */
694 691
 add_filter( 'gravityview/configuration/fields', function( $fields ) {
695
-	if ( empty( $fields  ) ) {
692
+	if ( empty( $fields ) ) {
696 693
 		return $fields;
697 694
 	}
698 695
 
@@ -719,11 +716,11 @@  discard block
 block discarded – undo
719 716
 		}
720 717
 
721 718
 		foreach ( $_fields as $uid => &$_field ) {
722
-			if ( ! isset( $_field['only_loggedin'] ) ) {
719
+			if ( ! isset( $_field[ 'only_loggedin' ] ) ) {
723 720
 				continue;
724 721
 			}
725 722
 			/** If we do not require login, we don't require a cap. */
726
-			$_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' );
723
+			$_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' );
727 724
 		}
728 725
 	}
729 726
 	return $fields;
@@ -754,8 +751,8 @@  discard block
 block discarded – undo
754 751
 		}
755 752
 
756 753
 		foreach ( $_fields as $uid => &$_field ) {
757
-			if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) {
758
-				$_field['form_id'] = $view->form->ID;
754
+			if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) {
755
+				$_field[ 'form_id' ] = $view->form->ID;
759 756
 			}
760 757
 		}
761 758
 	}
@@ -769,13 +766,13 @@  discard block
 block discarded – undo
769 766
 	if ( class_exists( '\GravityView_frontend' ) ) {
770 767
 		global $wp_filter;
771 768
 
772
-		if ( empty( $wp_filter['gravityview_after'] ) ) {
769
+		if ( empty( $wp_filter[ 'gravityview_after' ] ) ) {
773 770
 			return;
774 771
 		}
775 772
 
776
-		foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) {
773
+		foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) {
777 774
 			if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
778
-				unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] );
775
+				unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] );
779 776
 			}
780 777
 		}
781 778
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-collection-view.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			 * @deprecated
115 115
 			 * @see The `gravityview/view_collection/from_post/meta_keys` filter.
116 116
 			 */
117
-			$meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' );
117
+			$meta_keys = (array)apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' );
118 118
 
119 119
 			/** What about inside post meta values? */
120 120
 			foreach ( $meta_keys as $meta_key ) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 
169 169
 		/** Let's find us some [gravityview] shortcodes perhaps. */
170 170
 		foreach ( Shortcode::parse( $content ) as $shortcode ) {
171
-			if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) {
171
+			if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) {
172 172
 				continue;
173 173
 			}
174 174
 
175
-			if ( is_numeric( $shortcode->atts['id'] ) ) {
176
-				$view = View::by_id( $shortcode->atts['id'] );
175
+			if ( is_numeric( $shortcode->atts[ 'id' ] ) ) {
176
+				$view = View::by_id( $shortcode->atts[ 'id' ] );
177 177
 				if ( ! $view ) {
178 178
 					continue;
179 179
 				}
Please login to merge, or discard this patch.
future/includes/class-gv-template-legacy-override.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 		$additional = array();
99 99
 
100 100
 		// form-19-table-body.php
101
-		$additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name );
101
+		$additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name );
102 102
 
103 103
 		// view-3-table-body.php
104
-		$additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name );
104
+		$additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name );
105 105
 
106 106
 		global $post;
107 107
 		if ( $post ) {
108 108
 			// page-19-table-body.php
109
-			$additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name );
109
+			$additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name );
110 110
 		}
111 111
 
112 112
 		// Combine with existing table-body.php and table.php
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		ob_start();
131 131
 
132 132
 		$request = new Mock_Request();
133
-		$request->returns['is_view'] = $this->view;
133
+		$request->returns[ 'is_view' ] = $this->view;
134 134
 
135 135
 		/**
136 136
 		 * You got one shot. One opportunity. To render all the widgets you have ever wanted.
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 		 */
143 143
 		global $wp_filter;
144 144
 		foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) {
145
-			foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) {
145
+			foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) {
146 146
 				if ( strpos( $function_key, 'render_widget_hooks' ) ) {
147
-					unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] );
147
+					unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] );
148 148
 				}
149 149
 			}
150 150
 		}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		 */
155 155
 		if ( $this->entry ) {
156 156
 
157
-			$request->returns['is_entry'] = $this->entry;
157
+			$request->returns[ 'is_entry' ] = $this->entry;
158 158
 
159 159
 			global $post;
160 160
 
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 			 * This allows us to fake it till we make it.
189 189
 			 */
190 190
 			$parameters = $this->view->settings->as_atts();
191
-			if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) {
191
+			if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) {
192 192
 				$has_multisort = true;
193
-				$parameters['sort_field'] = reset( $parameters['sort_field'] );
194
-				if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) {
195
-					$parameters['sort_direction'] = reset( $parameters['sort_direction'] );
193
+				$parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] );
194
+				if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) {
195
+					$parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] );
196 196
 				}
197 197
 			}
198 198
 
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 					'fields' => $this->view->fields->by_visible( $this->view ),
212 212
 					'in_the_loop' => true,
213 213
 				), empty( $parameters ) ? array() : array(
214
-					'paging' => $parameters['paging'],
215
-					'sorting' => $parameters['sorting'],
214
+					'paging' => $parameters[ 'paging' ],
215
+					'sorting' => $parameters[ 'sorting' ],
216 216
 				), $post ? array(
217 217
 					'post' => $post,
218 218
 				) : array() ) );
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 	// If there's an overriding CSS file in the current template folder, use it.
33 33
 	$template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file;
34 34
 
35
-	if( file_exists( $template_css_path ) ) {
35
+	if ( file_exists( $template_css_path ) ) {
36 36
 		$path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file;
37 37
 		gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) );
38 38
 	} else {
39 39
 		// Default: use GravityView CSS file
40 40
 
41 41
 		// If no path is provided, assume default plugin templates CSS folder
42
-		if( '' === $dir_path ) {
42
+		if ( '' === $dir_path ) {
43 43
 			$dir_path = GRAVITYVIEW_DIR . 'templates/css/';
44 44
 		}
45 45
 
46 46
 		// plugins_url() expects a path to a file, not directory. We append a file to be stripped.
47
-		$path = plugins_url( $css_file, trailingslashit( $dir_path )  . 'stripped-by-plugin_basename.php' );
47
+		$path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' );
48 48
 	}
49 49
 
50 50
 	return $path;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 	$parsed_permalink = parse_url( get_permalink( $id ) );
84 84
 
85
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
85
+	$permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false;
86 86
 
87
-	if( empty( $permalink_args ) ) {
87
+	if ( empty( $permalink_args ) ) {
88 88
 		return array();
89 89
 	}
90 90
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
110 110
 
111 111
 	$output = '';
112
-	if( is_array( $current ) ) {
113
-		if( in_array( $value, $current ) ) {
112
+	if ( is_array( $current ) ) {
113
+		if ( in_array( $value, $current ) ) {
114 114
 			$output = __checked_selected_helper( true, true, false, $type );
115 115
 		}
116 116
 	} else {
117 117
 		$output = __checked_selected_helper( $value, $current, false, $type );
118 118
 	}
119 119
 
120
-	if( $echo ) {
120
+	if ( $echo ) {
121 121
 		echo $output;
122 122
 	}
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 }
126 126
 
127 127
 
128
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
128
+if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
129 129
 
130 130
 	/**
131 131
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function gravityview_strip_whitespace( $string ) {
173 173
 	$string = normalize_whitespace( $string );
174
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
174
+	return preg_replace( '/[\r\n\t ]+/', ' ', $string );
175 175
 }
176 176
 
177 177
 /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string Included file contents
186 186
  */
187 187
 function gravityview_ob_include( $file_path, $object = NULL ) {
188
-	if( ! file_exists( $file_path ) ) {
188
+	if ( ! file_exists( $file_path ) ) {
189 189
 		gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) );
190 190
 		return '';
191 191
 	}
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 
210 210
 	$width = $height * 0.7586206897;
211 211
 
212
-	if( function_exists('is_rtl') && is_rtl() ) {
213
-		$style = 'margin:10px 10px 10px 0; height='. $height .'px; width: '. $width .'px;';
212
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
213
+		$style = 'margin:10px 10px 10px 0; height=' . $height . 'px; width: ' . $width . 'px;';
214 214
 		$css_class = is_string( $css_class ) ? $css_class : 'alignright';
215 215
 	} else {
216
-		$style = 'margin:10px 10px 10px 0; height='. $height .'px; width: '. $width .'px;';
216
+		$style = 'margin:10px 10px 10px 0; height=' . $height . 'px; width: ' . $width . 'px;';
217 217
 		$css_class = is_string( $css_class ) ? $css_class : 'alignleft';
218 218
 	}
219 219
 
220
-	return '<img src="'. esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) .'" class="'. gravityview_sanitize_html_class( $css_class ).'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
220
+	return '<img src="' . esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) . '" class="' . gravityview_sanitize_html_class( $css_class ) . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />';
221 221
 }
222 222
 
223 223
 /**
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 function gravityview_number_format( $number, $decimals = '', $separator = true ) {
242 242
 	global $wp_locale;
243 243
 
244
-	if( '' === $decimals ) {
244
+	if ( '' === $decimals ) {
245 245
 
246
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
246
+		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.';
247 247
 
248 248
 		/**
249 249
 		 * Calculate the position of the decimal point in the number
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	$parts = parse_url( $value );
277 277
 
278 278
 	// No domain? Strange...show the original text.
279
-	if( empty( $parts['host'] ) ) {
279
+	if ( empty( $parts[ 'host' ] ) ) {
280 280
 		return $value;
281 281
 	}
282 282
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
290 290
 	 * If true: `http://example.com => example.com`
291 291
 	 */
292
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
292
+	if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) {
293 293
 
294
-		if( isset( $parts['scheme'] ) ) {
295
-			$return .= $parts['scheme'];
294
+		if ( isset( $parts[ 'scheme' ] ) ) {
295
+			$return .= $parts[ 'scheme' ];
296 296
 		}
297 297
 
298 298
 	}
299 299
 
300 300
 	// The domain, which may contain a subdomain
301
-	$domain = $parts['host'];
301
+	$domain = $parts[ 'host' ];
302 302
 
303 303
 	/**
304 304
 	 * @filter `gravityview_anchor_text_stripwww` Strip www from the domain?
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
307 307
 	 * If true: `www.example.com => example.com`
308 308
 	 */
309
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
309
+	$strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true );
310 310
 
311
-	if( $strip_www ) {
312
-		$domain = str_replace('www.', '', $domain );
311
+	if ( $strip_www ) {
312
+		$domain = str_replace( 'www.', '', $domain );
313 313
 	}
314 314
 
315 315
 	/**
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 	 * If true: `http://demo.example.com => example.com` \n
320 320
 	 * If false: `http://demo.example.com => demo.example.com`
321 321
 	 */
322
-	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
322
+	$strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true );
323 323
 
324
-	if( $strip_subdomains ) {
324
+	if ( $strip_subdomains ) {
325 325
 
326
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
326
+		$domain = _gravityview_strip_subdomain( $parts[ 'host' ] );
327 327
 
328 328
 	}
329 329
 
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 	 * If true: `http://example.com/sub/directory/page.html => example.com`  \n
338 338
 	 * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html`
339 339
 	 */
340
-	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
340
+	$root_only = apply_filters( 'gravityview_anchor_text_rootonly', true );
341 341
 
342
-	if( empty( $root_only ) ) {
342
+	if ( empty( $root_only ) ) {
343 343
 
344
-		if( isset( $parts['path'] ) ) {
345
-			$return .= $parts['path'];
344
+		if ( isset( $parts[ 'path' ] ) ) {
345
+			$return .= $parts[ 'path' ];
346 346
 		}
347 347
 	}
348 348
 
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
353 353
 	 * If true: `http://example.com/?query=example => example.com`
354 354
 	 */
355
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
355
+	$strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true );
356 356
 
357
-	if( empty( $strip_query_string ) ) {
357
+	if ( empty( $strip_query_string ) ) {
358 358
 
359
-		if( isset( $parts['query'] ) ) {
360
-			$return .= '?'.$parts['query'];
359
+		if ( isset( $parts[ 'query' ] ) ) {
360
+			$return .= '?' . $parts[ 'query' ];
361 361
 		}
362 362
 
363 363
 	}
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
376 376
 
377
-	if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
378
-		return $matches['domain'];
377
+	if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
378
+		return $matches[ 'domain' ];
379 379
 	} else {
380 380
 		return $string_maybe_has_subdomain;
381 381
 	}
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 
445 445
 		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
446 446
 			$value = true;
447
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
447
+		} else if ( in_array( $value, array( 'no', 'false' ), true ) ) {
448 448
 			$value = false;
449 449
 		}
450 450
 	}
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
  */
474 474
 function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) {
475 475
 
476
-	if( ! is_string( $value ) ) {
476
+	if ( ! is_string( $value ) ) {
477 477
 		return $value;
478 478
 	}
479 479
 
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
 	}
485 485
 
486 486
 	// There was a JSON error (PHP 5.3+)
487
-	if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) {
487
+	if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) {
488 488
 		return $value;
489 489
 	}
490 490
 
491 491
 	// It wasn't JSON (PHP < 5.3 fallback)
492
-	if( is_null( $decoded ) ) {
492
+	if ( is_null( $decoded ) ) {
493 493
 		return $value;
494 494
 	}
495 495
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 
557 557
 	$exploded = explode( '.', "{$field_id}" );
558 558
 
559
-	return isset( $exploded[1] ) ? intval( $exploded[1] ) : false;
559
+	return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false;
560 560
 }
561 561
 
562 562
 /**
@@ -597,13 +597,13 @@  discard block
 block discarded – undo
597 597
 	 */
598 598
 	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
599 599
 
600
-	$terms = get_terms( $args['taxonomy'], $args );
600
+	$terms = get_terms( $args[ 'taxonomy' ], $args );
601 601
 
602 602
 	$choices = array();
603 603
 
604 604
 	if ( is_array( $terms ) ) {
605 605
 		foreach ( $terms as $term_id => $term_name ) {
606
-			$choices[] = array(
606
+			$choices[ ] = array(
607 607
 				'text'  => $term_name,
608 608
 				'value' => $term_id
609 609
 			);
@@ -627,21 +627,21 @@  discard block
 block discarded – undo
627 627
 function _gravityview_process_posted_fields() {
628 628
 	$fields = array();
629 629
 
630
-	if( !empty( $_POST['gv_fields'] ) ) {
631
-		if ( ! is_array( $_POST['gv_fields'] ) ) {
630
+	if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
631
+		if ( ! is_array( $_POST[ 'gv_fields' ] ) ) {
632 632
 
633 633
 			// We are not using parse_str() due to max_input_vars limitation with large View configurations
634 634
 			$fields_holder = array();
635
-			GVCommon::gv_parse_str( stripslashes( $_POST['gv_fields'] ), $fields_holder );
635
+			GVCommon::gv_parse_str( stripslashes( $_POST[ 'gv_fields' ] ), $fields_holder );
636 636
 
637
-			if ( isset( $fields_holder['fields'] ) ) {
638
-				$fields = $fields_holder['fields'];
637
+			if ( isset( $fields_holder[ 'fields' ] ) ) {
638
+				$fields = $fields_holder[ 'fields' ];
639 639
 			} else {
640 640
 				gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) );
641 641
 			}
642 642
 
643 643
 		} else {
644
-			$fields = $_POST['gv_fields'];
644
+			$fields = $_POST[ 'gv_fields' ];
645 645
 		}
646 646
 	}
647 647
 
Please login to merge, or discard this patch.
includes/class-gravityview-admin-notices.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -60,21 +60,21 @@  discard block
 block discarded – undo
60 60
 	public function dismiss_notice() {
61 61
 
62 62
 		// No dismiss sent
63
-		if( empty( $_GET['gv-dismiss'] ) || empty( $_GET['notice'] ) ) {
63
+		if ( empty( $_GET[ 'gv-dismiss' ] ) || empty( $_GET[ 'notice' ] ) ) {
64 64
 			return;
65 65
 		}
66 66
 
67 67
 		// Invalid nonce
68
-		if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) {
68
+		if ( ! wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) {
69 69
 			return;
70 70
 		}
71 71
 
72
-		$notice_id = esc_attr( $_GET['notice'] );
72
+		$notice_id = esc_attr( $_GET[ 'notice' ] );
73 73
 
74 74
 		//don't display a message if use has dismissed the message for this version
75 75
 		$dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' );
76 76
 
77
-		$dismissed_notices[] = $notice_id;
77
+		$dismissed_notices[ ] = $notice_id;
78 78
 
79 79
 		$dismissed_notices = array_unique( $dismissed_notices );
80 80
 
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	private function is_notice_dismissed( $notice ) {
98 98
 
99 99
 		// There are no dismissed notices.
100
-		if( empty( self::$dismissed_notices ) ) {
100
+		if ( empty( self::$dismissed_notices ) ) {
101 101
 			return false;
102 102
 		}
103 103
 
104 104
 		// Has the
105
-		$is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices );
105
+		$is_dismissed = ! empty( $notice[ 'dismiss' ] ) && in_array( $notice[ 'dismiss' ], self::$dismissed_notices );
106 106
 
107 107
 		return $is_dismissed ? true : false;
108 108
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	private function check_show_multisite_notices() {
129 129
 
130
-		if( ! is_multisite() ) {
130
+		if ( ! is_multisite() ) {
131 131
 			return true;
132 132
 		}
133 133
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		}
138 138
 
139 139
 		// or they don't have admin capabilities
140
-		if( ! is_super_admin() ) {
140
+		if ( ! is_super_admin() ) {
141 141
 			return false;
142 142
 		}
143 143
 
@@ -160,48 +160,48 @@  discard block
 block discarded – undo
160 160
 		 */
161 161
 		$notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices );
162 162
 
163
-		if( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
163
+		if ( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
164 164
 			return;
165 165
 		}
166 166
 
167 167
 		//don't display a message if use has dismissed the message for this version
168 168
 		// TODO: Use get_user_meta instead of get_transient
169
-		self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
169
+		self::$dismissed_notices = isset( $_GET[ 'show-dismissed-notices' ] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
170 170
 
171 171
 		$output = '';
172 172
 
173
-		foreach( $notices as $notice ) {
173
+		foreach ( $notices as $notice ) {
174 174
 
175 175
 			// If the user doesn't have the capability to see the warning
176
-			if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) {
176
+			if ( isset( $notice[ 'cap' ] ) && false === GVCommon::has_cap( $notice[ 'cap' ] ) ) {
177 177
 				gravityview()->log->debug( 'Notice not shown because user does not have the capability to view it.', array( 'data' => $notice ) );
178 178
 				continue;
179 179
 			}
180 180
 
181
-			if( true === $this->is_notice_dismissed( $notice ) ) {
181
+			if ( true === $this->is_notice_dismissed( $notice ) ) {
182 182
 				gravityview()->log->debug( 'Notice not shown because the notice has already been dismissed.', array( 'data' => $notice ) );
183 183
 				continue;
184 184
 			}
185 185
 
186
-			$output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">';
186
+			$output .= '<div id="message" style="position:relative" class="notice ' . gravityview_sanitize_html_class( $notice[ 'class' ] ) . '">';
187 187
 
188 188
 			// Too cute to leave out.
189 189
 			$output .= gravityview_get_floaty();
190 190
 
191
-			if( !empty( $notice['title'] ) ) {
192
-				$output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>';
191
+			if ( ! empty( $notice[ 'title' ] ) ) {
192
+				$output .= '<h3>' . esc_html( $notice[ 'title' ] ) . '</h3>';
193 193
 			}
194 194
 
195
-			$message = isset( $notice['message'] ) ? $notice['message'] : '';
195
+			$message = isset( $notice[ 'message' ] ) ? $notice[ 'message' ] : '';
196 196
 
197
-			if( !empty( $notice['dismiss'] ) ) {
197
+			if ( ! empty( $notice[ 'dismiss' ] ) ) {
198 198
 
199
-				$dismiss = esc_attr($notice['dismiss']);
199
+				$dismiss = esc_attr( $notice[ 'dismiss' ] );
200 200
 
201 201
 				$url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) );
202 202
 
203 203
 				$align = is_rtl() ? 'alignleft' : 'alignright';
204
-				$message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>';
204
+				$message .= '<a href="' . $url . '" data-notice="' . $dismiss . '" class="' . $align . ' button button-link">' . esc_html__( 'Dismiss', 'gravityview' ) . '</a></p>';
205 205
 			}
206 206
 
207 207
 			$output .= wpautop( $message );
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public static function add_notice( $notice = array() ) {
235 235
 
236
-		if( !isset( $notice['message'] ) ) {
236
+		if ( ! isset( $notice[ 'message' ] ) ) {
237 237
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
238 238
 			return;
239 239
 		}
240 240
 
241
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
241
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
242 242
 
243
-		self::$admin_notices[] = $notice;
243
+		self::$admin_notices[ ] = $notice;
244 244
 	}
245 245
 }
246 246
 
Please login to merge, or discard this patch.
future/includes/class-gv-renderer.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$current_user  = wp_get_current_user();
82 82
 		$user_meta_key = '_gv_dismissed_entry_approval_notice' . $gravityview->view->ID;
83 83
 
84
-		if ( isset( $_GET['gv-dismiss'] ) && wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) {
84
+		if ( isset( $_GET[ 'gv-dismiss' ] ) && wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) {
85 85
 			add_user_meta( $current_user->ID, $user_meta_key, 1 ); // Prevent user from seeing this again for this View
86 86
 			return;
87 87
 		}
@@ -150,8 +150,7 @@  discard block
 block discarded – undo
150 150
 				$tab = __( 'Edit Entry', 'gravityview' );
151 151
 				$context = 'edit';
152 152
 				break;
153
-			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ):
154
-				$tab = __( 'Single Entry', 'gravityview' );
153
+			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' );
155 154
 				$context = 'single';
156 155
 				break;
157 156
 			default:
@@ -173,7 +172,7 @@  discard block
 block discarded – undo
173 172
 		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
174 173
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
175 174
 
176
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
175
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
177 176
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
178 177
 
179 178
 		echo \GVCommon::generate_notice( $output . $image, 'gv-warning warning', 'edit_gravityview', $gravityview->view->ID );
@@ -199,11 +198,11 @@  discard block
 block discarded – undo
199 198
 
200 199
 		$post_types = get_post_types();
201 200
 
202
-		foreach( $post_types as $post_type ) {
201
+		foreach ( $post_types as $post_type ) {
203 202
 			$post_type_rewrite = get_post_type_object( $post_type )->rewrite;
204 203
 
205 204
 			if ( $slug = \GV\Utils::get( $post_type_rewrite, 'slug' ) ) {
206
-				$reserved_slugs[] = $slug;
205
+				$reserved_slugs[ ] = $slug;
207 206
 			}
208 207
 		}
209 208
 
Please login to merge, or discard this patch.
includes/extensions/delete-entry/class-delete-entry.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function add_reserved_arg( $args ) {
114 114
 
115
-		$args[] = 'delete';
115
+		$args[ ] = 'delete';
116 116
 
117 117
 		return $args;
118 118
 	}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// Index 100 is the default GravityView template path.
184 184
 		// Index 110 is Edit Entry link
185
-		$file_paths[115] = self::$file;
185
+		$file_paths[ 115 ] = self::$file;
186 186
 
187 187
 		return $file_paths;
188 188
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 		$attributes = array(
288 288
 			'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete',
289
-			'tabindex' => ( GFCommon::$tab_index ++ ),
289
+			'tabindex' => ( GFCommon::$tab_index++ ),
290 290
 			'onclick' => self::get_confirm_dialog(),
291 291
 		);
292 292
 
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
 		);
323 323
 
324 324
 		// If the form is not submitted, return early
325
-		if ( 'delete' !== $get_fields['action'] || empty( $get_fields['entry_id'] ) ) {
325
+		if ( 'delete' !== $get_fields[ 'action' ] || empty( $get_fields[ 'entry_id' ] ) ) {
326 326
 			return;
327 327
 		}
328 328
 
329 329
 		// Make sure it's a GravityView request
330
-		$valid_nonce_key = wp_verify_nonce( $get_fields['delete'], self::get_nonce_key( $get_fields['entry_id'] ) );
330
+		$valid_nonce_key = wp_verify_nonce( $get_fields[ 'delete' ], self::get_nonce_key( $get_fields[ 'entry_id' ] ) );
331 331
 
332 332
 		if ( ! $valid_nonce_key ) {
333 333
 			gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' );
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 		}
337 337
 
338 338
 		// Get the entry slug
339
-		$entry_slug = esc_attr( $get_fields['entry_id'] );
339
+		$entry_slug = esc_attr( $get_fields[ 'entry_id' ] );
340 340
 
341 341
 		// Redirect after deleting the entry.
342
-		$view = \GV\View::by_id( $get_fields['view_id'] );
342
+		$view = \GV\View::by_id( $get_fields[ 'view_id' ] );
343 343
 
344 344
 		// See if there's an entry there
345 345
 		$entry = gravityview_get_entry( $entry_slug, true, false, $view );
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 			$this->_redirect_and_exit( $delete_redirect_base, $delete_response->get_error_message(), 'error' );
367 367
 		}
368 368
 
369
-		if ( (int) $view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) {
369
+		if ( (int)$view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) {
370 370
 
371
-			$form                 = GFAPI::get_form( $entry['form_id'] );
371
+			$form                 = GFAPI::get_form( $entry[ 'form_id' ] );
372 372
 			$redirect_url_setting = $view->settings->get( 'delete_redirect_url' );
373 373
 			$redirect_url         = GFCommon::replace_variables( $redirect_url_setting, $form, $entry, false, false, false, 'text' );
374 374
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 */
445 445
 	private function delete_or_trash_entry( $entry ) {
446 446
 
447
-		$entry_id = $entry['id'];
447
+		$entry_id = $entry[ 'id' ];
448 448
 
449 449
 		$mode = $this->get_delete_mode();
450 450
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	public function process_connected_posts( $entry_id = 0, $entry = array() ) {
509 509
 
510 510
 		// The entry had no connected post
511
-		if ( empty( $entry['post_id'] ) ) {
511
+		if ( empty( $entry[ 'post_id' ] ) ) {
512 512
 			return;
513 513
 		}
514 514
 
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 		$action = current_action();
527 527
 
528 528
 		if ( 'gravityview/delete-entry/deleted' === $action ) {
529
-			$result = wp_delete_post( $entry['post_id'], true );
529
+			$result = wp_delete_post( $entry[ 'post_id' ], true );
530 530
 		} else {
531
-			$result = wp_trash_post( $entry['post_id'] );
531
+			$result = wp_trash_post( $entry[ 'post_id' ] );
532 532
 		}
533 533
 
534 534
 		if ( false === $result ) {
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 	public function verify_nonce() {
560 560
 
561 561
 		// No delete entry request was made
562
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) {
562
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) {
563 563
 			return false;
564 564
 		}
565 565
 
566
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
566
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
567 567
 
568
-		$valid = wp_verify_nonce( $_GET['delete'], $nonce_key );
568
+		$valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key );
569 569
 
570 570
 		/**
571 571
 		 * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid.
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 			$error = __( 'You do not have permission to delete this entry.', 'gravityview' );
622 622
 		}
623 623
 
624
-		if ( $entry['status'] === 'trash' ) {
624
+		if ( $entry[ 'status' ] === 'trash' ) {
625 625
 			if ( 'trash' === $this->get_delete_mode() ) {
626 626
 				$error = __( 'The entry is already in the trash.', 'gravityview' );
627 627
 			} else {
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 
666 666
 		$current_user = wp_get_current_user();
667 667
 
668
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
668
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
669 669
 
670 670
 		// Or if they can delete any entries (as defined in Gravity Forms), we're good.
671 671
 		if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
@@ -679,17 +679,17 @@  discard block
 block discarded – undo
679 679
 		if ( ! empty( $field ) ) {
680 680
 
681 681
 			// If capability is not defined, something is not right!
682
-			if ( empty( $field['allow_edit_cap'] ) ) {
682
+			if ( empty( $field[ 'allow_edit_cap' ] ) ) {
683 683
 
684 684
 				gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) );
685 685
 
686 686
 				return false;
687 687
 			}
688 688
 
689
-			if ( GVCommon::has_cap( $field['allow_edit_cap'] ) ) {
689
+			if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) {
690 690
 
691 691
 				// Do not return true if cap is read, as we need to check if the current user created the entry
692
-				if ( $field['allow_edit_cap'] !== 'read' ) {
692
+				if ( $field[ 'allow_edit_cap' ] !== 'read' ) {
693 693
 					return true;
694 694
 				}
695 695
 			} else {
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 			}
701 701
 		}
702 702
 
703
-		if ( ! isset( $entry['created_by'] ) ) {
703
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
704 704
 
705 705
 			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
706 706
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 		}
717 717
 
718 718
 		// If the logged-in user is the same as the user who created the entry, we're good.
719
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
719
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
720 720
 
721 721
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
722 722
 
@@ -741,12 +741,12 @@  discard block
 block discarded – undo
741 741
 	 */
742 742
 	public function maybe_display_message( $current_view_id = 0 ) {
743 743
 
744
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
744
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
745 745
 			return;
746 746
 		}
747 747
 
748 748
 		// Entry wasn't deleted from current View
749
-		if ( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) {
749
+		if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) {
750 750
 			return;
751 751
 		}
752 752
 
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 
756 756
 	public function display_message() {
757 757
 
758
-		if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) {
758
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) {
759 759
 			return;
760 760
 		}
761 761
 
762
-		$status = esc_attr( $_GET['status'] );
762
+		$status = esc_attr( $_GET[ 'status' ] );
763 763
 		$message_from_url = \GV\Utils::_GET( 'message' );
764 764
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
765 765
 		$class = '';
Please login to merge, or discard this patch.
includes/extensions/duplicate-entry/class-duplicate-entry.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function add_reserved_arg( $args ) {
85 85
 
86
-		$args[] = 'duplicate';
86
+		$args[ ] = 'duplicate';
87 87
 
88 88
 		return $args;
89 89
 	}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function _filter_sortable_fields( $fields ) {
157 157
 
158
-		$fields = (array) $fields;
158
+		$fields = (array)$fields;
159 159
 
160
-		$fields[] = 'duplicate_link';
160
+		$fields[ ] = 'duplicate_link';
161 161
 
162 162
 		return $fields;
163 163
 	}
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	public function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
197 197
 
198 198
 		// Always a link, never a filter, always same window
199
-		unset( $field_options['show_as_link'], $field_options['search_filter'], $field_options['new_window'] );
199
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ], $field_options[ 'new_window' ] );
200 200
 
201 201
 		// Duplicate Entry link should only appear to visitors capable of editing entries
202
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
202
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
203 203
 
204
-		$add_option['duplicate_link'] = array(
204
+		$add_option[ 'duplicate_link' ] = array(
205 205
 			'type' => 'text',
206 206
 			'label' => __( 'Duplicate Link Text', 'gravityview' ),
207 207
 			'desc' => NULL,
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			'merge_tags' => true,
210 210
 		);
211 211
 
212
-		$field_options['allow_duplicate_cap'] = array(
212
+		$field_options[ 'allow_duplicate_cap' ] = array(
213 213
 			'type' => 'select',
214 214
 			'label' => __( 'Allow the following users to duplicate the entry:', 'gravityview' ),
215 215
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
237 237
 
238 238
 		if ( 'edit' !== $zone ) {
239
-			$entry_default_fields['duplicate_link'] = array(
239
+			$entry_default_fields[ 'duplicate_link' ] = array(
240 240
 				'label' => __( 'Duplicate Entry', 'gravityview' ),
241 241
 				'type'  => 'duplicate_link',
242 242
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gravityview' ),
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function add_available_field( $available_fields = array() ) {
260 260
 
261
-		$available_fields['duplicate_link'] = array(
261
+		$available_fields[ 'duplicate_link' ] = array(
262 262
 			'label_text' => __( 'Duplicate Entry', 'gravityview' ),
263 263
 			'field_id' => 'duplicate_link',
264 264
 			'label_type' => 'field',
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		if ( 'duplicate_link' === $field_id ) {
292 292
 
293 293
 			// Remove other built-in caps.
294
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] );
294
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] );
295 295
 
296
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
296
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
297 297
 		}
298 298
 
299 299
 		return $caps;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
330 330
 
331
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
331
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
332 332
 
333 333
 		if ( empty( $base ) ) {
334 334
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 
338 338
 		$actionurl = add_query_arg( array(
339 339
 			'action'	=> 'duplicate',
340
-			'entry_id'	=> $entry['id'],
340
+			'entry_id'	=> $entry[ 'id' ],
341 341
 			'gvid' => $view_id,
342 342
             'view_id' => $view_id,
343 343
 		), $base );
344 344
 
345
-		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
345
+		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry[ 'id' ] ) ), $actionurl );
346 346
 	}
347 347
 
348 348
 	/**
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	public function process_duplicate() {
364 364
 
365 365
 		// If the form is submitted
366
-		if ( ( ! isset( $_GET['action'] ) ) || 'duplicate' !== $_GET['action'] || ( ! isset( $_GET['entry_id'] ) ) ) {
366
+		if ( ( ! isset( $_GET[ 'action' ] ) ) || 'duplicate' !== $_GET[ 'action' ] || ( ! isset( $_GET[ 'entry_id' ] ) ) ) {
367 367
 			return;
368 368
 		}
369 369
 
370 370
 		// Make sure it's a GravityView request
371
-		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET['entry_id'] ) );
371
+		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET[ 'entry_id' ] ) );
372 372
 
373 373
 		if ( ! $valid_nonce_key ) {
374 374
 			gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		// Get the entry slug
379
-		$entry_slug = esc_attr( $_GET['entry_id'] );
379
+		$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
380 380
 
381 381
 		// See if there's an entry there
382 382
 		$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 			return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'The entry does not exist.', 'gravityview' ) );
471 471
 		}
472 472
 
473
-		$form = GFAPI::get_form( $entry['form_id'] );
473
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
474 474
 
475
-		$row['id'] = null;
476
-		$row['date_created'] = date( 'Y-m-d H:i:s', time() );
477
-		$row['date_updated'] = $row['date_created'];
478
-		$row['is_starred'] = false;
479
-		$row['is_read'] = false;
480
-		$row['ip'] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
481
-		$row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
482
-		$row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
483
-		$row['created_by'] = wp_get_current_user()->ID;
475
+		$row[ 'id' ] = null;
476
+		$row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() );
477
+		$row[ 'date_updated' ] = $row[ 'date_created' ];
478
+		$row[ 'is_starred' ] = false;
479
+		$row[ 'is_read' ] = false;
480
+		$row[ 'ip' ] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
481
+		$row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
482
+		$row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
483
+		$row[ 'created_by' ] = wp_get_current_user()->ID;
484 484
 
485 485
 		/**
486 486
 		 * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created.
@@ -508,15 +508,15 @@  discard block
 block discarded – undo
508 508
 
509 509
 		$save_this_meta = array();
510 510
 		foreach ( $duplicate_meta->get_output() as $m ) {
511
-			$save_this_meta[] = array(
512
-				'meta_key' => $m['meta_key'],
513
-				'meta_value' => $m['meta_value'],
514
-				'item_index' => $m['item_index'],
511
+			$save_this_meta[ ] = array(
512
+				'meta_key' => $m[ 'meta_key' ],
513
+				'meta_value' => $m[ 'meta_value' ],
514
+				'item_index' => $m[ 'item_index' ],
515 515
 			);
516 516
 		}
517 517
 
518 518
 		// Update the row ID for later usage
519
-		$row['id'] = $duplicated_id;
519
+		$row[ 'id' ] = $duplicated_id;
520 520
 
521 521
 		/**
522 522
 		 * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details.
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 		$save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry );
528 528
 
529 529
 		foreach ( $save_this_meta as $data ) {
530
-			$data['form_id'] = $entry['form_id'];
531
-			$data['entry_id'] = $duplicated_id;
530
+			$data[ 'form_id' ] = $entry[ 'form_id' ];
531
+			$data[ 'entry_id' ] = $duplicated_id;
532 532
 
533 533
 			if ( ! $wpdb->insert( $entry_meta_table, $data ) ) {
534 534
 				return new WP_Error( 'gravityview-duplicate-entry-db-meta', __( 'There was an error duplicating the entry.', 'gravityview' ) );
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
 	public function verify_nonce() {
563 563
 
564 564
 		// No duplicate entry request was made
565
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) {
565
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
566 566
 			return false;
567 567
 		}
568 568
 
569
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
569
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
570 570
 
571
-		$valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key );
571
+		$valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key );
572 572
 
573 573
 		/**
574 574
 		 * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid.
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 			return '';
605 605
 		}
606 606
 
607
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
607
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
608 608
 	}
609 609
 
610 610
 	/**
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	public static function check_user_cap_duplicate_entry( $entry, $field = array(), $view_id = 0 ) {
659 659
 		$current_user = wp_get_current_user();
660 660
 
661
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
661
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
662 662
 
663 663
 		// Or if they can duplicate any entries (as defined in Gravity Forms), we're good.
664 664
 		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gform_full_access', 'gravityview_full_access' ), $entry_id ) ) {
@@ -673,17 +673,17 @@  discard block
 block discarded – undo
673 673
 		if ( ! empty( $field ) ) {
674 674
 
675 675
 			// If capability is not defined, something is not right!
676
-			if ( empty( $field['allow_duplicate_cap'] ) ) {
676
+			if ( empty( $field[ 'allow_duplicate_cap' ] ) ) {
677 677
 
678 678
 				gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) );
679 679
 
680 680
 				return false;
681 681
 			}
682 682
 
683
-			if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) {
683
+			if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) {
684 684
 
685 685
 				// Do not return true if cap is read, as we need to check if the current user created the entry
686
-				if ( 'read' !== $field['allow_duplicate_cap'] ) {
686
+				if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) {
687 687
 					return true;
688 688
 				}
689 689
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
 		}
698 698
 
699
-		if ( ! isset( $entry['created_by'] ) ) {
699
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
700 700
 
701 701
 			gravityview()->log->error( 'Cannot duplicate entry; entry `created_by` doesn\'t exist.' );
702 702
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 		}
722 722
 
723 723
 		// If the logged-in user is the same as the user who created the entry, we're good.
724
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
724
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
725 725
 
726 726
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
727 727
 
@@ -745,12 +745,12 @@  discard block
 block discarded – undo
745 745
 	 * @return void
746 746
 	 */
747 747
 	public function maybe_display_message( $current_view_id = 0 ) {
748
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
748
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
749 749
 			return;
750 750
 		}
751 751
 
752 752
 		// Entry wasn't duplicated from current View
753
-		if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) {
753
+		if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) {
754 754
 			return;
755 755
 		}
756 756
 
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	}
759 759
 
760 760
 	public function display_message() {
761
-		if ( empty( $_GET['status'] ) || empty( $_GET['duplicate'] ) ) {
761
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
762 762
 			return;
763 763
 		}
764 764
 
765
-		$status = esc_attr( $_GET['status'] );
765
+		$status = esc_attr( $_GET[ 'status' ] );
766 766
 		$message_from_url = \GV\Utils::_GET( 'message' );
767 767
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
768 768
 		$class = '';
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 		$message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url );
789 789
 
790 790
 		// DISPLAY ERROR/SUCCESS MESSAGE
791
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
791
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
792 792
 	}
793 793
 
794 794
 	/**
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		?>
819 819
 		<span class="gv-duplicate">
820 820
 			|
821
-			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry['id'] ), self::get_nonce_key( $entry['id'] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
821
+			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry[ 'id' ] ), self::get_nonce_key( $entry[ 'id' ] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
822 822
 		</span>
823 823
 		<?php
824 824
 	}
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 
841 841
 		if ( 'success' === \GV\Utils::_GET( 'result' ) ) {
842 842
 			add_filter( 'gform_admin_messages', function( $messages ) {
843
-				$messages = (array) $messages;
843
+				$messages = (array)$messages;
844 844
 
845
-				$messages[] = esc_html__( 'Entry duplicated.', 'gravityview' );
845
+				$messages[ ] = esc_html__( 'Entry duplicated.', 'gravityview' );
846 846
 				return $messages;
847 847
 			} );
848 848
 		}
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 
854 854
 			$check_logs_message = '';
855 855
 
856
-			if( $is_logging_active ) {
856
+			if ( $is_logging_active ) {
857 857
 				$check_logs_message = sprintf( ' <a href="%s">%s</a>',
858 858
 					esc_url( admin_url( 'admin.php?page=gf_settings&subview=gravityformslogging' ) ),
859 859
 					esc_html_x( 'Check the GravityView logs for more information.', 'Error message links to logging page', 'gravityview' )
@@ -861,9 +861,9 @@  discard block
 block discarded – undo
861 861
 			}
862 862
 
863 863
 			add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) {
864
-				$messages = (array) $messages;
864
+				$messages = (array)$messages;
865 865
 
866
-				$messages[] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
866
+				$messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
867 867
 
868 868
 				return $messages;
869 869
 			} );
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$form = $gravityview_view->getForm();
32 32
 
33
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
33
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
34 34
 			/** Allow to fall through for back compatibility testing purposes. */
35 35
 		} else {
36 36
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$label = '';
40 40
 
41
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
41
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
42 42
 
43
-			$label = $field['label'];
43
+			$label = $field[ 'label' ];
44 44
 
45 45
 			// Support Gravity Forms 1.9+
46
-			if( class_exists( 'GF_Field' ) ) {
46
+			if ( class_exists( 'GF_Field' ) ) {
47 47
 
48
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
48
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
49 49
 
50
-				if( $field_object ) {
50
+				if ( $field_object ) {
51 51
 
52
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
52
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
53 53
 
54 54
 					// This is a complex field, with labels on a per-input basis
55
-					if( $input ) {
55
+					if ( $input ) {
56 56
 
57 57
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
58
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
58
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
59 59
 
60 60
 					} else {
61 61
 
62 62
 						// This is a field with one label
63
-						$label = $field_object->get_field_label( true, $field['label'] );
63
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
64 64
 
65 65
 					}
66 66
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 			}
70 70
 
71 71
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
72
-			if ( !empty( $field['custom_label'] ) ) {
72
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
73 73
 
74
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
74
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
75 75
 
76 76
 			}
77 77
 
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
 		$width = NULL;
135 135
 
136
-		if( !empty( $field['width'] ) ) {
137
-			$width = absint( $field['width'] );
136
+		if ( ! empty( $field[ 'width' ] ) ) {
137
+			$width = absint( $field[ 'width' ] );
138 138
 
139 139
 			// If using percentages, limit to 100%
140
-			if( '%d%%' === $format && $width > 100 ) {
140
+			if ( '%d%%' === $format && $width > 100 ) {
141 141
 				$width = 100;
142 142
 			}
143 143
 
@@ -157,42 +157,42 @@  discard block
 block discarded – undo
157 157
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
158 158
 		$classes = array();
159 159
 
160
-		if( !empty( $field['custom_class'] ) ) {
160
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
161 161
 
162
-            $custom_class = $field['custom_class'];
162
+            $custom_class = $field[ 'custom_class' ];
163 163
 
164
-            if( !empty( $entry ) ) {
164
+            if ( ! empty( $entry ) ) {
165 165
 
166 166
                 // We want the merge tag to be formatted as a class. The merge tag may be
167 167
                 // replaced by a multiple-word value that should be output as a single class.
168 168
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
169
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
169
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
170 170
 
171
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
171
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
172 172
 
173 173
                 // And then we want life to return to normal
174
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
174
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
175 175
             }
176 176
 
177 177
 			// And now we want the spaces to be handled nicely.
178
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
178
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
179 179
 
180 180
 		}
181 181
 
182
-		if(!empty($field['id'])) {
183
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
184
-				$form_id = '-'.$form['id'];
182
+		if ( ! empty( $field[ 'id' ] ) ) {
183
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
184
+				$form_id = '-' . $form[ 'id' ];
185 185
 			} else {
186 186
 				// @deprecated path. Form should always be given.
187 187
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
188 188
 				$gravityview_view = GravityView_View::getInstance();
189
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
189
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
190 190
 			}
191 191
 
192
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
192
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
193 193
 		}
194 194
 
195
-		return esc_attr(implode(' ', $classes));
195
+		return esc_attr( implode( ' ', $classes ) );
196 196
 	}
197 197
 
198 198
 	/**
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 	 * @return string Sanitized unique HTML `id` attribute for the field
208 208
 	 */
209 209
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
210
-		$id = $field['id'];
210
+		$id = $field[ 'id' ];
211 211
 
212 212
 		if ( ! empty( $id ) ) {
213
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
214
-				$form_id = '-' . $form['id'];
213
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
214
+				$form_id = '-' . $form[ 'id' ];
215 215
 			} else {
216 216
 				// @deprecated path. Form should always be given.
217 217
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
220 220
 			}
221 221
 
222
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
222
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
223 223
 		}
224 224
 
225 225
 		return esc_attr( $id );
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
260 260
 
261
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
261
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
262 262
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
263 263
 			return NULL;
264 264
 		}
265 265
 
266 266
 		$href = self::entry_link( $entry, $base_id );
267 267
 
268
-		if( '' === $href ) {
268
+		if ( '' === $href ) {
269 269
 			return NULL;
270 270
 		}
271 271
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		} else {
303 303
 			$gravityview_view = GravityView_View::getInstance();
304 304
 
305
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
305
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
306 306
 				$is_search = true;
307 307
 			}
308 308
 		}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 			$output = esc_html__( 'This search returned no results.', 'gravityview' );
315 315
 
316
-			if( $context ) {
316
+			if ( $context ) {
317 317
 				$setting = $context->view->settings->get( 'no_search_results_text', $output );
318 318
 			}
319 319
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 			$output = esc_html__( 'No entries match your request.', 'gravityview' );
323 323
 
324
-			if( $context ) {
324
+			if ( $context ) {
325 325
 				$setting = $context->view->settings->get( 'no_results_text', $output );
326 326
 			}
327 327
 		}
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 
440 440
 		// If we've saved the permalink in memory, use it
441 441
 		// @since 1.3
442
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
442
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
443 443
 
444
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
444
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
445 445
 			$link = home_url();
446 446
 		}
447 447
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
 			// If not yet saved, cache the permalink.
452 452
 			// @since 1.3
453
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
453
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
454 454
 		}
455 455
 
456 456
 		// Deal with returning to proper pagination for embedded views
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
 
459 459
 			$args = array();
460 460
 
461
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
462
-				$args['pagenum'] = intval( $pagenum );
461
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
462
+				$args[ 'pagenum' ] = intval( $pagenum );
463 463
 			}
464 464
 
465
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
466
-				$args['sort'] = $sort;
467
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
465
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
466
+				$args[ 'sort' ] = $sort;
467
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
468 468
 			}
469 469
 
470 470
 			$link = add_query_arg( $args, $link );
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
502 502
 
503 503
 		// Generate an unique hash to use as the default value
504
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
504
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
505 505
 
506 506
 		/**
507 507
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
513 513
 
514 514
 		// Make sure we have something - use the original ID as backup.
515
-		if( empty( $slug ) ) {
515
+		if ( empty( $slug ) ) {
516 516
 			$slug = $id;
517 517
 		}
518 518
 
@@ -606,15 +606,15 @@  discard block
 block discarded – undo
606 606
          * @param boolean $custom Should we process the custom entry slug?
607 607
          */
608 608
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
609
-        if( $custom ) {
609
+        if ( $custom ) {
610 610
             // create the gravityview_unique_id and save it
611 611
 
612 612
             // Get the entry hash
613
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
613
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
614 614
 
615
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
615
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
616 616
 
617
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
617
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
618 618
 
619 619
         }
620 620
     }
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
642 642
 			$entry = GVCommon::get_entry( $entry );
643
-		} else if( empty( $entry ) ) {
643
+		} else if ( empty( $entry ) ) {
644 644
 			// @deprecated path
645 645
 			$entry = GravityView_frontend::getInstance()->getEntry();
646 646
 		}
@@ -660,32 +660,32 @@  discard block
 block discarded – undo
660 660
 
661 661
 		$query_arg_name = \GV\Entry::get_endpoint_name();
662 662
 
663
-		if ( ! empty( $entry['_multi'] ) ) {
663
+		if ( ! empty( $entry[ '_multi' ] ) ) {
664 664
 			$entry_slugs = array();
665 665
 
666
-			foreach ( $entry['_multi'] as $_multi ) {
666
+			foreach ( $entry[ '_multi' ] as $_multi ) {
667 667
 
668
-				if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
669
-					$entry_slugs[] = $gv_multi->get_slug();
668
+				if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
669
+					$entry_slugs[ ] = $gv_multi->get_slug();
670 670
 				} else {
671 671
 					// TODO: This path isn't covered by unit tests
672
-					$entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi );
672
+					$entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi );
673 673
 				}
674 674
 
675 675
 				unset( $gv_multi );
676 676
 
677
-				$forms[] = $_multi['form_id'];
677
+				$forms[ ] = $_multi[ 'form_id' ];
678 678
 			}
679 679
 
680 680
 			$entry_slug = implode( ',', $entry_slugs );
681 681
 		} else {
682 682
 
683 683
 			// Fallback when
684
-			if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
684
+			if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
685 685
 				$entry_slug = $gv_entry->get_slug();
686 686
 			} else {
687 687
 				// TODO: This path isn't covered by unit tests
688
-				$entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry );
688
+				$entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
689 689
 			}
690 690
 
691 691
 			unset( $gv_entry );
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 			$args = gv_get_query_args();
705 705
 		}
706 706
 
707
-		if ( get_option('permalink_structure') && ! is_preview() ) {
707
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
708 708
 
709 709
 			/**
710 710
 			 * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug.
@@ -712,13 +712,13 @@  discard block
 block discarded – undo
712 712
 			 */
713 713
 			$link_parts = explode( '?', $directory_link );
714 714
 
715
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
715
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
716 716
 
717
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
717
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
718 718
 
719 719
 		} else {
720 720
 
721
-			$args[] = array( $query_arg_name => $entry_slug );
721
+			$args[ ] = array( $query_arg_name => $entry_slug );
722 722
 		}
723 723
 
724 724
 		/**
@@ -726,21 +726,21 @@  discard block
 block discarded – undo
726 726
 		 */
727 727
 		if ( $add_directory_args ) {
728 728
 
729
-			if ( ! empty( $_GET['pagenum'] ) ) {
730
-				$args['pagenum'] = intval( $_GET['pagenum'] );
729
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
730
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
731 731
 			}
732 732
 
733 733
 			/**
734 734
 			 * @since 1.7
735 735
 			 */
736 736
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
737
-				$args['sort'] = $sort;
738
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
737
+				$args[ 'sort' ] = $sort;
738
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
739 739
 			}
740 740
 
741 741
 		}
742 742
 
743
-		if( $post_id ) {
743
+		if ( $post_id ) {
744 744
 			$passed_post = get_post( $post_id );
745 745
 			$views       = \GV\View_Collection::from_post( $passed_post );
746 746
 			$has_multiple_views = $views->count() > 1;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 		}
750 750
 
751 751
 		if ( $has_multiple_views ) {
752
-			$args['gvid'] = $view_id ? $view_id : gravityview_get_view_id();
752
+			$args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id();
753 753
 		}
754 754
 
755 755
 		return add_query_arg( $args, $directory_link );
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 }
820 820
 
821 821
 function gv_class( $field, $form = NULL, $entry = array() ) {
822
-	return GravityView_API::field_class( $field, $form, $entry  );
822
+	return GravityView_API::field_class( $field, $form, $entry );
823 823
 }
824 824
 
825 825
 /**
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 		$view_id = 0;
843 843
 		if ( $context->view ) {
844 844
 			$view_id = $context->view->ID;
845
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
845
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
846 846
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
847 847
 			}
848 848
 		}
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 		$default_css_class .= ' ' . $context->view->settings->get( 'class', '' );
875 875
 	}
876 876
 
877
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
877
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
878 878
 
879 879
 	/**
880 880
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 
902 902
 	$value = GravityView_API::field_value( $entry, $field );
903 903
 
904
-	if( $value === '' ) {
904
+	if ( $value === '' ) {
905 905
 		/**
906 906
 		 * @filter `gravityview_empty_value` What to display when a field is empty
907 907
 		 * @param string $value (empty string)
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
  */
1015 1015
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
1016 1016
 
1017
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1017
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1018 1018
 
1019 1019
 		// For the complete field value as generated by Gravity Forms
1020 1020
 		return $display_value;
@@ -1048,16 +1048,16 @@  discard block
 block discarded – undo
1048 1048
 		$terms = explode( ', ', $value );
1049 1049
 	}
1050 1050
 
1051
-	foreach ($terms as $term_name ) {
1051
+	foreach ( $terms as $term_name ) {
1052 1052
 
1053 1053
 		// If we're processing a category,
1054
-		if( $taxonomy === 'category' ) {
1054
+		if ( $taxonomy === 'category' ) {
1055 1055
 
1056 1056
 			// Use rgexplode to prevent errors if : doesn't exist
1057 1057
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
1058 1058
 
1059 1059
 			// The explode was succesful; we have the category ID
1060
-			if( !empty( $term_id )) {
1060
+			if ( ! empty( $term_id ) ) {
1061 1061
 				$term = get_term_by( 'id', $term_id, $taxonomy );
1062 1062
 			} else {
1063 1063
 			// We have to fall back to the name
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 		}
1071 1071
 
1072 1072
 		// There's still a tag/category here.
1073
-		if( $term ) {
1073
+		if ( $term ) {
1074 1074
 
1075 1075
 			$term_link = get_term_link( $term, $taxonomy );
1076 1076
 
@@ -1079,11 +1079,11 @@  discard block
 block discarded – undo
1079 1079
 			    continue;
1080 1080
 			}
1081 1081
 
1082
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1082
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1083 1083
 		}
1084 1084
 	}
1085 1085
 
1086
-	return implode(', ', $output );
1086
+	return implode( ', ', $output );
1087 1087
 }
1088 1088
 
1089 1089
 /**
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
 
1098 1098
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
1099 1099
 
1100
-	if( empty( $link ) ) {
1101
-		return strip_tags( $output);
1100
+	if ( empty( $link ) ) {
1101
+		return strip_tags( $output );
1102 1102
 	}
1103 1103
 
1104 1104
 	return $output;
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	$fe = GravityView_frontend::getInstance();
1118 1118
 
1119 1119
 	// Solve problem when loading content via admin-ajax.php
1120
-	if( ! $fe->getGvOutputData() ) {
1120
+	if ( ! $fe->getGvOutputData() ) {
1121 1121
 
1122 1122
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
1123 1123
 
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 	}
1126 1126
 
1127 1127
 	// Make 100% sure that we're dealing with a properly called situation
1128
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1128
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1129 1129
 
1130 1130
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
1131 1131
 
@@ -1356,12 +1356,12 @@  discard block
 block discarded – undo
1356 1356
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1357 1357
 	/** @define "GRAVITYVIEW_DIR" "../" */
1358 1358
 
1359
-	if( !class_exists( 'GravityView_Field' ) ) {
1360
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1359
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1360
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1361 1361
 	}
1362 1362
 
1363
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1364
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1363
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1364
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1365 1365
 	}
1366 1366
 
1367 1367
 	if ( is_null( $context ) ) {
@@ -1464,21 +1464,21 @@  discard block
 block discarded – undo
1464 1464
 	} else {
1465 1465
 		// @deprecated path
1466 1466
 		// Required fields.
1467
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1467
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1468 1468
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1469 1469
 			return '';
1470 1470
 		}
1471 1471
 	}
1472 1472
 
1473 1473
 	if ( $context instanceof \GV\Template_Context ) {
1474
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1475
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1476
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1474
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1475
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1476
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1477 1477
 	} else {
1478 1478
 		// @deprecated path
1479
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1480
-		$field = $args['field'];
1481
-		$form = $args['form'];
1479
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1480
+		$field = $args[ 'field' ];
1481
+		$form = $args[ 'form' ];
1482 1482
 	}
1483 1483
 
1484 1484
 	/**
@@ -1498,43 +1498,43 @@  discard block
 block discarded – undo
1498 1498
 	);
1499 1499
 
1500 1500
 	if ( $context instanceof \GV\Template_Context ) {
1501
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1501
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1502 1502
 	} else {
1503 1503
 		// @deprecated path
1504
-		$placeholders['value'] = gv_value( $entry, $field );
1504
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1505 1505
 	}
1506 1506
 
1507 1507
 	// If the value is empty and we're hiding empty, return empty.
1508
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1508
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1509 1509
 		return '';
1510 1510
 	}
1511 1511
 
1512
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1513
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1512
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1513
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1514 1514
 	}
1515 1515
 
1516 1516
 	// Get width setting, if exists
1517
-	$placeholders['width'] = GravityView_API::field_width( $field );
1517
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1518 1518
 
1519 1519
 	// If replacing with CSS inline formatting, let's do it.
1520
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1520
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1521 1521
 
1522 1522
 	// Grab the Class using `gv_class`
1523
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1524
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1523
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1524
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1525 1525
 
1526 1526
 	if ( $context instanceof \GV\Template_Context ) {
1527
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1527
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1528 1528
 	} else {
1529 1529
 		// Default Label value
1530
-		$placeholders['label_value'] = gv_label( $field, $entry );
1530
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1531 1531
 	}
1532 1532
 
1533
-	$placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders['label_value'] ) ) ) );
1534
-	$placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] );
1533
+	$placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders[ 'label_value' ] ) ) ) );
1534
+	$placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] );
1535 1535
 
1536
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1537
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1536
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1537
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1538 1538
 	}
1539 1539
 
1540 1540
 	/**
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 	 * @since 2.0
1546 1546
 	 * @param \GV\Template_Context $context The context.
1547 1547
 	 */
1548
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1548
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1549 1549
 
1550 1550
 	/**
1551 1551
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 	foreach ( $placeholders as $tag => $value ) {
1573 1573
 
1574 1574
 		// If the tag doesn't exist just skip it
1575
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1575
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1576 1576
 			continue;
1577 1577
 		}
1578 1578
 
Please login to merge, or discard this patch.