Completed
Pull Request — develop (#1360)
by Zack
26:19 queued 08:34
created
plugin-and-theme-hooks/class-gravityview-plugin-hooks-pageviews.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 		parent::add_hooks();
44 44
 
45
-		add_shortcode( 'gv_pageviews', array( $this, 'pageviews') );
45
+		add_shortcode( 'gv_pageviews', array( $this, 'pageviews' ) );
46 46
 
47 47
 		add_filter( 'gravityview/fields/custom/decode_shortcodes', array( $this, 'inject_entry_id' ), 10, 3 );
48 48
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * Used as sort of an action via the gravityview/fields/custom/decode_shortcodes filter.
69 69
 	 */
70 70
 	public function inject_entry_id( $r, $content, $context ) {
71
-		if ( ! empty( $context->entry['id'] ) ) {
72
-			$this->next_id = $context->entry['id'];
71
+		if ( ! empty( $context->entry[ 'id' ] ) ) {
72
+			$this->next_id = $context->entry[ 'id' ];
73 73
 		} else {
74 74
 			$this->next_id = false; // Nothing to look at, move along
75 75
 		}
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 			'id'        => $this->next_id,
98 98
 		), $atts );
99 99
 
100
-		if ( ! $this->atts['id'] ) {
100
+		if ( ! $this->atts[ 'id' ] ) {
101 101
 			return; // The ID was not set
102 102
 		}
103 103
 
104 104
 		add_filter( 'pageviews_placeholder_preload', array( $this, 'preload_callback' ) );
105 105
 
106
-		$output = Pageviews::placeholder( 'GV' . $this->atts['id'] ); // Prefix the ID to avoid collissions with default post IDs
106
+		$output = Pageviews::placeholder( 'GV' . $this->atts[ 'id' ] ); // Prefix the ID to avoid collissions with default post IDs
107 107
 
108 108
 		remove_filter( 'pageviews_placeholder_preload', array( $this, 'preload_callback' ) );
109 109
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * Set the preload text.
115 115
 	 */
116 116
 	public function preload_callback( $preload ) {
117
-		return $this->atts['preload'];
117
+		return $this->atts[ 'preload' ];
118 118
 	}
119 119
 
120 120
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function increment_callback() {
124 124
 		if ( $entry = gravityview()->request->is_entry() ) {
125
-			$increment = 'GV' . $entry['id'];
125
+			$increment = 'GV' . $entry[ 'id' ];
126 126
 			?>
127 127
 				_pv_config.incr = <?php echo json_encode( $increment ); ?>;
128 128
 			<?php
Please login to merge, or discard this patch.
includes/extensions/duplicate-entry/class-duplicate-entry.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -171,7 +171,6 @@
 block discarded – undo
171 171
 	 *
172 172
 	 * @since develop
173 173
 	 * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
174
-	 * @param  string      $field_type  Type of field options to render (`field` or `widget`)
175 174
 	 * @param  string      $template_id Table slug
176 175
 	 * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
177 176
 	 * @param  string      $context     What context are we in? Example: `single` or `directory`
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
238 238
 		self::getInstance()->set_entry( $entry );
239 239
 
240
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
240
+		$base = GravityView_API::directory_link( $post_id ? : $view_id, true );
241 241
 
242 242
 		if ( empty( $base ) ) {
243 243
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			'action'	=> 'duplicate',
252 252
 			'entry_id'	=> $entry_slug,
253 253
 			'gvid' => $view_id,
254
-            'view_id' => $view_id,
254
+			'view_id' => $view_id,
255 255
 		), $base );
256 256
 
257 257
 		$url = wp_nonce_url( $actionurl, 'duplicate_'.$entry_slug, 'duplicate' );
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 		 * @since develop
443 443
 		 * @param  array $duplicated_entry The duplicated entry
444 444
 		 * @param  array $entry The original entry
445
-		*/
445
+		 */
446 446
 		do_action( 'gravityview/duplicate-entry/duplicated', $duplicated_entry, $entry );
447 447
 
448 448
 		gravityview()->log->debug( 'Duplicate response: {duplicate_response}', array( 'duplicate_response' => $duplicate_response ) );
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 	function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
109 109
 
110 110
 		// Always a link, never a filter
111
-		unset( $field_options['show_as_link'], $field_options['search_filter'] );
111
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
112 112
 
113 113
 
114 114
 		// Duplicate Entry link should only appear to visitors capable of editing entries
115
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
115
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
116 116
 
117
-		$add_option['duplicate_link'] = array(
117
+		$add_option[ 'duplicate_link' ] = array(
118 118
 			'type' => 'text',
119 119
 			'label' => __( 'Duplicate Link Text', 'gravityview' ),
120 120
 			'desc' => NULL,
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			'merge_tags' => true,
123 123
 		);
124 124
 
125
-		$field_options['allow_duplicate_cap'] = array(
125
+		$field_options[ 'allow_duplicate_cap' ] = array(
126 126
 			'type' => 'select',
127 127
 			'label' => __( 'Allow the following users to duplicate the entry:', 'gravityview' ),
128 128
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
147 147
 
148 148
 		if ( 'edit' !== $zone ) {
149
-			$entry_default_fields['duplicate_link'] = array(
149
+			$entry_default_fields[ 'duplicate_link' ] = array(
150 150
 				'label' => __( 'Duplicate Entry', 'gravityview' ),
151 151
 				'type'  => 'duplicate_link',
152 152
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gravityview' ),
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	function add_available_field( $available_fields = array() ) {
165 165
 
166
-		$available_fields['duplicate_link'] = array(
166
+		$available_fields[ 'duplicate_link' ] = array(
167 167
 			'label_text' => __( 'Duplicate Entry', 'gravityview' ),
168 168
 			'field_id' => 'duplicate_link',
169 169
 			'label_type' => 'field',
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 		if ( 'duplicate_link' === $field_id ) {
195 195
 
196 196
 			// Remove other built-in caps.
197
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] );
197
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] );
198 198
 
199
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
199
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
200 200
 		}
201 201
 
202 202
 		return $caps;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
238 238
 		self::getInstance()->set_entry( $entry );
239 239
 
240
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
240
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
241 241
 
242 242
 		if ( empty( $base ) ) {
243 243
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		}
246 246
 
247 247
 		// Use the slug instead of the ID for consistent security
248
-		$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
248
+		$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
249 249
 
250 250
 		$actionurl = add_query_arg( array(
251 251
 			'action'	=> 'duplicate',
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             'view_id' => $view_id,
255 255
 		), $base );
256 256
 
257
-		$url = wp_nonce_url( $actionurl, 'duplicate_'.$entry_slug, 'duplicate' );
257
+		$url = wp_nonce_url( $actionurl, 'duplicate_' . $entry_slug, 'duplicate' );
258 258
 
259 259
 		return $url;
260 260
 	}
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 	function process_duplicate() {
276 276
 
277 277
 		// If the form is submitted
278
-		if ( ! isset( $_GET['action'] ) || 'duplicate' !== $_GET['action'] || ! isset( $_GET['entry_id'] ) ) {
278
+		if ( ! isset( $_GET[ 'action' ] ) || 'duplicate' !== $_GET[ 'action' ] || ! isset( $_GET[ 'entry_id' ] ) ) {
279 279
 			return;
280 280
 		}
281 281
 
282 282
 		// Make sure it's a GravityView request
283
-		$valid_nonce_key = wp_verify_nonce( $_GET['duplicate'], self::get_nonce_key( $_GET['entry_id'] ) );
283
+		$valid_nonce_key = wp_verify_nonce( $_GET[ 'duplicate' ], self::get_nonce_key( $_GET[ 'entry_id' ] ) );
284 284
 
285 285
 		if ( ! $valid_nonce_key ) {
286 286
 			gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' );
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		}
289 289
 
290 290
 		// Get the entry slug
291
-		$entry_slug = esc_attr( $_GET['entry_id'] );
291
+		$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
292 292
 
293 293
 		// See if there's an entry there
294 294
 		$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -371,15 +371,15 @@  discard block
 block discarded – undo
371 371
 			return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'No such entry ID', 'gravityview' ) );
372 372
 		}
373 373
 
374
-		$row['id'] = null;
375
-		$row['date_created'] = date( 'Y-m-d H:i:s', time() );
376
-		$row['date_updated'] = $row['date_created'];
377
-		$row['is_starred'] = false;
378
-		$row['is_read'] = false;
379
-		$row['ip'] = GFFormsModel::get_ip();
380
-		$row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid' ) ) );
381
-		$row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
382
-		$row['created_by'] = wp_get_current_user()->ID;
374
+		$row[ 'id' ] = null;
375
+		$row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() );
376
+		$row[ 'date_updated' ] = $row[ 'date_created' ];
377
+		$row[ 'is_starred' ] = false;
378
+		$row[ 'is_read' ] = false;
379
+		$row[ 'ip' ] = GFFormsModel::get_ip();
380
+		$row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid' ) ) );
381
+		$row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
382
+		$row[ 'created_by' ] = wp_get_current_user()->ID;
383 383
 
384 384
 		/**
385 385
 		 * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created.
@@ -406,15 +406,15 @@  discard block
 block discarded – undo
406 406
 
407 407
 		$save_this_meta = array();
408 408
 		foreach ( $duplicate_meta->get_output() as $m ) {
409
-			$save_this_meta[] = array(
410
-				'meta_key' => $m['meta_key'],
411
-				'meta_value' => $m['meta_value'],
412
-				'item_index' => $m['item_index'],
409
+			$save_this_meta[ ] = array(
410
+				'meta_key' => $m[ 'meta_key' ],
411
+				'meta_value' => $m[ 'meta_value' ],
412
+				'item_index' => $m[ 'item_index' ],
413 413
 			);
414 414
 		}
415 415
 
416 416
 		// Update the row ID for later usage
417
-		$row['id'] = $duplicated_id;
417
+		$row[ 'id' ] = $duplicated_id;
418 418
 
419 419
 		/**
420 420
 		 * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details.
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 		$save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry );
426 426
 
427 427
 		foreach ( $save_this_meta as $data ) {
428
-			$data['form_id'] = $entry['form_id'];
429
-			$data['entry_id'] = $duplicated_id;
428
+			$data[ 'form_id' ] = $entry[ 'form_id' ];
429
+			$data[ 'entry_id' ] = $duplicated_id;
430 430
 
431 431
 			if ( ! $wpdb->insert( $entry_meta_table, $data ) ) {
432 432
 				return new WP_Error( 'gravityview-duplicate-entry-db', __( 'Database error', 'gravityview' ) );
@@ -459,13 +459,13 @@  discard block
 block discarded – undo
459 459
 	public function verify_nonce() {
460 460
 
461 461
 		// No duplicate entry request was made
462
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) {
462
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
463 463
 			return false;
464 464
 		}
465 465
 
466
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
466
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
467 467
 
468
-		$valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key );
468
+		$valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key );
469 469
 
470 470
 		/**
471 471
 		 * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid.
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		 */
496 496
 		$confirm = apply_filters( 'gravityview/duplicate-entry/confirm-text', $confirm );
497 497
 
498
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
498
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
499 499
 	}
500 500
 
501 501
 	/**
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	public static function check_user_cap_duplicate_entry( $entry, $field, $view_id ) {
546 546
 		$current_user = wp_get_current_user();
547 547
 
548
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : NULL;
548
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : NULL;
549 549
 
550 550
 		// Or if they can duplicate any entries (as defined in Gravity Forms), we're good.
551 551
 		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries' ), $entry_id ) ) {
@@ -560,17 +560,17 @@  discard block
 block discarded – undo
560 560
 		if ( ! empty( $field ) ) {
561 561
 
562 562
 			// If capability is not defined, something is not right!
563
-			if ( empty( $field['allow_duplicate_cap'] ) ) {
563
+			if ( empty( $field[ 'allow_duplicate_cap' ] ) ) {
564 564
 
565 565
 				gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) );
566 566
 
567 567
 				return false;
568 568
 			}
569 569
 
570
-			if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) {
570
+			if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) {
571 571
 
572 572
 				// Do not return true if cap is read, as we need to check if the current user created the entry
573
-				if ( 'read' !== $field['allow_duplicate_cap'] ) {
573
+				if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) {
574 574
 					return true;
575 575
 				}
576 576
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 
584 584
 		}
585 585
 
586
-		if ( ! isset( $entry['created_by'] ) ) {
586
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
587 587
 
588 588
 			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
589 589
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 
596 596
 			$current_view = gravityview_get_current_view_data( $view_id );
597 597
 
598
-			$user_duplicate = isset( $current_view['atts']['user_duplicate'] ) ? $current_view['atts']['user_duplicate'] : false;
598
+			$user_duplicate = isset( $current_view[ 'atts' ][ 'user_duplicate' ] ) ? $current_view[ 'atts' ][ 'user_duplicate' ] : false;
599 599
 
600 600
 			if ( empty( $user_duplicate ) ) {
601 601
 
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 		}
607 607
 
608 608
 		// If the logged-in user is the same as the user who created the entry, we're good.
609
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
609
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
610 610
 
611 611
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
612 612
 
@@ -630,16 +630,16 @@  discard block
 block discarded – undo
630 630
 	 */
631 631
 	public function display_message( $current_view_id = 0 ) {
632 632
 
633
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
633
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
634 634
 			return;
635 635
 		}
636 636
 
637 637
 		// Entry wasn't duplicateded from current View
638
-		if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) {
638
+		if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) {
639 639
 			return;
640 640
 		}
641 641
 
642
-		$status = esc_attr( $_GET['status'] );
642
+		$status = esc_attr( $_GET[ 'status' ] );
643 643
 		$message_from_url = \GV\Utils::_GET( 'message' );
644 644
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
645 645
 		$class = '';
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 		$message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url );
666 666
 
667 667
 		// DISPLAY ERROR/SUCCESS MESSAGE
668
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
668
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
669 669
 	}
670 670
 
671 671
 
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gvlogic.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -248,6 +248,8 @@
 block discarded – undo
248 248
 
249 249
 	/**
250 250
 	 * Process the attributes passed to the shortcode. Make sure they're valid
251
+	 * @param string $content
252
+	 * @param string $tag
251 253
 	 * @return void
252 254
 	 */
253 255
 	private function parse_atts( $atts, $content, $tag ) {
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 		$value    = $this->get_value( $atts );
58 58
 
59 59
 		if ( false === $operator && is_null( $value ) ) {
60
-			if ( false !== $atts['if'] ) { // Only-if test
61
-				$match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) );
60
+			if ( false !== $atts[ 'if' ] ) { // Only-if test
61
+				$match = $authed && ! in_array( strtolower( $atts[ 'if' ] ), array( '', '0', 'false', 'no' ) );
62 62
 			} else {
63 63
 				$match = $authed; // Just login test
64 64
 			}
65 65
 		} else { // Regular test
66
-			$match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator );
66
+			$match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $value, $operator );
67 67
 		}
