Completed
Push — develop ( a58a90...41e545 )
by Zack
19:18
created
future/includes/class-gv-collection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	 * @return void
25 25
 	 */
26 26
 	public function append( $value ) {
27
-		$this->storage []= $value;
27
+		$this->storage [ ] = $value;
28 28
 	}
29 29
 
30 30
 	/**
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@
 block discarded – undo
2 2
 namespace GV;
3 3
 
4 4
 /** If this file is called directly, abort. */
5
-if ( ! defined( 'GRAVITYVIEW_DIR' ) )
5
+if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6 6
 	die();
7
+}
7 8
 
8 9
 /**
9 10
  * A generic Collection base class.
Please login to merge, or discard this patch.
future/includes/class-gv-request-frontend.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@
 block discarded – undo
2 2
 namespace GV;
3 3
 
4 4
 /** If this file is called directly, abort. */
5
-if ( ! defined( 'GRAVITYVIEW_DIR' ) )
5
+if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6 6
 	die();
7
+}
7 8
 
8 9
 /**
9 10
  * The default Request class.
Please login to merge, or discard this patch.
includes/class-data.php 2 patches
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	private function __construct( $passed_post = NULL ) {
19 19
 
20
-		if( !empty( $passed_post ) ) {
20
+		if ( ! empty( $passed_post ) ) {
21 21
 
22 22
 			$id_or_id_array = $this->maybe_get_view_id( $passed_post );
23 23
 
24
-			if( !empty( $id_or_id_array ) ) {
24
+			if ( ! empty( $id_or_id_array ) ) {
25 25
 				$this->add_view( $id_or_id_array );
26 26
 			}
27 27
 		}
@@ -58,40 +58,40 @@  discard block
 block discarded – undo
58 58
 	public function maybe_get_view_id( $passed_post ) {
59 59
 		$ids = array();
60 60
 
61
-		if( ! empty( $passed_post ) ) {
61
+		if ( ! empty( $passed_post ) ) {
62 62
 
63
-			if( is_numeric( $passed_post ) ) {
63
+			if ( is_numeric( $passed_post ) ) {
64 64
 				$passed_post = get_post( $passed_post );
65 65
 			}
66 66
 
67 67
 			// Convert WP_Posts into WP_Posts[] array
68
-			if( $passed_post instanceof WP_Post ) {
68
+			if ( $passed_post instanceof WP_Post ) {
69 69
 				$passed_post = array( $passed_post );
70 70
 			}
71 71
 
72
-			if( is_array( $passed_post ) ) {
72
+			if ( is_array( $passed_post ) ) {
73 73
 
74
-				foreach ( $passed_post as &$post) {
74
+				foreach ( $passed_post as &$post ) {
75 75
 					if ( function_exists( 'gravityview' ) && $post instanceof WP_Post ) {
76 76
 						$views = \GV\View_Collection::from_post( $post );
77 77
 						foreach ( $views->all() as $view ) {
78
-							$ids []= $view->ID;
78
+							$ids [ ] = $view->ID;
79 79
 						}
80 80
 					} else {
81 81
 						/** Deprecated, see \GV\View_Collection::from_post */
82
-						if( ( get_post_type( $post ) === 'gravityview' ) ) {
83
-							$ids[] = $post->ID;
84
-						} else{
82
+						if ( ( get_post_type( $post ) === 'gravityview' ) ) {
83
+							$ids[ ] = $post->ID;
84
+						} else {
85 85
 							// Parse the Post Content
86 86
 							$id = $this->parse_post_content( $post->post_content );
87
-							if( $id ) {
88
-								$ids = array_merge( $ids, (array) $id );
87
+							if ( $id ) {
88
+								$ids = array_merge( $ids, (array)$id );
89 89
 							}
90 90
 
91 91
 							// Parse the Post Meta
92 92
 							$id = $this->parse_post_meta( $post->ID );
93
-							if( $id ) {
94
-								$ids = array_merge( $ids, (array) $id );
93
+							if ( $id ) {
94
+								$ids = array_merge( $ids, (array)$id );
95 95
 							}
96 96
 						}
97 97
 					}
@@ -105,31 +105,31 @@  discard block
 block discarded – undo
105 105
 					if ( function_exists( 'gravityview' ) ) {
106 106
 						$shortcodes = \GV\Shortcode::parse( $passed_post );
107 107
 						foreach ( $shortcodes as $shortcode ) {
108
-							if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) )
109
-								$ids []= $shortcode->atts['id'];
108
+							if ( $shortcode->name == 'gravityview' && ! empty( $shortcode->atts[ 'id' ] ) )
109
+								$ids [ ] = $shortcode->atts[ 'id' ];
110 110
 						}
111 111
 					} else {
112 112
 						/** Deprecated, use \GV\Shortcode::parse. */
113 113
 						$id = $this->parse_post_content( $passed_post );
114
-						if( $id ) {
115
-							$ids = array_merge( $ids, (array) $id );
114
+						if ( $id ) {
115
+							$ids = array_merge( $ids, (array)$id );
116 116
 						}
117 117
 					}
118 118
 
119 119
 				} else {
120 120
 					$id = $this->get_id_from_atts( $passed_post );
121
-					$ids[] = intval( $id );
121
+					$ids[ ] = intval( $id );
122 122
 				}
