Completed
Push — develop ( cf97a4...7b8d22 )
by Zack
04:36
created
includes/class-gravityview-merge-tags.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$gv_modifiers = array(
54 54
 			'maxwords:(\d+)' => 'modifier_maxwords', /** @see modifier_maxwords */
55 55
 			'wpautop' => 'modifier_wpautop', /** @see modifier_wpautop */
56
-		    'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */
56
+			'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */
57 57
 		);
58 58
 		
59 59
 		$return = $value;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 		$atts = array(
255 255
 			'format' => self::get_format_from_modifiers( $exploded, false ),
256
-		    'human' => in_array( 'human', $exploded ), // {date_created:human}
256
+			'human' => in_array( 'human', $exploded ), // {date_created:human}
257 257
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
258 258
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
259 259
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 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
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 		foreach ( $gv_modifiers as $gv_modifier => $method ) {
62 62
 
63 63
 			// Only match the regex if it's the first modifer; this allows us to enforce our own modifier structure
64
-			preg_match( '/^' . $gv_modifier .'/ism', $modifier, $matches );
64
+			preg_match( '/^' . $gv_modifier . '/ism', $modifier, $matches );
65 65
 
66
-			if( ! empty( $matches ) ) {
66
+			if ( ! empty( $matches ) ) {
67 67
 				// The called method is passed the raw value and the full matches array
68 68
 				$return = self::$method( $raw_value, $matches );
69 69
 				break;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	private static function modifier_timestamp( $raw_value, $matches ) {
89 89
 
90
-		if( empty( $matches[0] ) ) {
90
+		if ( empty( $matches[ 0 ] ) ) {
91 91
 			return $raw_value;
92 92
 		}
93 93
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	private static function modifier_wpautop( $raw_value, $matches ) {
113 113
 
114
-		if( empty( $matches[0] ) || ! function_exists( 'wpautop' ) ) {
114
+		if ( empty( $matches[ 0 ] ) || ! function_exists( 'wpautop' ) ) {
115 115
 			return $raw_value;
116 116
 		}
117 117
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	private static function modifier_maxwords( $raw_value, $matches ) {
137 137
 
138
-		if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) {
138
+		if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) {
139 139
 			return $raw_value;
140 140
 		}
141 141
 
142
-		$max = intval( $matches[1] );
142
+		$max = intval( $matches[ 1 ] );
143 143
 
144 144
 		$more_placeholder = '[GVMORE]';
145 145
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @param  bool       $esc_html     Pass return value through `esc_html()`
172 172
 	 * @return string                  Text with variables maybe replaced
173 173
 	 */
174
-	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
174
+	public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
175 175
 
176 176
 		/**
177 177
 		 * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 		 * @internal Reported to GF Support on 12/3
196 196
 		 * @internal Fixed in Gravity Forms
197 197
 		 */
198
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
199
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
200
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
198
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
199
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
200
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
201 201
 
202 202
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
203 203
 	}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @return mixed
219 219
 	 */
220
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
220
+	public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
221 221
 
222 222
 		/**
223 223
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		 * @see GFCommon::replace_variables_prepopulate()
226 226
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
227 227
 		 */
228
-		if( false === $form ) {
228
+		if ( false === $form ) {
229 229
 			return $text;
230 230
 		}
231 231
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
258 258
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
259 259
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
260
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
260
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
261 261
 		);
262 262
 
263 263
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
321 321
 
322 322
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
323
-		if( empty( $matches ) ) {
323
+		if ( empty( $matches ) ) {
324 324
 			return $text;
325 325
 		}
326 326
 
327 327
 		foreach ( $matches as $match ) {
328 328
 
329
-			$full_tag = $match[0];
330
-			$property = $match[1];
329
+			$full_tag = $match[ 0 ];
330
+			$property = $match[ 1 ];
331 331
 
332 332
 			$value = stripslashes_deep( rgget( $property ) );
333 333
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			 * @since 1.15
352 352
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
353 353
 			 */
354
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
354
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
355 355
 
356 356
 			$value = $esc_html ? esc_html( $value ) : $value;
357 357
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			 * @param[in] array $form Gravity Forms form array
363 363
 			 * @param[in] array $entry Entry array
364 364
 			 */
365
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
365
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
366 366
 
367 367
 			$text = str_replace( $full_tag, $value, $text );
368 368
 		}
Please login to merge, or discard this patch.