Completed
Push — develop ( 7735c4...95a60a )
by Zack
35:46 queued 15:49
created
includes/class-gravityview-merge-tags.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 
79 79
 			$non_gv_modifiers = array_diff( $modifiers, array_keys( $gv_modifiers ) );
80 80
 
81
-			$return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false);
81
+			$return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false );
82 82
 		}
83 83
 
84 84
 		foreach ( $modifiers as $passed_modifier ) {
85 85
 
86
-			foreach( $gv_modifiers as $gv_modifier => $method ) {
86
+			foreach ( $gv_modifiers as $gv_modifier => $method ) {
87 87
 
88 88
 				// Uses ^ to only match the first modifier, to enforce same order as passed by GF
89 89
 				preg_match( '/^' . $gv_modifier . '/ism', $passed_modifier, $matches );
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	private static function modifier_timestamp( $raw_value, $matches ) {
134 134
 
135
-		if( empty( $matches[0] ) ) {
135
+		if ( empty( $matches[ 0 ] ) ) {
136 136
 			return $raw_value;
137 137
 		}
138 138
 
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	private static function modifier_maxwords( $raw_value, $matches, $field = null ) {
163 163
 
164
-		if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) {
164
+		if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) {
165 165
 			return $raw_value;
166 166
 		}
167 167
 
168
-		$max = intval( $matches[1] );
168
+		$max = intval( $matches[ 1 ] );
169 169
 
170 170
 		$more_placeholder = '[GVMORE]';
171 171
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	private static function modifier_explode( $raw_value, $matches, $value, $field = null ) {
235 235
 
236 236
 		// For JSON-encoded arrays
237
-		if( $json_array = json_decode( $raw_value, true ) ) {
237
+		if ( $json_array = json_decode( $raw_value, true ) ) {
238 238
 			return implode( ' ', $json_array );
239 239
 		}
240 240
 
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	private static function modifier_strings( $raw_value, $matches, $value = '', $field = null ) {
257 257
 
258
-		if( empty( $matches[0] ) ) {
258
+		if ( empty( $matches[ 0 ] ) ) {
259 259
 			return $raw_value;
260 260
 		}
261 261
 
262 262
 		$return = $raw_value;
263 263
 
264
-		switch( $matches[0] ) {
264
+		switch ( $matches[ 0 ] ) {
265 265
 			case 'urlencode':
266 266
 				$return = urlencode( $raw_value );
267 267
 				break;
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 		 * @internal Fixed $form['title'] in Gravity Forms
349 349
 		 * @see      https://github.com/gravityforms/gravityforms/pull/27/files
350 350
 		 */
351
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
352
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
353
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
351
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
352
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
353
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
354 354
 
355 355
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format, $aux_data );
356 356
 	}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
 		$site_url = get_site_url();
420 420
 
421
-		if( $url_encode ) {
421
+		if ( $url_encode ) {
422 422
 			$site_url = urlencode( $site_url );
423 423
 		}
424 424
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		// Is there is {gv_entry_link} or {gv_entry_link:[post id]} or {gv_entry_link:[post id]:[action]} merge tag?
446 446
 		preg_match_all( "/{gv_entry_link(?:\:(\d+)\:?(.*?))?}/ism", $original_text, $matches, PREG_SET_ORDER );
447 447
 
448
-		if( empty( $matches ) ) {
448
+		if ( empty( $matches ) ) {
449 449
 			return $original_text;
450 450
 		}
451 451
 
@@ -466,18 +466,18 @@  discard block
 block discarded – undo
466 466
 		 * }
467 467
 		 */
468 468
 		foreach ( $matches as $match ) {
469
-			$full_tag = $match[0];
469
+			$full_tag = $match[ 0 ];
470 470
 
471 471
 			$link_args = array(
472 472
 				'return' => 'url',
473
-				'entry_id' => $entry['id'],
473
+				'entry_id' => $entry[ 'id' ],
474 474
 				'post_id' => \GV\Utils::get( $match, 1, null ),
475 475
 				'action' => \GV\Utils::get( $match, 2, 'read' ),
476 476
 			);
477 477
 
478 478
 			$entry_link = $Shortcode->read_shortcode( $link_args, null, 'gv_entry_link_merge_tag' );
479 479
 
480
-			if( $url_encode ) {
480
+			if ( $url_encode ) {
481 481
 				$entry_link = urlencode( $entry_link );
482 482
 			}
483 483
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
515 515
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
516 516
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
517
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
517
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
518 518
 		);
519 519
 
520 520
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 			return $original_text;
592 592
 		}
593 593
 
594
-		foreach ( (array) $matches as $match ) {
595
-			$full_tag = $match[0];
594
+		foreach ( (array)$matches as $match ) {
595
+			$full_tag = $match[ 0 ];
596 596
 			$modifier = \GV\Utils::get( $match, 2, 'permalink' );
597 597
 
598 598
 			$replacement = false;
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 					$replacement = esc_html( $replacement );
611 611
 				}
612 612
 
613
-				if( $url_encode ) {
613
+				if ( $url_encode ) {
614 614
 					$replacement = urlencode( $replacement );
615 615
 				}
616 616
 
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
651 651
 
652 652
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
653
-		if( empty( $matches ) ) {
653
+		if ( empty( $matches ) ) {
654 654
 			return $text;
655 655
 		}
656 656
 
657 657
 		foreach ( $matches as $match ) {
658 658
 
659
-			$full_tag = $match[0];
660
-			$property = $match[1];
659
+			$full_tag = $match[ 0 ];
660
+			$property = $match[ 1 ];
661 661
 
662 662
 			$value = stripslashes_deep( \GV\Utils::_GET( $property ) );
663 663
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 			 * @since 1.15
682 682
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
683 683
 			 */
684
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
684
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
685 685
 
686 686
 			$value = $esc_html ? esc_html( $value ) : $value;
687 687
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 			 * @param[in] array $form Gravity Forms form array
693 693
 			 * @param[in] array $entry Entry array
694 694
 			 */
695
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
695
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
696 696
 
697 697
 			$text = str_replace( $full_tag, $value, $text );
698 698
 		}
Please login to merge, or discard this patch.