Completed
Push — master ( b7b1e3...3c0751 )
by Jamie
03:40
created
classes/models/FrmEntryFormat.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
 			$atts['id'] = $atts['entry']->id;
38 38
 		}
39 39
 
40
-		if ( ! $atts['fields'] || ! is_array($atts['fields']) ) {
40
+		if ( ! $atts['fields'] || ! is_array( $atts['fields'] ) ) {
41 41
 			$atts['fields'] = FrmField::get_all_for_form( $atts['form_id'], '', 'include' );
42 42
 		}
43 43
 
44 44
 		$values = array();
45 45
 		foreach ( $atts['fields'] as $f ) {
46 46
 			self::fill_entry_values( $atts, $f, $values );
47
-			unset($f);
47
+			unset( $f );
48 48
 		}
49 49
 
50 50
 		self::fill_entry_user_info( $atts, $values );
51 51
 
52 52
 		if ( $atts['format'] == 'json' ) {
53
-			return json_encode($values);
53
+			return json_encode( $values );
54 54
 		} else if ( $atts['format'] == 'array' ) {
55 55
 			return $values;
56 56
 		}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		self::convert_entry_to_content( $values, $atts, $content );
60 60
 
61 61
 		if ( 'text' == $atts['format'] ) {
62
-			$content = implode('', $content);
62
+			$content = implode( '', $content );
63 63
 		}
64 64
 
65 65
 		if ( $atts['clickable'] ) {
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 			}
84 84
 
85 85
 			$field_id_string = reset( $f->field_options['hide_field'] ) . ' show=' . $f->field_options['form_select'];
86
-			$values[ $f->id ] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $field_id_string . ']' );
86
+			$values[$f->id] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $field_id_string . ']' );
87 87
 		} else {
88
-			$values[ $f->id ] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $f->id . ']' );
88
+			$values[$f->id] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $f->id . ']' );
89 89
 		}
90 90
 	}
91 91
 
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 			return;
100 100
 		}
101 101
 
102
-		if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $f->id ] ) ) {
102
+		if ( $atts['entry'] && ! isset( $atts['entry']->metas[$f->id] ) ) {
103 103
 			// In case include_blank is set
104
-			$atts['entry']->metas[ $f->id ] = '';
104
+			$atts['entry']->metas[$f->id] = '';
105 105
 
106 106
 			if ( FrmAppHelper::pro_is_installed() ) {
107 107
 				FrmProEntryMeta::add_post_value_to_entry( $f, $atts['entry'] );
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 		$val = '';
113 113
 		if ( $atts['entry'] ) {
114
-			$prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] );
114
+			$prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] );
115 115
 			$meta = array( 'item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type );
116 116
 
117 117
 			//This filter applies to the default-message shortcode and frm-show-entry shortcode only
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 		self::maybe_strip_html( $atts['plain_text'], $val );
137 137
 
138 138
 		if ( $atts['format'] != 'text' ) {
139
-			$values[ $f->field_key ] = $val;
139
+			$values[$f->field_key] = $val;
140 140
 			if ( isset( $prev_val ) && $prev_val != $val && $f->type != 'textarea' ) {
141
-				$values[ $f->field_key .'-value' ] = $prev_val;
141
+				$values[$f->field_key . '-value'] = $prev_val;
142 142
 			}
143 143
 		} else {
144
-			$values[ $f->id ] = array( 'label' => $f->name, 'val' => $val );
144
+			$values[$f->id] = array( 'label' => $f->name, 'val' => $val );
145 145
 		}
146 146
 	}
147 147
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			return;
188 188
 		}
189 189
 
190
-		$data  = self::get_entry_description_data( $atts );
190
+		$data = self::get_entry_description_data( $atts );
191 191
 
192 192
 		if ( $atts['default_email'] ) {
193 193
 			$atts['entry']->ip = '[ip]';
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers
275 275
 
276 276
 		// see how many we have
277
-		$i = count($matches['browser']);
277
+		$i = count( $matches['browser'] );
278 278
 		if ( $i != 1 ) {
279 279
 			//we will have two since we are not using 'other' argument yet
280 280
 			//see if version is before or after the name
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 			$version = '?';
293 293
 		}
294 294
 
295
-		return $bname .' '. $version .' / '. $platform;
295
+		return $bname . ' ' . $version . ' / ' . $platform;
296 296
 	}