123 123
 			}
124 124
 		}
125 125
 
126
-		if( empty($ids) ) {
126
+		if ( empty( $ids ) ) {
127 127
 			return NULL;
128 128
 		}
129 129
 
130 130
 		// If it's just one ID, return that.
131 131
 		// Otherwise, return array of IDs
132
-		return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids;
132
+		return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids;
133 133
 	}
134 134
 
135 135
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	public static function getInstance( $passed_post = NULL ) {
139 139
 
140
-		if( empty( self::$instance ) ) {
140
+		if ( empty( self::$instance ) ) {
141 141
 			self::$instance = new GravityView_View_Data( $passed_post );
142 142
 		}
143 143
 
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
 
151 151
 	function get_view( $view_id, $atts = NULL ) {
152 152
 
153
-		if( ! is_numeric( $view_id) ) {
154
-			do_action('gravityview_log_error', sprintf('GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id) );
153
+		if ( ! is_numeric( $view_id ) ) {
154
+			do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id ) );
155 155
 			return false;
156 156
 		}
157 157
 
158 158
 		// Backup: the view hasn't been fetched yet. Doing it now.
159 159
 		if ( ! isset( $this->views[ $view_id ] ) ) {
160
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] View #%s not set yet.', $view_id) );
160
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] View #%s not set yet.', $view_id ) );
161 161
 			return $this->add_view( $view_id, $atts );
162 162
 		}
163 163
 
164 164
 		if ( empty( $this->views[ $view_id ] ) ) {
165
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id) );
165
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id ) );
166 166
 			return false;
167 167
 		}
168 168
 
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	function add_view( $view_id, $atts = NULL ) {
194 194
 
195 195
 		// Handle array of IDs
196
-		if( is_array( $view_id ) ) {
197
-			foreach( $view_id as $id ) {
196
+		if ( is_array( $view_id ) ) {
197
+			foreach ( $view_id as $id ) {
198 198
 
199 199
 				$this->add_view( $id, $atts );
200 200
 			}
@@ -203,21 +203,21 @@  discard block
 block discarded – undo
203 203
 		}
204 204
 
205 205
 		// The view has been set already; returning stored view.
206
-		if ( !empty( $this->views[ $view_id ] ) ) {
207
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id) );
206
+		if ( ! empty( $this->views[ $view_id ] ) ) {
207
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id ) );
208 208
 			return $this->views[ $view_id ];
209 209
 		}
210 210
 
211
-		if( ! $this->view_exists( $view_id ) ) {
212
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id) );
211
+		if ( ! $this->view_exists( $view_id ) ) {
212
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id ) );
213 213
 			return false;
214 214
 		}
215 215
 
216 216
 		$form_id = gravityview_get_form_id( $view_id );
217 217
 
218
-		if( empty( $form_id ) ) {
218
+		if ( empty( $form_id ) ) {
219 219
 
220
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id) );
220
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id ) );
221 221
 
222 222
 			return false;
223 223
 		}
@@ -225,21 +225,21 @@  discard block
 block discarded – undo
225 225
 		// Get the settings for the View ID
226 226
 		$view_settings = gravityview_get_template_settings( $view_id );
227 227
 
228
-		do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id), $view_settings );
228
+		do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id ), $view_settings );
229 229
 
230 230
 		// Merge the view settings with the defaults
231 231
 		$view_defaults = wp_parse_args( $view_settings, self::get_default_args() );
232 232
 
233
-		do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults );
233
+		do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults );
234 234
 
