Completed
Push — master ( 29b5ef...9e7308 )
by Stephanie
03:30
created
classes/models/FrmEntryFormat.php 1 patch
Spacing   +25 added lines, -25 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'] ) {
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 		}
76 76
 
77 77
 		if ( $atts['default_email'] ) {
78
-			$values[ $f->id ] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $f->id . ']' );
78
+			$values[$f->id] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $f->id . ']' );
79 79
 			return;
80 80
 		}
81 81
 
82
-		if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $f->id ] ) ) {
82
+		if ( $atts['entry'] && ! isset( $atts['entry']->metas[$f->id] ) ) {
83 83
 			// In case include_blank is set
84
-			$atts['entry']->metas[ $f->id ] = '';
84
+			$atts['entry']->metas[$f->id] = '';
85 85
 
86 86
 			if ( FrmAppHelper::pro_is_installed() ) {
87 87
 				FrmProEntryMeta::add_post_value_to_entry( $f, $atts['entry'] );
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$val = '';
93 93
 		if ( $atts['entry'] ) {
94
-			$prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] );
94
+			$prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] );
95 95
 			$meta = array( 'item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type );
96 96
 
97 97
 			//This filter applies to the default-message shortcode and frm-show-entry shortcode only
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 		self::maybe_strip_html( $atts['plain_text'], $val );
117 117
 
118 118
 		if ( $atts['format'] != 'text' ) {
119
-			$values[ $f->field_key ] = $val;
119
+			$values[$f->field_key] = $val;
120 120
 			if ( isset( $prev_val ) && $prev_val != $val && $f->type != 'textarea' ) {
121
-				$values[ $f->field_key .'-value' ] = $prev_val;
121
+				$values[$f->field_key . '-value'] = $prev_val;
122 122
 			}
123 123
 		} else {
124
-			$values[ $f->id ] = array( 'label' => $f->name, 'val' => $val );
124
+			$values[$f->id] = array( 'label' => $f->name, 'val' => $val );
125 125
 		}
126 126
 	}
127 127
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			return;
167 167
 		}
168 168
 
169
-		$data  = self::get_entry_description_data( $atts );
169
+		$data = self::get_entry_description_data( $atts );
170 170
 
171 171
 		if ( $atts['default_email'] ) {
172 172
 			$atts['entry']->ip = '[ip]';
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers
254 254
 
255 255
 		// see how many we have
256
-		$i = count($matches['browser']);
256
+		$i = count( $matches['browser'] );
257 257
 		if ( $i != 1 ) {
258 258
 			//we will have two since we are not using 'other' argument yet
259 259
 			//see if version is before or after the name
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 			$version = '?';
272 272
 		}
273 273
 
274
-		return $bname .' '. $version .' / '. $platform;
274
+		return $bname . ' ' . $version . ' / ' . $platform;
275 275
 	}
276 276
 
277 277
 	public static function convert_entry_to_content( $values, $atts, array &$content ) {
@@ -290,34 +290,34 @@  discard block
 block discarded – undo
290 290
 
291 291
 			// merge defaults, global settings, and shortcode options
292 292
 			foreach ( $default_settings as $key => $setting ) {
293
-				if ( $atts[ $key ] != '' ) {
293
+				if ( $atts[$key] != '' ) {
294 294
 					continue;
295 295
 				}
296 296
 
297
-				$atts[ $key ] = $setting;
297
+				$atts[$key] = $setting;
298 298
 				unset( $key, $setting );
299 299
 			}
300 300
 
301
-			unset($default_settings);
301
+			unset( $default_settings );
302 302
 
303
-			$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";
304
-			$atts['bg_color'] = ' style="background-color:#'. $atts['bg_color'] .';"';
305
-			$bg_color_alt = ' style="background-color:#'. $atts['alt_bg_color'] .';"';
306
-			$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'] . '"';
303
+			$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";
304
+			$atts['bg_color'] = ' style="background-color:#' . $atts['bg_color'] . ';"';
305
+			$bg_color_alt = ' style="background-color:#' . $atts['alt_bg_color'] . ';"';
306
+			$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'] . '"';
307 307
 		}
308 308
 
309 309
 		$odd = true;
310 310
 		foreach ( $values as $id => $value ) {
311 311
 			if ( $atts['plain_text'] ) {
312 312
 				if ( 'rtl' == $atts['direction'] ) {
313
-					$content[] = $value['val'] . ' :'. $value['label'] ."\r\n";
313
+					$content[] = $value['val'] . ' :' . $value['label'] . "\r\n";
314 314
 				} else {
315
-					$content[] = $value['label'] . ': '. $value['val'] ."\r\n";
315
+					$content[] = $value['label'] . ': ' . $value['val'] . "\r\n";
316 316
 				}
317 317
 				continue;
318 318
 			}
319 319
 
320
-			if ( $atts['default_email'] && is_numeric($id) ) {
320
+			if ( $atts['default_email'] && is_numeric( $id ) ) {
321 321
 				$content[] = '[if ' . $id . ']<tr style="[frm-alt-color]">';
322 322
 			} else {
323 323
 				$content[] = '<tr' . ( $odd ? $atts['bg_color'] : $bg_color_alt ) . '>';
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			if ( 'rtl' == $atts['direction'] ) {
328 328
 				$content[] = '<td ' . $row_style . '>' . $value['val'] . '</td><th ' . $row_style . '>' . $value['label'] . '</th>';
329 329
 			} else {
330
-				$content[] = '<th ' . $row_style . '>' . $value['label'] . '</th><td '. $row_style . '>' . $value['val'] . '</td>';
330
+				$content[] = '<th ' . $row_style . '>' . $value['label'] . '</th><td ' . $row_style . '>' . $value['val'] . '</td>';
331 331
 			}
332 332
 			$content[] = '</tr>' . "\r\n";
333 333
 
Please login to merge, or discard this patch.