Completed
Pull Request — develop (#595)
by Zack
04:05
created
includes/class-frontend-views.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
 	/**
152 152
 	 * Sets the single entry ID and also the entry
153
-	 * @param bool|int $single_entry
153
+	 * @param boolean|string $single_entry
154 154
 	 */
155 155
 	public function setSingleEntry( $single_entry ) {
156 156
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 	/**
169 169
 	 * Set the current entry
170
-	 * @param array|int $entry Entry array or entry ID
170
+	 * @param boolean|string $entry Entry array or entry ID
171 171
 	 */
172 172
 	public function setEntry( $entry ) {
173 173
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 *
227 227
 	 *
228
-	 * @param null $view_id
228
+	 * @param string $view_id
229 229
 	 */
230 230
 	public function set_context_view_id( $view_id = null ) {
231 231
 
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 	 *
935 935
 	 * @uses  gravityview_get_entries()
936 936
 	 * @access public
937
-	 * @param array $args\n
937
+	 * @param array $args
938 938
 	 *   - $id - View id
939 939
 	 *   - $page_size - Page
940 940
 	 *   - $sort_field - form field id to sort
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 	/**
1365 1365
 	 * Checks if field (column) is sortable
1366 1366
 	 *
1367
-	 * @param string $field Field settings
1367
+	 * @param string $field_id Field settings
1368 1368
 	 * @param array $form Gravity Forms form array
1369 1369
 	 *
1370 1370
 	 * @since 1.7
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GravityView Frontend functions
4
- *
5
- * @package   GravityView
6
- * @license   GPL2+
7
- * @author    Katz Web Services, Inc.
8
- * @link      http://gravityview.co
9
- * @copyright Copyright 2014, Katz Web Services, Inc.
10
- *
11
- * @since 1.0.0
12
- */
3
+	 * GravityView Frontend functions
4
+	 *
5
+	 * @package   GravityView
6
+	 * @license   GPL2+
7
+	 * @author    Katz Web Services, Inc.
8
+	 * @link      http://gravityview.co
9
+	 * @copyright Copyright 2014, Katz Web Services, Inc.
10
+	 *
11
+	 * @since 1.0.0
12
+	 */
13 13
 
14 14
 
15 15
 class GravityView_frontend {
Please login to merge, or discard this patch.
Spacing   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @since 1.7.4.1
21 21
 	 * @var array
22 22
 	 */
23
-	private static $search_parameters = array( 'gv_search', 'gv_start', 'gv_end', 'gv_id', 'gv_by', 'filter_*' );
23
+	private static $search_parameters = array('gv_search', 'gv_start', 'gv_end', 'gv_id', 'gv_by', 'filter_*');
24 24
 
25 25
 	/**
26 26
 	 * Is the currently viewed post a `gravityview` post type?
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
89
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
88
+		add_action('wp', array($this, 'parse_content'), 11);
89
+		add_action('template_redirect', array($this, 'set_entry_data'), 1);
90 90
 
91 91
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
92
-		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
92
+		add_action('wp_enqueue_scripts', array($this, 'add_scripts_and_styles'), 20);
93 93
 
94 94
 		// Enqueue and print styles in the footer. Added 1 priorty so stuff gets printed at 10 priority.
95
-		add_action( 'wp_print_footer_scripts', array( $this, 'add_scripts_and_styles' ), 1 );
95
+		add_action('wp_print_footer_scripts', array($this, 'add_scripts_and_styles'), 1);
96 96
 
97
-		add_filter( 'the_title', array( $this, 'single_entry_title' ), 1, 2 );
98
-		add_filter( 'the_content', array( $this, 'insert_view_in_content' ) );
99
-		add_filter( 'comments_open', array( $this, 'comments_open' ), 10, 2 );
97
+		add_filter('the_title', array($this, 'single_entry_title'), 1, 2);
98
+		add_filter('the_content', array($this, 'insert_view_in_content'));
99
+		add_filter('comments_open', array($this, 'comments_open'), 10, 2);
100 100
 	}
101 101
 
102 102
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public static function getInstance() {
107 107
 
108
-		if ( empty( self::$instance ) ) {
108
+		if (empty(self::$instance)) {
109 109
 			self::$instance = new self;
110 110
 			self::$instance->initialize();
111 111
 		}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	/**
124 124
 	 * @param GravityView_View_Data $gv_output_data
125 125
 	 */
126
-	public function setGvOutputData( $gv_output_data ) {
126
+	public function setGvOutputData($gv_output_data) {
127 127
 		$this->gv_output_data = $gv_output_data;
128 128
 	}
129 129
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * @param boolean $is_search
139 139
 	 */
140
-	public function setIsSearch( $is_search ) {
140
+	public function setIsSearch($is_search) {
141 141
 		$this->is_search = $is_search;
142 142
 	}
143 143
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * Sets the single entry ID and also the entry
153 153
 	 * @param bool|int $single_entry
154 154
 	 */
155
-	public function setSingleEntry( $single_entry ) {
155
+	public function setSingleEntry($single_entry) {
156 156
 
157 157
 		$this->single_entry = $single_entry;
158 158
 
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	 * Set the current entry
170 170
 	 * @param array|int $entry Entry array or entry ID
171 171
 	 */
172
-	public function setEntry( $entry ) {
172
+	public function setEntry($entry) {
173 173
 
174
-		if ( ! is_array( $entry ) ) {
175
-			$entry = GVCommon::get_entry( $entry );
174
+		if (!is_array($entry)) {
175
+			$entry = GVCommon::get_entry($entry);
176 176
 		}
177 177
 
178 178
 		$this->entry = $entry;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	/**
189 189
 	 * @param int $post_id
190 190
 	 */
191
-	public function setPostId( $post_id ) {
191
+	public function setPostId($post_id) {
192 192
 		$this->post_id = $post_id;
193 193
 	}
194 194
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	/**
203 203
 	 * @param boolean $post_has_shortcode
204 204
 	 */
205
-	public function setPostHasShortcode( $post_has_shortcode ) {
205
+	public function setPostHasShortcode($post_has_shortcode) {
206 206
 		$this->post_has_shortcode = $post_has_shortcode;
207 207
 	}
208 208
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	/**
217 217
 	 * @param boolean $is_gravityview_post_type
218 218
 	 */
219
-	public function setIsGravityviewPostType( $is_gravityview_post_type ) {
219
+	public function setIsGravityviewPostType($is_gravityview_post_type) {
220 220
 		$this->is_gravityview_post_type = $is_gravityview_post_type;
221 221
 	}
222 222
 
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @param null $view_id
229 229
 	 */
230
-	public function set_context_view_id( $view_id = null ) {
230
+	public function set_context_view_id($view_id = null) {
231 231
 
232
-		if ( ! empty( $view_id ) ) {
232
+		if (!empty($view_id)) {
233 233
 
234 234
 			$this->context_view_id = $view_id;
235 235
 
236
-		} elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) {
236
+		} elseif (isset($_GET['gvid']) && $this->getGvOutputData()->has_multiple_views()) {
237 237
 			/**
238 238
 			 * used on a has_multiple_views context
239 239
 			 * @see GravityView_API::entry_link
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 			 */
242 242
 			$this->context_view_id = $_GET['gvid'];
243 243
 
244
-		} elseif ( ! $this->getGvOutputData()->has_multiple_views() )  {
245
-			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
246
-			$this->context_view_id = array_pop( $array_keys );
247
-			unset( $array_keys );
244
+		} elseif (!$this->getGvOutputData()->has_multiple_views()) {
245
+			$array_keys = array_keys($this->getGvOutputData()->get_views());
246
+			$this->context_view_id = array_pop($array_keys);
247
+			unset($array_keys);
248 248
 		}
249 249
 
250 250
 	}
@@ -265,31 +265,31 @@  discard block
 block discarded – undo
265 265
 	 * @param  array  $wp Passed in the `wp` hook. Not used.
266 266
 	 * @return void
267 267
 	 */
268
-	function parse_content( $wp = array() ) {
268
+	function parse_content($wp = array()) {
269 269
 		global $post;
270 270
 
271 271
 		// If in admin and NOT AJAX request, get outta here.
272
-		if ( GravityView_Plugin::is_admin() )  {
272
+		if (GravityView_Plugin::is_admin()) {
273 273
 			return;
274 274
 		}
275 275
 
276 276
 		// Calculate requested Views
277
-		$this->setGvOutputData( GravityView_View_Data::getInstance( $post ) );
277
+		$this->setGvOutputData(GravityView_View_Data::getInstance($post));
278 278
 
279 279
 		// !important: we need to run this before getting single entry (to kick the advanced filter)
280 280
 		$this->set_context_view_id();
281 281
 
282
-		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
282
+		$this->setIsGravityviewPostType(get_post_type($post) === 'gravityview');
283 283
 
284
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
285
-		$this->setPostId( $post_id );
286
-		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
287
-		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
284
+		$post_id = $this->getPostId() ? $this->getPostId() : (isset($post) ? $post->ID : null);
285
+		$this->setPostId($post_id);
286
+		$post_has_shortcode = !empty($post->post_content) ? gravityview_has_shortcode_r($post->post_content, 'gravityview') : false;
287
+		$this->setPostHasShortcode($this->isGravityviewPostType() ? null : !empty($post_has_shortcode));
288 288
 
289 289
 		// check if the View is showing search results (only for multiple entries View)
290
-		$this->setIsSearch( $this->is_searching() );
290
+		$this->setIsSearch($this->is_searching());
291 291
 
292
-		unset( $entry, $post_id, $post_has_shortcode );
292
+		unset($entry, $post_id, $post_has_shortcode);
293 293
 	}
294 294
 
295 295
 	/**
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	function set_entry_data() {
299 299
 		$entry_id = self::is_single_entry();
300
-		$this->setSingleEntry( $entry_id );
301
-		$this->setEntry( $entry_id );
300
+		$this->setSingleEntry($entry_id);
301
+		$this->setEntry($entry_id);
302 302
 	}
303 303
 
304 304
 	/**
@@ -311,31 +311,31 @@  discard block
 block discarded – undo
311 311
 	function is_searching() {
312 312
 
313 313
 		// It's a single entry, not search
314
-		if ( $this->getSingleEntry() ) {
314
+		if ($this->getSingleEntry()) {
315 315
 			return false;
316 316
 		}
317 317
 
318 318
 		// No $_GET parameters
319
-		if ( empty( $_GET ) || ! is_array( $_GET ) ) {
319
+		if (empty($_GET) || !is_array($_GET)) {
320 320
 			return false;
321 321
 		}
322 322
 
323 323
 		// Remove empty values
324
-		$get = array_filter( $_GET );
324
+		$get = array_filter($_GET);
325 325
 
326 326
 		// If the $_GET parameters are empty, it's no search.
327
-		if ( empty( $get ) ) {
327
+		if (empty($get)) {
328 328
 			return false;
329 329
 		}
330 330
 
331
-		$search_keys = array_keys( $get );
331
+		$search_keys = array_keys($get);
332 332
 
333
-		$search_match = implode( '|', self::$search_parameters );
333
+		$search_match = implode('|', self::$search_parameters);
334 334
 
335
-		foreach ( $search_keys as $search_key ) {
335
+		foreach ($search_keys as $search_key) {
336 336
 
337 337
 			// Analyze the search key $_GET parameter and see if it matches known GV args
338
-			if ( preg_match( '/(' . $search_match . ')/i', $search_key ) ) {
338
+			if (preg_match('/('.$search_match.')/i', $search_key)) {
339 339
 				return true;
340 340
 			}
341 341
 		}
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 	 * @param  int $passed_post_id Post ID
351 351
 	 * @return string          (modified) title
352 352
 	 */
353
-	public function single_entry_title( $title, $passed_post_id = null ) {
353
+	public function single_entry_title($title, $passed_post_id = null) {
354 354
 		global $post;
355 355
 
356 356
 		// If this is the directory view, return.
357
-		if ( ! $this->getSingleEntry() ) {
357
+		if (!$this->getSingleEntry()) {
358 358
 			return $title;
359 359
 		}
360 360
 
@@ -365,44 +365,44 @@  discard block
 block discarded – undo
365 365
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
366 366
 		 * @param array $entry Current entry
367 367
 		 */
368
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
368
+		$apply_outside_loop = apply_filters('gravityview/single/title/out_loop', in_the_loop(), $entry);
369 369
 
370
-		if ( ! $apply_outside_loop ) {
370
+		if (!$apply_outside_loop) {
371 371
 			return $title;
372 372
 		}
373 373
 
374 374
 		// User reported WooCommerce doesn't pass two args.
375
-		if ( empty( $passed_post_id ) )  {
375
+		if (empty($passed_post_id)) {
376 376
 			return $title;
377 377
 		}
378 378
 
379 379
 		// Don't modify the title for anything other than the current view/post.
380 380
 		// This is true for embedded shortcodes and Views.
381
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
381
+		if (is_object($post) && (int)$post->ID !== (int)$passed_post_id) {
382 382
 			return $title;
383 383
 		}
384 384
 
385 385
 		$context_view_id = $this->get_context_view_id();
386 386
 
387
-		if ( $this->getGvOutputData()->has_multiple_views() && ! empty( $context_view_id ) ) {
388
-			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
387
+		if ($this->getGvOutputData()->has_multiple_views() && !empty($context_view_id)) {
388
+			$view_meta = $this->getGvOutputData()->get_view($context_view_id);
389 389
 		} else {
390
-			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
391
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
390
+			foreach ($this->getGvOutputData()->get_views() as $view_id => $view_data) {
391
+				if (intval($view_data['form_id']) === intval($entry['form_id'])) {
392 392
 					$view_meta = $view_data;
393 393
 					break;
394 394
 				}
395 395
 			}
396 396
 		}
397 397
 
398
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
398
+		if (!empty($view_meta['atts']['single_title'])) {
399 399
 
400 400
 			$title = $view_meta['atts']['single_title'];
401 401
 
402 402
 			// We are allowing HTML in the fields, so no escaping the output
403
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
403
+			$title = GravityView_API::replace_variables($title, $view_meta['form'], $entry);
404 404
 
405
-			$title = do_shortcode( $title );
405
+			$title = do_shortcode($title);
406 406
 		}
407 407
 
408 408
 		return $title;
@@ -417,38 +417,38 @@  discard block
 block discarded – undo
417 417
 	 * @param mixed $content
418 418
 	 * @return string Add the View output into View CPT content
419 419
 	 */
420
-	public function insert_view_in_content( $content ) {
420
+	public function insert_view_in_content($content) {
421 421
 
422 422
 		// Plugins may run through the content in the header. WP SEO does this for its OpenGraph functionality.
423
-		if ( ! did_action( 'loop_start' ) ) {
423
+		if (!did_action('loop_start')) {
424 424
 
425
-			do_action( 'gravityview_log_debug', '[insert_view_in_content] Not processing yet: loop_start hasn\'t run yet. Current action:', current_filter() );
425
+			do_action('gravityview_log_debug', '[insert_view_in_content] Not processing yet: loop_start hasn\'t run yet. Current action:', current_filter());
426 426
 
427 427
 			return $content;
428 428
 		}
429 429
 
430 430
 		//	We don't want this filter to run infinite loop on any post content fields
431
-		remove_filter( 'the_content', array( $this, 'insert_view_in_content' ) );
431
+		remove_filter('the_content', array($this, 'insert_view_in_content'));
432 432
 
433 433
 		// Otherwise, this is called on the Views page when in Excerpt mode.
434
-		if ( is_admin() ) {
434
+		if (is_admin()) {
435 435
 			return $content;
436 436
 		}
437 437
 
438
-		if ( $this->isGravityviewPostType() ) {
438
+		if ($this->isGravityviewPostType()) {
439 439
 
440 440
 			/** @since 1.7.4 */
441
-			if ( is_preview() && ! gravityview_get_form_id( $this->post_id ) ) {
442
-				$content .= __( 'When using a Start Fresh template, you must save the View before a Preview is available.', 'gravityview' );
441
+			if (is_preview() && !gravityview_get_form_id($this->post_id)) {
442
+				$content .= __('When using a Start Fresh template, you must save the View before a Preview is available.', 'gravityview');
443 443
 			} else {
444
-				foreach ( $this->getGvOutputData()->get_views() as $view_id => $data ) {
445
-					$content .= $this->render_view( array( 'id' => $view_id ) );
444
+				foreach ($this->getGvOutputData()->get_views() as $view_id => $data) {
445
+					$content .= $this->render_view(array('id' => $view_id));
446 446
 				}
447 447
 			}
448 448
 		}
449 449
 
450 450
 		//	Add the filter back in
451
-		add_filter( 'the_content', array( $this, 'insert_view_in_content' ) );
451
+		add_filter('the_content', array($this, 'insert_view_in_content'));
452 452
 
453 453
 		return $content;
454 454
 	}
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
 	 * @param  int $post_id Post ID
460 460
 	 * @return boolean
461 461
 	 */
462
-	public function comments_open( $open, $post_id ) {
462
+	public function comments_open($open, $post_id) {
463 463
 
464
-		if ( $this->isGravityviewPostType() ) {
464
+		if ($this->isGravityviewPostType()) {
465 465
 			$open = false;
466 466
 		}
467 467
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 		 * @param  boolean $open Open or closed status
472 472
 		 * @param  int $post_id Post ID to set comment status for
473 473
 		 */
474
-		$open = apply_filters( 'gravityview/comments_open', $open, $post_id );
474
+		$open = apply_filters('gravityview/comments_open', $open, $post_id);
475 475
 
476 476
 		return $open;
477 477
 	}
@@ -498,55 +498,55 @@  discard block
 block discarded – undo
498 498
 	 *
499 499
 	 * @return string|null HTML output of a View, NULL if View isn't found
500 500
 	 */
501
-	public function render_view( $passed_args ) {
501
+	public function render_view($passed_args) {
502 502
 
503 503
 		// validate attributes
504
-		if ( empty( $passed_args['id'] ) ) {
505
-			do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args );
504
+		if (empty($passed_args['id'])) {
505
+			do_action('gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args);
506 506
 			return null;
507 507
 		}
508 508
 
509 509
 		// Solve problem when loading content via admin-ajax.php
510 510
 		// @hack
511
-		if ( ! $this->getGvOutputData() ) {
511
+		if (!$this->getGvOutputData()) {
512 512
 
513
-			do_action( 'gravityview_log_error', '[render_view] gv_output_data not defined; parsing content.', $passed_args );
513
+			do_action('gravityview_log_error', '[render_view] gv_output_data not defined; parsing content.', $passed_args);
514 514
 
515 515
 			$this->parse_content();
516 516
 		}
517 517
 
518 518
 		// Make 100% sure that we're dealing with a properly called situation
519
-		if ( ! is_object( $this->getGvOutputData() ) || ! is_callable( array( $this->getGvOutputData(), 'get_view' ) ) ) {
519
+		if (!is_object($this->getGvOutputData()) || !is_callable(array($this->getGvOutputData(), 'get_view'))) {
520 520
 
521
-			do_action( 'gravityview_log_error', '[render_view] gv_output_data not an object or get_view not callable.', $this->getGvOutputData() );
521
+			do_action('gravityview_log_error', '[render_view] gv_output_data not an object or get_view not callable.', $this->getGvOutputData());
522 522
 
523 523
 			return null;
524 524
 		}
525 525
 
526 526
 		$view_id = $passed_args['id'];
527 527
 
528
-		$view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args );
528
+		$view_data = $this->getGvOutputData()->get_view($view_id, $passed_args);
529 529
 
530
-		do_action( 'gravityview_log_debug', '[render_view] View Data: ', $view_data );
530
+		do_action('gravityview_log_debug', '[render_view] View Data: ', $view_data);
531 531
 
532
-		do_action( 'gravityview_log_debug', '[render_view] Init View. Arguments: ', $passed_args );
532
+		do_action('gravityview_log_debug', '[render_view] Init View. Arguments: ', $passed_args);
533 533
 
534 534
 		// The passed args were always winning, even if they were NULL.
535 535
 		// This prevents that. Filters NULL, FALSE, and empty strings.
536
-		$passed_args = array_filter( $passed_args, 'strlen' );
536
+		$passed_args = array_filter($passed_args, 'strlen');
537 537
 
538 538
 		//Override shortcode args over View template settings
539
-		$atts = wp_parse_args( $passed_args, $view_data['atts'] );
539
+		$atts = wp_parse_args($passed_args, $view_data['atts']);
540 540
 
541
-		do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts );
541
+		do_action('gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts);
542 542
 
543 543
 		// It's password protected and you need to log in.
544
-		if ( post_password_required( $view_id ) ) {
544
+		if (post_password_required($view_id)) {
545 545
 
546
-			do_action( 'gravityview_log_error', sprintf( '[render_view] Returning: View %d is password protected.', $view_id ) );
546
+			do_action('gravityview_log_error', sprintf('[render_view] Returning: View %d is password protected.', $view_id));
547 547
 
548 548
 			// If we're in an embed or on an archive page, show the password form
549
-			if ( get_the_ID() !== $view_id ) {
549
+			if (get_the_ID() !== $view_id) {
550 550
 				return get_the_password_form();
551 551
 			}
552 552
 
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 		 * Don't render View if user isn't allowed to see it
559 559
 		 * @since 1.15
560 560
 		 */
561
-		if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
561
+		if (is_user_logged_in() && false === GVCommon::has_cap('read_gravityview', $view_id)) {
562 562
 			return null;
563 563
 		}
564 564
 
565
-		if( $this->isGravityviewPostType() ) {
565
+		if ($this->isGravityviewPostType()) {
566 566
 
567 567
 			/**
568 568
 			 * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode?
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 			 * @param[in,out] boolean `true`: allow Views to be accessible directly. `false`: Only allow Views to be embedded via shortcode. Default: `true`
573 573
 			 * @param int $view_id The ID of the View currently being requested. `0` for general setting
574 574
 			 */
575
-			$direct_access = apply_filters( 'gravityview_direct_access', true, $view_id );
575
+			$direct_access = apply_filters('gravityview_direct_access', true, $view_id);
576 576
 
577
-			$embed_only = ! empty( $atts['embed_only'] );
577
+			$embed_only = !empty($atts['embed_only']);
578 578
 
579
-			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
580
-				return __( 'You are not allowed to view this content.', 'gravityview' );
579
+			if (!$direct_access || ($embed_only && !GVCommon::has_cap('read_private_gravityviews'))) {
580
+				return __('You are not allowed to view this content.', 'gravityview');
581 581
 			}
582 582
 		}
583 583
 
@@ -589,137 +589,137 @@  discard block
 block discarded – undo
589 589
 		 */
590 590
 		global $gravityview_view;
591 591
 
592
-		$gravityview_view = new GravityView_View( $view_data );
592
+		$gravityview_view = new GravityView_View($view_data);
593 593
 
594
-		$post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId();
594
+		$post_id = !empty($atts['post_id']) ? intval($atts['post_id']) : $this->getPostId();
595 595
 
596
-		$gravityview_view->setPostId( $post_id );
596
+		$gravityview_view->setPostId($post_id);
597 597
 
598
-		if ( ! $this->getSingleEntry() ) {
598
+		if (!$this->getSingleEntry()) {
599 599
 
600 600
 			// user requested Directory View
601
-			do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' );
601
+			do_action('gravityview_log_debug', '[render_view] Executing Directory View');
602 602
 
603 603
 			//fetch template and slug
604
-			$view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' );
604
+			$view_slug = apply_filters('gravityview_template_slug_'.$view_data['template_id'], 'table', 'directory');
605 605
 
606
-			do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug );
606
+			do_action('gravityview_log_debug', '[render_view] View template slug: ', $view_slug);
607 607
 
608 608
 			/**
609 609
 			 * Disable fetching initial entries for views that don't need it (DataTables)
610 610
 			 */
611
-			$get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true );
611
+			$get_entries = apply_filters('gravityview_get_view_entries_'.$view_slug, true);
612 612
 
613 613
 			/**
614 614
 			 * Hide View data until search is performed
615 615
 			 * @since 1.5.4
616 616
 			 */
617
-			if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) {
618
-				$gravityview_view->setHideUntilSearched( true );
617
+			if (!empty($atts['hide_until_searched']) && !$this->isSearch()) {
618
+				$gravityview_view->setHideUntilSearched(true);
619 619
 				$get_entries = false;
620 620
 			}
621 621
 
622 622
 
623
-			if ( $get_entries ) {
623
+			if ($get_entries) {
624 624
 
625
-				if ( ! empty( $atts['sort_columns'] ) ) {
625
+				if (!empty($atts['sort_columns'])) {
626 626
 					// add filter to enable column sorting
627
-					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 );
627
+					add_filter('gravityview/template/field_label', array($this, 'add_columns_sort_links'), 100, 3);
628 628
 				}
629 629
 
630
-				$view_entries = self::get_view_entries( $atts, $view_data['form_id'] );
630
+				$view_entries = self::get_view_entries($atts, $view_data['form_id']);
631 631
 
632
-				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) );
632
+				do_action('gravityview_log_debug', sprintf('[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof($view_entries['entries'])));
633 633
 
634 634
 			} else {
635 635
 
636
-				$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null );
636
+				$view_entries = array('count' => null, 'entries' => null, 'paging' => null);
637 637
 
638
-				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' );
638
+				do_action('gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false');
639 639
 			}
640 640
 
641
-			$gravityview_view->setPaging( $view_entries['paging'] );
642
-			$gravityview_view->setContext( 'directory' );
643
-			$sections = array( 'header', 'body', 'footer' );
641
+			$gravityview_view->setPaging($view_entries['paging']);
642
+			$gravityview_view->setContext('directory');
643
+			$sections = array('header', 'body', 'footer');
644 644
 
645 645
 		} else {
646 646
 
647 647
 			// user requested Single Entry View
648
-			do_action( 'gravityview_log_debug', '[render_view] Executing Single View' );
648
+			do_action('gravityview_log_debug', '[render_view] Executing Single View');
649 649
 
650
-			do_action( 'gravityview_render_entry_'.$view_data['id'] );
650
+			do_action('gravityview_render_entry_'.$view_data['id']);
651 651
 
652 652
 			$entry = $this->getEntry();
653 653
 
654 654
 			// You are not permitted to view this entry.
655
-			if ( empty( $entry ) || ! self::is_entry_approved( $entry, $atts ) ) {
655
+			if (empty($entry) || !self::is_entry_approved($entry, $atts)) {
656 656
 
657
-				do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' );
657
+				do_action('gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.');
658 658
 
659 659
 				/**
660 660
 				 * @since 1.6
661 661
 				 */
662
-				echo esc_attr( apply_filters( 'gravityview/render/entry/not_visible', __( 'You have attempted to view an entry that is not visible or may not exist.', 'gravityview' ) ) );
662
+				echo esc_attr(apply_filters('gravityview/render/entry/not_visible', __('You have attempted to view an entry that is not visible or may not exist.', 'gravityview')));
663 663
 
664 664
 				return null;
665 665
 			}
666 666
 
667 667
 			// We're in single view, but the view being processed is not the same view the single entry belongs to.
668 668
 			// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms
669
-			if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) {
670
-				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id );
669
+			if ($this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id()) {
670
+				do_action('gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '.$view_id);
671 671
 				return null;
672 672
 			}
673 673
 
674 674
 			//fetch template and slug
675
-			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' );
676
-			do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug );
675
+			$view_slug = apply_filters('gravityview_template_slug_'.$view_data['template_id'], 'table', 'single');
676
+			do_action('gravityview_log_debug', '[render_view] View single template slug: ', $view_slug);
677 677
 
678 678
 			//fetch entry detail
679 679
 			$view_entries['count'] = 1;
680 680
 			$view_entries['entries'][] = $entry;
681
-			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] );
681
+			do_action('gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries']);
682 682
 
683
-			$back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null;
683
+			$back_link_label = isset($atts['back_link_label']) ? $atts['back_link_label'] : null;
684 684
 
685 685
 			// set back link label
686
-			$gravityview_view->setBackLinkLabel( $back_link_label );
687
-			$gravityview_view->setContext( 'single' );
688
-			$sections = array( 'single' );
686
+			$gravityview_view->setBackLinkLabel($back_link_label);
687
+			$gravityview_view->setContext('single');
688
+			$sections = array('single');
689 689
 
690 690
 		}
691 691
 
692 692
 		// add template style
693
-		self::add_style( $view_data['template_id'] );
693
+		self::add_style($view_data['template_id']);
694 694
 
695 695
 		// Prepare to render view and set vars
696
-		$gravityview_view->setEntries( $view_entries['entries'] );
697
-		$gravityview_view->setTotalEntries( $view_entries['count'] );
696
+		$gravityview_view->setEntries($view_entries['entries']);
697
+		$gravityview_view->setTotalEntries($view_entries['count']);
698 698
 
699 699
 		// If Edit
700
-		if ( 'edit' === gravityview_get_context() ) {
700
+		if ('edit' === gravityview_get_context()) {
701 701
 
702
-			do_action( 'gravityview_log_debug', '[render_view] Edit Entry ' );
702
+			do_action('gravityview_log_debug', '[render_view] Edit Entry ');
703 703
 
704
-			do_action( 'gravityview_edit_entry', $this->getGvOutputData() );
704
+			do_action('gravityview_edit_entry', $this->getGvOutputData());
705 705
 
706 706
 			return ob_get_clean();
707 707
 
708 708
 		} else {
709 709
 			// finaly we'll render some html
710
-			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] );
710
+			$sections = apply_filters('gravityview_render_view_sections', $sections, $view_data['template_id']);
711 711
 
712
-			do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections );
713
-			foreach ( $sections as $section ) {
714
-				do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' );
715
-				$gravityview_view->render( $view_slug, $section, false );
712
+			do_action('gravityview_log_debug', '[render_view] Sections to render: ', $sections);
713
+			foreach ($sections as $section) {
714
+				do_action('gravityview_log_debug', '[render_view] Rendering '.$section.' section.');
715
+				$gravityview_view->render($view_slug, $section, false);
716 716
 			}
717 717
 		}
718 718
 
719 719
 		//@todo: check why we need the IF statement vs. print the view id always.
720
-		if ( $this->isGravityviewPostType() || $this->isPostHasShortcode() ) {
720
+		if ($this->isGravityviewPostType() || $this->isPostHasShortcode()) {
721 721
 			// Print the View ID to enable proper cookie pagination
722
-			echo '<input type="hidden" class="gravityview-view-id" value="' . esc_attr( $view_id ) . '">';
722
+			echo '<input type="hidden" class="gravityview-view-id" value="'.esc_attr($view_id).'">';
723 723
 		}
724 724
 		$output = ob_get_clean();
725 725
 
@@ -741,23 +741,23 @@  discard block
 block discarded – undo
741 741
 	 * @param  array      $search_criteria Search being performed, if any
742 742
 	 * @return array                       Modified `$search_criteria` array
743 743
 	 */
744
-	public static function process_search_dates( $args, $search_criteria = array() ) {
744
+	public static function process_search_dates($args, $search_criteria = array()) {
745 745
 
746 746
 		$return_search_criteria = $search_criteria;
747 747
 
748
-		foreach ( array( 'start_date', 'end_date' ) as $key ) {
748
+		foreach (array('start_date', 'end_date') as $key) {
749 749
 
750 750
 
751 751
 			// Is the start date or end date set in the view or shortcode?
752 752
 			// If so, we want to make sure that the search doesn't go outside the bounds defined.
753
-			if ( ! empty( $args[ $key ] ) ) {
753
+			if (!empty($args[$key])) {
754 754
 
755 755
 				// Get a timestamp and see if it's a valid date format
756
-				$date = strtotime( $args[ $key ] );
756
+				$date = strtotime($args[$key]);
757 757
 
758 758
 				// The date was invalid
759
-				if ( empty( $date ) ) {
760
-					do_action( 'gravityview_log_error', __METHOD__ . ' Invalid ' . $key . ' date format: ' . $args[ $key ] );
759
+				if (empty($date)) {
760
+					do_action('gravityview_log_error', __METHOD__.' Invalid '.$key.' date format: '.$args[$key]);
761 761
 					continue;
762 762
 				}
763 763
 
@@ -765,12 +765,12 @@  discard block
 block discarded – undo
765 765
 				$datetime_format = 'Y-m-d H:i:s';
766 766
 				$search_is_outside_view_bounds = false;
767 767
 
768
-				if( ! empty( $search_criteria[ $key ] ) ) {
768
+				if (!empty($search_criteria[$key])) {
769 769
 
770
-					$search_date = strtotime( $search_criteria[ $key ] );
770
+					$search_date = strtotime($search_criteria[$key]);
771 771
 
772 772
 					// The search is for entries before the start date defined by the settings
773
-					switch ( $key ) {
773
+					switch ($key) {
774 774
 						case 'end_date':
775 775
 							/**
776 776
 							 * If the end date is formatted as 'Y-m-d', it should be formatted without hours and seconds
@@ -780,28 +780,28 @@  discard block
 block discarded – undo
780 780
 							 *
781 781
 							 * @see GFFormsModel::get_date_range_where
782 782
 							 */
783
-							$datetime_format               = gravityview_is_valid_datetime( $args[ $key ] ) ? 'Y-m-d' : 'Y-m-d H:i:s';
784
-							$search_is_outside_view_bounds = ( $search_date > $date );
783
+							$datetime_format               = gravityview_is_valid_datetime($args[$key]) ? 'Y-m-d' : 'Y-m-d H:i:s';
784
+							$search_is_outside_view_bounds = ($search_date > $date);
785 785
 							break;
786 786
 						case 'start_date':
787
-							$search_is_outside_view_bounds = ( $search_date < $date );
787
+							$search_is_outside_view_bounds = ($search_date < $date);
788 788
 							break;
789 789
 					}
790 790
 				}
791 791
 
792 792
 				// If there is no search being performed, or if there is a search being performed that's outside the bounds
793
-				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
793
+				if (empty($search_criteria[$key]) || $search_is_outside_view_bounds) {
794 794
 
795 795
 					// Then we override the search and re-set the start date
796
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
796
+					$return_search_criteria[$key] = date_i18n($datetime_format, $date, true);
797 797
 				}
798 798
 			}
799 799
 		}
800 800
 
801
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
801
+		if (isset($return_search_criteria['start_date']) && isset($return_search_criteria['end_date'])) {
802 802
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
803
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
804
-				do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria );
803
+			if (strtotime($return_search_criteria['start_date']) > strtotime($return_search_criteria['end_date'])) {
804
+				do_action('gravityview_log_error', __METHOD__.' Invalid search: the start date is after the end date.', $return_search_criteria);
805 805
 			}
806 806
 		}
807 807
 
@@ -816,13 +816,13 @@  discard block
 block discarded – undo
816 816
 	 * @param  array      $search_criteria Search being performed, if any
817 817
 	 * @return array                       Modified `$search_criteria` array
818 818
 	 */
819
-	public static function process_search_only_approved( $args, $search_criteria ) {
819
+	public static function process_search_only_approved($args, $search_criteria) {
820 820
 
821
-		if ( ! empty( $args['show_only_approved'] ) ) {
822
-			$search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' );
821
+		if (!empty($args['show_only_approved'])) {
822
+			$search_criteria['field_filters'][] = array('key' => 'is_approved', 'value' => 'Approved');
823 823
 			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
824 824
 
825
-			do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria );
825
+			do_action('gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria);
826 826
 		}
827 827
 
828 828
 		return $search_criteria;
@@ -842,16 +842,16 @@  discard block
 block discarded – undo
842 842
 	 *
843 843
 	 * @return bool
844 844
 	 */
845
-	public static function is_entry_approved( $entry, $args = array() ) {
845
+	public static function is_entry_approved($entry, $args = array()) {
846 846
 
847
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
847
+		if (empty($entry['id']) || (array_key_exists('show_only_approved', $args) && !$args['show_only_approved'])) {
848 848
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
849 849
 			return true;
850 850
 		}
851 851
 
852
-		$is_approved = gform_get_meta( $entry['id'], 'is_approved' );
852
+		$is_approved = gform_get_meta($entry['id'], 'is_approved');
853 853
 
854
-		if ( $is_approved ) {
854
+		if ($is_approved) {
855 855
 			return true;
856 856
 		}
857 857
 
@@ -872,47 +872,47 @@  discard block
 block discarded – undo
872 872
 	 * @param  int $form_id Gravity Forms form ID
873 873
 	 * @return array          Array of search parameters, formatted in Gravity Forms mode, using `status` key set to "active" by default, `field_filters` array with `key`, `value` and `operator` keys.
874 874
 	 */
875
-	public static function get_search_criteria( $args, $form_id ) {
875
+	public static function get_search_criteria($args, $form_id) {
876 876
 
877 877
 		// Search Criteria
878
-		$search_criteria = apply_filters( 'gravityview_fe_search_criteria', array( 'field_filters' => array() ), $form_id );
878
+		$search_criteria = apply_filters('gravityview_fe_search_criteria', array('field_filters' => array()), $form_id);
879 879
 
880 880
 		$original_search_criteria = $search_criteria;
881 881
 
882
-		do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria );
882
+		do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria);
883 883
 
884 884
 		// implicity search
885
-		if ( ! empty( $args['search_value'] ) ) {
885
+		if (!empty($args['search_value'])) {
886 886
 
887 887
 			// Search operator options. Options: `is` or `contains`
888
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
888
+			$operator = !empty($args['search_operator']) && in_array($args['search_operator'], array('is', 'isnot', '>', '<', 'contains')) ? $args['search_operator'] : 'contains';
889 889
 
890 890
 			$search_criteria['field_filters'][] = array(
891
-				'key' => rgget( 'search_field', $args ), // The field ID to search
892
-				'value' => esc_attr( $args['search_value'] ), // The value to search
891
+				'key' => rgget('search_field', $args), // The field ID to search
892
+				'value' => esc_attr($args['search_value']), // The value to search
893 893
 				'operator' => $operator,
894 894
 			);
895 895
 		}
896 896
 
897
-		if( $search_criteria !== $original_search_criteria ) {
898
-			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria );
897
+		if ($search_criteria !== $original_search_criteria) {
898
+			do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria);
899 899
 		}
900 900
 
901 901
 		// Handle setting date range
902
-		$search_criteria = self::process_search_dates( $args, $search_criteria );
902
+		$search_criteria = self::process_search_dates($args, $search_criteria);
903 903
 
904
-		if( $search_criteria !== $original_search_criteria ) {
905
-			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria );
904
+		if ($search_criteria !== $original_search_criteria) {
905
+			do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria);
906 906
 		}
907 907
 
908 908
 		// remove not approved entries
909
-		$search_criteria = self::process_search_only_approved( $args, $search_criteria );
909
+		$search_criteria = self::process_search_only_approved($args, $search_criteria);
910 910
 
911 911
 		/**
912 912
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
913 913
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
914 914
 		 */
915
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
915
+		$search_criteria['status'] = apply_filters('gravityview_status', 'active', $args);
916 916
 
917 917
 		return $search_criteria;
918 918
 	}
@@ -946,29 +946,29 @@  discard block
 block discarded – undo
946 946
 	 * @param int $form_id Gravity Forms Form ID
947 947
 	 * @return array Associative array with `count`, `entries`, and `paging` keys. `count` has the total entries count, `entries` is an array with Gravity Forms full entry data, `paging` is an array with `offset` and `page_size` keys
948 948
 	 */
949
-	public static function get_view_entries( $args, $form_id ) {
949
+	public static function get_view_entries($args, $form_id) {
950 950
 
951
-		do_action( 'gravityview_log_debug', '[get_view_entries] init' );
951
+		do_action('gravityview_log_debug', '[get_view_entries] init');
952 952
 		// start filters and sorting
953 953
 
954 954
 		/**
955 955
 		 * Process search parameters
956 956
 		 * @var array
957 957
 		 */
958
-		$search_criteria = self::get_search_criteria( $args, $form_id );
958
+		$search_criteria = self::get_search_criteria($args, $form_id);
959 959
 
960 960
 		// Paging & offset
961
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 );
961
+		$page_size = !empty($args['page_size']) ? intval($args['page_size']) : apply_filters('gravityview_default_page_size', 25);
962 962
 
963 963
 		if ( -1 === $page_size ) {
964 964
 			$page_size = PHP_INT_MAX;
965 965
 		}
966 966
 
967
-		if ( isset( $args['offset'] ) ) {
968
-			$offset = intval( $args['offset'] );
967
+		if (isset($args['offset'])) {
968
+			$offset = intval($args['offset']);
969 969
 		} else {
970
-			$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
971
-			$offset = ( $curr_page - 1 ) * $page_size;
970
+			$curr_page = empty($_GET['pagenum']) ? 1 : intval($_GET['pagenum']);
971
+			$offset = ($curr_page - 1) * $page_size;
972 972
 		}
973 973
 
974 974
 		$paging = array(
@@ -976,16 +976,16 @@  discard block
 block discarded – undo
976 976
 			'page_size' => $page_size,
977 977
 		);
978 978
 
979
-		do_action( 'gravityview_log_debug', '[get_view_entries] Paging: ', $paging );
979
+		do_action('gravityview_log_debug', '[get_view_entries] Paging: ', $paging);
980 980
 
981 981
 		// Sorting
982
-		$sorting = self::updateViewSorting( $args, $form_id );
982
+		$sorting = self::updateViewSorting($args, $form_id);
983 983
 
984 984
 		$parameters = array(
985 985
 			'search_criteria' => $search_criteria,
986 986
 			'sorting' => $sorting,
987 987
 			'paging' => $paging,
988
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
988
+			'cache' => isset($args['cache']) ? $args['cache'] : true,
989 989
 		);
990 990
 
991 991
 		/**
@@ -1003,22 +1003,22 @@  discard block
 block discarded – undo
1003 1003
 		 * }
1004 1004
 		 * @param int $form_id ID of Gravity Forms form
1005 1005
 		 */
1006
-		$parameters = apply_filters( 'gravityview_get_entries', $parameters, $args, $form_id );
1006
+		$parameters = apply_filters('gravityview_get_entries', $parameters, $args, $form_id);
1007 1007
 
1008 1008
 		/**
1009 1009
 		 * @filter `gravityview_get_entries_{View ID}` Filter get entries criteria
1010 1010
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1011 1011
 		 * @param array $args View configuration args.
1012 1012
 		 */
1013
-		$parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id );
1013
+		$parameters = apply_filters('gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id);
1014 1014
 
1015
-		do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters );
1015
+		do_action('gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters);
1016 1016
 
1017 1017
 		//fetch entries
1018 1018
 		$count = 0;
1019
-		$entries = gravityview_get_entries( $form_id, $parameters, $count );
1019
+		$entries = gravityview_get_entries($form_id, $parameters, $count);
1020 1020
 
1021
-		do_action( 'gravityview_log_debug', sprintf( '[get_view_entries] Get Entries. Found: %s entries', $count ), $entries );
1021
+		do_action('gravityview_log_debug', sprintf('[get_view_entries] Get Entries. Found: %s entries', $count), $entries);
1022 1022
 
1023 1023
 		/**
1024 1024
 		 * @filter `gravityview_view_entries` Filter the entries output to the View
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 		 * @param array $args View settings associative array
1027 1027
 		 * @var array
1028 1028
 		 */
1029
-		$entries = apply_filters( 'gravityview_view_entries', $entries, $args );
1029
+		$entries = apply_filters('gravityview_view_entries', $entries, $args);
1030 1030
 
1031 1031
 		/**
1032 1032
 		 * @filter `gravityview/view/entries` Filter the entries output to the View
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 		 * @param array $args View settings associative array
1035 1035
 		 * @since 1.5.2
1036 1036
 		 */
1037
-		return apply_filters( 'gravityview/view/entries', compact( 'count', 'entries', 'paging' ), $args );
1037
+		return apply_filters('gravityview/view/entries', compact('count', 'entries', 'paging'), $args);
1038 1038
 
1039 1039
 	}
1040 1040
 
@@ -1048,24 +1048,24 @@  discard block
 block discarded – undo
1048 1048
 	 * @param int $form_id The ID of the form used to sort
1049 1049
 	 * @return array $sorting Array with `key`, `direction` and `is_numeric` keys
1050 1050
 	 */
1051
-	public static function updateViewSorting( $args, $form_id ) {
1051
+	public static function updateViewSorting($args, $form_id) {
1052 1052
 		$sorting = array();
1053
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' );
1054
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' );
1053
+		$sort_field_id = isset($_GET['sort']) ? $_GET['sort'] : rgar($args, 'sort_field');
1054
+		$sort_direction = isset($_GET['dir']) ? $_GET['dir'] : rgar($args, 'sort_direction');
1055 1055
 
1056
-		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1056
+		$sort_field_id = self::_override_sorting_id_by_field_type($sort_field_id, $form_id);
1057 1057
 
1058
-		if ( ! empty( $sort_field_id ) ) {
1058
+		if (!empty($sort_field_id)) {
1059 1059
 			$sorting = array(
1060 1060
 				'key' => $sort_field_id,
1061
-				'direction' => strtolower( $sort_direction ),
1062
-				'is_numeric' => GVCommon::is_field_numeric( $form_id, $sort_field_id )
1061
+				'direction' => strtolower($sort_direction),
1062
+				'is_numeric' => GVCommon::is_field_numeric($form_id, $sort_field_id)
1063 1063
 			);
1064 1064
 		}
1065 1065
 
1066
-		GravityView_View::getInstance()->setSorting( $sorting );
1066
+		GravityView_View::getInstance()->setSorting($sorting);
1067 1067
 
1068
-		do_action( 'gravityview_log_debug', '[updateViewSorting] Sort Criteria : ', $sorting );
1068
+		do_action('gravityview_log_debug', '[updateViewSorting] Sort Criteria : ', $sorting);
1069 1069
 
1070 1070
 		return $sorting;
1071 1071
 
@@ -1085,17 +1085,17 @@  discard block
 block discarded – undo
1085 1085
 	 *
1086 1086
 	 * @return string Possibly modified sorting ID
1087 1087
 	 */
1088
-	private static function _override_sorting_id_by_field_type( $sort_field_id, $form_id ) {
1088
+	private static function _override_sorting_id_by_field_type($sort_field_id, $form_id) {
1089 1089
 
1090
-		$form = gravityview_get_form( $form_id );
1090
+		$form = gravityview_get_form($form_id);
1091 1091
 
1092
-		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1092
+		$sort_field = GFFormsModel::get_field($form, $sort_field_id);
1093 1093
 
1094
-		switch ( $sort_field['type'] ) {
1094
+		switch ($sort_field['type']) {
1095 1095
 
1096 1096
 			case 'address':
1097 1097
 				// Sorting by full address
1098
-				if ( floatval( $sort_field_id ) === floor( $sort_field_id ) ) {
1098
+				if (floatval($sort_field_id) === floor($sort_field_id)) {
1099 1099
 
1100 1100
 					/**
1101 1101
 					 * Override how to sort when sorting address
@@ -1106,9 +1106,9 @@  discard block
 block discarded – undo
1106 1106
 					 * @param string $sort_field_id Field used for sorting
1107 1107
 					 * @param int $form_id GF Form ID
1108 1108
 					 */
1109
-					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1109
+					$address_part = apply_filters('gravityview/sorting/address', 'city', $sort_field_id, $form_id);
1110 1110
 
1111
-					switch( strtolower( $address_part ) ){
1111
+					switch (strtolower($address_part)) {
1112 1112
 						case 'street':
1113 1113
 							$sort_field_id .= '.1';
1114 1114
 							break;
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 				break;
1135 1135
 			case 'name':
1136 1136
 				// Sorting by full name, not first, last, etc.
1137
-				if ( floatval( $sort_field_id ) === floor( $sort_field_id ) ) {
1137
+				if (floatval($sort_field_id) === floor($sort_field_id)) {
1138 1138
 					/**
1139 1139
 					 * @filter `gravityview/sorting/full-name` Override how to sort when sorting full name.
1140 1140
 					 * @since 1.7.4
@@ -1142,9 +1142,9 @@  discard block
 block discarded – undo
1142 1142
 					 * @param[in] string $sort_field_id Field used for sorting
1143 1143
 					 * @param[in] int $form_id GF Form ID
1144 1144
 					 */
1145
-					$name_part = apply_filters( 'gravityview/sorting/full-name', 'first', $sort_field_id, $form_id );
1145
+					$name_part = apply_filters('gravityview/sorting/full-name', 'first', $sort_field_id, $form_id);
1146 1146
 
1147
-					if ( 'last' === strtolower( $name_part ) ) {
1147
+					if ('last' === strtolower($name_part)) {
1148 1148
 						$sort_field_id .= '.6';
1149 1149
 					} else {
1150 1150
 						$sort_field_id .= '.3';
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 				 * @param[in,out] string $name_part Field used for sorting
1164 1164
 				 * @param[in] int $form_id GF Form ID
1165 1165
 				 */
1166
-				$sort_field_id = apply_filters( 'gravityview/sorting/time', $sort_field_id, $form_id );
1166
+				$sort_field_id = apply_filters('gravityview/sorting/time', $sort_field_id, $form_id);
1167 1167
 				break;
1168 1168
 		}
1169 1169
 
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 
1179 1179
 		$var_name = GravityView_Post_Types::get_entry_var_name();
1180 1180
 
1181
-		$single_entry = get_query_var( $var_name );
1181
+		$single_entry = get_query_var($var_name);
1182 1182
 
1183 1183
 		/**
1184 1184
 		 * Modify the entry that is being displayed.
@@ -1186,9 +1186,9 @@  discard block
 block discarded – undo
1186 1186
 		 * @internal Should only be used by things like the oEmbed functionality.
1187 1187
 		 * @since 1.6
1188 1188
 		 */
1189
-		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1189
+		$single_entry = apply_filters('gravityview/is_single_entry', $single_entry);
1190 1190
 
1191
-		if ( empty( $single_entry ) ){
1191
+		if (empty($single_entry)) {
1192 1192
 			return false;
1193 1193
 		} else {
1194 1194
 			return $single_entry;
@@ -1205,38 +1205,38 @@  discard block
 block discarded – undo
1205 1205
 	public function add_scripts_and_styles() {
1206 1206
 		global $post, $posts;
1207 1207
 		// enqueue template specific styles
1208
-		if ( $this->getGvOutputData() ) {
1208
+		if ($this->getGvOutputData()) {
1209 1209
 
1210 1210
 			$views = $this->getGvOutputData()->get_views();
1211 1211
 
1212
-			foreach ( $views as $view_id => $data ) {
1212
+			foreach ($views as $view_id => $data) {
1213 1213
 
1214 1214
 				/**
1215 1215
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1216 1216
 				 * @since 1.15
1217 1217
 				 */
1218
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1218
+				if (is_user_logged_in() && false === GVCommon::has_cap('read_gravityview', $view_id)) {
1219 1219
 					continue;
1220 1220
 				}
1221 1221
 
1222 1222
 				// By default, no thickbox
1223
-				$js_dependencies = array( 'jquery', 'gravityview-jquery-cookie' );
1223
+				$js_dependencies = array('jquery', 'gravityview-jquery-cookie');
1224 1224
 				$css_dependencies = array();
1225 1225
 
1226 1226
 				// If the thickbox is enqueued, add dependencies
1227
-				if ( ! empty( $data['atts']['lightbox'] ) ) {
1227
+				if (!empty($data['atts']['lightbox'])) {
1228 1228
 
1229 1229
 					/**
1230 1230
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1231 1231
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1232 1232
 					 */
1233
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1233
+					$js_dependencies[] = apply_filters('gravity_view_lightbox_script', 'thickbox');
1234 1234
 
1235 1235
 					/**
1236 1236
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1237 1237
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1238 1238
 					 */
1239
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1239
+					$css_dependencies[] = apply_filters('gravity_view_lightbox_style', 'thickbox');
1240 1240
 				}
1241 1241
 
1242 1242
 				/**
@@ -1244,34 +1244,34 @@  discard block
 block discarded – undo
1244 1244
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1245 1245
 				 * @since 1.15
1246 1246
 				 */
1247
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1247
+				if (gravityview_view_has_single_checkbox_or_radio($data['form'], $data['fields'])) {
1248 1248
 					$css_dependencies[] = 'dashicons';
1249 1249
 				}
1250 1250
 
1251
-				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1251
+				wp_register_script('gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array('jquery'), GravityView_Plugin::version, true);
1252 1252
 
1253
-				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1253
+				$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1254 1254
 
1255
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1255
+				wp_register_script('gravityview-fe-view', plugins_url('assets/js/fe-views'.$script_debug.'.js', GRAVITYVIEW_FILE), apply_filters('gravityview_js_dependencies', $js_dependencies), GravityView_Plugin::version, true);
1256 1256
 
1257
-				wp_enqueue_script( 'gravityview-fe-view' );
1257
+				wp_enqueue_script('gravityview-fe-view');
1258 1258
 
1259
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1260
-					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1259
+				if (!empty($data['atts']['sort_columns'])) {
1260
+					wp_enqueue_style('gravityview_font', plugins_url('assets/css/font.css', GRAVITYVIEW_FILE), $css_dependencies, GravityView_Plugin::version, 'all');
1261 1261
 				}
1262 1262
 
1263
-				wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1263
+				wp_enqueue_style('gravityview_default_style', plugins_url('templates/css/gv-default-styles.css', GRAVITYVIEW_FILE), $css_dependencies, GravityView_Plugin::version, 'all');
1264 1264
 
1265
-				self::add_style( $data['template_id'] );
1265
+				self::add_style($data['template_id']);
1266 1266
 
1267 1267
 			}
1268 1268
 
1269
-			if ( 'wp_print_footer_scripts' === current_filter() ) {
1269
+			if ('wp_print_footer_scripts' === current_filter()) {
1270 1270
 
1271 1271
 				$js_localization = array(
1272 1272
 					'cookiepath' => COOKIEPATH,
1273
-					'clear' => _x( 'Clear', 'Clear all data from the form', 'gravityview' ),
1274
-					'reset' => _x( 'Reset', 'Reset the search form to the state that existed on page load', 'gravityview' ),
1273
+					'clear' => _x('Clear', 'Clear all data from the form', 'gravityview'),
1274
+					'reset' => _x('Reset', 'Reset the search form to the state that existed on page load', 'gravityview'),
1275 1275
 				);
1276 1276
 
1277 1277
 				/**
@@ -1279,9 +1279,9 @@  discard block
 block discarded – undo
1279 1279
 				 * @param array $js_localization The data padded to the Javascript file
1280 1280
 				 * @param array $views Array of View data arrays with View settings
1281 1281
 				 */
1282
-				$js_localization = apply_filters( 'gravityview_js_localization', $js_localization, $views );
1282
+				$js_localization = apply_filters('gravityview_js_localization', $js_localization, $views);
1283 1283
 
1284
-				wp_localize_script( 'gravityview-fe-view', 'gvGlobals', $js_localization );
1284
+				wp_localize_script('gravityview-fe-view', 'gvGlobals', $js_localization);
1285 1285
 			}
1286 1286
 		}
1287 1287
 	}
@@ -1290,15 +1290,15 @@  discard block
 block discarded – undo
1290 1290
 	 * Add template extra style if exists
1291 1291
 	 * @param string $template_id
1292 1292
 	 */
1293
-	public static function add_style( $template_id ) {
1293
+	public static function add_style($template_id) {
1294 1294
 
1295
-		if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) {
1296
-			do_action( 'gravityview_log_debug', sprintf( '[add_style] Adding extra template style for %s', $template_id ) );
1297
-			wp_enqueue_style( 'gravityview_style_' . $template_id );
1298
-		} elseif ( empty( $template_id ) ) {
1299
-			do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' );
1295
+		if (!empty($template_id) && wp_style_is('gravityview_style_'.$template_id, 'registered')) {
1296
+			do_action('gravityview_log_debug', sprintf('[add_style] Adding extra template style for %s', $template_id));
1297
+			wp_enqueue_style('gravityview_style_'.$template_id);
1298
+		} elseif (empty($template_id)) {
1299
+			do_action('gravityview_log_error', '[add_style] Cannot add template style; template_id is empty');
1300 1300
 		} else {
1301
-			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) );
1301
+			do_action('gravityview_log_error', sprintf('[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id));
1302 1302
 		}
1303 1303
 
1304 1304
 	}
@@ -1317,17 +1317,17 @@  discard block
 block discarded – undo
1317 1317
 	 *
1318 1318
 	 * @return string Field Label
1319 1319
 	 */
1320
-	public function add_columns_sort_links( $label = '', $field, $form ) {
1320
+	public function add_columns_sort_links($label = '', $field, $form) {
1321 1321
 
1322 1322
 		/**
1323 1323
 		 * Not a table-based template; don't add sort icons
1324 1324
 		 * @since 1.12
1325 1325
 		 */
1326
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1326
+		if (!preg_match('/table/ism', GravityView_View::getInstance()->getTemplatePartSlug())) {
1327 1327
 			return $label;
1328 1328
 		}
1329 1329
 
1330
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1330
+		if (!$this->is_field_sortable($field['id'], $form)) {
1331 1331
 			return $label;
1332 1332
 		}
1333 1333
 
@@ -1335,16 +1335,16 @@  discard block
 block discarded – undo
1335 1335
 
1336 1336
 		$class = 'gv-sort icon';
1337 1337
 
1338
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1338
+		$sort_field_id = self::_override_sorting_id_by_field_type($field['id'], $form['id']);
1339 1339
 
1340 1340
 		$sort_args = array(
1341 1341
 			'sort' => $field['id'],
1342 1342
 			'dir' => 'asc',
1343 1343
 		);
1344 1344
 
1345
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1345
+		if (!empty($sorting['key']) && (string)$sort_field_id === (string)$sorting['key']) {
1346 1346
 			//toggle sorting direction.
1347
-			if ( 'asc' === $sorting['direction'] ) {
1347
+			if ('asc' === $sorting['direction']) {
1348 1348
 				$sort_args['dir'] = 'desc';
1349 1349
 				$class .= ' gv-icon-sort-desc';
1350 1350
 			} else {
@@ -1355,9 +1355,9 @@  discard block
 block discarded – undo
1355 1355
 			$class .= ' gv-icon-caret-up-down';
1356 1356
 		}
1357 1357
 
1358
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1358
+		$url = add_query_arg($sort_args, remove_query_arg(array('pagenum')));
1359 1359
 
1360
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1360
+		return '<a href="'.esc_url_raw($url).'" class="'.$class.'" ></a>&nbsp;'.$label;
1361 1361
 
1362 1362
 	}
1363 1363
 
@@ -1371,10 +1371,10 @@  discard block
 block discarded – undo
1371 1371
 	 *
1372 1372
 	 * @return bool True: Yes, field is sortable; False: not sortable
1373 1373
 	 */
1374
-	public function is_field_sortable( $field_id = '', $form ) {
1374
+	public function is_field_sortable($field_id = '', $form) {
1375 1375
 
1376
-		if( is_numeric( $field_id ) ) {
1377
-			$field = GFFormsModel::get_field( $form, $field_id );
1376
+		if (is_numeric($field_id)) {
1377
+			$field = GFFormsModel::get_field($form, $field_id);
1378 1378
 			$field_id = $field->type;
1379 1379
 		}
1380 1380
 
@@ -1390,13 +1390,13 @@  discard block
 block discarded – undo
1390 1390
 		 * @param string $field_id Field ID to check whether the field is sortable
1391 1391
 		 * @param array $form Gravity Forms form
1392 1392
 		 */
1393
-		$not_sortable = apply_filters( 'gravityview/sortable/field_blacklist', $not_sortable, $field_id, $form );
1393
+		$not_sortable = apply_filters('gravityview/sortable/field_blacklist', $not_sortable, $field_id, $form);
1394 1394
 
1395
-		if ( in_array( $field_id, $not_sortable ) ) {
1395
+		if (in_array($field_id, $not_sortable)) {
1396 1396
 			return false;
1397 1397
 		}
1398 1398
 
1399
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1399
+		return apply_filters("gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters("gravityview/sortable/field_{$field_id}", true, $form));
1400 1400
 
1401 1401
 	}
1402 1402
 
Please login to merge, or discard this patch.
includes/class-gravityview-admin-duplicate-view.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@
 block discarded – undo
195 195
 	 *
196 196
 	 * @since 1.6
197 197
 	 *
198
-	 * @param int $new_view_id The ID of the newly created View
198
+	 * @param int $new_id The ID of the newly created View
199 199
 	 * @param WP_Post $post The View that was just cloned
200 200
 	 *
201 201
 	 * @return void
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 	function __construct() {
16 16
 
17 17
 		// Only run on Admin
18
-		if ( !is_admin() ) {
18
+		if (!is_admin()) {
19 19
 			return;
20 20
 		}
21 21
 
22 22
 		// If the Duplicate Post plugin is active, don't run.
23
-		if( defined('DUPLICATE_POST_CURRENT_VERSION') ) {
23
+		if (defined('DUPLICATE_POST_CURRENT_VERSION')) {
24 24
 			return;
25 25
 		}
26 26
 
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
 	 * @return void
34 34
 	 */
35 35
 	private function add_hooks() {
36
-		add_filter( 'post_row_actions', array( $this, 'make_duplicate_link_row' ), 10, 2 );
36
+		add_filter('post_row_actions', array($this, 'make_duplicate_link_row'), 10, 2);
37 37
 
38 38
 		/**
39 39
 		 * Connect actions to functions
40 40
 		 */
41
-		add_action( 'admin_action_duplicate_view', array( $this, 'save_as_new_view' ) );
42
-		add_action( 'admin_action_duplicate_view_as_draft', array( $this, 'save_as_new_view_draft' ) );
41
+		add_action('admin_action_duplicate_view', array($this, 'save_as_new_view'));
42
+		add_action('admin_action_duplicate_view_as_draft', array($this, 'save_as_new_view_draft'));
43 43
 
44 44
 		// Using our action hooks to copy meta fields
45
-		add_action( 'gv_duplicate_view', array( $this, 'copy_view_meta_info' ), 10, 2 );
45
+		add_action('gv_duplicate_view', array($this, 'copy_view_meta_info'), 10, 2);
46 46
 
47
-		add_filter( 'gravityview_connected_form_links', array( $this, 'connected_form_links' ), 10, 2 );
47
+		add_filter('gravityview_connected_form_links', array($this, 'connected_form_links'), 10, 2);
48 48
 	}
49 49
 
50 50
 	/**
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return array If it's the All Views page, return unedited. Otherwise, add a link to create cloned draft of View
57 57
 	 */
58
-	function connected_form_links( $links = array(), $form = array() ) {
58
+	function connected_form_links($links = array(), $form = array()) {
59 59
 		/** @global WP_Post $post */
60 60
 		global $post;
61 61
 
62 62
 		// We only want to add Clone links to the Edit View metabox
63
-		if( !$this->is_all_views_page() ) {
63
+		if (!$this->is_all_views_page()) {
64 64
 
65
-			if( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) {
66
-				$links[] = '<span>' . $duplicate_links['edit_as_new_draft'] . '</span>';
65
+			if ($duplicate_links = $this->make_duplicate_link_row(array(), $post)) {
66
+				$links[] = '<span>'.$duplicate_links['edit_as_new_draft'].'</span>';
67 67
 			}
68 68
 
69 69
 		}
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @since 1.6
90 90
 	 */
91
-	private function current_user_can_copy( $post ) {
91
+	private function current_user_can_copy($post) {
92 92
 
93
-		$id = is_object( $post ) ? $post->ID : $post;
93
+		$id = is_object($post) ? $post->ID : $post;
94 94
 
95 95
 		// Can't edit this current View
96
-		return GVCommon::has_cap( 'copy_gravityviews', $id );
96
+		return GVCommon::has_cap('copy_gravityviews', $id);
97 97
 
98 98
 	}
99 99
 
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	 * @param string $status The post status
105 105
 	 * @since 1.6
106 106
 	 */
107
-	private function create_duplicate( $post, $status = '' ) {
107
+	private function create_duplicate($post, $status = '') {
108 108
 
109 109
 		// We only want to clone Views
110
-		if ( $post->post_type !== 'gravityview' ) {
110
+		if ($post->post_type !== 'gravityview') {
111 111
 			return;
112 112
 		}
113 113
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		 * @param string|null If string, the status to set for the new View. If empty, use existing View status.
120 120
 		 * @param WP_Post $post View being cloned
121 121
 		 */
122
-		$new_view_status = apply_filters('gravityview/duplicate-view/status', $status, $post );
122
+		$new_view_status = apply_filters('gravityview/duplicate-view/status', $status, $post);
123 123
 
124 124
 		$new_view = array(
125 125
 			'menu_order'     => $post->menu_order,
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			'post_mime_type' => $post->post_mime_type,
132 132
 			'post_parent'    => $post->post_parent,
133 133
 			'post_password'  => $post->post_password,
134
-			'post_status'    => ( empty( $new_view_status ) ) ? $post->post_status : $new_view_status,
134
+			'post_status'    => (empty($new_view_status)) ? $post->post_status : $new_view_status,
135 135
 			'post_title'     => $post->post_title,
136 136
 			'post_type'      => $post->post_type,
137 137
 		);
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 		 * @param boolean $copy_date Whether the copy the date from the existing View. Default: `false`
143 143
 		 * @param WP_Post $post View being cloned
144 144
 		 */
145
-		$copy_date = apply_filters('gravityview/duplicate-view/copy-date', false, $post );
145
+		$copy_date = apply_filters('gravityview/duplicate-view/copy-date', false, $post);
146 146
 
147
-		if ( $copy_date ) {
147
+		if ($copy_date) {
148 148
 			$new_view['post_date']     = $new_post_date = $post->post_date;
149
-			$new_view['post_date_gmt'] = get_gmt_from_date( $new_post_date );
149
+			$new_view['post_date_gmt'] = get_gmt_from_date($new_post_date);
150 150
 		}
151 151
 
152 152
 		/**
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 		 * @param array $new_view Array of settings to be passed to wp_insert_post()
156 156
 		 * @param WP_Post $post View being cloned
157 157
 		 */
158
-		$new_view = apply_filters('gravityview/duplicate-view/new-view', $new_view, $post );
158
+		$new_view = apply_filters('gravityview/duplicate-view/new-view', $new_view, $post);
159 159
 
160 160
 		// Magic happens here.
161
-		$new_view_id = wp_insert_post( $new_view );
161
+		$new_view_id = wp_insert_post($new_view);
162 162
 
163 163
 		// If the copy is published or scheduled, we have to set a proper slug.
164
-		if ( $new_view_status == 'publish' || $new_view_status == 'future' ) {
164
+		if ($new_view_status == 'publish' || $new_view_status == 'future') {
165 165
 
166
-			$view_name = wp_unique_post_slug( $post->post_name, $new_view_id, $new_view_status, $post->post_type, $post->post_parent );
166
+			$view_name = wp_unique_post_slug($post->post_name, $new_view_id, $new_view_status, $post->post_type, $post->post_parent);
167 167
 
168 168
 			$new_view_name_array = array(
169 169
 				'ID' => $new_view_id,
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 			);
172 172
 
173 173
 			// Update the post into the database
174
-			wp_update_post( $new_view_name_array );
174
+			wp_update_post($new_view_name_array);
175 175
 		}
176 176
 
177 177
 		/**
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 		 * @param int $new_view_id The ID of the newly created View
182 182
 		 * @param WP_Post The View that was just cloned
183 183
 		 */
184
-		do_action( 'gv_duplicate_view', $new_view_id, $post );
184
+		do_action('gv_duplicate_view', $new_view_id, $post);
185 185
 
186
-		delete_post_meta( $new_view_id, '_dp_original' );
186
+		delete_post_meta($new_view_id, '_dp_original');
187 187
 
188
-		add_post_meta( $new_view_id, '_dp_original', $post->ID, false );
188
+		add_post_meta($new_view_id, '_dp_original', $post->ID, false);
189 189
 
190 190
 		return $new_view_id;
191 191
 	}
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return void
202 202
 	 */
203
-	public function copy_view_meta_info( $new_id, $post ) {
203
+	public function copy_view_meta_info($new_id, $post) {
204 204
 
205
-		$post_meta_keys = get_post_custom_keys( $post->ID );
205
+		$post_meta_keys = get_post_custom_keys($post->ID);
206 206
 
207
-		if ( empty( $post_meta_keys ) ) {
207
+		if (empty($post_meta_keys)) {
208 208
 			return;
209 209
 		}
210 210
 
211
-		foreach ( $post_meta_keys as $meta_key ) {
211
+		foreach ($post_meta_keys as $meta_key) {
212 212
 
213
-			$meta_values = get_post_custom_values( $meta_key, $post->ID );
213
+			$meta_values = get_post_custom_values($meta_key, $post->ID);
214 214
 
215
-			foreach ( $meta_values as $meta_value ) {
215
+			foreach ($meta_values as $meta_value) {
216 216
 
217
-				$meta_value = maybe_unserialize( $meta_value );
217
+				$meta_value = maybe_unserialize($meta_value);
218 218
 
219
-				add_post_meta( $new_id, $meta_key, $meta_value );
219
+				add_post_meta($new_id, $meta_key, $meta_value);
220 220
 			}
221 221
 		}
222 222
 	}
@@ -228,22 +228,22 @@  discard block
 block discarded – undo
228 228
 	 * @param array $actions Row action links. Defaults are 'Edit', 'Quick Edit', 'Restore, 'Trash', 'Delete Permanently', 'Preview', and 'View'
229 229
 	 * @param WP_Post $post
230 230
 	 */
231
-	public function make_duplicate_link_row( $actions, $post ) {
231
+	public function make_duplicate_link_row($actions, $post) {
232 232
 
233 233
 		// Only process on GravityView Views
234
-		if ( get_post_type( $post ) === 'gravityview' && $this->current_user_can_copy( $post ) ) {
234
+		if (get_post_type($post) === 'gravityview' && $this->current_user_can_copy($post)) {
235 235
 
236
-			$clone_link = $this->get_clone_view_link( $post->ID, 'display', false );
237
-			$clone_text = __( 'Clone', 'gravityview' );
238
-			$clone_title = __( 'Clone this View', 'gravityview' );
236
+			$clone_link = $this->get_clone_view_link($post->ID, 'display', false);
237
+			$clone_text = __('Clone', 'gravityview');
238
+			$clone_title = __('Clone this View', 'gravityview');
239 239
 
240
-			$actions['clone'] = gravityview_get_link( $clone_link, $clone_text, 'title='.$clone_title );
240
+			$actions['clone'] = gravityview_get_link($clone_link, $clone_text, 'title='.$clone_title);
241 241
 
242
-			$clone_draft_link = $this->get_clone_view_link( $post->ID );
243
-			$clone_draft_text = $this->is_all_views_page() ? __( 'New Draft', 'gravityview' ) : __( 'Clone View', 'gravityview' );
244
-			$clone_draft_title = __( 'Copy as a new draft View', 'gravityview' );
242
+			$clone_draft_link = $this->get_clone_view_link($post->ID);
243
+			$clone_draft_text = $this->is_all_views_page() ? __('New Draft', 'gravityview') : __('Clone View', 'gravityview');
244
+			$clone_draft_title = __('Copy as a new draft View', 'gravityview');
245 245
 
246
-			$actions['edit_as_new_draft'] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title='.$clone_draft_title );
246
+			$actions['edit_as_new_draft'] = gravityview_get_link($clone_draft_link, esc_html($clone_draft_text), 'title='.$clone_draft_title);
247 247
 		}
248 248
 
249 249
 		return $actions;
@@ -259,31 +259,31 @@  discard block
 block discarded – undo
259 259
 	 * @param string $draft Optional, default to true
260 260
 	 * @return string
261 261
 	 */
262
-	private function get_clone_view_link( $id = 0, $context = 'display', $draft = true ) {
262
+	private function get_clone_view_link($id = 0, $context = 'display', $draft = true) {
263 263
 
264 264
 		// Make sure they have permission
265
-		if ( false === $this->current_user_can_copy( $id ) ) {
265
+		if (false === $this->current_user_can_copy($id)) {
266 266
 			return '';
267 267
 		}
268 268
 
269 269
 		// Verify the View exists
270
-		if ( !$view = get_post( $id ) ) {
270
+		if (!$view = get_post($id)) {
271 271
 			return '';
272 272
 		}
273 273
 
274 274
 		$action_name = $draft ? "duplicate_view_as_draft" : "duplicate_view";
275 275
 
276
-		$action = '?action=' . $action_name . '&post=' . $view->ID;
276
+		$action = '?action='.$action_name.'&post='.$view->ID;
277 277
 
278
-		if ( 'display' == $context ) {
279
-			$action = esc_html( $action );
278
+		if ('display' == $context) {
279
+			$action = esc_html($action);
280 280
 		}
281 281
 
282
-		$post_type_object = get_post_type_object( $view->post_type );
282
+		$post_type_object = get_post_type_object($view->post_type);
283 283
 
284 284
 		/** If there's no gravityview post type for some reason, abort! */
285
-		if ( !$post_type_object ) {
286
-			do_action( 'gravityview_log_error', __METHOD__ . ' No gravityview post type exists when trying to clone the View.', $view );
285
+		if (!$post_type_object) {
286
+			do_action('gravityview_log_error', __METHOD__.' No gravityview post type exists when trying to clone the View.', $view);
287 287
 			return '';
288 288
 		}
289 289
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 * @param int $view_id View ID
295 295
 		 * @param string $context How to display the link. If "display", the URL is run through esc_html(). Default: `display`
296 296
 		 */
297
-		$clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php". $action ), $view->ID, $context );
297
+		$clone_view_link = apply_filters('gravityview/duplicate-view/get_clone_view_link', admin_url("admin.php".$action), $view->ID, $context);
298 298
 
299 299
 		return $clone_view_link;
300 300
 	}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @return void
309 309
 	 */
310 310
 	public function save_as_new_view_draft() {
311
-		$this->save_as_new_view( 'draft' );
311
+		$this->save_as_new_view('draft');
312 312
 	}
313 313
 
314 314
 	/**
@@ -319,38 +319,38 @@  discard block
 block discarded – undo
319 319
 	 * @param string $status The status to set for the new View
320 320
 	 * @return void
321 321
 	 */
322
-	public function save_as_new_view( $status = '' ) {
322
+	public function save_as_new_view($status = '') {
323 323
 
324
-		if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) ) ) {
325
-			wp_die( __( 'No post to duplicate has been supplied!', 'gravityview' ) );
324
+		if (!(isset($_GET['post']) || isset($_POST['post']))) {
325
+			wp_die(__('No post to duplicate has been supplied!', 'gravityview'));
326 326
 		}
327 327
 
328 328
 		// Get the original post
329
-		$id   = ( isset( $_GET['post'] ) ? $_GET['post'] : $_POST['post'] );
329
+		$id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
330 330
 
331
-		if( ! $this->current_user_can_copy( $id ) ) {
332
-			wp_die( __( 'You don\'t have permission to copy this View.', 'gravityview' ) );
331
+		if (!$this->current_user_can_copy($id)) {
332
+			wp_die(__('You don\'t have permission to copy this View.', 'gravityview'));
333 333
 		}
334 334
 
335
-		$post = get_post( $id );
335
+		$post = get_post($id);
336 336
 
337 337
 		// Copy the post and insert it
338
-		if ( isset( $post ) && $post != NULL ) {
338
+		if (isset($post) && $post != NULL) {
339 339
 
340
-			$new_id = $this->create_duplicate( $post, $status );
340
+			$new_id = $this->create_duplicate($post, $status);
341 341
 
342
-			if ( $status == '' ) {
342
+			if ($status == '') {
343 343
 				// Redirect to the post list screen
344
-				wp_redirect( admin_url( 'edit.php?post_type=' . $post->post_type ) );
344
+				wp_redirect(admin_url('edit.php?post_type='.$post->post_type));
345 345
 			} else {
346 346
 				// Redirect to the edit screen for the new draft post
347
-				wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_id ) );
347
+				wp_redirect(admin_url('post.php?action=edit&post='.$new_id));
348 348
 			}
349 349
 			exit;
350 350
 
351 351
 		} else {
352 352
 
353
-			wp_die( sprintf( esc_attr__( 'Copy creation failed, could not find original View with ID #%d', 'gravityview' ), $id ) );
353
+			wp_die(sprintf(esc_attr__('Copy creation failed, could not find original View with ID #%d', 'gravityview'), $id));
354 354
 
355 355
 		}
356 356
 	}
Please login to merge, or discard this patch.
includes/class-gravityview-compatibility.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 
117 117
 	/**
118 118
 	 * @since 1.12
119
-	 * @return bool
119
+	 * @return boolean|null
120 120
 	 */
121 121
 	private function add_fallback_shortcode() {
122 122
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@
 block discarded – undo
204 204
 			self::$notices['wp_version'] = array(
205 205
 				'class' => 'error',
206 206
 				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ),
207
-			    'cap' => 'update_core',
207
+				'cap' => 'update_core',
208 208
 				'dismiss' => 'wp_version',
209 209
 			);
210 210
 
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	function add_hooks() {
59 59
 
60
-		add_filter( 'gravityview/admin/notices', array( $this, 'insert_admin_notices' ) );
60
+		add_filter('gravityview/admin/notices', array($this, 'insert_admin_notices'));
61 61
 
62 62
 		$this->add_fallback_shortcode();
63 63
 	}
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @return array
70 70
 	 */
71
-	function insert_admin_notices( $notices = array() ) {
72
-		return array_merge( $notices, self::$notices );
71
+	function insert_admin_notices($notices = array()) {
72
+		return array_merge($notices, self::$notices);
73 73
 	}
74 74
 
75 75
 	/**
76 76
 	 * @return GravityView_Compatibility
77 77
 	 */
78 78
 	public static function getInstance() {
79
-		if( self::$instance ) {
79
+		if (self::$instance) {
80 80
 			return self::$instance;
81 81
 		}
82 82
 		return new self;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @return bool
88 88
 	 */
89 89
 	public static function is_valid() {
90
-		return ( self::is_valid_gravity_forms() && self::is_valid_wordpress() && self::is_valid_php() );
90
+		return (self::is_valid_gravity_forms() && self::is_valid_wordpress() && self::is_valid_php());
91 91
 	}
92 92
 
93 93
 	/**
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 		// If Gravity Forms doesn't exist or is outdated, load the admin view class to
124 124
 		// show the notice, but not load any post types or process shortcodes.
125 125
 		// Without Gravity Forms, there is no GravityView. Beautiful, really.
126
-		if( ! self::is_valid() ) {
126
+		if (!self::is_valid()) {
127 127
 
128 128
 			// If the plugin's not loaded, might as well hide the shortcode for people.
129
-			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') );
129
+			add_shortcode('gravityview', array($this, '_shortcode_gf_notice'));
130 130
 
131 131
 		}
132 132
 	}
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @return null|string NULL returned if user can't activate plugins. Notice shown with a warning that GF isn't supported.
152 152
 	 */
153
-	public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) {
153
+	public function _shortcode_gf_notice($atts = array(), $content = null, $shortcode = 'gravityview') {
154 154
 
155
-		if( ! GVCommon::has_cap( 'activate_plugins' ) ) {
155
+		if (!GVCommon::has_cap('activate_plugins')) {
156 156
 			return null;
157 157
 		}
158 158
 
159 159
 		$notices = self::get_notices();
160 160
 
161
-		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>';
162
-		foreach( (array)$notices as $notice ) {
163
-			$message .= wpautop( $notice['message'] );
161
+		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>'.esc_html__('You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview').'</em></p>';
162
+		foreach ((array)$notices as $notice) {
163
+			$message .= wpautop($notice['message']);
164 164
 		}
165 165
 		$message .= '</div>';
166 166
 
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	 * @return boolean
176 176
 	 */
177 177
 	public static function check_php() {
178
-		if( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) {
178
+		if (false === version_compare(phpversion(), GV_MIN_PHP_VERSION, '>=')) {
179 179
 
180 180
 			self::$notices['php_version'] = array(
181 181
 				'class' => 'error',
182
-				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
182
+				'message' => sprintf(__("%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview'), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>'),
183 183
 				'cap' => 'manage_options',
184 184
 				'dismiss' => 'php_version',
185 185
 			);
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	public static function check_wordpress() {
200 200
 		global $wp_version;
201 201
 
202
-		if( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
202
+		if (version_compare($wp_version, GV_MIN_WP_VERSION) <= 0) {
203 203
 
204 204
 			self::$notices['wp_version'] = array(
205 205
 				'class' => 'error',
206
-				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ),
206
+				'message' => sprintf(__("%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview'), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>'),
207 207
 			    'cap' => 'update_core',
208 208
 				'dismiss' => 'wp_version',
209 209
 			);
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 	public static function check_gravityforms() {
227 227
 
228 228
 		// Bypass other checks: if the class exists
229
-		if( class_exists( 'GFCommon' ) ) {
229
+		if (class_exists('GFCommon')) {
230 230
 
231 231
 			// and the version's right, we're good.
232
-			if( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) {
232
+			if (true === version_compare(GFCommon::$version, GV_MIN_GF_VERSION, ">=")) {
233 233
 				return true;
234 234
 			}
235 235
 
236 236
 			// Or the version's wrong
237 237
 			self::$notices['gf_version'] = array(
238 238
 				'class' => 'error',
239
-				'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
239
+				'message' => sprintf(__("%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview'), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>'),
240 240
 				'cap' => 'update_plugins',
241 241
 				'dismiss' => 'gf_version',
242 242
 			);
@@ -244,40 +244,40 @@  discard block
 block discarded – undo
244 244
 			return false;
245 245
 		}
246 246
 
247
-		$gf_status = self::get_plugin_status( 'gravityforms/gravityforms.php' );
247
+		$gf_status = self::get_plugin_status('gravityforms/gravityforms.php');
248 248
 
249 249
 		/**
250 250
 		 * The plugin is activated and yet somehow GFCommon didn't get picked up...
251 251
 		 * OR
252 252
 		 * It's the Network Admin and we just don't know whether the sites have GF activated themselves.
253 253
 		 */
254
-		if( true === $gf_status || is_network_admin() ) {
254
+		if (true === $gf_status || is_network_admin()) {
255 255
 			return true;
256 256
 		}
257 257
 
258 258
 		// If GFCommon doesn't exist, assume GF not active
259 259
 		$return = false;
260 260
 
261
-		switch( $gf_status ) {
261
+		switch ($gf_status) {
262 262
 			case 'inactive':
263 263
 
264 264
 				// Required for multisite
265
-				if( ! function_exists('wp_create_nonce') ) {
266
-					require_once ABSPATH . WPINC . '/pluggable.php';
265
+				if (!function_exists('wp_create_nonce')) {
266
+					require_once ABSPATH.WPINC.'/pluggable.php';
267 267
 				}
268 268
 
269 269
 				// Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
270
-				if( is_multisite() ) {
270
+				if (is_multisite()) {
271 271
 					wp_cookie_constants();
272 272
 				}
273 273
 
274 274
 				$return = false;
275 275
 
276
-				$button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">';
276
+				$button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'.wp_nonce_url(admin_url('plugins.php?action=activate&plugin=gravityforms/gravityforms.php'), 'activate-plugin_gravityforms/gravityforms.php').'" class="button button-large">';
277 277
 
278 278
 				self::$notices['gf_inactive'] = array(
279 279
 					'class' => 'error',
280
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ),
280
+					'message' => sprintf(__('%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview'), '<h3>', "</h3>\n\n".$button, '</a></strong>'),
281 281
 					'cap' => 'activate_plugins',
282 282
 					'dismiss' => 'gf_inactive',
283 283
 				);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			default:
287 287
 				self::$notices['gf_installed'] = array(
288 288
 					'class' => 'error',
289
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
289
+					'message' => sprintf(__('%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview'), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>'),
290 290
 					'cap' => 'install_plugins',
291 291
 					'dismiss' => 'gf_installed',
292 292
 				);
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	private static function check_gf_directory() {
305 305
 
306
-		if( class_exists( 'GFDirectory' ) ) {
306
+		if (class_exists('GFDirectory')) {
307 307
 			self::$notices['gf_directory'] = array(
308 308
 				'class' => 'error is-dismissible',
309
-				'title' => __('Potential Conflict', 'gravityview' ),
310
-				'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ),
309
+				'title' => __('Potential Conflict', 'gravityview'),
310
+				'message' => __('GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview'),
311 311
 				'dismiss' => 'gf_directory',
312 312
 				'cap' => 'activate_plugins',
313 313
 			);
@@ -323,23 +323,23 @@  discard block
 block discarded – undo
323 323
 	 * @param string $location (default: '')
324 324
 	 * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive
325 325
 	 */
326
-	public static function get_plugin_status( $location = '' ) {
326
+	public static function get_plugin_status($location = '') {
327 327
 
328
-		if( ! function_exists('is_plugin_active') ) {
329
-			include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
328
+		if (!function_exists('is_plugin_active')) {
329
+			include_once(ABSPATH.'/wp-admin/includes/plugin.php');
330 330
 		}
331 331
 
332
-		if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
332
+		if (is_network_admin() && is_plugin_active_for_network($location)) {
333 333
 			return true;
334 334
 		}
335 335
 
336
-		if( !is_network_admin() && is_plugin_active( $location ) ) {
336
+		if (!is_network_admin() && is_plugin_active($location)) {
337 337
 			return true;
338 338
 		}
339 339
 
340
-		if(
341
-			!file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
342
-			!file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
340
+		if (
341
+			!file_exists(trailingslashit(WP_PLUGIN_DIR).$location) &&
342
+			!file_exists(trailingslashit(WPMU_PLUGIN_DIR).$location)
343 343
 		) {
344 344
 			return false;
345 345
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-link-shortcode.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -221,7 +221,6 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @since 1.15
223 223
 	 *
224
-	 * @param string|null $content Content inside shortcode, if defined
225 224
 	 *
226 225
 	 * @return string|boolean If URL is fetched, the URL to the entry link. If not found, returns false.
227 226
 	 */
@@ -316,7 +315,7 @@  discard block
 block discarded – undo
316 315
 	 *
317 316
 	 * @since 1.15
318 317
 	 *
319
-	 * @param string $href URL
318
+	 * @param string|null $url
320 319
 	 */
321 320
 	private function maybe_add_field_values_query_args( $url ) {
322 321
 
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 	 * @since 1.15
52 52
 	 */
53 53
 	private function add_hooks() {
54
-		add_shortcode( 'gv_entry_link', array( $this, 'read_shortcode' ) );
55
-		add_shortcode( 'gv_edit_entry_link', array( $this, 'edit_shortcode' ) );
56
-		add_shortcode( 'gv_delete_entry_link', array( $this, 'delete_shortcode' ) );
54
+		add_shortcode('gv_entry_link', array($this, 'read_shortcode'));
55
+		add_shortcode('gv_edit_entry_link', array($this, 'edit_shortcode'));
56
+		add_shortcode('gv_delete_entry_link', array($this, 'delete_shortcode'));
57 57
 	}
58 58
 
59 59
 	/**
60 60
 	 * @since 1.15
61 61
 	 * @copydoc GravityView_Entry_Link_Shortcode::shortcode
62 62
 	 */
63
-	public function read_shortcode( $atts, $content = null, $context = 'gv_entry_link' ) {
64
-		return $this->shortcode( $atts, $content, $context );
63
+	public function read_shortcode($atts, $content = null, $context = 'gv_entry_link') {
64
+		return $this->shortcode($atts, $content, $context);
65 65
 	}
66 66
 
67 67
 	/**
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 	 * @since 1.15
72 72
 	 * @copydoc GravityView_Entry_Link_Shortcode::shortcode
73 73
 	 */
74
-	public function edit_shortcode( $atts, $content = null, $context = 'gv_edit_entry_link' ) {
74
+	public function edit_shortcode($atts, $content = null, $context = 'gv_edit_entry_link') {
75 75
 		$atts['action'] = 'edit';
76 76
 
77
-		return $this->shortcode( $atts, $content, $context );
77
+		return $this->shortcode($atts, $content, $context);
78 78
 	}
79 79
 
80 80
 	/**
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 	 * @since 1.15
85 85
 	 * @copydoc GravityView_Entry_Link_Shortcode::shortcode
86 86
 	 */
87
-	public function delete_shortcode( $atts, $content = null, $context = 'gv_delete_entry_link' ) {
87
+	public function delete_shortcode($atts, $content = null, $context = 'gv_delete_entry_link') {
88 88
 		$atts['action'] = 'delete';
89 89
 
90
-		return $this->shortcode( $atts, $content, $context );
90
+		return $this->shortcode($atts, $content, $context);
91 91
 	}
92 92
 
93 93
 	/**
@@ -110,58 +110,58 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return null|string If admin or an error occurred, returns null. Otherwise, returns entry link output. If `$atts['return']` is 'url', the entry link URL. Otherwise, entry link `<a>` HTML tag.
112 112
 	 */
113
-	private function shortcode( $atts, $content = null, $context = 'gv_entry_link' ) {
113
+	private function shortcode($atts, $content = null, $context = 'gv_entry_link') {
114 114
 
115 115
 		// Don't process when saving post. Keep processing if it's admin-ajax.php
116
-		if ( ! class_exists( 'GravityView_Plugin' ) || GravityView_Plugin::is_admin() ) {
116
+		if (!class_exists('GravityView_Plugin') || GravityView_Plugin::is_admin()) {
117 117
 			return null;
118 118
 		}
119 119
 
120 120
 		// Make sure GV is loaded
121
-		if ( ! class_exists( 'GravityView_frontend' ) || ! class_exists( 'GravityView_View' ) ) {
122
-			do_action( 'gravityview_log_error', __METHOD__ . ' GravityView_frontend or GravityView_View do not exist.' );
121
+		if (!class_exists('GravityView_frontend') || !class_exists('GravityView_View')) {
122
+			do_action('gravityview_log_error', __METHOD__.' GravityView_frontend or GravityView_View do not exist.');
123 123
 
124 124
 			return null;
125 125
 		}
126 126
 
127
-		$this->settings = shortcode_atts( self::$defaults, $atts, $context );
127
+		$this->settings = shortcode_atts(self::$defaults, $atts, $context);
128 128
 
129
-		$this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] );
129
+		$this->view_id = empty($this->settings['view_id']) ? GravityView_View::getInstance()->getViewId() : absint($this->settings['view_id']);
130 130
 
131
-		if ( empty( $this->view_id ) ) {
132
-			do_action( 'gravityview_log_error', __METHOD__ . ' A View ID was not defined and we are not inside a View' );
131
+		if (empty($this->view_id)) {
132
+			do_action('gravityview_log_error', __METHOD__.' A View ID was not defined and we are not inside a View');
133 133
 
134 134
 			return null;
135 135
 		}
136 136
 
137
-		$this->entry = $this->get_entry( $this->settings['entry_id'] );
137
+		$this->entry = $this->get_entry($this->settings['entry_id']);
138 138
 
139
-		do_action( 'gravityview_log_debug', __METHOD__ . ' ' . $context . ' $atts: ', $atts );
139
+		do_action('gravityview_log_debug', __METHOD__.' '.$context.' $atts: ', $atts);
140 140
 
141
-		if ( ! $this->has_cap() ) {
142
-			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr( $this->settings['action'] ) . ' this entry: ' . $this->entry['id'] );
141
+		if (!$this->has_cap()) {
142
+			do_action('gravityview_log_error', __METHOD__.' User does not have the capability to '.esc_attr($this->settings['action']).' this entry: '.$this->entry['id']);
143 143
 
144 144
 			return null;
145 145
 		}
146 146
 
147 147
 		$url = $this->get_url();
148 148
 
149
-		if ( ! $url ) {
150
-			do_action( 'gravityview_log_error', __METHOD__ . ' Link returned false; View or Post may not exist.' );
149
+		if (!$url) {
150
+			do_action('gravityview_log_error', __METHOD__.' Link returned false; View or Post may not exist.');
151 151
 
152 152
 			return false;
153 153
 		}
154 154
 
155 155
 		// Get just the URL, not the tag
156
-		if ( 'url' === $this->settings['return'] ) {
156
+		if ('url' === $this->settings['return']) {
157 157
 			return $url;
158 158
 		}
159 159
 
160 160
 		$link_atts = $this->get_link_atts();
161 161
 
162
-		$link_text = $this->get_anchor_text( $content );
162
+		$link_text = $this->get_anchor_text($content);
163 163
 
164
-		return gravityview_get_link( $url, $link_text, $link_atts );
164
+		return gravityview_get_link($url, $link_text, $link_atts);
165 165
 	}
166 166
 
167 167
 	/**
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	private function get_link_atts() {
176 176
 
177
-		wp_parse_str( $this->settings['link_atts'], $link_atts );
177
+		wp_parse_str($this->settings['link_atts'], $link_atts);
178 178
 
179
-		if ( 'delete' === $this->settings['action'] ) {
180
-			$link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog();
179
+		if ('delete' === $this->settings['action']) {
180
+			$link_atts['onclick'] = isset($link_atts['onclick']) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog();
181 181
 		}
182 182
 
183
-		return (array) $link_atts;
183
+		return (array)$link_atts;
184 184
 	}
185 185
 
186 186
 	/**
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return string Text to use for HTML anchor
196 196
 	 */
197
-	private function get_anchor_text( $content = null ) {
197
+	private function get_anchor_text($content = null) {
198 198
 
199
-		if ( $content ) {
199
+		if ($content) {
200 200
 			return $content;
201 201
 		}
202 202
 
203
-		switch ( $this->settings['action'] ) {
203
+		switch ($this->settings['action']) {
204 204
 			case 'edit':
205
-				$anchor_text = __( 'Edit Entry', 'gravityview' );
205
+				$anchor_text = __('Edit Entry', 'gravityview');
206 206
 				break;
207 207
 			case 'delete':
208
-				$anchor_text = __( 'Delete Entry', 'gravityview' );
208
+				$anchor_text = __('Delete Entry', 'gravityview');
209 209
 				break;
210 210
 			default:
211
-				$anchor_text = __( 'View Details', 'gravityview' );
211
+				$anchor_text = __('View Details', 'gravityview');
212 212
 		}
213 213
 
214 214
 		return $anchor_text;
@@ -228,21 +228,21 @@  discard block
 block discarded – undo
228 228
 	private function get_url() {
229 229
 
230 230
 		// if post_id is not defined, default to view_id
231
-		$post_id = empty( $this->settings['post_id'] ) ? $this->view_id : absint( $this->settings['post_id'] );
231
+		$post_id = empty($this->settings['post_id']) ? $this->view_id : absint($this->settings['post_id']);
232 232
 
233
-		switch ( $this->settings['action'] ) {
233
+		switch ($this->settings['action']) {
234 234
 			case 'edit':
235
-				$url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id );
235
+				$url = GravityView_Edit_Entry::get_edit_link($this->entry, $this->view_id, $post_id);
236 236
 				break;
237 237
 			case 'delete':
238
-				$url = GravityView_Delete_Entry::get_delete_link( $this->entry, $this->view_id, $post_id );
238
+				$url = GravityView_Delete_Entry::get_delete_link($this->entry, $this->view_id, $post_id);
239 239
 				break;
240 240
 			case 'read':
241 241
 			default:
242
-				$url = GravityView_API::entry_link( $this->entry, $post_id );
242
+				$url = GravityView_API::entry_link($this->entry, $post_id);
243 243
 		}
244 244
 
245
-		$url = $this->maybe_add_field_values_query_args( $url );
245
+		$url = $this->maybe_add_field_values_query_args($url);
246 246
 
247 247
 		return $url;
248 248
 	}
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	private function has_cap() {
257 257
 
258
-		switch ( $this->settings['action'] ) {
258
+		switch ($this->settings['action']) {
259 259
 			case 'edit':
260
-				$has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id );
260
+				$has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry($this->entry, $this->view_id);
261 261
 				break;
262 262
 			case 'delete':
263
-				$has_cap = GravityView_Delete_Entry::check_user_cap_delete_entry( $this->entry, array(), $this->view_id );
263
+				$has_cap = GravityView_Delete_Entry::check_user_cap_delete_entry($this->entry, array(), $this->view_id);
264 264
 				break;
265 265
 			case 'read':
266 266
 			default:
@@ -281,28 +281,28 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @return array|bool Gravity Forms array, if found. Otherwise, false.
283 283
 	 */
284
-	private function get_entry( $entry_id = 0 ) {
284
+	private function get_entry($entry_id = 0) {
285 285
 
286 286
 		$backup_entry = GravityView_frontend::getInstance()->getSingleEntry() ? GravityView_frontend::getInstance()->getEntry() : GravityView_View::getInstance()->getCurrentEntry();
287 287
 
288
-		if ( empty( $entry_id ) ) {
289
-			if ( ! $backup_entry ) {
290
-				do_action( 'gravityview_log_error', __METHOD__ . ' No entry defined (or entry id not valid number)', $this->settings );
288
+		if (empty($entry_id)) {
289
+			if (!$backup_entry) {
290
+				do_action('gravityview_log_error', __METHOD__.' No entry defined (or entry id not valid number)', $this->settings);
291 291
 
292 292
 				return false;
293 293
 			}
294 294
 			$entry = $backup_entry;
295 295
 		} else {
296
-			$entry = wp_cache_get( 'gv_entry_link_entry_' . $entry_id, 'gravityview_entry_link_shortcode' );
297
-			if ( false === $entry ) {
298
-				$entry = GVCommon::get_entry( $entry_id, true, false );
299
-				wp_cache_add( 'gv_entry_link_entry_' . $entry_id, $entry, 'gravityview_entry_link_shortcode' );
296
+			$entry = wp_cache_get('gv_entry_link_entry_'.$entry_id, 'gravityview_entry_link_shortcode');
297
+			if (false === $entry) {
298
+				$entry = GVCommon::get_entry($entry_id, true, false);
299
+				wp_cache_add('gv_entry_link_entry_'.$entry_id, $entry, 'gravityview_entry_link_shortcode');
300 300
 			}
301 301
 		}
302 302
 
303 303
 		// No search results
304
-		if ( false === $entry ) {
305
-			do_action( 'gravityview_log_error', __METHOD__ . ' No entries match the entry ID defined', $entry_id );
304
+		if (false === $entry) {
305
+			do_action('gravityview_log_error', __METHOD__.' No entries match the entry ID defined', $entry_id);
306 306
 
307 307
 			return false;
308 308
 		}
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 * @param string $href URL
320 320
 	 */
321
-	private function maybe_add_field_values_query_args( $url ) {
321
+	private function maybe_add_field_values_query_args($url) {
322 322
 
323
-		if ( $url && ! empty( $this->settings['field_values'] ) ) {
323
+		if ($url && !empty($this->settings['field_values'])) {
324 324
 
325
-			wp_parse_str( $this->settings['field_values'], $field_values );
325
+			wp_parse_str($this->settings['field_values'], $field_values);
326 326
 
327
-			$url = add_query_arg( $field_values, $url );
327
+			$url = add_query_arg($field_values, $url);
328 328
 		}
329 329
 
330 330
 		return $url;
Please login to merge, or discard this patch.
includes/class-gravityview-extension.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@
 block discarded – undo
278 278
 
279 279
 	/**
280 280
 	 * Add a notice to be displayed in the admin.
281
-	 * @param array $notice Array with `class` and `message` keys. The message is not escaped.
281
+	 * @param string $notice Array with `class` and `message` keys. The message is not escaped.
282 282
 	 */
283 283
 	public static function add_notice( $notice = array() ) {
284 284
 
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -244,13 +244,13 @@
 block discarded – undo
244 244
 			$this->_remote_update_url,
245 245
 			$this->_path,
246 246
 			array(
247
-            	'version'	=> $this->_version, // current version number
248
-            	'license'	=> $license['license'],
249
-	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
250
-            	'item_name' => $this->_title,  // name of this plugin
251
-            	'author' 	=> strip_tags( $this->_author )  // author of this plugin
252
-          	)
253
-        );
247
+				'version'	=> $this->_version, // current version number
248
+				'license'	=> $license['license'],
249
+				'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
250
+				'item_name' => $this->_title,  // name of this plugin
251
+				'author' 	=> strip_tags( $this->_author )  // author of this plugin
252
+		  	)
253
+		);
254 254
 	}
255 255
 
256 256
 	/**
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -69,22 +69,22 @@  discard block
 block discarded – undo
69 69
 
70 70
 	function __construct() {
71 71
 
72
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
72
+		add_action('init', array($this, 'load_plugin_textdomain'));
73 73
 
74
-		add_action( 'admin_init', array( $this, 'settings') );
74
+		add_action('admin_init', array($this, 'settings'));
75 75
 
76
-		add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 );
76
+		add_action('admin_notices', array($this, 'admin_notice'), 100);
77 77
 
78
-		add_action( 'gravityview/metaboxes/before_render', array( $this, 'add_metabox_tab' ) );
78
+		add_action('gravityview/metaboxes/before_render', array($this, 'add_metabox_tab'));
79 79
 
80
-		if( false === $this->is_extension_supported() ) {
80
+		if (false === $this->is_extension_supported()) {
81 81
 			return;
82 82
 		}
83 83
 
84
-		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
84
+		add_filter('gravityview_tooltips', array($this, 'tooltips'));
85 85
 
86 86
 		// Save the form configuration. Run at 14 so that View metadata is already saved (at 10)
87
-		add_action( 'save_post', array( $this, 'save_post' ), 14 );
87
+		add_action('save_post', array($this, 'save_post'), 14);
88 88
 
89 89
 		$this->add_hooks();
90 90
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$tab_settings = $this->tab_settings();
117 117
 
118 118
 		// Don't add a tab if it's empty.
119
-		if( empty( $tab_settings ) ) {
119
+		if (empty($tab_settings)) {
120 120
 			return;
121 121
 		}
122 122
 
@@ -131,20 +131,20 @@  discard block
 block discarded – undo
131 131
 			'priority' => 'default',
132 132
 		);
133 133
 
134
-		$tab = wp_parse_args( $tab_settings, $tab_defaults );
134
+		$tab = wp_parse_args($tab_settings, $tab_defaults);
135 135
 
136 136
 		// Force the screen to be GravityView
137 137
 		$tab['screen'] = 'gravityview';
138 138
 
139
-		if( class_exists('GravityView_Metabox_Tab') ) {
139
+		if (class_exists('GravityView_Metabox_Tab')) {
140 140
 
141
-			$metabox = new GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] );
141
+			$metabox = new GravityView_Metabox_Tab($tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args']);
142 142
 
143
-			GravityView_Metabox_Tabs::add( $metabox );
143
+			GravityView_Metabox_Tabs::add($metabox);
144 144
 
145 145
 		} else {
146 146
 
147
-			add_meta_box( 'gravityview_'.$tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] );
147
+			add_meta_box('gravityview_'.$tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority']);
148 148
 
149 149
 		}
150 150
 	}
@@ -160,37 +160,37 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function load_plugin_textdomain() {
162 162
 
163
-		if( empty( $this->_text_domain ) ) {
164
-			do_action( 'gravityview_log_debug', __METHOD__ . ': Extension translation cannot be loaded; the `_text_domain` variable is not defined', $this );
163
+		if (empty($this->_text_domain)) {
164
+			do_action('gravityview_log_debug', __METHOD__.': Extension translation cannot be loaded; the `_text_domain` variable is not defined', $this);
165 165
 			return;
166 166
 		}
167 167
 
168 168
 		// Backward compat for Ratings & Reviews / Maps
169
-		$path = isset( $this->_path ) ? $this->_path : ( isset( $this->plugin_file ) ? $this->plugin_file : '' );
169
+		$path = isset($this->_path) ? $this->_path : (isset($this->plugin_file) ? $this->plugin_file : '');
170 170
 
171 171
 		// Set filter for plugin's languages directory
172
-		$lang_dir = dirname( plugin_basename( $path ) ) . '/languages/';
172
+		$lang_dir = dirname(plugin_basename($path)).'/languages/';
173 173
 
174 174
 		// Traditional WordPress plugin locale filter
175
-		$locale = apply_filters( 'plugin_locale',  get_locale(), $this->_text_domain );
175
+		$locale = apply_filters('plugin_locale', get_locale(), $this->_text_domain);
176 176
 
177
-		$mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale );
177
+		$mofile = sprintf('%1$s-%2$s.mo', $this->_text_domain, $locale);
178 178
 
179 179
 		// Setup paths to current locale file
180
-		$mofile_local  = $lang_dir . $mofile;
181
-		$mofile_global = WP_LANG_DIR . '/' . $this->_text_domain . '/' . $mofile;
180
+		$mofile_local  = $lang_dir.$mofile;
181
+		$mofile_global = WP_LANG_DIR.'/'.$this->_text_domain.'/'.$mofile;
182 182
 
183
-		if ( file_exists( $mofile_global ) ) {
183
+		if (file_exists($mofile_global)) {
184 184
 			// Look in global /wp-content/languages/[plugin-dir]/ folder
185
-			load_textdomain( $this->_text_domain, $mofile_global );
185
+			load_textdomain($this->_text_domain, $mofile_global);
186 186
 		}
187
-		elseif ( file_exists( $mofile_local ) ) {
187
+		elseif (file_exists($mofile_local)) {
188 188
 			// Look in local /wp-content/plugins/[plugin-dir]/languages/ folder
189
-			load_textdomain( $this->_text_domain, $mofile_local );
189
+			load_textdomain($this->_text_domain, $mofile_local);
190 190
 		}
191 191
 		else {
192 192
 			// Load the default language files
193
-			load_plugin_textdomain( $this->_text_domain, false, $lang_dir );
193
+			load_plugin_textdomain($this->_text_domain, false, $lang_dir);
194 194
 		}
195 195
 	}
196 196
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	protected function get_license() {
204 204
 
205
-		if( !class_exists( 'GravityView_Settings' ) ) {
205
+		if (!class_exists('GravityView_Settings')) {
206 206
 			return false;
207 207
 		}
208 208
 
@@ -219,17 +219,17 @@  discard block
 block discarded – undo
219 219
 	public function settings() {
220 220
 
221 221
 		// If doing ajax, get outta here
222
-		if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )  {
222
+		if (!is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) {
223 223
 			return;
224 224
 		}
225 225
 
226
-		if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
226
+		if (!class_exists('EDD_SL_Plugin_Updater')) {
227 227
 
228
-			$file_path = plugin_dir_path( __FILE__ ) . 'lib/EDD_SL_Plugin_Updater.php';
228
+			$file_path = plugin_dir_path(__FILE__).'lib/EDD_SL_Plugin_Updater.php';
229 229
 
230 230
 			// This file may be in the lib/ directory already
231
-			if( ! file_exists( $file_path ) ) {
232
-				$file_path = plugin_dir_path( __FILE__ ) . '/EDD_SL_Plugin_Updater.php';
231
+			if (!file_exists($file_path)) {
232
+				$file_path = plugin_dir_path(__FILE__).'/EDD_SL_Plugin_Updater.php';
233 233
 			}
234 234
 
235 235
 			include_once $file_path;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		$license = $this->get_license();
239 239
 
240 240
 		// Don't update if invalid license.
241
-		if( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) { return; }
241
+		if (false === $license || empty($license['status']) || strtolower($license['status']) !== 'valid') { return; }
242 242
 
243 243
 		new EDD_SL_Plugin_Updater(
244 244
 			$this->_remote_update_url,
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
             	'version'	=> $this->_version, // current version number
248 248
             	'license'	=> $license['license'],
249 249
 	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
250
-            	'item_name' => $this->_title,  // name of this plugin
251
-            	'author' 	=> strip_tags( $this->_author )  // author of this plugin
250
+            	'item_name' => $this->_title, // name of this plugin
251
+            	'author' 	=> strip_tags($this->_author)  // author of this plugin
252 252
           	)
253 253
         );
254 254
 	}
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function admin_notice() {
262 262
 
263
-		if( empty( self::$admin_notices ) ) {
263
+		if (empty(self::$admin_notices)) {
264 264
 			return;
265 265
 		}
266 266
 
267
-		foreach( self::$admin_notices as $key => $notice ) {
267
+		foreach (self::$admin_notices as $key => $notice) {
268 268
 
269
-			echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">';
270
-			echo wpautop( $notice['message'] );
269
+			echo '<div id="message" class="'.esc_attr($notice['class']).'">';
270
+			echo wpautop($notice['message']);
271 271
 			echo '<div class="clear"></div>';
272 272
 			echo '</div>';
273 273
 		}
@@ -280,16 +280,16 @@  discard block
 block discarded – undo
280 280
 	 * Add a notice to be displayed in the admin.
281 281
 	 * @param array $notice Array with `class` and `message` keys. The message is not escaped.
282 282
 	 */
283
-	public static function add_notice( $notice = array() ) {
283
+	public static function add_notice($notice = array()) {
284 284
 
285
-		if( is_array( $notice ) && !isset( $notice['message'] ) ) {
286
-			do_action( 'gravityview_log_error', __CLASS__.'[add_notice] Notice not set', $notice );
285
+		if (is_array($notice) && !isset($notice['message'])) {
286
+			do_action('gravityview_log_error', __CLASS__.'[add_notice] Notice not set', $notice);
287 287
 			return;
288
-		} else if( is_string( $notice ) ) {
289
-			$notice = array( 'message' => $notice );
288
+		} else if (is_string($notice)) {
289
+			$notice = array('message' => $notice);
290 290
 		}
291 291
 
292
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
292
+		$notice['class'] = empty($notice['class']) ? 'error' : $notice['class'];
293 293
 
294 294
 		self::$admin_notices[] = $notice;
295 295
 	}
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	 * @param  int $post_id Post ID
305 305
 	 * @return void
306 306
 	 */
307
-	public function save_post( $post_id ) {}
307
+	public function save_post($post_id) {}
308 308
 
309 309
 	/**
310 310
 	 * Add tooltips for the extension.
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 * @param  array  $tooltips Existing GV tooltips, with `title` and `value` keys
324 324
 	 * @return array           Modified tooltips
325 325
 	 */
326
-	public function tooltips( $tooltips = array() ) {
326
+	public function tooltips($tooltips = array()) {
327 327
 
328 328
 		return $tooltips;
329 329
 
@@ -346,17 +346,17 @@  discard block
 block discarded – undo
346 346
 
347 347
 		$message = '';
348 348
 
349
-		if( !class_exists( 'GravityView_Plugin' ) ) {
349
+		if (!class_exists('GravityView_Plugin')) {
350 350
 
351
-			$message = sprintf( __('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title );
351
+			$message = sprintf(__('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title);
352 352
 
353
-		} else if( false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version , ">=") ) {
353
+		} else if (false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version, ">=")) {
354 354
 
355
-			$message = sprintf( __('The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_gravityview_version.'</tt>' );
355
+			$message = sprintf(__('The %s Extension requires GravityView Version %s or newer.', 'gravityview'), $this->_title, '<tt>'.$this->_min_gravityview_version.'</tt>');
356 356
 
357
-		} else if( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=") ) {
357
+		} else if (isset($this->_min_php_version) && false === version_compare(phpversion(), $this->_min_php_version, ">=")) {
358 358
 
359
-			$message = sprintf( __('The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_php_version.'</tt>' );
359
+			$message = sprintf(__('The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview'), $this->_title, '<tt>'.$this->_min_php_version.'</tt>');
360 360
 
361 361
 		} else {
362 362
 
@@ -364,11 +364,11 @@  discard block
 block discarded – undo
364 364
 
365 365
 		}
366 366
 
367
-		if ( ! empty( $message ) ) {
367
+		if (!empty($message)) {
368 368
 
369
-			self::add_notice( $message );
369
+			self::add_notice($message);
370 370
 
371
-			do_action( 'gravityview_log_error', __METHOD__. ' ' . $message );
371
+			do_action('gravityview_log_error', __METHOD__.' '.$message);
372 372
 
373 373
 			self::$is_compatible = false;
374 374
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -183,12 +183,10 @@
 block discarded – undo
183 183
 		if ( file_exists( $mofile_global ) ) {
184 184
 			// Look in global /wp-content/languages/[plugin-dir]/ folder
185 185
 			load_textdomain( $this->_text_domain, $mofile_global );
186
-		}
187
-		elseif ( file_exists( $mofile_local ) ) {
186
+		} elseif ( file_exists( $mofile_local ) ) {
188 187
 			// Look in local /wp-content/plugins/[plugin-dir]/languages/ folder
189 188
 			load_textdomain( $this->_text_domain, $mofile_local );
190
-		}
191
-		else {
189
+		} else {
192 190
 			// Load the default language files
193 191
 			load_plugin_textdomain( $this->_text_domain, false, $lang_dir );
194 192
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-merge-tags.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
 	 * @param bool $url_encode Whether to URL-encode output
136 136
 	 * @param bool $esc_html Whether to apply `esc_html()` to output
137 137
 	 *
138
-	 * @return mixed
138
+	 * @return string
139 139
 	 */
140 140
 	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
141 141
 
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	private function add_hooks() {
21 21
 
22
-		add_filter( 'gform_custom_merge_tags', array( $this, '_gform_custom_merge_tags' ), 10, 4 );
22
+		add_filter('gform_custom_merge_tags', array($this, '_gform_custom_merge_tags'), 10, 4);
23 23
 
24 24
 		/** @see GFCommon::replace_variables_prepopulate **/
25
-		add_filter( 'gform_replace_merge_tags', array( 'GravityView_Merge_Tags', 'replace_gv_merge_tags' ), 10, 7 );
25
+		add_filter('gform_replace_merge_tags', array('GravityView_Merge_Tags', 'replace_gv_merge_tags'), 10, 7);
26 26
 
27 27
 	}
28 28
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param  bool       $esc_html     Pass return value through `esc_html()`
44 44
 	 * @return string                  Text with variables maybe replaced
45 45
 	 */
46
-	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
46
+	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true) {
47 47
 
48 48
 		/**
49 49
 		 * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 		 * @param[in]  array      $form        GF Form array
56 56
 		 * @param[in]  array      $entry        GF Entry array
57 57
 		 */
58
-		$do_replace_variables = apply_filters( 'gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry );
58
+		$do_replace_variables = apply_filters('gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry);
59 59
 
60
-		if ( strpos( $text, '{' ) === false || ! $do_replace_variables ) {
60
+		if (strpos($text, '{') === false || !$do_replace_variables) {
61 61
 			return $text;
62 62
 		}
63 63
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 		 *
67 67
 		 * @internal Reported to GF Support on 12/3
68 68
 		 */
69
-		$form['title'] = isset( $form['title'] ) ? $form['title'] : '';
70
-		$form['id']    = isset( $form['id'] ) ? $form['id'] : '';
69
+		$form['title'] = isset($form['title']) ? $form['title'] : '';
70
+		$form['id']    = isset($form['id']) ? $form['id'] : '';
71 71
 
72
-		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
72
+		return GFCommon::replace_variables($text, $form, $entry, $url_encode, $esc_html);
73 73
 	}
74 74
 
75 75
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return array Modified merge tags
86 86
 	 */
87
-	public function _gform_custom_merge_tags( $existing_merge_tags = array(), $form_id, $fields = array(), $element_id = '' ) {
87
+	public function _gform_custom_merge_tags($existing_merge_tags = array(), $form_id, $fields = array(), $element_id = '') {
88 88
 
89 89
 		$created_by_merge_tags = array(
90 90
 			array(
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		);
111 111
 
112 112
 		//return the form object from the php hook
113
-		return array_merge( $existing_merge_tags, $created_by_merge_tags );
113
+		return array_merge($existing_merge_tags, $created_by_merge_tags);
114 114
 	}
115 115
 
116 116
 	/**
@@ -128,21 +128,21 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return mixed
130 130
 	 */
131
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
131
+	public static function replace_gv_merge_tags($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
132 132
 
133 133
 		/**
134 134
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
135 135
 		 * @see GFCommon::replace_variables()
136 136
 		 * @see GFCommon::replace_variables_prepopulate()
137 137
 		 */
138
-		if( false === $form ) {
138
+		if (false === $form) {
139 139
 			return $text;
140 140
 		}
141 141
 
142
-		$text = self::replace_get_variables( $text, $form, $entry, $url_encode );
142
+		$text = self::replace_get_variables($text, $form, $entry, $url_encode);
143 143
 
144 144
 		// Process the merge vars here
145
-		$text = self::replace_user_variables_created_by( $text, $form, $entry, $url_encode, $esc_html );
145
+		$text = self::replace_user_variables_created_by($text, $form, $entry, $url_encode, $esc_html);
146 146
 
147 147
 		return $text;
148 148
 	}
@@ -168,22 +168,22 @@  discard block
 block discarded – undo
168 168
 	 * @param array $entry Entry array
169 169
 	 * @param bool $url_encode Whether to URL-encode output
170 170
 	 */
171
-	public static function replace_get_variables( $text, $form = array(), $entry = array(), $url_encode = false ) {
171
+	public static function replace_get_variables($text, $form = array(), $entry = array(), $url_encode = false) {
172 172
 
173 173
 		// Is there is {get:[xyz]} merge tag?
174
-		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
174
+		preg_match_all("/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER);
175 175
 
176 176
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
177
-		if( empty( $matches ) ) {
177
+		if (empty($matches)) {
178 178
 			return $text;
179 179
 		}
180 180
 
181
-		foreach ( $matches as $match ) {
181
+		foreach ($matches as $match) {
182 182
 
183 183
 			$full_tag = $match[0];
184 184
 			$property = $match[1];
185 185
 
186
-			$value = stripslashes_deep( rgget( $property ) );
186
+			$value = stripslashes_deep(rgget($property));
187 187
 
188 188
 			/**
189 189
 			 * @filter `gravityview/merge_tags/get/glue/` Modify the glue used to convert an array of `{get}` values from an array to string
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 			 * @param[in,out] string $glue String used to `implode()` $_GET values Default: ', '
192 192
 			 * @param[in] string $property The current name of the $_GET parameter being combined
193 193
 			 */
194
-			$glue = apply_filters( 'gravityview/merge_tags/get/glue/', ', ', $property );
194
+			$glue = apply_filters('gravityview/merge_tags/get/glue/', ', ', $property);
195 195
 
196
-			$value = is_array( $value ) ? implode( $glue, $value ) : $value;
196
+			$value = is_array($value) ? implode($glue, $value) : $value;
197 197
 
198
-			$value = $url_encode ? urlencode( $value ) : $value;
198
+			$value = $url_encode ? urlencode($value) : $value;
199 199
 
200 200
 			/**
201 201
 			 * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Disable esc_html() from running on `{get}` merge tag
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 			 * @since 1.15
206 206
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
207 207
 			 */
208
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
208
+			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/'.$property, true);
209 209
 
210
-			$value = $esc_html ? esc_html( $value ) : $value;
210
+			$value = $esc_html ? esc_html($value) : $value;
211 211
 
212 212
 			/**
213 213
 			 * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Modify the value of the `{get}` replacement before being used
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 			 * @param[in] array $form Gravity Forms form array
217 217
 			 * @param[in] array $entry Entry array
218 218
 			 */
219
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
219
+			$value = apply_filters('gravityview/merge_tags/get/value/'.$property, $value, $text, $form, $entry);
220 220
 
221
-			$text = str_replace( $full_tag, $value, $text );
221
+			$text = str_replace($full_tag, $value, $text);
222 222
 		}
223 223
 
224
-		unset( $value, $glue, $matches );
224
+		unset($value, $glue, $matches);
225 225
 
226 226
 		return $text;
227 227
 	}
@@ -242,41 +242,41 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return string Text, with user variables replaced, if they existed
244 244
 	 */
245
-	private static function replace_user_variables_created_by( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
245
+	private static function replace_user_variables_created_by($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
246 246
 
247 247
 		// Is there is {created_by:[xyz]} merge tag?
248
-		preg_match_all( "/\{created_by:(.*?)\}/", $text, $matches, PREG_SET_ORDER );
248
+		preg_match_all("/\{created_by:(.*?)\}/", $text, $matches, PREG_SET_ORDER);
249 249
 
250 250
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
251
-		if( empty( $matches ) || empty( $entry['created_by'] ) ) {
251
+		if (empty($matches) || empty($entry['created_by'])) {
252 252
 			return $text;
253 253
 		}
254 254
 
255 255
 		// Get the creator of the entry
256
-		$entry_creator = new WP_User( $entry['created_by'] );
256
+		$entry_creator = new WP_User($entry['created_by']);
257 257
 
258
-		foreach ( $matches as $match ) {
258
+		foreach ($matches as $match) {
259 259
 
260 260
 			$full_tag = $match[0];
261 261
 			$property = $match[1];
262 262
 
263
-			switch( $property ) {
263
+			switch ($property) {
264 264
 				/** @since 1.13.2 */
265 265
 				case 'roles':
266
-					$value = implode( ', ', $entry_creator->roles );
266
+					$value = implode(', ', $entry_creator->roles);
267 267
 					break;
268 268
 				default:
269
-					$value = $entry_creator->get( $property );
269
+					$value = $entry_creator->get($property);
270 270
 			}
271 271
 
272
-			$value = $url_encode ? urlencode( $value ) : $value;
272
+			$value = $url_encode ? urlencode($value) : $value;
273 273
 
274
-			$value = $esc_html ? esc_html( $value ) : $value;
274
+			$value = $esc_html ? esc_html($value) : $value;
275 275
 
276
-			$text = str_replace( $full_tag, $value, $text );
276
+			$text = str_replace($full_tag, $value, $text);
277 277
 		}
278 278
 
279
-		unset( $entry_creator );
279
+		unset($entry_creator);
280 280
 
281 281
 		return $text;
282 282
 	}
Please login to merge, or discard this patch.
includes/class-gravityview-roles-capabilities.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,6 @@
 block discarded – undo
67 67
 	 *
68 68
 	 * @since 1.15
69 69
 	 *
70
-	 * @param array   $allcaps An array of all the user's capabilities.
71 70
 	 * @param array   $caps    Actual capabilities for meta capability.
72 71
 	 * @param array   $args    Optional parameters passed to has_cap(), typically object ID.
73 72
 	 * @param WP_User|null $user    The user object, in WordPress 3.7.0 or higher
Please login to merge, or discard this patch.
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+		add_action( 'admin_init', array( $this, 'add_caps') );
60 60
 	}
61 61
 
62 62
 
@@ -360,7 +360,6 @@  discard block
 block discarded – undo
360 360
 	 * Add Gravity Forms and GravityView's "full access" caps when any other caps are checked against.
361 361
 	 *
362 362
 	 * @since 1.15
363
-
364 363
 	 * @param array $caps_to_check
365 364
 	 *
366 365
 	 * @return array
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-defined( 'ABSPATH' ) || exit;
14
+defined('ABSPATH') || exit;
15 15
 
16 16
 /**
17 17
  * GravityView Roles Class
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 
36
-		if( ! self::$instance ) {
36
+		if (!self::$instance) {
37 37
 			self::$instance = new self;
38 38
 		}
39 39
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 * @since 1.15
54 54
 	 */
55 55
 	private function add_hooks() {
56
-		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57
-		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58
-		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
56
+		add_filter('members_get_capabilities', array('GravityView_Roles_Capabilities', 'merge_with_all_caps'));
57
+		add_action('members_register_cap_groups', array($this, 'members_register_cap_group'), 20);
58
+		add_filter('user_has_cap', array($this, 'filter_user_has_cap'), 10, 4);
59
+        add_action('admin_init', array($this, 'add_caps'));
60 60
 	}
61 61
 
62 62
 
@@ -74,28 +74,28 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return mixed
76 76
 	 */
77
-	public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) {
77
+	public function filter_user_has_cap($usercaps = array(), $caps = array(), $args = array(), $user = NULL) {
78 78
 
79 79
 		// Empty caps_to_check array
80
-		if( ! $usercaps || ! $caps ) {
80
+		if (!$usercaps || !$caps) {
81 81
 			return $usercaps;
82 82
 		}
83 83
 
84 84
 		/**
85 85
 		 * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled
86 86
 		 */
87
-		if( ! empty( $usercaps['gravityview_full_access'] ) ) {
87
+		if (!empty($usercaps['gravityview_full_access'])) {
88 88
 
89 89
 			$all_gravityview_caps = self::all_caps();
90 90
 
91
-			foreach( $all_gravityview_caps as $gv_cap ) {
92
-				$usercaps[ $gv_cap ] = true;
91
+			foreach ($all_gravityview_caps as $gv_cap) {
92
+				$usercaps[$gv_cap] = true;
93 93
 			}
94 94
 
95
-			unset( $all_gravityview_caps );
95
+			unset($all_gravityview_caps);
96 96
 		}
97 97
 
98
-		$usercaps = $this->add_gravity_forms_usercaps_to_gravityview_caps( $usercaps );
98
+		$usercaps = $this->add_gravity_forms_usercaps_to_gravityview_caps($usercaps);
99 99
 
100 100
 		return $usercaps;
101 101
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return array
116 116
 	 */
117
-	private function add_gravity_forms_usercaps_to_gravityview_caps( $usercaps ) {
117
+	private function add_gravity_forms_usercaps_to_gravityview_caps($usercaps) {
118 118
 
119 119
 		$gf_to_gv_caps = array(
120 120
 			'gravityforms_edit_entries'     => 'gravityview_edit_others_entries',
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 			'gravityforms_edit_entry_notes' => 'gravityview_edit_others_entry_notes',
123 123
 		);
124 124
 
125
-		foreach ( $gf_to_gv_caps as $gf_cap => $gv_cap ) {
126
-			if ( isset( $usercaps[ $gf_cap ] ) && ! isset( $usercaps[ $gv_cap ] ) ) {
127
-				$usercaps[ $gv_cap ] = $usercaps[ $gf_cap ];
125
+		foreach ($gf_to_gv_caps as $gf_cap => $gv_cap) {
126
+			if (isset($usercaps[$gf_cap]) && !isset($usercaps[$gv_cap])) {
127
+				$usercaps[$gv_cap] = $usercaps[$gf_cap];
128 128
 			}
129 129
 		}
130 130
 
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
138 138
 	 * @return void
139 139
 	 */
140 140
 	function members_register_cap_group() {
141
-		if ( function_exists( 'members_register_cap_group' ) ) {
141
+		if (function_exists('members_register_cap_group')) {
142 142
 
143 143
 			$args = array(
144
-				'label'         => __( 'GravityView', 'gravityview' ),
144
+				'label'         => __('GravityView', 'gravityview'),
145 145
 				'icon'          => 'gv-icon-astronaut-head',
146 146
 				'caps'          => self::all_caps(),
147 147
 				'merge_added'   => true,
148 148
 				'diff_added'    => false,
149 149
 			);
150 150
 
151
-			members_register_cap_group( 'gravityview', $args );
151
+			members_register_cap_group('gravityview', $args);
152 152
 		}
153 153
 	}
154 154
 
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 * @param array $caps Existing capabilities
160 160
 	 * @return array Modified capabilities array
161 161
 	 */
162
-	public static function merge_with_all_caps( $caps ) {
162
+	public static function merge_with_all_caps($caps) {
163 163
 
164
-		$return_caps = array_merge( $caps, self::all_caps() );
164
+		$return_caps = array_merge($caps, self::all_caps());
165 165
 
166
-		return array_unique( $return_caps );
166
+		return array_unique($return_caps);
167 167
 	}
168 168
 
169 169
 	/**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	private function wp_roles() {
179 179
 		global $wp_roles;
180 180
 
181
-		if ( ! isset( $wp_roles ) ) {
181
+		if (!isset($wp_roles)) {
182 182
 			$wp_roles = new WP_Roles();
183 183
 		}
184 184
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$wp_roles = $this->wp_roles();
198 198
 
199
-		if ( is_object( $wp_roles ) ) {
199
+		if (is_object($wp_roles)) {
200 200
 
201 201
 			$_use_db_backup = $wp_roles->use_db;
202 202
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 			 */
207 207
 			$wp_roles->use_db = false;
208 208
 
209
-			$capabilities = self::all_caps( false, false );
209
+			$capabilities = self::all_caps(false, false);
210 210
 
211
-			foreach ( $capabilities as $role_slug => $role_caps ) {
212
-				foreach ( $role_caps as $cap ) {
213
-					$wp_roles->add_cap( $role_slug, $cap );
211
+			foreach ($capabilities as $role_slug => $role_caps) {
212
+				foreach ($role_caps as $cap) {
213
+					$wp_roles->add_cap($role_slug, $cap);
214 214
 				}
215 215
 			}
216 216
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			 *
220 220
 			 * @see WP_Roles::add_cap() Original code
221 221
 			 */
222
-			update_option( $wp_roles->role_key, $wp_roles->roles );
222
+			update_option($wp_roles->role_key, $wp_roles->roles);
223 223
 
224 224
 			/**
225 225
 			 * Restore previous $use_db setting
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return array If $role is set, flat array of caps_to_check. Otherwise, a multi-dimensional array of roles and their caps_to_check with the following keys: 'administrator', 'editor', 'author', 'contributor', 'subscriber'
242 242
 	 */
243
-	public static function all_caps( $single_role = false, $flat_array = true ) {
243
+	public static function all_caps($single_role = false, $flat_array = true) {
244 244
 
245 245
 		// Change settings
246 246
 		$administrator_caps = array(
@@ -297,20 +297,20 @@  discard block
 block discarded – undo
297 297
 		);
298 298
 
299 299
 		$subscriber = $subscriber_caps;
300
-		$contributor = array_merge( $contributor_caps, $subscriber_caps );
301
-		$author = array_merge( $author_caps, $contributor_caps, $subscriber_caps );
302
-		$editor = array_merge( $editor_caps, $author_caps, $contributor_caps, $subscriber_caps );
303
-		$administrator = array_merge( $administrator_caps, $editor_caps, $author_caps, $contributor_caps, $subscriber_caps );
300
+		$contributor = array_merge($contributor_caps, $subscriber_caps);
301
+		$author = array_merge($author_caps, $contributor_caps, $subscriber_caps);
302
+		$editor = array_merge($editor_caps, $author_caps, $contributor_caps, $subscriber_caps);
303
+		$administrator = array_merge($administrator_caps, $editor_caps, $author_caps, $contributor_caps, $subscriber_caps);
304 304
 		$all = $administrator;
305 305
 
306 306
 		// If role is set, return caps_to_check for just that role.
307
-		if( $single_role ) {
308
-			$caps = isset( ${$single_role} ) ? ${$single_role} : false;
309
-			return $flat_array ? $caps : array( $single_role => $caps );
307
+		if ($single_role) {
308
+			$caps = isset(${$single_role} ) ? ${$single_role} : false;
309
+			return $flat_array ? $caps : array($single_role => $caps);
310 310
 		}
311 311
 
312 312
 		// Otherwise, return multi-dimensional array of all caps_to_check
313
-		return $flat_array ? $all : compact( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
313
+		return $flat_array ? $all : compact('administrator', 'editor', 'author', 'contributor', 'subscriber');
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * @return bool True: user has at least one passed capability; False: user does not have any defined capabilities
332 332
 	 */
333
-	public static function has_cap( $caps_to_check = '', $object_id = null, $user_id = null ) {
333
+	public static function has_cap($caps_to_check = '', $object_id = null, $user_id = null) {
334 334
 
335 335
 		$has_cap = false;
336 336
 
337
-		if( empty( $caps_to_check ) ) {
337
+		if (empty($caps_to_check)) {
338 338
 			return $has_cap;
339 339
 		}
340 340
 
341 341
 		// Add full access caps for GV & GF
342
-		$caps_to_check = self::maybe_add_full_access_caps( $caps_to_check );
342
+		$caps_to_check = self::maybe_add_full_access_caps($caps_to_check);
343 343
 
344
-		foreach ( $caps_to_check as $cap ) {
345
-			if( ! is_null( $object_id ) ) {
346
-				$has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id );
344
+		foreach ($caps_to_check as $cap) {
345
+			if (!is_null($object_id)) {
346
+				$has_cap = $user_id ? user_can($user_id, $cap, $object_id) : current_user_can($cap, $object_id);
347 347
 			} else {
348
-				$has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap );
348
+				$has_cap = $user_id ? user_can($user_id, $cap) : current_user_can($cap);
349 349
 			}
350 350
 			// At the first successful response, stop checking
351
-			if( $has_cap ) {
351
+			if ($has_cap) {
352 352
 				break;
353 353
 			}
354 354
 		}
@@ -365,25 +365,25 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @return array
367 367
 	 */
368
-	public static function maybe_add_full_access_caps( $caps_to_check = array() ) {
368
+	public static function maybe_add_full_access_caps($caps_to_check = array()) {
369 369
 
370 370
 		$caps_to_check = (array)$caps_to_check;
371 371
 
372 372
 		$all_gravityview_caps = self::all_caps();
373 373
 
374 374
 		// Are there any $caps_to_check that are from GravityView?
375
-		if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
375
+		if ($has_gravityview_caps = array_intersect($caps_to_check, $all_gravityview_caps)) {
376 376
 			$caps_to_check[] = 'gravityview_full_access';
377 377
 		}
378 378
 
379
-		$all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array();
379
+		$all_gravity_forms_caps = class_exists('GFCommon') ? GFCommon::all_caps() : array();
380 380
 
381 381
 		// Are there any $caps_to_check that are from Gravity Forms?
382
-		if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
382
+		if ($all_gravity_forms_caps = array_intersect($caps_to_check, $all_gravity_forms_caps)) {
383 383
 			$caps_to_check[] = 'gform_full_access';
384 384
 		}
385 385
 
386
-		return array_unique( $caps_to_check );
386
+		return array_unique($caps_to_check);
387 387
 	}
388 388
 
389 389
 	/**
@@ -396,19 +396,19 @@  discard block
 block discarded – undo
396 396
 
397 397
 		$wp_roles = $this->wp_roles();
398 398
 
399
-		if ( is_object( $wp_roles ) ) {
399
+		if (is_object($wp_roles)) {
400 400
 
401 401
 			/** Remove all GravityView caps_to_check from all roles */
402 402
 			$capabilities = self::all_caps();
403 403
 
404 404
 			// Loop through each role and remove GV caps_to_check
405
-			foreach( $wp_roles->get_names() as $role_slug => $role_name ) {
406
-				foreach ( $capabilities as $cap ) {
407
-					$wp_roles->remove_cap( $role_slug, $cap );
405
+			foreach ($wp_roles->get_names() as $role_slug => $role_name) {
406
+				foreach ($capabilities as $cap) {
407
+					$wp_roles->remove_cap($role_slug, $cap);
408 408
 				}
409 409
 			}
410 410
 		}
411 411
 	}
412 412
 }
413 413
 
414
-add_action( 'init', array( 'GravityView_Roles_Capabilities', 'get_instance' ), 1 );
415 414
\ No newline at end of file
415
+add_action('init', array('GravityView_Roles_Capabilities', 'get_instance'), 1);
416 416
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-gravityview-template.php 2 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@  discard block
 block discarded – undo
37 37
 	public $active_areas;
38 38
 
39 39
 
40
+	/**
41
+	 * @param string $id
42
+	 */
40 43
 	function __construct( $id, $settings = array(), $field_options = array(), $areas = array() ) {
41 44
 
42 45
 		if ( empty( $id ) ) {
@@ -144,6 +147,9 @@  discard block
 block discarded – undo
144 147
 		return $areas;
145 148
 	}
146 149
 
150
+	/**
151
+	 * @param string $context
152
+	 */
147 153
 	public function get_active_areas( $context ) {
148 154
 		if ( isset( $this->active_areas[ $context ] ) ) {
149 155
 			return $this->active_areas[ $context ];
@@ -156,8 +162,8 @@  discard block
 block discarded – undo
156 162
 	/**
157 163
 	 * Assign template specific field options
158 164
 	 *
159
-	 * @param array $options (default: array())
160
-	 * @param string $template (default: '')
165
+	 * @param array $field_options (default: array())
166
+	 * @param string $template_id (default: '')
161 167
 	 * @param string $field_id key for the field
162 168
 	 * @param  string|array $context Context for the field; `directory` or `single` for example.
163 169
 	 *
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 	public $active_areas;
38 38
 
39 39
 
40
-	function __construct( $id, $settings = array(), $field_options = array(), $areas = array() ) {
40
+	function __construct($id, $settings = array(), $field_options = array(), $areas = array()) {
41 41
 
42
-		if ( empty( $id ) ) {
42
+		if (empty($id)) {
43 43
 			return;
44 44
 		}
45 45
 
46 46
 		$this->template_id = $id;
47 47
 
48
-		$this->merge_defaults( $settings );
48
+		$this->merge_defaults($settings);
49 49
 
50 50
 		$this->field_options = $field_options;
51 51
 		$this->active_areas  = $areas;
@@ -60,25 +60,25 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	private function add_hooks() {
62 62
 
63
-		add_filter( 'gravityview_register_directory_template', array( $this, 'register_template' ) );
63
+		add_filter('gravityview_register_directory_template', array($this, 'register_template'));
64 64
 
65 65
 		// presets hooks:
66 66
 		// form xml
67
-		add_filter( 'gravityview_template_formxml', array( $this, 'assign_form_xml' ), 10, 2 );
67
+		add_filter('gravityview_template_formxml', array($this, 'assign_form_xml'), 10, 2);
68 68
 		// fields config xml
69
-		add_filter( 'gravityview_template_fieldsxml', array( $this, 'assign_fields_xml' ), 10, 2 );
69
+		add_filter('gravityview_template_fieldsxml', array($this, 'assign_fields_xml'), 10, 2);
70 70
 
71 71
 		// assign active areas
72
-		add_filter( 'gravityview_template_active_areas', array( $this, 'assign_active_areas' ), 10, 3 );
72
+		add_filter('gravityview_template_active_areas', array($this, 'assign_active_areas'), 10, 3);
73 73
 
74 74
 		// field options
75
-		add_filter( 'gravityview_template_field_options', array( $this, 'assign_field_options' ), 10, 4 );
75
+		add_filter('gravityview_template_field_options', array($this, 'assign_field_options'), 10, 4);
76 76
 
77 77
 		// template slug
78
-		add_filter( "gravityview_template_slug_{$this->template_id}", array( $this, 'assign_view_slug' ), 10, 2 );
78
+		add_filter("gravityview_template_slug_{$this->template_id}", array($this, 'assign_view_slug'), 10, 2);
79 79
 
80 80
 		// register template CSS
81
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) );
81
+		add_action('wp_enqueue_scripts', array($this, 'register_styles'));
82 82
 	}
83 83
 
84 84
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return array                Merged template settings.
92 92
 	 */
93
-	private function merge_defaults( $settings = array() ) {
93
+	private function merge_defaults($settings = array()) {
94 94
 
95 95
 		$defaults = array(
96 96
 			'slug'          => '',
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			'preset_fields' => ''
106 106
 		);
107 107
 
108
-		$this->settings = wp_parse_args( $settings, $defaults );
108
+		$this->settings = wp_parse_args($settings, $defaults);
109 109
 
110 110
 		return $this->settings;
111 111
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return array Array of templates available for GV
121 121
 	 */
122
-	public function register_template( $templates ) {
123
-		$templates[ $this->template_id ] = $this->settings;
122
+	public function register_template($templates) {
123
+		$templates[$this->template_id] = $this->settings;
124 124
 
125 125
 		return $templates;
126 126
 	}
@@ -136,17 +136,17 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return array Array of active areas
138 138
 	 */
139
-	public function assign_active_areas( $areas, $template = '', $context = 'directory' ) {
140
-		if ( $this->template_id === $template ) {
141
-			$areas = $this->get_active_areas( $context );
139
+	public function assign_active_areas($areas, $template = '', $context = 'directory') {
140
+		if ($this->template_id === $template) {
141
+			$areas = $this->get_active_areas($context);
142 142
 		}
143 143
 
144 144
 		return $areas;
145 145
 	}
146 146
 
147
-	public function get_active_areas( $context ) {
148
-		if ( isset( $this->active_areas[ $context ] ) ) {
149
-			return $this->active_areas[ $context ];
147
+	public function get_active_areas($context) {
148
+		if (isset($this->active_areas[$context])) {
149
+			return $this->active_areas[$context];
150 150
 		} else {
151 151
 			return $this->active_areas;
152 152
 		}
@@ -163,21 +163,21 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return array Array of field options
165 165
 	 */
166
-	public function assign_field_options( $field_options, $template_id, $field_id = NULL, $context = 'directory' ) {
166
+	public function assign_field_options($field_options, $template_id, $field_id = NULL, $context = 'directory') {
167 167
 
168
-		if ( $this->template_id === $template_id ) {
168
+		if ($this->template_id === $template_id) {
169 169
 
170
-			foreach ( $this->field_options as $key => $field_option ) {
170
+			foreach ($this->field_options as $key => $field_option) {
171 171
 
172
-				$field_context = rgar( $field_option, 'context' );
172
+				$field_context = rgar($field_option, 'context');
173 173
 
174 174
 				// Does the field option only apply to a certain context?
175 175
 				// You can define multiple contexts as an array:  `context => array("directory", "single")`
176
-				$context_matches = is_array( $field_context ) ? in_array( $context, $field_context ) : $context === $field_context;
176
+				$context_matches = is_array($field_context) ? in_array($context, $field_context) : $context === $field_context;
177 177
 
178 178
 				// If the context matches (or isn't defined), add the field options.
179
-				if ( $context_matches ) {
180
-					$field_options[ $key ] = $field_option;
179
+				if ($context_matches) {
180
+					$field_options[$key] = $field_option;
181 181
 				}
182 182
 			}
183 183
 		}
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @see GravityView_Admin_Views::create_preset_form()
193 193
 	 * @return string                Path to XML file
194 194
 	 */
195
-	public function assign_form_xml( $xml = '', $template = '' ) {
196
-		if ( $this->settings['type'] === 'preset' && ! empty( $this->settings['preset_form'] ) && $this->template_id === $template ) {
195
+	public function assign_form_xml($xml = '', $template = '') {
196
+		if ($this->settings['type'] === 'preset' && !empty($this->settings['preset_form']) && $this->template_id === $template) {
197 197
 			return $this->settings['preset_form'];
198 198
 		}
199 199
 
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 * @see GravityView_Admin_Views::pre_get_form_fields()
207 207
 	 * @return string                Path to XML file
208 208
 	 */
209
-	public function assign_fields_xml( $xml = '', $template = '' ) {
210
-		if ( $this->settings['type'] === 'preset' && ! empty( $this->settings['preset_fields'] ) && $this->template_id === $template ) {
209
+	public function assign_fields_xml($xml = '', $template = '') {
210
+		if ($this->settings['type'] === 'preset' && !empty($this->settings['preset_fields']) && $this->template_id === $template) {
211 211
 			return $this->settings['preset_fields'];
212 212
 		}
213 213
 
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return string
226 226
 	 */
227
-	public function assign_view_slug( $default, $context ) {
227
+	public function assign_view_slug($default, $context) {
228 228
 
229
-		if ( ! empty( $this->settings['slug'] ) ) {
229
+		if (!empty($this->settings['slug'])) {
230 230
 			return $this->settings['slug'];
231 231
 		}
232
-		if ( ! empty( $default ) ) {
232
+		if (!empty($default)) {
233 233
 			return $default;
234 234
 		}
235 235
 
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 	 * @return void
245 245
 	 */
246 246
 	public function register_styles() {
247
-		if ( ! empty( $this->settings['css_source'] ) ) {
248
-			wp_register_style( 'gravityview_style_' . $this->template_id, $this->settings['css_source'], array(), GravityView_Plugin::version, 'all' );
247
+		if (!empty($this->settings['css_source'])) {
248
+			wp_register_style('gravityview_style_'.$this->template_id, $this->settings['css_source'], array(), GravityView_Plugin::version, 'all');
249 249
 		}
250 250
 	}
251 251
 
Please login to merge, or discard this patch.
includes/class-gv-license-handler.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,6 +53,9 @@  discard block
 block discarded – undo
53 53
 		add_action( 'wp_ajax_gravityview_license', array( $this, 'license_call' ) );
54 54
 	}
55 55
 
56
+	/**
57
+	 * @param boolean $echo
58
+	 */
56 59
 	function settings_edd_license_activation( $field, $echo ) {
57 60
 
58 61
 		wp_enqueue_script( 'gv-admin-edd-license', GRAVITYVIEW_URL . 'assets/js/admin-edd-license.js', array( 'jquery' ) );
@@ -241,7 +244,7 @@  discard block
 block discarded – undo
241 244
 	 * Generate the status message box HTML based on the current status
242 245
 	 *
243 246
 	 * @since 1.7.4
244
-	 * @param $message
247
+	 * @param string $message
245 248
 	 * @param string $class
246 249
 	 *
247 250
 	 * @return string
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -340,7 +340,7 @@
 block discarded – undo
340 340
 		// Update option with passed data license
341 341
 		$settings = $this->Addon->get_app_settings();
342 342
 
343
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
343
+		$settings['license_key'] = $license_data->license_key = trim( $data['license'] );
344 344
 		$settings['license_key_status'] = $license_data->license;
345 345
 		$settings['license_key_response'] = (array)$license_data;
346 346
 
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return GV_License_Handler
35 35
 	 */
36
-	public static function get_instance( GravityView_Settings $GFAddOn ) {
37
-		if( empty( self::$instance ) ) {
38
-			self::$instance = new self( $GFAddOn );
36
+	public static function get_instance(GravityView_Settings $GFAddOn) {
37
+		if (empty(self::$instance)) {
38
+			self::$instance = new self($GFAddOn);
39 39
 		}
40 40
 		return self::$instance;
41 41
 	}
42 42
 	
43
-	private function __construct( GravityView_Settings $GFAddOn ) {
43
+	private function __construct(GravityView_Settings $GFAddOn) {
44 44
 
45 45
 		$this->Addon = $GFAddOn;
46 46
 
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	private function add_hooks() {
53
-		add_action( 'wp_ajax_gravityview_license', array( $this, 'license_call' ) );
53
+		add_action('wp_ajax_gravityview_license', array($this, 'license_call'));
54 54
 	}
55 55
 
56
-	function settings_edd_license_activation( $field, $echo ) {
56
+	function settings_edd_license_activation($field, $echo) {
57 57
 
58
-		wp_enqueue_script( 'gv-admin-edd-license', GRAVITYVIEW_URL . 'assets/js/admin-edd-license.js', array( 'jquery' ) );
58
+		wp_enqueue_script('gv-admin-edd-license', GRAVITYVIEW_URL.'assets/js/admin-edd-license.js', array('jquery'));
59 59
 
60
-		$status = trim( $this->Addon->get_app_setting( 'license_key_status' ) );
61
-		$key = trim( $this->Addon->get_app_setting( 'license_key' ) );
60
+		$status = trim($this->Addon->get_app_setting('license_key_status'));
61
+		$key = trim($this->Addon->get_app_setting('license_key'));
62 62
 
63
-		if( !empty( $key ) ) {
64
-			$response = $this->Addon->get_app_setting( 'license_key_response' );
65
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
63
+		if (!empty($key)) {
64
+			$response = $this->Addon->get_app_setting('license_key_response');
65
+			$response = is_array($response) ? (object)$response : json_decode($response);
66 66
 		} else {
67 67
 			$response = array();
68 68
 		}
69 69
 
70
-		wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array(
71
-			'license_box' => $this->get_license_message( $response )
70
+		wp_localize_script('gv-admin-edd-license', 'GVGlobals', array(
71
+			'license_box' => $this->get_license_message($response)
72 72
 		));
73 73
 
74 74
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				'value' => __('Deactivate License', 'gravityview'),
86 86
 				'data-pending_text' => __('Deactivating license&hellip;', 'gravityview'),
87 87
 				'data-edd_action' => 'deactivate_license',
88
-				'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ),
88
+				'class' => (empty($status) ? 'button-primary hide' : 'button-primary'),
89 89
 			),
90 90
 			array(
91 91
 				'name'  => 'edd-check',
@@ -100,19 +100,19 @@  discard block
 block discarded – undo
100 100
 
101 101
 		$class = 'button gv-edd-action';
102 102
 
103
-		$class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
103
+		$class .= (!empty($key) && $status !== 'valid') ? '' : ' hide';
104 104
 
105
-		$disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled';
105
+		$disabled_attribute = GVCommon::has_cap('gravityview_edit_settings') ? false : 'disabled';
106 106
 
107 107
 		$submit = '<div class="gv-edd-button-wrapper">';
108
-		foreach ( $fields as $field ) {
108
+		foreach ($fields as $field) {
109 109
 			$field['type'] = 'button';
110
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
110
+			$field['class'] = isset($field['class']) ? $field['class'].' '.$class : $class;
111 111
 			$field['style'] = 'margin-left: 10px;';
112
-			if( $disabled_attribute ) {
112
+			if ($disabled_attribute) {
113 113
 				$field['disabled'] = $disabled_attribute;
114 114
 			}
115
-			$submit .= $this->Addon->settings_submit( $field, $echo );
115
+			$submit .= $this->Addon->settings_submit($field, $echo);
116 116
 		}
117 117
 		$submit .= '</div>';
118 118
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	private function setup_edd() {
128 128
 
129
-		if( !class_exists('EDD_SL_Plugin_Updater') ) {
130
-			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php');
129
+		if (!class_exists('EDD_SL_Plugin_Updater')) {
130
+			require_once(GRAVITYVIEW_DIR.'includes/lib/EDD_SL_Plugin_Updater.php');
131 131
 		}
132 132
 
133 133
 		// setup the updater
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return array
151 151
 	 */
152
-	function _get_edd_settings( $action = '', $license = '' ) {
152
+	function _get_edd_settings($action = '', $license = '') {
153 153
 
154 154
 		// retrieve our license key from the DB
155
-		$license_key = empty( $license ) ? trim( $this->Addon->get_app_setting( 'license_key' ) ) : $license;
155
+		$license_key = empty($license) ? trim($this->Addon->get_app_setting('license_key')) : $license;
156 156
 
157 157
 		$settings = array(
158 158
 			'version'   => self::version,
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 			'url'       => home_url(),
164 164
 		);
165 165
 
166
-		if( !empty( $action ) ) {
167
-			$settings['edd_action'] = esc_attr( $action );
166
+		if (!empty($action)) {
167
+			$settings['edd_action'] = esc_attr($action);
168 168
 		}
169 169
 
170
-		$settings = array_map( 'urlencode', $settings );
170
+		$settings = array_map('urlencode', $settings);
171 171
 
172 172
 		return $settings;
173 173
 	}
@@ -176,27 +176,27 @@  discard block
 block discarded – undo
176 176
 	 * Perform the call
177 177
 	 * @return array|WP_Error
178 178
 	 */
179
-	private function _license_get_remote_response( $data, $license = '' ) {
179
+	private function _license_get_remote_response($data, $license = '') {
180 180
 
181
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
181
+		$api_params = $this->_get_edd_settings($data['edd_action'], $license);
182 182
 
183
-		$url = add_query_arg( $api_params, self::url );
183
+		$url = add_query_arg($api_params, self::url);
184 184
 
185
-		$response = wp_remote_get( $url, array(
185
+		$response = wp_remote_get($url, array(
186 186
 			'timeout'   => 15,
187 187
 			'sslverify' => false,
188 188
 		));
189 189
 
190
-		if ( is_wp_error( $response ) ) {
190
+		if (is_wp_error($response)) {
191 191
 			return array();
192 192
 		}
193 193
 
194
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
194
+		$license_data = json_decode(wp_remote_retrieve_body($response));
195 195
 
196 196
 		// Not JSON
197
-		if ( empty( $license_data ) ) {
197
+		if (empty($license_data)) {
198 198
 
199
-			delete_transient( 'gravityview_' . esc_attr( $data['field_id'] ) . '_valid' );
199
+			delete_transient('gravityview_'.esc_attr($data['field_id']).'_valid');
200 200
 
201 201
 			// Change status
202 202
 			return array();
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return string
218 218
 	 */
219
-	function get_license_message( $license_data ) {
219
+	function get_license_message($license_data) {
220 220
 
221
-		if( empty( $license_data ) ) {
221
+		if (empty($license_data)) {
222 222
 			$class = 'hide';
223 223
 			$message = '';
224 224
 		} else {
225 225
 
226
-			if( ! empty( $license_data->error ) ) {
226
+			if (!empty($license_data->error)) {
227 227
 				$class = 'error';
228 228
 				$string_key = $license_data->error;
229 229
 			} else {
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 				$string_key = $license_data->license;
232 232
 			}
233 233
 
234
-			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) );
234
+			$message = sprintf('<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings($string_key, $license_data));
235 235
 		}
236 236
 
237
-		return $this->generate_license_box( $message, $class );
237
+		return $this->generate_license_box($message, $class);
238 238
 	}
239 239
 
240 240
 	/**
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @return string
248 248
 	 */
249
-	private function generate_license_box( $message, $class = '' ) {
249
+	private function generate_license_box($message, $class = '') {
250 250
 
251 251
 		$template = '<div id="gv-edd-status" class="gv-edd-message inline %s">%s</div>';
252 252
 
253
-		$output = sprintf( $template, esc_attr( $class ), $message );
253
+		$output = sprintf($template, esc_attr($class), $message);
254 254
 
255 255
 		return $output;
256 256
 	}
@@ -270,63 +270,63 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return mixed|string|void
272 272
 	 */
273
-	public function license_call( $array = array() ) {
273
+	public function license_call($array = array()) {
274 274
 
275
-		$is_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
276
-		$data = empty( $array ) ? $_POST['data'] : $array;
277
-		$has_cap = GVCommon::has_cap( 'gravityview_edit_settings' );
275
+		$is_ajax = (defined('DOING_AJAX') && DOING_AJAX);
276
+		$data = empty($array) ? $_POST['data'] : $array;
277
+		$has_cap = GVCommon::has_cap('gravityview_edit_settings');
278 278
 
279
-		if ( $is_ajax && empty( $data['license'] ) ) {
280
-			die( - 1 );
279
+		if ($is_ajax && empty($data['license'])) {
280
+			die( -1 );
281 281
 		}
282 282
 
283 283
 		// If the user isn't allowed to edit settings, show an error message
284
-		if( ! $has_cap ) {
284
+		if (!$has_cap) {
285 285
 			$license_data = new stdClass();
286 286
 			$license_data->error = 'capability';
287
-			$license_data->message = $this->get_license_message( $license_data );
288
-			$json = json_encode( $license_data );
287
+			$license_data->message = $this->get_license_message($license_data);
288
+			$json = json_encode($license_data);
289 289
 		} else {
290 290
 
291
-			$license      = esc_attr( rgget( 'license', $data ) );
292
-			$license_data = $this->_license_get_remote_response( $data, $license );
291
+			$license      = esc_attr(rgget('license', $data));
292
+			$license_data = $this->_license_get_remote_response($data, $license);
293 293
 
294 294
 			// Empty is returned when there's an error.
295
-			if ( empty( $license_data ) ) {
296
-				if ( $is_ajax ) {
297
-					exit( json_encode( array() ) );
295
+			if (empty($license_data)) {
296
+				if ($is_ajax) {
297
+					exit(json_encode(array()));
298 298
 				} else { // Non-ajax call
299
-					return json_encode( array() );
299
+					return json_encode(array());
300 300
 				}
301 301
 			}
302 302
 
303
-			$license_data->message = $this->get_license_message( $license_data );
303
+			$license_data->message = $this->get_license_message($license_data);
304 304
 
305
-			$json = json_encode( $license_data );
305
+			$json = json_encode($license_data);
306 306
 
307
-			$update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) );
307
+			$update_license = (!isset($data['update']) || !empty($data['update']));
308 308
 
309
-			$is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX );
309
+			$is_check_action_button = ('check_license' === $data['edd_action'] && defined('DOING_AJAX') && DOING_AJAX);
310 310
 
311 311
 			// Failed is the response from trying to de-activate a license and it didn't work.
312 312
 			// This likely happened because people entered in a different key and clicked "Deactivate",
313 313
 			// meaning to deactivate the original key. We don't want to save this response, since it is
314 314
 			// most likely a mistake.
315
-			if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) {
315
+			if ($license_data->license !== 'failed' && !$is_check_action_button && $update_license) {
316 316
 
317
-				if ( ! empty( $data['field_id'] ) ) {
318
-					set_transient( 'gravityview_' . esc_attr( $data['field_id'] ) . '_valid', $license_data, DAY_IN_SECONDS );
317
+				if (!empty($data['field_id'])) {
318
+					set_transient('gravityview_'.esc_attr($data['field_id']).'_valid', $license_data, DAY_IN_SECONDS);
319 319
 				}
320 320
 
321
-				$this->license_call_update_settings( $license_data, $data );
321
+				$this->license_call_update_settings($license_data, $data);
322 322
 
323 323
 			}
324 324
 		} // End $has_cap
325 325
 
326
-		if ( $is_ajax ) {
327
-			exit( $json );
326
+		if ($is_ajax) {
327
+			exit($json);
328 328
 		} else { // Non-ajax call
329
-			return ( rgget('format', $data ) === 'object' ) ? $license_data : $json;
329
+			return (rgget('format', $data) === 'object') ? $license_data : $json;
330 330
 		}
331 331
 	}
332 332
 
@@ -335,16 +335,16 @@  discard block
 block discarded – undo
335 335
 	 * @param object $license_data
336 336
 	 * @return void
337 337
 	 */
338
-	private function license_call_update_settings( $license_data, $data ) {
338
+	private function license_call_update_settings($license_data, $data) {
339 339
 
340 340
 		// Update option with passed data license
341 341
 		$settings = $this->Addon->get_app_settings();
342 342
 
343
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
343
+        $settings['license_key'] = $license_data->license_key = trim($data['license']);
344 344
 		$settings['license_key_status'] = $license_data->license;
345 345
 		$settings['license_key_response'] = (array)$license_data;
346 346
 
347
-		$this->Addon->update_app_settings( $settings );
347
+		$this->Addon->update_app_settings($settings);
348 348
 	}
349 349
 
350 350
 	/**
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
 	 * @param  object|null $license_data Object with license data
354 354
 	 * @return string Renewal or account URL
355 355
 	 */
356
-	private function get_license_renewal_url( $license_data ) {
357
-		$renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation', $license_data->license_key ) : 'https://gravityview.co/account/';
356
+	private function get_license_renewal_url($license_data) {
357
+		$renew_license_url = (!empty($license_data) && !empty($license_data->license_key)) ? sprintf('https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation', $license_data->license_key) : 'https://gravityview.co/account/';
358 358
 		return $renew_license_url;
359 359
 	}
360 360
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @param  object|null $license_data Object with license data
365 365
 	 * @return array          Modified array of content
366 366
 	 */
367
-	public function strings( $status = NULL, $license_data = null ) {
367
+	public function strings($status = NULL, $license_data = null) {
368 368
 
369 369
 
370 370
 		$strings = array(
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 			'error' => esc_html__('There was an error processing the request.', 'gravityview'),
373 373
 			'failed'  => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'),
374 374
 			'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
375
-			'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
375
+			'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview').' '.sprintf(esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>'),
376 376
 			'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'),
377 377
 			'valid' => esc_html__('The license key is valid and active.', 'gravityview'),
378 378
 			'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'),
379 379
 			'missing' => esc_html__('The license key was not defined.', 'gravityview'),
380 380
 			'revoked' => esc_html__('This license key has been revoked.', 'gravityview'),
381
-			'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
382
-			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
381
+			'expired' => sprintf(esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'.esc_url($this->get_license_renewal_url($license_data)).'">', '</a>'),
382
+			'capability' => esc_html__('You don\'t have the ability to edit plugin settings.', 'gravityview'),
383 383
 
384 384
 			'verifying_license' => esc_html__('Verifying license&hellip;', 'gravityview'),
385 385
 			'activate_license' => esc_html__('Activate License', 'gravityview'),
@@ -387,33 +387,33 @@  discard block
 block discarded – undo
387 387
 			'check_license' => esc_html__('Verify License', 'gravityview'),
388 388
 		);
389 389
 
390
-		if( empty( $status ) ) {
390
+		if (empty($status)) {
391 391
 			return $strings;
392 392
 		}
393 393
 
394
-		if( isset( $strings[ $status ] ) ) {
395
-			return $strings[ $status ];
394
+		if (isset($strings[$status])) {
395
+			return $strings[$status];
396 396
 		}
397 397
 
398 398
 		return NULL;
399 399
 	}
400 400
 
401
-	public function validate_license_key( $value, $field ) {
401
+	public function validate_license_key($value, $field) {
402 402
 
403 403
 		// No license? No status.
404
-		if( empty( $value ) ) {
404
+		if (empty($value)) {
405 405
 			return NULL;
406 406
 		}
407 407
 
408 408
 		$response = $this->license_call(array(
409
-			'license' => $this->Addon->get_app_setting( 'license_key' ),
409
+			'license' => $this->Addon->get_app_setting('license_key'),
410 410
 			'edd_action' => 'check_license',
411 411
 			'field_id' => $field['name'],
412 412
 		));
413 413
 
414
-		$response = is_string( $response ) ? json_decode( $response, true ) : $response;
414
+		$response = is_string($response) ? json_decode($response, true) : $response;
415 415
 
416
-		switch( $response['license'] ) {
416
+		switch ($response['license']) {
417 417
 			case 'valid':
418 418
 				$return = true;
419 419
 				break;
Please login to merge, or discard this patch.