68 68
 
69 69
 		// Output and get recursive!
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @return bool Yes, or no.
82 82
 	 */
83 83
 	private function authorized( $atts ) {
84
-		if ( is_null( $needs_login  = \GV\Utils::get( $atts, 'logged_in', null ) ) ) {
84
+		if ( is_null( $needs_login = \GV\Utils::get( $atts, 'logged_in', null ) ) ) {
85 85
 			return true; // No auth requirements have been set
86 86
 		}
87 87
 		return ! $needs_login ^ is_user_logged_in(); // XNOR
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @return string The output.
144 144
 	 */
145 145
 	private function get_output( $match, $atts, $content ) {
146
-		if ( ! $match && ! empty( $atts['else'] ) ) {
147
-			return $atts['else']; // Attributized else is easy :)
146
+		if ( ! $match && ! empty( $atts[ 'else' ] ) ) {
147
+			return $atts[ 'else' ]; // Attributized else is easy :)
148 148
 		}
149 149
 
150 150
 		$if = '';
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 		$atts = array_intersect_key( $supplied_atts, $atts );
268 268
 
269 269
 		// Strip whitespace if it's not default false
270
-		if ( isset( $atts['if'] ) && is_string( $atts['if'] ) ) {
271
-			$atts['if'] = trim( $atts['if'] );
270
+		if ( isset( $atts[ 'if' ] ) && is_string( $atts[ 'if' ] ) ) {
271
+			$atts[ 'if' ] = trim( $atts[ 'if' ] );
272 272
 		} else {
273
-			$atts['if'] = false;
273
+			$atts[ 'if' ] = false;
274 274
 		}
275 275
 
276
-		if ( isset( $atts['logged_in'] ) ) {
276
+		if ( isset( $atts[ 'logged_in' ] ) ) {
277 277
 			// Truthy
278
-			if ( in_array( strtolower( $atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) {
279
-				$atts['logged_in'] = false;
278
+			if ( in_array( strtolower( $atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) {
279
+				$atts[ 'logged_in' ] = false;
280 280
 			} else {
281
-				$atts['logged_in'] = true;
281
+				$atts[ 'logged_in' ] = true;
282 282
 			}
283 283
 		}
284 284
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,12 +57,14 @@  discard block
 block discarded – undo
57 57
 		$value    = $this->get_value( $atts );
58 58
 
59 59
 		if ( false === $operator && is_null( $value ) ) {
60
-			if ( false !== $atts['if'] ) { // Only-if test
60
+			if ( false !== $atts['if'] ) {
61
+// Only-if test
61 62
 				$match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) );
62 63
 			} else {
63 64
 				$match = $authed; // Just login test
64 65
 			}
65
-		} else { // Regular test
66
+		} else {
67
+// Regular test
66 68
 			$match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator );
67 69
 		}
68 70
 
@@ -153,11 +155,14 @@  discard block
 block discarded – undo
153 155
 		$opens = 0; // inner opens
154 156
 		$found = false; // found split position
155 157
 
156
-		while ( $content ) { // scan
158
+		while ( $content ) {
159
+// scan
157 160
 			if ( ! preg_match( '#(.*?)(\[\/?(gvlogic|else).*?])(.*)#', $content, $matches ) ) {
158
-				if ( ! $found ) { // We're still iffing.
161
+				if ( ! $found ) {
162
+// We're still iffing.
159 163
 					$if .= $content;
160
-				} else { // We are elsing
164
+				} else {
165
+// We are elsing
161 166
 					$else .= $content;
162 167
 				}
163 168
 				break; // No more shortcodes
@@ -165,9 +170,11 @@  discard block
 block discarded – undo
165 170
 
166 171
 			list( $_, $before_shortcode, $shortcode, $_, $after_shortcode ) = $matches;
167 172
 
168
-			if ( ! $found ) { // We're still iffing.
173
+			if ( ! $found ) {
174
+// We're still iffing.
169 175
 				$if .= $before_shortcode;
170
-			} else { // We are elsing
176
+			} else {
177
+// We are elsing
171 178
 				$else .= $before_shortcode;
172 179
 			}
173 180
 
@@ -191,9 +198,11 @@  discard block
 block discarded – undo
191 198
 				}
192 199
 
193 200
 				// Tack on the shortcode
194
-				if ( ! $found ) { // We're still iffing.
201
+				if ( ! $found ) {
202
+// We're still iffing.
195 203
 					$if .= $shortcode;
196
-				} else { // We are elsing
204
+				} else {
205
+// We are elsing
197 206
 					$else .= $shortcode;
198 207
 				}
199 208
 			}
Please login to merge, or discard this patch.
includes/class-gvlogic-shortcode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 		return self::$instance;
18 18
 	}
19 19
 
20
-	public function shortcode( $atts, $content = '', $tag = '') {
20
+	public function shortcode( $atts, $content = '', $tag = '' ) {
21 21
 		$shortcode = new \GV\Shortcodes\gvlogic();
22 22
 		return $shortcode->callback( $atts, $content, $tag );
23 23
 	}
Please login to merge, or discard this patch.