235
-		if( ! empty( $atts ) && is_array( $atts ) ) {
235
+		if ( ! empty( $atts ) && is_array( $atts ) ) {
236 236
 
237
-			do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging  with the $view_defaults', $atts );
237
+			do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging  with the $view_defaults', $atts );
238 238
 
239 239
 			// Get the settings from the shortcode and merge them with defaults.
240 240
 			$atts = shortcode_atts( $view_defaults, $atts );
241 241
 
242
-			do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging  with the $view_defaults', $atts );
242
+			do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging  with the $view_defaults', $atts );
243 243
 
244 244
 		} else {
245 245
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 		}
250 250
 
251
-		unset( $atts['id'], $view_defaults, $view_settings );
251
+		unset( $atts[ 'id' ], $view_defaults, $view_settings );
252 252
 
253 253
 		$data = array(
254 254
 			'id' => $view_id,
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 			'form' => gravityview_get_form( $form_id ),
262 262
 		);
263 263
 
264
-		do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] View #%s being added.', $view_id), $data );
264
+		do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] View #%s being added.', $view_id ), $data );
265 265
 
266 266
 		$this->views[ $view_id ] = $data;
267 267
 
@@ -296,15 +296,15 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	private function filter_fields( $dir_fields ) {
298 298
 
299
-		if( empty( $dir_fields ) || !is_array( $dir_fields ) ) {
299
+		if ( empty( $dir_fields ) || ! is_array( $dir_fields ) ) {
300 300
 			return $dir_fields;
301 301
 		}
302 302
 
303
-		foreach( $dir_fields as $area => $fields ) {
303
+		foreach ( $dir_fields as $area => $fields ) {
304 304
 
305
-			foreach( (array)$fields as $uniqid => $properties ) {
305
+			foreach ( (array)$fields as $uniqid => $properties ) {
306 306
 
307
-				if( $this->hide_field_check_conditions( $properties ) ) {
307
+				if ( $this->hide_field_check_conditions( $properties ) ) {
308 308
 					unset( $dir_fields[ $area ][ $uniqid ] );
309 309
 				}
310 310
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	private function hide_field_check_conditions( $properties ) {
327 327
 
328 328
 		// logged-in visibility
329
-		if( ! empty( $properties['only_loggedin'] ) && ! GVCommon::has_cap( $properties['only_loggedin_cap'] ) ) {
329
+		if ( ! empty( $properties[ 'only_loggedin' ] ) && ! GVCommon::has_cap( $properties[ 'only_loggedin_cap' ] ) ) {
330 330
 			return true;
331 331
 		}
332 332
 
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
 		// Get the settings from the shortcode and merge them with defaults.
344 344
 		$atts = wp_parse_args( $atts, self::get_default_args() );
345 345
 
346
-		$view_id = ! empty( $atts['view_id'] ) ? (int)$atts['view_id'] : NULL;
346
+		$view_id = ! empty( $atts[ 'view_id' ] ) ? (int)$atts[ 'view_id' ] : NULL;
347 347
 
348
-		if( empty( $view_id ) && !empty( $atts['id'] ) ) {
349
-			$view_id = (int)$atts['id'];
348
+		if ( empty( $view_id ) && ! empty( $atts[ 'id' ] ) ) {
349
+			$view_id = (int)$atts[ 'id' ];
350 350
 		}
351 351
 
352
-		if( empty( $view_id ) ) {
353
-			do_action('gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts );
352
+		if ( empty( $view_id ) ) {
353
+			do_action( 'gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts );
354 354
 			return;
355 355
 		}
356 356
 
@@ -372,46 +372,46 @@  discard block
 block discarded – undo
372 372
 		 * @hack This is so that the shortcode is registered for the oEmbed preview in the Admin
373 373
 		 * @since 1.6
374 374
 		 */
375
-		if( ! shortcode_exists('gravityview') && class_exists( 'GravityView_Shortcode' ) ) {
375
+		if ( ! shortcode_exists( 'gravityview' ) && class_exists( 'GravityView_Shortcode' ) ) {
376 376
 			new GravityView_Shortcode;
377 377
 		}
378 378
 
379 379
 		$shortcodes = gravityview_has_shortcode_r( $content, 'gravityview' );
380 380
 
381
-		if( empty( $shortcodes ) ) {
381
+		if ( empty( $shortcodes ) ) {
382 382
 			return NULL;
383 383
 		}
384 384
 
385
-		do_action('gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes );
385
+		do_action( 'gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes );
386 386
 
387 387
 		$ids = array();
388 388
 
389
-		foreach ($shortcodes as $key => $shortcode) {
389
+		foreach ( $shortcodes as $key => $shortcode ) {
390 390
 
391
-			$shortcode[3] = htmlspecialchars_decode( $shortcode[3], ENT_QUOTES );
391
+			$shortcode[ 3 ] = htmlspecialchars_decode( $shortcode[ 3 ], ENT_QUOTES );
392 392
 
393
-			$args = shortcode_parse_atts( $shortcode[3] );
393
+			$args = shortcode_parse_atts( $shortcode[ 3 ] );
394 394
 
395
-			if( empty( $args['id'] ) ) {
396
-				do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode );
395
+			if ( empty( $args[ 'id' ] ) ) {
396
+				do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode );
397 397
 				continue;
398 398
 			}
399 399
 
400
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args['id']), $args );
400
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args[ 'id' ] ), $args );
401 401
 
402 402
 			// Store the View to the object for later fetching.
403
-			$this->add_view( $args['id'], $args );
403
+			$this->add_view( $args[ 'id' ], $args );
404 404
 
405
-			$ids[] = $args['id'];
405
+			$ids[ ] = $args[ 'id' ];
406 406
 		}
407 407
 
408
-		if( empty($ids) ) {
408
+		if ( empty( $ids ) ) {
409 409
 			return NULL;
410 410
 		}
411 411
 
412 412
 		// If it's just one ID, return that.
413 413
 		// Otherwise, return array of IDs
414
-		return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids;
414
+		return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids;
415 415
 
416 416
 	}
417 417
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 		 */
433 433
 		$meta_keys = (array)apply_filters( 'gravityview/data/parse/meta_keys', array(), $post_id );
434 434
 
435
-		if( empty( $meta_keys ) ) {
435
+		if ( empty( $meta_keys ) ) {
436 436
 			return NULL;
437 437
 		}
438 438
 
@@ -440,16 +440,16 @@  discard block
 block discarded – undo
440 440
 
441 441
 		$meta_content = '';
442 442
 
443
-		foreach( $meta_keys as $key ) {
444
-			$meta = get_post_meta( $post_id, $key , true );
445
-			if( ! is_string( $meta ) ) {
443
+		foreach ( $meta_keys as $key ) {
444
+			$meta = get_post_meta( $post_id, $key, true );
445
+			if ( ! is_string( $meta ) ) {
446 446
 				continue;
447 447
 			}
448 448
 			$meta_content .= $meta . ' ';
449 449
 		}
450 450
 
451
-		if( empty( $meta_content ) ) {
452
-			do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys );
451
+		if ( empty( $meta_content ) ) {
452
+			do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys );
453 453
 			return NULL;
454 454
 		}
455 455
 
@@ -476,16 +476,16 @@  discard block
 block discarded – undo
476 476
 		$message = NULL;
477 477
 
478 478
 		// Not invalid if not set!
479
-		if( empty( $post_id ) || empty( $view_id ) ) {
479
+		if ( empty( $post_id ) || empty( $view_id ) ) {
480 480
 
481
-			if( $empty_is_valid ) {
481
+			if ( $empty_is_valid ) {
482 482
 				return true;
483 483
 			}
484 484
 
485 485
 			$message = esc_html__( 'The ID is required.', 'gravityview' );
486 486
 		}
487 487
 
488
-		if( ! $message ) {
488
+		if ( ! $message ) {
489 489
 			$status = get_post_status( $post_id );
490 490
 
491 491
 			// Nothing exists with that post ID.
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 			}
498 498
 		}
499 499
 
500
-		if( ! $message ) {
500
+		if ( ! $message ) {
501 501
 
502 502
 			// Nothing exists with that post ID.
503 503
 			if ( empty( $status ) || in_array( $status, array( 'revision', 'attachment' ) ) ) {
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 
507 507
 		}
508 508
 
509
-		if( ! $message ) {
510
-			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) )  {
509
+		if ( ! $message ) {
510
+			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) {
511 511
 				$views = GV\View_Collection::from_post( $post );
512 512
 				$view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() );
513 513
 			} else {
@@ -516,21 +516,21 @@  discard block
 block discarded – undo
516 516
 			}
517 517
 
518 518
 			// The post or page specified does not contain the shortcode.
519
-			if ( false === in_array( $view_id, (array) $view_ids_in_post ) ) {
519
+			if ( false === in_array( $view_id, (array)$view_ids_in_post ) ) {
520 520
 				$message = sprintf( esc_html__( 'The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview' ), '<br /><code>[gravityview id="' . intval( $view_id ) . '"]</code>' );
521 521
 			}
522 522
 		}
523 523
 
524
-		if( ! $message ) {
524
+		if ( ! $message ) {
525 525
 
526 526
 			// It's a View
527
-			if( 'gravityview' === get_post_type( $post_id ) ) {
528
-				$message = esc_html__( 'The ID is already a View.', 'gravityview' );;
527
+			if ( 'gravityview' === get_post_type( $post_id ) ) {
528
+				$message = esc_html__( 'The ID is already a View.', 'gravityview' ); ;
529 529
 			}
530 530
 
531 531
 		}
532 532
 
533
-		if( $message ) {
533
+		if ( $message ) {
534 534
 			return new WP_Error( 'invalid_embed_id', $message );
535 535
 		}
536 536
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 
548 548
 		$args = self::get_default_args( $with_details );
549 549
 
550
-		if( !isset( $args[ $key ] ) ) { return NULL; }
550
+		if ( ! isset( $args[ $key ] ) ) { return NULL; }
551 551
 
552 552
 		return $args[ $key ];
553 553
 	}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 		 */
577 577
 		$default_settings = apply_filters( 'gravityview_default_args', array(
578 578
 			'id' => array(
579
-				'label' => __('View ID', 'gravityview'),
579
+				'label' => __( 'View ID', 'gravityview' ),
580 580
 				'type' => 'number',
581 581
 				'group'	=> 'default',
582 582
 				'value' => NULL,
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				'show_in_shortcode' => false,
585 585
 			),
586 586
 			'page_size' => array(
587
-				'label' 	=> __('Number of entries per page', 'gravityview'),
587
+				'label' 	=> __( 'Number of entries per page', 'gravityview' ),
588 588
 				'type' => 'number',
589 589
 				'class'	=> 'small-text',
590 590
 				'group'	=> 'default',
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 			),
609 609
 			'admin_show_all_statuses' => array(
610 610
 				'label' => __( 'Show all entries to administrators', 'gravityview' ),
611
-				'desc'	=> __('Administrators will be able to see entries with any approval status.', 'gravityview'),
612
-				'tooltip' => __('Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview'),
611
+				'desc'	=> __( 'Administrators will be able to see entries with any approval status.', 'gravityview' ),
612
+				'tooltip' => __( 'Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview' ),
613 613
 				'requires' => 'show_only_approved',
614 614
 				'type' => 'checkbox',
615 615
 				'group'	=> 'default',
@@ -634,40 +634,40 @@  discard block
 block discarded – undo
634 634
 			'user_edit' => array(
635 635
 				'label'	=> __( 'Allow User Edit', 'gravityview' ),
636 636
 				'group'	=> 'default',
637
-				'desc'	=> __('Allow logged-in users to edit entries they created.', 'gravityview'),
637
+				'desc'	=> __( 'Allow logged-in users to edit entries they created.', 'gravityview' ),
638 638
 				'value'	=> 0,
639
-				'tooltip' => __('Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview'),
639
+				'tooltip' => __( 'Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview' ),
640 640
 				'type'	=> 'checkbox',
641 641
 				'show_in_shortcode' => true,
642 642
 			),
643 643
 			'user_delete' => array(
644 644
 				'label'	=> __( 'Allow User Delete', 'gravityview' ),
645 645
 				'group'	=> 'default',
646
-				'desc'	=> __('Allow logged-in users to delete entries they created.', 'gravityview'),
646
+				'desc'	=> __( 'Allow logged-in users to delete entries they created.', 'gravityview' ),
647 647
 				'value'	=> 0,
648
-				'tooltip' => __('Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview'),
648
+				'tooltip' => __( 'Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview' ),
649 649
 				'type'	=> 'checkbox',
650 650
 				'show_in_shortcode' => true,
651 651
 			),
652 652
 			'sort_field' => array(
653
-				'label'	=> __('Sort by field', 'gravityview'),
653
+				'label'	=> __( 'Sort by field', 'gravityview' ),
654 654
 				'type' => 'select',
655 655
 				'value' => '',
656 656
 				'group'	=> 'sort',
657 657
 				'options' => array(
658
-					'' => __( 'Default', 'gravityview'),
659
-					'date_created' => __( 'Date Created', 'gravityview'),
658
+					'' => __( 'Default', 'gravityview' ),
659
+					'date_created' => __( 'Date Created', 'gravityview' ),
660 660
 				),
661 661
 				'show_in_shortcode' => true,
662 662
 			),
663 663
 			'sort_direction' => array(
664
-				'label' 	=> __('Sort direction', 'gravityview'),
664
+				'label' 	=> __( 'Sort direction', 'gravityview' ),
665 665
 				'type' => 'select',
666 666
 				'value' => 'ASC',
667 667
 				'group'	=> 'sort',
668 668
 				'options' => array(
669
-					'ASC' => __('ASC', 'gravityview'),
670
-					'DESC' => __('DESC', 'gravityview'),
669
+					'ASC' => __( 'ASC', 'gravityview' ),
670
+					'DESC' => __( 'DESC', 'gravityview' ),
671 671
 					//'RAND' => __('Random', 'gravityview'),
672 672
 				),
673 673
 				'show_in_shortcode' => true,
@@ -683,69 +683,69 @@  discard block
 block discarded – undo
683 683
 				'show_in_template' => array( 'default_table' ),
684 684
 			),
685 685
 			'start_date' => array(
686
-				'label' 	=> __('Filter by Start Date', 'gravityview'),
686
+				'label' 	=> __( 'Filter by Start Date', 'gravityview' ),
687 687
 				'class'	=> 'gv-datepicker',
688
-				'desc'	=> __('Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ),
688
+				'desc'	=> __( 'Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ),
689 689
 				'type' => 'text',
690 690
 				'value' => '',
691 691
 				'group'	=> 'filter',
692 692
 				'show_in_shortcode' => true,
693 693
 			),
694 694
 			'end_date' => array(
695
-				'label' 	=> __('Filter by End Date', 'gravityview'),
695
+				'label' 	=> __( 'Filter by End Date', 'gravityview' ),
696 696
 				'class'	=> 'gv-datepicker',
697
-				'desc'	=> __('Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ),
697
+				'desc'	=> __( 'Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ),
698 698
 				'type' => 'text',
699 699
 				'value' => '',
700 700
 				'group'	=> 'filter',
701 701
 				'show_in_shortcode' => true,
702 702
 			),
703 703
 			'class' => array(
704
-				'label' 	=> __('CSS Class', 'gravityview'),
705
-				'desc'	=> __('CSS class to add to the wrapping HTML container.', 'gravityview'),
704
+				'label' 	=> __( 'CSS Class', 'gravityview' ),
705
+				'desc'	=> __( 'CSS class to add to the wrapping HTML container.', 'gravityview' ),
706 706
 				'group'	=> 'default',
707 707
 				'type' => 'text',
708 708
 				'value' => '',
709 709
 				'show_in_shortcode' => false,
710 710
 			),
711 711
 			'search_value' => array(
712
-				'label' 	=> __('Search Value', 'gravityview'),
713
-				'desc'	=> __('Define a default search value for the View', 'gravityview'),
712
+				'label' 	=> __( 'Search Value', 'gravityview' ),
713
+				'desc'	=> __( 'Define a default search value for the View', 'gravityview' ),
714 714
 				'type' => 'text',
715 715
 				'value' => '',
716 716
 				'group'	=> 'filter',
717 717
 				'show_in_shortcode' => false,
718 718
 			),
719 719
 			'search_field' => array(
720
-				'label' 	=> __('Search Field', 'gravityview'),
721
-				'desc'	=> __('If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview'),
720
+				'label' 	=> __( 'Search Field', 'gravityview' ),
721
+				'desc'	=> __( 'If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview' ),
722 722
 				'type' => 'number',
723 723
 				'value' => '',
724 724
 				'group'	=> 'filter',
725 725
 				'show_in_shortcode' => false,
726 726
 			),
727 727
 			'single_title' => array(
728
-				'label'	=> __('Single Entry Title', 'gravityview'),
728
+				'label'	=> __( 'Single Entry Title', 'gravityview' ),
729 729
 				'type'	=> 'text',
730
-				'desc'	=> __('When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview'),
730
+				'desc'	=> __( 'When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview' ),
731 731
 				'group'	=> 'default',
732 732
 				'value'	=> '',
733 733
 				'show_in_shortcode' => false,
734 734
 				'full_width' => true,
735 735
 			),
736 736
 			'back_link_label' => array(
737
-				'label'	=> __('Back Link Label', 'gravityview'),
737
+				'label'	=> __( 'Back Link Label', 'gravityview' ),
738 738
 				'group'	=> 'default',
739
-				'desc'	=> __('The text of the link that returns to the multiple entries view.', 'gravityview'),
739
+				'desc'	=> __( 'The text of the link that returns to the multiple entries view.', 'gravityview' ),
740 740
 				'type'	=> 'text',
741 741
 				'value'	=> '',
742 742
 				'show_in_shortcode' => false,
743 743
 				'full_width' => true,
744 744
 			),
745 745
 			'embed_only' => array(
746
-				'label'	=> __('Prevent Direct Access', 'gravityview'),
746
+				'label'	=> __( 'Prevent Direct Access', 'gravityview' ),
747 747
 				'group'	=> 'default',
748
-				'desc'	=> __('Only allow access to this View when embedded using the shortcode.', 'gravityview'),
748
+				'desc'	=> __( 'Only allow access to this View when embedded using the shortcode.', 'gravityview' ),
749 749
 				'type'	=> 'checkbox',
750 750
 				'value'	=> '',
751 751
 				'show_in_shortcode' => false,
@@ -756,15 +756,15 @@  discard block
 block discarded – undo
756 756
 				'value' => '',
757 757
 				'show_in_shortcode' => false,
758 758
 			),
759
-		));
759
+		) );
760 760
 
761 761
 		// By default, we only want the key => value pairing, not the whole array.
762
-		if( empty( $with_details ) ) {
762
+		if ( empty( $with_details ) ) {
763 763
 
764 764
 			$defaults = array();
765 765
 
766
-			foreach( $default_settings as $key => $value ) {
767
-				$defaults[ $key ] = $value['value'];
766
+			foreach ( $default_settings as $key => $value ) {
767
+				$defaults[ $key ] = $value[ 'value' ];
768 768
 			}
769 769
 
770 770
 			return $defaults;
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 		// But sometimes, we want all the details.
774 774
 		else {
775 775
 
776
-			foreach ($default_settings as $key => $value) {
776
+			foreach ( $default_settings as $key => $value ) {
777 777
 
778 778
 				// If the $group argument is set for the method,
779 779
 				// ignore any settings that aren't in that group.
780
-				if( !empty( $group ) && is_string( $group ) ) {
781
-					if( empty( $value['group'] ) || $value['group'] !== $group ) {
780
+				if ( ! empty( $group ) && is_string( $group ) ) {
781
+					if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) {
782 782
 						unset( $default_settings[ $key ] );
783 783
 					}
784 784
 				}
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 						/** Deprecated, see \GV\View_Collection::from_post */
82 82
 						if( ( get_post_type( $post ) === 'gravityview' ) ) {
83 83
 							$ids[] = $post->ID;
84
-						} else{
84
+						} else {
85 85
 							// Parse the Post Content
86 86
 							$id = $this->parse_post_content( $post->post_content );
87 87
 							if( $id ) {
@@ -105,8 +105,9 @@  discard block
 block discarded – undo
105 105
 					if ( function_exists( 'gravityview' ) ) {
106 106
 						$shortcodes = \GV\Shortcode::parse( $passed_post );
107 107
 						foreach ( $shortcodes as $shortcode ) {
108
-							if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) )
109
-								$ids []= $shortcode->atts['id'];
108
+							if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) {
109
+															$ids []= $shortcode->atts['id'];
110
+							}
110 111
 						}
111 112
 					} else {
112 113
 						/** Deprecated, use \GV\Shortcode::parse. */
@@ -507,7 +508,7 @@  discard block
 block discarded – undo
507 508
 		}
508 509
 
509 510
 		if( ! $message ) {
510
-			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) )  {
511
+			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) {
511 512
 				$views = GV\View_Collection::from_post( $post );
512 513
 				$view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() );
513 514
 			} else {
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-wpml.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 		add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) );
64 64
 
65
-		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') );
65
+		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) );
66 66
 	}
67 67
 
68 68
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	function filter_gravityview_back_link( $link ) {
83 83
 		global $wpml_url_filters;
84 84
 
85
-		if( $wpml_url_filters ) {
85
+		if ( $wpml_url_filters ) {
86 86
 			$link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() );
87 87
 		}
88 88
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	private function remove_url_hooks() {
100 100
 		global $wpml_url_filters;
101 101
 
102
-		if( ! $wpml_url_filters ) {
102
+		if ( ! $wpml_url_filters ) {
103 103
 			return;
104 104
 		}
105 105
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	private function add_url_hooks() {
123 123
 		global $wpml_url_filters;
124 124
 
125
-		if( ! $wpml_url_filters ) {
125
+		if ( ! $wpml_url_filters ) {
126 126
 			return;
127 127
 		}
128 128
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 			$this->remove_url_hooks();
163 163
 
164
-			if( $translations ) {
164
+			if ( $translations ) {
165 165
 				foreach ( $languages as $lang_code => $language ) {
166 166
 
167 167
 					$lang_post_id = $translations[ $lang_code ]->element_id;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 							break;
195 195
 					}
196 196
 
197
-					$languages[ $lang_code ]['url'] = $entry_link;
197
+					$languages[ $lang_code ][ 'url' ] = $entry_link;
198 198
 				}
199 199
 			}
200 200
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/data-source.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' );
12 12
 
13 13
 //current value
14
-$current_form = (int) rgar( (array) $_GET, 'form_id', gravityview_get_form_id( $post->ID ) );
14
+$current_form = (int)rgar( (array)$_GET, 'form_id', gravityview_get_form_id( $post->ID ) );
15 15
 
16 16
 // If form is in trash or not existing, show error
17 17
 GravityView_Admin::connected_form_warning( $current_form );
18 18
 
19 19
 // check for available gravity forms
20
-$forms = gravityview_get_forms('any');
20
+$forms = gravityview_get_forms( 'any' );
21 21
 ?>
22 22
 <label for="gravityview_form_id" ><?php esc_html_e( 'Where would you like the data to come from for this View?', 'gravityview' ); ?></label>
23 23
 
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
 		?>
29 29
 		<a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Use a Form Preset', 'gravityview' ); ?>"><?php esc_html_e( 'Use a Form Preset', 'gravityview' ); ?></a>
30 30
 
31
-		<?php if( !empty( $forms ) ) { ?>
31
+		<?php if ( ! empty( $forms ) ) { ?>
32 32
 			<span>&nbsp;<?php esc_html_e( 'or use an existing form', 'gravityview' ); ?>&nbsp;</span>
33 33
 		<?php }
34 34
 	}
35 35
 
36 36
 	// If there are no forms to select, show no forms.
37
-	if( !empty( $forms ) ) { ?>
37
+	if ( ! empty( $forms ) ) { ?>
38 38
 		<select name="gravityview_form_id" id="gravityview_form_id">
39 39
 			<option value="" <?php selected( '', $current_form, true ); ?>>&mdash; <?php esc_html_e( 'list of forms', 'gravityview' ); ?> &mdash;</option>
40
-			<?php foreach( $forms as $form ) { ?>
41
-				<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
40
+			<?php foreach ( $forms as $form ) { ?>
41
+				<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
42 42
 			<?php } ?>
43 43
 		</select>
44 44
 	<?php } else { ?>
45 45
 		<select name="gravityview_form_id" id="gravityview_form_id" class="hidden"><option selected="selected" value=""></option></select>
46 46
 	<?php } ?>
47 47
 
48
-	&nbsp;<a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a>
48
+	&nbsp;<a class="button button-primary" <?php if ( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a>
49 49
 </p>
50 50
 
51 51
 <?php // confirm dialog box ?>
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-total.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total.
52 52
 	 */
53
-	public function add_to_blacklist( $blacklist = array(), $context = NULL  ){
53
+	public function add_to_blacklist( $blacklist = array(), $context = NULL ) {
54 54
 
55
-		if( empty( $context ) || $context !== 'edit' ) {
55
+		if ( empty( $context ) || $context !== 'edit' ) {
56 56
 			return $blacklist;
57 57
 		}
58 58
 
59
-		$blacklist[] = 'total';
59
+		$blacklist[ ] = 'total';
60 60
 
61 61
 		return $blacklist;
62 62
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) {
76 76
 
77
-		$original_form = GFAPI::get_form( $form['id'] );
77
+		$original_form = GFAPI::get_form( $form[ 'id' ] );
78 78
 
79 79
 		$total_fields = GFCommon::get_fields_by_type( $original_form, 'total' );
80 80
 
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 
86 86
 			/** @var GF_Field_Total $total_field */
87 87
 			foreach ( $total_fields as $total_field ) {
88
-				$entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry );
88
+				$entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry );
89 89
 			}
90 90
 
91 91
 			$return_entry = GFAPI::update_entry( $entry );
92 92
 
93
-			if( is_wp_error( $return_entry ) ) {
93
+			if ( is_wp_error( $return_entry ) ) {
94 94
 				do_action( 'gravityview_log_error', __METHOD__ . ': Updating the entry total fields failed', $return_entry );
95 95
 			} else {
96 96
 				do_action( 'gravityview_log_debug', __METHOD__ . ': Updating the entry total fields succeeded' );
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 *
51 51
 	 * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total.
52 52
 	 */
53
-	public function add_to_blacklist( $blacklist = array(), $context = NULL  ){
53
+	public function add_to_blacklist( $blacklist = array(), $context = NULL  ) {
54 54
 
55 55
 		if( empty( $context ) || $context !== 'edit' ) {
56 56
 			return $blacklist;
Please login to merge, or discard this patch.