Completed
Push — develop ( 2ebfd1...bd3fa2 )
by Zack
12:27
created
includes/class-gravityview-merge-tags.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	public static function process_modifiers( $value, $merge_tag, $modifier, $field, $raw_value ) {
46 46
 
47 47
 		// No modifier was set or the raw value was empty
48
-		if( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) {
48
+		if ( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) {
49 49
 			return $value;
50 50
 		}
51 51
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 		foreach ( $gv_modifiers as $gv_modifier => $method ) {
61 61
 
62 62
 			// Only match the regex if it's the first modifer; this allows us to enforce our own modifier structure
63
-			preg_match( '/^' . $gv_modifier .'/ism', $modifier, $matches );
63
+			preg_match( '/^' . $gv_modifier . '/ism', $modifier, $matches );
64 64
 
65
-			if( $matches ) {
65
+			if ( $matches ) {
66 66
 				// The called method is passed the raw value and the full matches array
67 67
 				$return = self::$method( $raw_value, $matches );
68 68
 				break;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	private static function modifier_wpautop( $raw_value, $matches ) {
88 88
 
89
-		if( empty( $matches[0] ) || ! function_exists( 'wpautop' ) ) {
89
+		if ( empty( $matches[ 0 ] ) || ! function_exists( 'wpautop' ) ) {
90 90
 			return $raw_value;
91 91
 		}
92 92
 
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	private static function modifier_maxwords( $raw_value, $matches ) {
112 112
 
113
-		if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) {
113
+		if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) {
114 114
 			return $raw_value;
115 115
 		}
116 116
 
117
-		$max = intval( $matches[1] );
117
+		$max = intval( $matches[ 1 ] );
118 118
 
119 119
 		$more_placeholder = '[GVMORE]';
120 120
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param  bool       $esc_html     Pass return value through `esc_html()`
147 147
 	 * @return string                  Text with variables maybe replaced
148 148
 	 */
149
-	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
149
+	public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
150 150
 
151 151
 		/**
152 152
 		 * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 		 * @internal Reported to GF Support on 12/3
171 171
 		 * @internal Fixed in Gravity Forms
172 172
 		 */
173
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
174
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
175
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
173
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
174
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
175
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
176 176
 
177 177
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
178 178
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return mixed
194 194
 	 */
195
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
195
+	public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
196 196
 
197 197
 		/**
198 198
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		 * @see GFCommon::replace_variables_prepopulate()
201 201
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
202 202
 		 */
203
-		if( false === $form ) {
203
+		if ( false === $form ) {
204 204
 			return $text;
205 205
 		}
206 206
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
233 233
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
234 234
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
235
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
235
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
236 236
 		);
237 237
 
238 238
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
296 296
 
297 297
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
298
-		if( empty( $matches ) ) {
298
+		if ( empty( $matches ) ) {
299 299
 			return $text;
300 300
 		}
301 301
 
302 302
 		foreach ( $matches as $match ) {
303 303
 
304
-			$full_tag = $match[0];
305
-			$property = $match[1];
304
+			$full_tag = $match[ 0 ];
305
+			$property = $match[ 1 ];
306 306
 
307 307
 			$value = stripslashes_deep( rgget( $property ) );
308 308
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			 * @since 1.15
327 327
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
328 328
 			 */
329
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
329
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
330 330
 
331 331
 			$value = $esc_html ? esc_html( $value ) : $value;
332 332
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			 * @param[in] array $form Gravity Forms form array
338 338
 			 * @param[in] array $entry Entry array
339 339
 			 */
340
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
340
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
341 341
 
342 342
 			$text = str_replace( $full_tag, $value, $text );
343 343
 		}
Please login to merge, or discard this patch.