297 297
 
298 298
 	public static function convert_entry_to_content( $values, $atts, array &$content ) {
@@ -311,34 +311,34 @@  discard block
 block discarded – undo
311 311
 
312 312
 			// merge defaults, global settings, and shortcode options
313 313
 			foreach ( $default_settings as $key => $setting ) {
314
-				if ( $atts[ $key ] != '' ) {
314
+				if ( $atts[$key] != '' ) {
315 315
 					continue;
316 316
 				}
317 317
 
318
-				$atts[ $key ] = $setting;
318
+				$atts[$key] = $setting;
319 319
 				unset( $key, $setting );
320 320
 			}
321 321
 
322
-			unset($default_settings);
322
+			unset( $default_settings );
323 323
 
324
-			$content[] = '<table cellspacing="0" style="font-size:'. $atts['font_size'] .';line-height:135%; border-bottom:'. $atts['border_width'] . ' solid #' . $atts['border_color'] . ';"><tbody>' . "\r\n";
325
-			$atts['bg_color'] = ' style="background-color:#'. $atts['bg_color'] .';"';
326
-			$bg_color_alt = ' style="background-color:#'. $atts['alt_bg_color'] .';"';
327
-			$row_style = 'style="text-align:' . ( $atts['direction'] == 'rtl' ? 'right' : 'left' ) .';color:#'. $atts['text_color'] . ';padding:7px 9px;border-top:' . $atts['border_width'] .' solid #' . $atts['border_color'] . '"';
324
+			$content[] = '<table cellspacing="0" style="font-size:' . $atts['font_size'] . ';line-height:135%; border-bottom:' . $atts['border_width'] . ' solid #' . $atts['border_color'] . ';"><tbody>' . "\r\n";
325
+			$atts['bg_color'] = ' style="background-color:#' . $atts['bg_color'] . ';"';
326
+			$bg_color_alt = ' style="background-color:#' . $atts['alt_bg_color'] . ';"';
327
+			$row_style = 'style="text-align:' . ( $atts['direction'] == 'rtl' ? 'right' : 'left' ) . ';color:#' . $atts['text_color'] . ';padding:7px 9px;border-top:' . $atts['border_width'] . ' solid #' . $atts['border_color'] . '"';
328 328
 		}
329 329
 
330 330
 		$odd = true;
331 331
 		foreach ( $values as $id => $value ) {
332 332
 			if ( $atts['plain_text'] ) {
333 333
 				if ( 'rtl' == $atts['direction'] ) {
334
-					$content[] = $value['val'] . ' :'. $value['label'] ."\r\n";
334
+					$content[] = $value['val'] . ' :' . $value['label'] . "\r\n";
335 335
 				} else {
336
-					$content[] = $value['label'] . ': '. $value['val'] ."\r\n";
336
+					$content[] = $value['label'] . ': ' . $value['val'] . "\r\n";
337 337
 				}
338 338
 				continue;
339 339
 			}
340 340
 
341
-			if ( $atts['default_email'] && is_numeric($id) ) {
341
+			if ( $atts['default_email'] && is_numeric( $id ) ) {
342 342
 				$content[] = '[if ' . $id . ']<tr style="[frm-alt-color]">';
343 343
 			} else {
344 344
 				$content[] = '<tr' . ( $odd ? $atts['bg_color'] : $bg_color_alt ) . '>';
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 			if ( 'rtl' == $atts['direction'] ) {
349 349
 				$content[] = '<td ' . $row_style . '>' . $value['val'] . '</td><th ' . $row_style . '>' . $value['label'] . '</th>';
350 350
 			} else {
351
-				$content[] = '<th ' . $row_style . '>' . $value['label'] . '</th><td '. $row_style . '>' . $value['val'] . '</td>';
351
+				$content[] = '<th ' . $row_style . '>' . $value['label'] . '</th><td ' . $row_style . '>' . $value['val'] . '</td>';
352 352
 			}
353 353
 			$content[] = '</tr>' . "\r\n";
354 354
 
Please login to merge, or discard this patch.