Completed
Branch BETA-4.9-message-activity (c2a8e0)
by
unknown
18:28 queued 10s
created
core/helpers/EEH_Address.helper.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 
@@ -35,24 +35,24 @@  discard block
 block discarded – undo
35 35
 		$add_wrapper = true
36 36
 	) {
37 37
 		// check that incoming object implements the EEI_Address interface
38
-		if ( ! $obj_with_address instanceof EEI_Address ) {
39
-			$msg = __( 'The address could not be formatted.', 'event_espresso' );
38
+		if ( ! $obj_with_address instanceof EEI_Address) {
39
+			$msg = __('The address could not be formatted.', 'event_espresso');
40 40
 			$dev_msg = __(
41 41
 				'The Address Formatter requires passed objects to implement the EEI_Address interface.',
42 42
 				'event_espresso'
43 43
 			);
44
-			EE_Error::add_error( $msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
44
+			EE_Error::add_error($msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
45 45
 			return null;
46 46
 		}
47 47
 		// obtain an address formatter
48
-		$formatter = EEH_Address::_get_formatter( $type );
48
+		$formatter = EEH_Address::_get_formatter($type);
49 49
 		// apply schema.org formatting ?
50 50
 		$use_schema = ! is_admin() ? $use_schema : false;
51 51
 		$formatted_address = $use_schema
52
-			? EEH_Address::_schema_formatting( $formatter, $obj_with_address )
53
-			: EEH_Address::_regular_formatting( $formatter, $obj_with_address, $add_wrapper );
52
+			? EEH_Address::_schema_formatting($formatter, $obj_with_address)
53
+			: EEH_Address::_regular_formatting($formatter, $obj_with_address, $add_wrapper);
54 54
 		$formatted_address = $add_wrapper && ! $use_schema
55
-			? '<div class="espresso-address-dv">' . $formatted_address . '</div>'
55
+			? '<div class="espresso-address-dv">'.$formatted_address.'</div>'
56 56
 			: $formatted_address;
57 57
 		// return the formatted address
58 58
 		return $formatted_address;
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 * @param string $type how the address is formatted. for example: 'multiline' or 'inline'
68 68
 	 * @return EEI_Address_Formatter
69 69
 	 */
70
-	private static function _get_formatter( $type ) {
71
-		switch ( $type ) {
70
+	private static function _get_formatter($type) {
71
+		switch ($type) {
72 72
 			case 'multiline' :
73 73
 				return new EventEspresso\core\services\address\formatters\MultiLineAddressFormatter();
74 74
 			case 'inline' :
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 	 * @param object EEI_Address $obj_with_address
122 122
 	 * @return string
123 123
 	 */
124
-	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ) {
124
+	private static function _schema_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address) {
125 125
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
126 126
 		$formatted_address .= $formatter->format(
127
-			EEH_Schema::streetAddress( $obj_with_address ),
128
-			EEH_Schema::postOfficeBoxNumber( $obj_with_address ),
129
-			EEH_Schema::addressLocality( $obj_with_address ),
130
-			EEH_Schema::addressRegion( $obj_with_address ),
131
-			EEH_Schema::postalCode( $obj_with_address ),
132
-			EEH_Schema::addressCountry( $obj_with_address ),
127
+			EEH_Schema::streetAddress($obj_with_address),
128
+			EEH_Schema::postOfficeBoxNumber($obj_with_address),
129
+			EEH_Schema::addressLocality($obj_with_address),
130
+			EEH_Schema::addressRegion($obj_with_address),
131
+			EEH_Schema::postalCode($obj_with_address),
132
+			EEH_Schema::addressCountry($obj_with_address),
133 133
 			$obj_with_address->country_ID()
134 134
 		);
135 135
 		$formatted_address .= '</div>';
Please login to merge, or discard this patch.
core/helpers/EEH_Venue_View.helper.php 1 patch
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
 	 *                             		     regardless of access.
45 45
 	 * @return EE_Venue | null
46 46
 	 */
47
-	public static function get_venue( $VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true ) {
48
-		$VNU_ID = absint( $VNU_ID );
47
+	public static function get_venue($VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true) {
48
+		$VNU_ID = absint($VNU_ID);
49 49
 		// do we already have the Venue you are looking for?
50
-		if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID ) {
51
-			return EEH_Venue_View::_get_venue( $privacy_check );
50
+		if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID) {
51
+			return EEH_Venue_View::_get_venue($privacy_check);
52 52
 		}
53 53
 		// international newspaper?
54 54
 		global $post;
55
-		if ( $post instanceof WP_Post ) {
56
-			switch ( $post->post_type ) {
55
+		if ($post instanceof WP_Post) {
56
+			switch ($post->post_type) {
57 57
 				// if this is being called from an EE_Venue post,
58 58
 				// and the EE_Venue post corresponds to the EE_Venue that is being asked for,
59 59
 				// then we can try to just grab the attached EE_Venue object
@@ -61,31 +61,31 @@  discard block
 block discarded – undo
61 61
 					// the post already contains the related EE_Venue object AND one of the following is TRUE:
62 62
 					// the requested Venue ID matches the post ID OR...
63 63
 					// there was no specific Venue ID requested
64
-					if ( isset( $post->EE_Venue ) && ( $VNU_ID == $post->ID || ! $VNU_ID )) {
64
+					if (isset($post->EE_Venue) && ($VNU_ID == $post->ID || ! $VNU_ID)) {
65 65
 						// use existing related EE_Venue object
66
-						EEH_Venue_View::$_venue =  $post->EE_Venue;
67
-					} else if ( $VNU_ID ) {
66
+						EEH_Venue_View::$_venue = $post->EE_Venue;
67
+					} else if ($VNU_ID) {
68 68
 						// there WAS a specific Venue ID requested, but it's NOT the current post object
69
-						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
69
+						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
70 70
 					} else {
71 71
 						// no specific Venue ID requested, so use post ID to generate EE_Venue object
72
-						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $post->ID );
72
+						EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($post->ID);
73 73
 					}
74 74
 				break;
75 75
 
76 76
 				case 'espresso_events':
77
-					if ( $look_in_event ) {
77
+					if ($look_in_event) {
78 78
 						// grab the events related venues
79 79
 						$venues = EEH_Venue_View::get_event_venues();
80 80
 						// make sure the result is an array
81
-						$venues = is_array( $venues ) ? $venues : array();
81
+						$venues = is_array($venues) ? $venues : array();
82 82
 						// do we have an ID for a specific venue?
83
-						if ( $VNU_ID ) {
83
+						if ($VNU_ID) {
84 84
 							// loop thru the related venues
85
-							foreach( $venues as $venue ) {
86
-								if ( $venue instanceof EE_Venue ) {
85
+							foreach ($venues as $venue) {
86
+								if ($venue instanceof EE_Venue) {
87 87
 									// until we find the venue we're looking for
88
-									if ( $venue->ID() == $VNU_ID ) {
88
+									if ($venue->ID() == $VNU_ID) {
89 89
 										EEH_Venue_View::$_venue = $venue;
90 90
 										break;
91 91
 									}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 							// then the global post is an events post and this function was called with no argument
98 98
 						} else {
99 99
 							// just grab the first related event venue
100
-							EEH_Venue_View::$_venue = reset( $venues );
100
+							EEH_Venue_View::$_venue = reset($venues);
101 101
 						}
102 102
 					}
103 103
 				break;
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 			}
106 106
 		}
107 107
 		// now if we STILL do NOT have an EE_Venue model object, BUT we have a Venue ID...
108
-		if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID ) {
108
+		if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID) {
109 109
 			// sigh... pull it from the db
110
-			EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
110
+			EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
111 111
 		}
112
-		return EEH_Venue_View::_get_venue( $privacy_check );
112
+		return EEH_Venue_View::_get_venue($privacy_check);
113 113
 	}
114 114
 
115 115
 
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 *                             		     regardless of access.
122 122
 	 *  @return 	EE_Venue
123 123
 	 */
124
-	protected static function _get_venue( $privacy_check = true ) {
124
+	protected static function _get_venue($privacy_check = true) {
125 125
 		// check for private venues.
126
-		if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->status() == 'private' && $privacy_check && ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
126
+		if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->status() == 'private' && $privacy_check && ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
127 127
 			return null;
128 128
 		}
129 129
 		return EEH_Venue_View::$_venue instanceof EE_Venue ? EEH_Venue_View::$_venue : null;
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public static function get_event_venues() {
141 141
 		global $post;
142
-		if ( $post->post_type == 'espresso_events' ) {
143
-			if ( isset( $post->EE_Event ) && $post->EE_Event instanceof EE_Event ) {
142
+		if ($post->post_type == 'espresso_events') {
143
+			if (isset($post->EE_Event) && $post->EE_Event instanceof EE_Event) {
144 144
 				return $post->EE_Event->venues();
145 145
 			}
146 146
 		}
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return bool|null
162 162
 	 */
163
-	public static function is_venue_private( $VNU_ID = false ) {
164
-		$venue = EEH_Venue_View::get_venue( $VNU_ID, true, true );
165
-		if ( ! $venue instanceof EE_Venue ) {
163
+	public static function is_venue_private($VNU_ID = false) {
164
+		$venue = EEH_Venue_View::get_venue($VNU_ID, true, true);
165
+		if ( ! $venue instanceof EE_Venue) {
166 166
 			return null;
167 167
 		}
168 168
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 	 * @param int $VNU_ID
179 179
 	 * @return string
180 180
 	 */
181
-	public static function venue_description( $VNU_ID = 0 ) {
182
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
183
-		if ( $venue instanceof EE_Venue ) {
181
+	public static function venue_description($VNU_ID = 0) {
182
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
183
+		if ($venue instanceof EE_Venue) {
184 184
 			return$venue->description();
185 185
 		}
186 186
 		return '';
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
 	 * @param int $VNU_ID
196 196
 	 * @return string
197 197
 	 */
198
-	public static function venue_excerpt( $VNU_ID = 0 ) {
199
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
200
-		if ( $venue instanceof EE_Venue ) {
198
+	public static function venue_excerpt($VNU_ID = 0) {
199
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
200
+		if ($venue instanceof EE_Venue) {
201 201
 			$excerpt = $venue->excerpt() != NULL && $venue->excerpt() ? $venue->excerpt() : $venue->description();
202
-			$venue_link = ' ' . EEH_Venue_View::venue_details_link( $venue->ID(), __( 'more', 'event_espresso' ) . '&hellip;' );
203
-			return ! empty( $excerpt ) ? wp_trim_words( $excerpt, 25, '' ) . $venue_link : '';
202
+			$venue_link = ' '.EEH_Venue_View::venue_details_link($venue->ID(), __('more', 'event_espresso').'&hellip;');
203
+			return ! empty($excerpt) ? wp_trim_words($excerpt, 25, '').$venue_link : '';
204 204
 		}
205 205
 		return '';
206 206
 	}
@@ -215,22 +215,22 @@  discard block
 block discarded – undo
215 215
 	 * @param bool $hide_uncategorized
216 216
 	 * @return string
217 217
 	 */
218
-	public static function venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE ) {
218
+	public static function venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE) {
219 219
 		$category_links = array();
220
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
221
-		if ( $venue instanceof EE_Venue ) {
220
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
221
+		if ($venue instanceof EE_Venue) {
222 222
 			// get category terms
223
-			if ( $venue_categories = get_the_terms( $venue->ID(), 'espresso_venue_categories' )) {
223
+			if ($venue_categories = get_the_terms($venue->ID(), 'espresso_venue_categories')) {
224 224
 				// loop thru terms and create links
225
-				foreach ( $venue_categories as $term ) {
226
-					$url = get_term_link( $term, 'espresso_venue_categories' );
227
-					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
228
-						$category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a> ';
225
+				foreach ($venue_categories as $term) {
226
+					$url = get_term_link($term, 'espresso_venue_categories');
227
+					if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) {
228
+						$category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a> ';
229 229
 					}
230 230
 				}
231 231
 			}
232 232
 		}
233
-		return implode( ', ', $category_links );
233
+		return implode(', ', $category_links);
234 234
 	}
235 235
 
236 236
 
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	 * @param bool $add_wrapper
246 246
 	 * @return string
247 247
 	 */
248
-	public static function venue_address( $type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true ) {
249
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
250
-		if ( $venue instanceof EE_Venue ) {
251
-			return EEH_Address::format( $venue, $type, $use_schema, $add_wrapper );
248
+	public static function venue_address($type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true) {
249
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
250
+		if ($venue instanceof EE_Venue) {
251
+			return EEH_Address::format($venue, $type, $use_schema, $add_wrapper);
252 252
 		}
253 253
 		return '';
254 254
 	}
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
 	 * @param int $VNU_ID
263 263
 	 * @return bool|string
264 264
 	 */
265
-	public static function venue_has_address( $VNU_ID = 0 ) {
266
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
267
-		if ( $venue instanceof EE_Venue ) {
268
-			return EEH_Address::format( $venue, 'inline', FALSE, FALSE );
265
+	public static function venue_has_address($VNU_ID = 0) {
266
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
267
+		if ($venue instanceof EE_Venue) {
268
+			return EEH_Address::format($venue, 'inline', FALSE, FALSE);
269 269
 		}
270 270
 		return false;
271 271
 	}
@@ -280,30 +280,30 @@  discard block
 block discarded – undo
280 280
 	 * @param int $VNU_ID
281 281
 	 * @return string
282 282
 	 */
283
-	public static function venue_name( $link_to = 'details', $VNU_ID = 0 ) {
284
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
285
-		if ( $venue instanceof EE_Venue ) {
283
+	public static function venue_name($link_to = 'details', $VNU_ID = 0) {
284
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
285
+		if ($venue instanceof EE_Venue) {
286 286
 			$venue_name = apply_filters(
287 287
 				'FHEE__EEH_Venue__venue_name__append_private_venue_name',
288 288
 				EEH_Venue_View::is_venue_private()
289
-					? EEH_Venue_View::$_venue->name() . "&nbsp;" . __( '(Private)', 'event_espresso' )
289
+					? EEH_Venue_View::$_venue->name()."&nbsp;".__('(Private)', 'event_espresso')
290 290
 					: EEH_Venue_View::$_venue->name(),
291 291
 				EEH_Venue_View::$_venue
292 292
 			);
293
-			$venue_name = EEH_Schema::name( $venue_name );
293
+			$venue_name = EEH_Schema::name($venue_name);
294 294
 
295 295
 			//if venue is trashed then ignore the "link to" setting because the venue is trashed.
296
-			if ( $venue->get('status') == 'trash' ) {
296
+			if ($venue->get('status') == 'trash') {
297 297
 				$link_to = '';
298 298
 			}
299
-			switch( $link_to ) {
299
+			switch ($link_to) {
300 300
 
301 301
 				case 'details' :
302
-					return EEH_Venue_View::venue_details_link( $venue->ID(), $venue_name );
302
+					return EEH_Venue_View::venue_details_link($venue->ID(), $venue_name);
303 303
 				break;
304 304
 
305 305
 				case 'website' :
306
-					return EEH_Venue_View::venue_website_link( $venue->ID(), $venue_name );
306
+					return EEH_Venue_View::venue_website_link($venue->ID(), $venue_name);
307 307
 				break;
308 308
 
309 309
 				default :
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 	 * @param    string $text
324 324
 	 * @return string
325 325
 	 */
326
-	public static function venue_details_link( $VNU_ID = 0, $text = '' ) {
327
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
328
-		if ( $venue instanceof EE_Venue ) {
329
-			return EEH_Schema::url( get_permalink( $venue->ID() ), $text );
326
+	public static function venue_details_link($VNU_ID = 0, $text = '') {
327
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
328
+		if ($venue instanceof EE_Venue) {
329
+			return EEH_Schema::url(get_permalink($venue->ID()), $text);
330 330
 		}
331 331
 		return '';
332 332
 	}
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 	 * @param    string $text
342 342
 	 * @return string
343 343
 	 */
344
-	public static function venue_website_link( $VNU_ID = 0, $text = '' ) {
345
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
346
-		if ( $venue instanceof EE_Venue ) {
344
+	public static function venue_website_link($VNU_ID = 0, $text = '') {
345
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
346
+		if ($venue instanceof EE_Venue) {
347 347
 			$url = $venue->venue_url();
348
-			$text = ! empty( $text ) ? $text : $url;
349
-			return ! empty( $url ) ? EEH_Schema::url( $url, $text ) : '';
348
+			$text = ! empty($text) ? $text : $url;
349
+			return ! empty($url) ? EEH_Schema::url($url, $text) : '';
350 350
 		}
351 351
 		return '';
352 352
 	}
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 	 * @param int $VNU_ID
361 361
 	 * @return string
362 362
 	 */
363
-	public static function venue_phone( $VNU_ID = 0) {
364
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
365
-		if ( $venue instanceof EE_Venue ) {
366
-			return EEH_Schema::telephone( $venue->phone() );
363
+	public static function venue_phone($VNU_ID = 0) {
364
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
365
+		if ($venue instanceof EE_Venue) {
366
+			return EEH_Schema::telephone($venue->phone());
367 367
 		}
368 368
 		return '';
369 369
 	}
@@ -379,48 +379,48 @@  discard block
 block discarded – undo
379 379
 	 * @param    array $gmap map options
380 380
 	 * @return string
381 381
 	 */
382
-	public static function venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array() ) {
382
+	public static function venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array()) {
383 383
 
384
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
385
-		if ( $venue instanceof EE_Venue ) {
384
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
385
+		if ($venue instanceof EE_Venue) {
386 386
 			// check for global espresso_events post and use it's ID if no map_ID is set
387 387
 			global $post;
388
-			$map_ID = empty( $map_ID ) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID;
388
+			$map_ID = empty($map_ID) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID;
389 389
 			// grab map settings
390 390
 			$map_cfg = EE_Registry::instance()->CFG->map_settings;
391 391
 			// are maps enabled ?
392
-			if ( $map_cfg->use_google_maps && $venue->enable_for_gmap() ) {
392
+			if ($map_cfg->use_google_maps && $venue->enable_for_gmap()) {
393 393
 
394 394
 				$details_page = is_single();
395 395
 				$options = array();
396
-				$options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID . '-' . $venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/;
396
+				$options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID.'-'.$venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/;
397 397
 
398
-				$options['location'] = EEH_Address::format( $venue, 'inline', FALSE, FALSE );
398
+				$options['location'] = EEH_Address::format($venue, 'inline', FALSE, FALSE);
399 399
 
400 400
 				$options['ee_map_width'] = $details_page ? $map_cfg->event_details_map_width : $map_cfg->event_list_map_width;
401
-				$options['ee_map_width'] = isset( $gmap['ee_map_width'] ) && ! empty( $gmap['ee_map_width'] ) ? $gmap['ee_map_width'] : $options['ee_map_width'];
401
+				$options['ee_map_width'] = isset($gmap['ee_map_width']) && ! empty($gmap['ee_map_width']) ? $gmap['ee_map_width'] : $options['ee_map_width'];
402 402
 
403 403
 				$options['ee_map_height'] = $details_page ? $map_cfg->event_details_map_height : $map_cfg->event_list_map_height;
404
-				$options['ee_map_height'] = isset( $gmap['ee_map_height'] ) && ! empty( $gmap['ee_map_height'] ) ? $gmap['ee_map_height'] : $options['ee_map_height'];
404
+				$options['ee_map_height'] = isset($gmap['ee_map_height']) && ! empty($gmap['ee_map_height']) ? $gmap['ee_map_height'] : $options['ee_map_height'];
405 405
 
406 406
 				$options['ee_map_zoom'] = $details_page ? $map_cfg->event_details_map_zoom : $map_cfg->event_list_map_zoom;
407
-				$options['ee_map_zoom'] = isset( $gmap['ee_map_zoom'] ) && ! empty( $gmap['ee_map_zoom'] ) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom'];
407
+				$options['ee_map_zoom'] = isset($gmap['ee_map_zoom']) && ! empty($gmap['ee_map_zoom']) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom'];
408 408
 
409 409
 				$options['ee_map_nav_display'] = $details_page ? $map_cfg->event_details_display_nav : $map_cfg->event_list_display_nav;
410
-				$options['ee_map_nav_display'] = isset( $gmap['ee_map_nav_display'] ) && ! empty( $gmap['ee_map_nav_display'] ) ? 'true' : $options['ee_map_nav_display'];;
410
+				$options['ee_map_nav_display'] = isset($gmap['ee_map_nav_display']) && ! empty($gmap['ee_map_nav_display']) ? 'true' : $options['ee_map_nav_display']; ;
411 411
 
412 412
 				$options['ee_map_nav_size'] = $details_page ? $map_cfg->event_details_nav_size : $map_cfg->event_list_nav_size;
413
-				$options['ee_map_nav_size'] =  isset( $gmap['ee_map_nav_size'] ) && ! empty( $gmap['ee_map_nav_size'] )? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size'];
413
+				$options['ee_map_nav_size'] = isset($gmap['ee_map_nav_size']) && ! empty($gmap['ee_map_nav_size']) ? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size'];
414 414
 
415 415
 				$options['ee_map_type_control'] = $details_page ? $map_cfg->event_details_control_type : $map_cfg->event_list_control_type;
416
-				$options['ee_map_type_control'] =  isset( $gmap['ee_map_type_control'] ) && ! empty( $gmap['ee_map_type_control'] )? $gmap['ee_map_type_control'] : $options['ee_map_type_control'];
416
+				$options['ee_map_type_control'] = isset($gmap['ee_map_type_control']) && ! empty($gmap['ee_map_type_control']) ? $gmap['ee_map_type_control'] : $options['ee_map_type_control'];
417 417
 
418 418
 				$options['ee_map_align'] = $details_page ? $map_cfg->event_details_map_align : $map_cfg->event_list_map_align;
419
-				$options['ee_map_align'] =  isset( $gmap['ee_map_align'] ) && ! empty( $gmap['ee_map_align'] )? $gmap['ee_map_align'] : $options['ee_map_align'];
419
+				$options['ee_map_align'] = isset($gmap['ee_map_align']) && ! empty($gmap['ee_map_align']) ? $gmap['ee_map_align'] : $options['ee_map_align'];
420 420
 
421
-				$options['ee_static_url'] =  isset( $gmap['ee_static_url'] ) && ! empty( $gmap['ee_static_url'] ) ? (bool)absint( $gmap['ee_static_url'] ) : $venue->google_map_link();
421
+				$options['ee_static_url'] = isset($gmap['ee_static_url']) && ! empty($gmap['ee_static_url']) ? (bool) absint($gmap['ee_static_url']) : $venue->google_map_link();
422 422
 
423
-				return EEH_Maps::google_map( $options );
423
+				return EEH_Maps::google_map($options);
424 424
 
425 425
 			}
426 426
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 * @param array $atts like EEH_Maps::google_map_link
436 436
 	 * @return string
437 437
 	 */
438
-	public static function espresso_google_static_map( EE_Venue $venue, $atts = array() ){
438
+	public static function espresso_google_static_map(EE_Venue $venue, $atts = array()) {
439 439
 		$state = $venue->state_obj();
440 440
 		$country = $venue->country_obj();
441 441
 		$atts = shortcode_atts(
@@ -466,23 +466,23 @@  discard block
 block discarded – undo
466 466
 	 * @param string $after
467 467
 	 * @return string
468 468
 	 */
469
-	public static function edit_venue_link( $VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>' ) {
470
-		$venue = EEH_Venue_View::get_venue( $VNU_ID );
471
-		if ( $venue instanceof EE_Venue ) {
469
+	public static function edit_venue_link($VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>') {
470
+		$venue = EEH_Venue_View::get_venue($VNU_ID);
471
+		if ($venue instanceof EE_Venue) {
472 472
 			// can the user edit this post ?
473
-			if ( current_user_can( 'edit_post', $venue->ID() )) {
473
+			if (current_user_can('edit_post', $venue->ID())) {
474 474
 				// set link text
475
-				$link = ! empty( $link ) ? $link : __('edit this venue');
475
+				$link = ! empty($link) ? $link : __('edit this venue');
476 476
 				// generate nonce
477
-				$nonce = wp_create_nonce( 'edit_nonce' );
477
+				$nonce = wp_create_nonce('edit_nonce');
478 478
 				// generate url to venue editor for this venue
479
-				$url = add_query_arg( array( 'page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce ), admin_url( 'admin.php' ) );
479
+				$url = add_query_arg(array('page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce), admin_url('admin.php'));
480 480
 				// get edit CPT text
481
-				$post_type_obj = get_post_type_object( 'espresso_venues' );
481
+				$post_type_obj = get_post_type_object('espresso_venues');
482 482
 				// build final link html
483
-				$link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>';
483
+				$link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>';
484 484
 				// put it all together
485
-				return $before . apply_filters( 'edit_post_link', $link, $venue->ID() ) . $after;
485
+				return $before.apply_filters('edit_post_link', $link, $venue->ID()).$after;
486 486
 			}
487 487
 		}
488 488
 		return '';
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 1 patch
Spacing   +377 added lines, -377 removed lines patch added patch discarded remove patch
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	 * 	@return string
70 70
 	 * 	@todo: at some point we can break this down into other static methods to abstract it a bit better.
71 71
 	 */
72
-	static public function get_form_fields( $input_vars = array(), $id = FALSE ) {
72
+	static public function get_form_fields($input_vars = array(), $id = FALSE) {
73 73
 		
74
-		if ( empty($input_vars) ) {
75
-			EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
74
+		if (empty($input_vars)) {
75
+			EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
76 76
 			return FALSE;
77 77
 		}
78 78
 
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
 				'append_content' => ''
99 99
 				);
100 100
 
101
-			$input_value = wp_parse_args( $input_value, $defaults );
101
+			$input_value = wp_parse_args($input_value, $defaults);
102 102
 
103 103
 			// required fields get a *
104 104
 			$required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': ';
105 105
 			// and the css class "required"
106
-			$css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : '';
107
-			$styles = $input_value['required'] ? 'required ' . $css_class : $css_class;
106
+			$css_class = isset($input_value['css_class']) ? $input_value['css_class'] : '';
107
+			$styles = $input_value['required'] ? 'required '.$css_class : $css_class;
108 108
 
109
-			$field_id = ($id) ? $id . '-' . $input_key : $input_key;
110
-			$tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : '';
109
+			$field_id = ($id) ? $id.'-'.$input_key : $input_key;
110
+			$tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : '';
111 111
 
112 112
 			//rows or cols?
113
-			$rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10';
114
-			$cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80';
113
+			$rows = isset($input_value['rows']) ? $input_value['rows'] : '10';
114
+			$cols = isset($input_value['cols']) ? $input_value['cols'] : '80';
115 115
 
116 116
 			//any content?
117 117
 			$append_content = $input_value['append_content'];
118 118
 
119
-			$output .= (!$close) ? '<ul>' : '';
119
+			$output .= ( ! $close) ? '<ul>' : '';
120 120
 			$output .= '<li>';
121 121
 
122 122
 			// what type of input are we dealing with ?
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 
125 125
 				// text inputs
126 126
 				case 'text' :
127
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
128
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
127
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
128
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>';
129 129
 					break;
130 130
 
131 131
 				// dropdowns
132 132
 				case 'select' :
133 133
 
134
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
135
-					$output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
134
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
135
+					$output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>';
136 136
 
137 137
 					if (is_array($input_value['options'])) {
138 138
 						$options = $input_value['options'];
@@ -141,30 +141,30 @@  discard block
 block discarded – undo
141 141
 					}
142 142
 
143 143
 					foreach ($options as $key => $value) {
144
-						$selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : '';
144
+						$selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : '';
145 145
 						//$key = str_replace( ' ', '_', sanitize_key( $value ));
146
-						$output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>';
146
+						$output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>';
147 147
 					}
148
-					$output .= "\n\t\t\t" . '</select>';
148
+					$output .= "\n\t\t\t".'</select>';
149 149
 
150 150
 					break;
151 151
 
152 152
 				case 'textarea' :
153 153
 
154
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
155
-					$output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>';
154
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
155
+					$output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>';
156 156
 					break;
157 157
 
158 158
 				case 'hidden' :
159 159
 					$close = false;
160 160
 					$output .= "</li></ul>";
161
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">';
161
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">';
162 162
 					break;
163 163
 
164 164
 				case 'checkbox' :
165
-					$checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : '';
166
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
167
-					$output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />';
165
+					$checked = ($input_value['value'] == 1) ? 'checked="checked"' : '';
166
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
167
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />';
168 168
 					break;
169 169
 
170 170
 				case 'wp_editor' :
@@ -177,19 +177,19 @@  discard block
 block discarded – undo
177 177
 					);
178 178
 					$output .= '</li>';
179 179
 					$output .= '</ul>';
180
-					$output .= '<h4>' . $input_value['label'] . '</h4>';
181
-					if ( $append_content ) {
180
+					$output .= '<h4>'.$input_value['label'].'</h4>';
181
+					if ($append_content) {
182 182
 						$output .= $append_content;
183 183
 					}
184 184
 					ob_start();
185
-					wp_editor( $input_value['value'], $field_id, $editor_settings);
185
+					wp_editor($input_value['value'], $field_id, $editor_settings);
186 186
 					$editor = ob_get_contents();
187 187
 					ob_end_clean();
188 188
 					$output .= $editor;
189 189
 					break;
190 190
 
191 191
 				}
192
-				if ( $append_content && $input_value['input'] !== 'wp_editor' ) {
192
+				if ($append_content && $input_value['input'] !== 'wp_editor') {
193 193
 					$output .= $append_content;
194 194
 				}
195 195
 				$output .= ($close) ? '</li>' : '';
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$form_fields = array();
231 231
 		$fields = (array) $fields;
232 232
 
233
-		foreach ( $fields as $field_name => $field_atts ) {
233
+		foreach ($fields as $field_name => $field_atts) {
234 234
 			//defaults:
235 235
 			$defaults = array(
236 236
 				'label' => '',
@@ -248,67 +248,67 @@  discard block
 block discarded – undo
248 248
 				'wpeditor_args' => array()
249 249
 				);
250 250
 			// merge defaults with passed arguments
251
-			$_fields = wp_parse_args( $field_atts, $defaults);
252
-			extract( $_fields );
251
+			$_fields = wp_parse_args($field_atts, $defaults);
252
+			extract($_fields);
253 253
 			// generate label
254
-			$label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>';
254
+			$label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>';
255 255
 			// generate field name
256
-			$f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
256
+			$f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
257 257
 
258 258
 			//tabindex
259
-			$tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
259
+			$tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : '';
260 260
 
261 261
 			//we determine what we're building based on the type
262
-			switch ( $type ) {
262
+			switch ($type) {
263 263
 
264 264
 				case 'textarea' :
265
-						$fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>';
265
+						$fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>';
266 266
 						$fld .= $extra_desc;
267 267
 					break;
268 268
 
269 269
 				case 'checkbox' :
270 270
 						$c_input = '';
271
-						if ( is_array($value) ) {
272
-							foreach ( $value as $key => $val ) {
273
-								$c_id = $field_name . '_' . $value;
274
-								$c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : '';
275
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
276
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
277
-								$c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
271
+						if (is_array($value)) {
272
+							foreach ($value as $key => $val) {
273
+								$c_id = $field_name.'_'.$value;
274
+								$c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : '';
275
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
276
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
277
+								$c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
278 278
 							}
279 279
 							$fld = $c_input;
280 280
 						} else {
281
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
282
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
281
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
282
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
283 283
 						}
284 284
 					break;
285 285
 
286 286
 				case 'radio' :
287 287
 						$c_input = '';
288
-						if ( is_array($value) ) {
289
-							foreach ( $value as $key => $val ) {
290
-								$c_id = $field_name . '_' . $value;
291
-								$c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : '';
292
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
293
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
294
-								$c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
288
+						if (is_array($value)) {
289
+							foreach ($value as $key => $val) {
290
+								$c_id = $field_name.'_'.$value;
291
+								$c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : '';
292
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
293
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
294
+								$c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
295 295
 							}
296 296
 							$fld = $c_input;
297 297
 						} else {
298
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
299
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
298
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
299
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
300 300
 						}
301 301
 					break;
302 302
 
303 303
 				case 'hidden' :
304
-						$fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n";
304
+						$fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
305 305
 					break;
306 306
 
307 307
 				case 'select' :
308
-						$fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n";
309
-						foreach ( $value as $key => $val ) {
310
-							$checked = !empty($default) && $default == $val ? ' selected="selected"' : '';
311
-							$fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n";
308
+						$fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n";
309
+						foreach ($value as $key => $val) {
310
+							$checked = ! empty($default) && $default == $val ? ' selected="selected"' : '';
311
+							$fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n";
312 312
 						}
313 313
 						$fld .= '</select>';
314 314
 					break;
@@ -320,21 +320,21 @@  discard block
 block discarded – undo
320 320
 							'editor_class' => $class,
321 321
 							'tabindex' => $tabindex
322 322
 							);
323
-						$editor_settings = array_merge( $wpeditor_args, $editor_settings );
323
+						$editor_settings = array_merge($wpeditor_args, $editor_settings);
324 324
 						ob_start();
325
-						wp_editor( $value, $id, $editor_settings );
325
+						wp_editor($value, $id, $editor_settings);
326 326
 						$editor = ob_get_contents();
327 327
 						ob_end_clean();
328 328
 						$fld = $editor;
329 329
 					break;
330 330
 
331 331
 				default : //'text fields'
332
-						$fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n";
332
+						$fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n";
333 333
 						$fld .= $extra_desc;
334 334
 
335 335
 			}
336 336
 
337
-			$form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld );
337
+			$form_fields[$field_name] = array('label' => $label, 'field' => $fld);
338 338
 		}
339 339
 
340 340
 		return $form_fields;
@@ -363,19 +363,19 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) {
365 365
 		//if $values was submitted in the wrong format, convert it over
366
-		if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){
367
-			$converted_values=array();
368
-			foreach($values as $id=>$text){
369
-				$converted_values[]=array('id'=>$id,'text'=>$text);
366
+		if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
367
+			$converted_values = array();
368
+			foreach ($values as $id=>$text) {
369
+				$converted_values[] = array('id'=>$id, 'text'=>$text);
370 370
 			}
371
-			$values=$converted_values;
371
+			$values = $converted_values;
372 372
 		}
373 373
 
374
-		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
374
+		$field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"';
375 375
 		//Debug
376 376
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
377
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
378
-			$field .= ' ' . $parameters;
377
+		if (EEH_Formatter::ee_tep_not_null($parameters))
378
+			$field .= ' '.$parameters;
379 379
 		if ($autosize) {
380 380
 			$size = 'med';
381 381
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
@@ -388,21 +388,21 @@  discard block
 block discarded – undo
388 388
 			$size = '';
389 389
 		}
390 390
 
391
-		$field .= ' class="' . $class . ' ' . $size . '">';
391
+		$field .= ' class="'.$class.' '.$size.'">';
392 392
 
393 393
 		if (empty($default) && isset($GLOBALS[$name]))
394 394
 			$default = stripslashes($GLOBALS[$name]);
395 395
 
396 396
 
397 397
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
398
-			$field .= '<option value="' . $values[$i]['id'] . '"';
398
+			$field .= '<option value="'.$values[$i]['id'].'"';
399 399
 			if ($default == $values[$i]['id']) {
400 400
 				$field .= ' selected = "selected"';
401 401
 			}
402
-			if ( isset( $values[$i]['class'] ) ) {
403
-				$field .= ' class="' . $values[$i]['class'] . '"';
402
+			if (isset($values[$i]['class'])) {
403
+				$field .= ' class="'.$values[$i]['class'].'"';
404 404
 			}
405
-			$field .= '>' . $values[$i]['text'] . '</option>';
405
+			$field .= '>'.$values[$i]['text'].'</option>';
406 406
 		}
407 407
 		$field .= '</select>';
408 408
 
@@ -420,38 +420,38 @@  discard block
 block discarded – undo
420 420
 	 * @param string $question_groups
421 421
 	 * @return string HTML
422 422
 	 */
423
-	static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) {
423
+	static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') {
424 424
 
425 425
 		$html = '';
426
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
427
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
426
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
427
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
428 428
 
429
-		if ( ! empty( $question_groups )) {
429
+		if ( ! empty($question_groups)) {
430 430
 			//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
431 431
 			// loop thru question groups
432
-			foreach ( $question_groups as $QSG ) {
432
+			foreach ($question_groups as $QSG) {
433 433
 				// check that questions exist
434
-				if ( ! empty( $QSG['QSG_questions'] )) {
434
+				if ( ! empty($QSG['QSG_questions'])) {
435 435
 					// use fieldsets
436
-					$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">';
436
+					$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">';
437 437
 					// group_name
438
-					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : '';
438
+					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : '';
439 439
 					// group_desc
440
-					$html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : '';
440
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : '';
441 441
 
442 442
 					$html .= $before_question_group_questions;
443 443
 					// loop thru questions
444
-					foreach ( $QSG['QSG_questions'] as $question ) {
444
+					foreach ($QSG['QSG_questions'] as $question) {
445 445
 //						EEH_Debug_Tools::printr( $question, '$question  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
446 446
 						$QFI = new EE_Question_Form_Input(
447 447
 							$question['qst_obj'],
448 448
 							$question['ans_obj'],
449 449
 							$question
450 450
 						);
451
-						$html .= self::generate_form_input( $QFI );
451
+						$html .= self::generate_form_input($QFI);
452 452
 					}
453 453
 					$html .= $after_question_group_questions;
454
-					$html .= "\n\t" . '</' . $group_wrapper . '>';
454
+					$html .= "\n\t".'</'.$group_wrapper.'>';
455 455
 				}
456 456
 			}
457 457
 		}
@@ -471,11 +471,11 @@  discard block
 block discarded – undo
471 471
 	 * @param string       $group_wrapper
472 472
 	 * @return string HTML
473 473
 	 */
474
-	static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), 	$from_admin = FALSE, $group_wrapper = 'fieldset' ) {
474
+	static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') {
475 475
 
476 476
 		$html = '';
477
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
478
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
477
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
478
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
479 479
 
480 480
 		$default_q_meta = array(
481 481
 				'att_nmbr' => 1,
@@ -484,55 +484,55 @@  discard block
 block discarded – undo
484 484
 				'input_id' => '',
485 485
 				'input_class' => ''
486 486
 		);
487
-		$q_meta = array_merge( $default_q_meta, $q_meta );
487
+		$q_meta = array_merge($default_q_meta, $q_meta);
488 488
 		//EEH_Debug_Tools::printr( $q_meta, '$q_meta  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
489 489
 
490
-		if ( ! empty( $question_groups )) {
490
+		if ( ! empty($question_groups)) {
491 491
 //			EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
492 492
 			// loop thru question groups
493
-			foreach ( $question_groups as $QSG ) {
494
-				if ( $QSG instanceof EE_Question_Group ) {
493
+			foreach ($question_groups as $QSG) {
494
+				if ($QSG instanceof EE_Question_Group) {
495 495
 					// check that questions exist
496 496
 
497
-					$where = array( 'QST_deleted' => 0 );
498
-					if ( ! $from_admin ) {
497
+					$where = array('QST_deleted' => 0);
498
+					if ( ! $from_admin) {
499 499
 						$where['QST_admin_only'] = 0;
500 500
 					}
501
-					$questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' )));
502
-					if ( ! empty( $questions )) {
501
+					$questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC')));
502
+					if ( ! empty($questions)) {
503 503
 						// use fieldsets
504
-						$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">';
504
+						$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">';
505 505
 						// group_name
506
-						if ( $QSG->show_group_name() ) {
507
-							$html .=  "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>';
506
+						if ($QSG->show_group_name()) {
507
+							$html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>';
508 508
 						}
509 509
 						// group_desc
510
-						if ( $QSG->show_group_desc() ) {
511
-							$html .=  '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc'  ) . '</div>';
510
+						if ($QSG->show_group_desc()) {
511
+							$html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>';
512 512
 						}
513 513
 
514 514
 						$html .= $before_question_group_questions;
515 515
 						// loop thru questions
516
-						foreach ( $questions as $QST ) {
516
+						foreach ($questions as $QST) {
517 517
 							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
518 518
 
519 519
 							$answer = NULL;
520 520
 
521
-							if (  isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) {
521
+							if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
522 522
 								// check for answer in $_GET in case we are reprocessing a form after an error
523
-								if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) {
524
-									$answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] );
523
+								if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) {
524
+									$answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]);
525 525
 								}
526
-							} else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) {
526
+							} else if (isset($q_meta['attendee']) && $q_meta['attendee']) {
527 527
 								//attendee data from the session
528
-								$answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL;
528
+								$answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL;
529 529
 							}
530 530
 
531 531
 
532 532
 
533 533
 							$QFI = new EE_Question_Form_Input(
534 534
 									$QST,
535
-									EE_Answer::new_instance ( array(
535
+									EE_Answer::new_instance(array(
536 536
 											'ANS_ID'=> 0,
537 537
 											'QST_ID'=> 0,
538 538
 											'REG_ID'=> 0,
@@ -541,10 +541,10 @@  discard block
 block discarded – undo
541 541
 									$q_meta
542 542
 							);
543 543
 							//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
544
-							$html .= self::generate_form_input( $QFI );
544
+							$html .= self::generate_form_input($QFI);
545 545
 						}
546 546
 						$html .= $after_question_group_questions;
547
-						$html .= "\n\t" . '</' . $group_wrapper . '>';
547
+						$html .= "\n\t".'</'.$group_wrapper.'>';
548 548
 					}
549 549
 				}
550 550
 			}
@@ -564,63 +564,63 @@  discard block
 block discarded – undo
564 564
 	 * @param EE_Question_Form_Input $QFI
565 565
 	 * @return string HTML
566 566
 	 */
567
-	static function generate_form_input( EE_Question_Form_Input $QFI ) {
568
-		if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) {
567
+	static function generate_form_input(EE_Question_Form_Input $QFI) {
568
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
569 569
 			return '';
570 570
 		}
571 571
 
572
-		$QFI = self::_load_system_dropdowns( $QFI );
573
-		$QFI = self::_load_specialized_dropdowns( $QFI );
572
+		$QFI = self::_load_system_dropdowns($QFI);
573
+		$QFI = self::_load_specialized_dropdowns($QFI);
574 574
 
575 575
 		//we also need to verify
576 576
 
577 577
 		$display_text = $QFI->get('QST_display_text');
578 578
 		$input_name = $QFI->get('QST_input_name');
579
-		$answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value');
579
+		$answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
580 580
 		$input_id = $QFI->get('QST_input_id');
581 581
 		$input_class = $QFI->get('QST_input_class');
582 582
 //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
583 583
 		$disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
584
-		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' );
584
+		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
585 585
 		$QST_required = $QFI->get('QST_required');
586
-		$required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array();
587
-		$use_html_entities = $QFI->get_meta( 'htmlentities' );
588
-		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' );
589
-		$required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : '';
586
+		$required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
587
+		$use_html_entities = $QFI->get_meta('htmlentities');
588
+		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
589
+		$required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : '';
590 590
 		$label_class = 'espresso-form-input-lbl';
591
-		$QST_options = $QFI->options(true,$answer);
592
-		$options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array();
591
+		$QST_options = $QFI->options(true, $answer);
592
+		$options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
593 593
 		$system_ID = $QFI->get('QST_system');
594
-		$label_b4 = $QFI->get_meta( 'label_b4' );
595
-		$use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' );
594
+		$label_b4 = $QFI->get_meta('label_b4');
595
+		$use_desc_4_label = $QFI->get_meta('use_desc_4_label');
596 596
 
597 597
 
598
-		switch ( $QFI->get('QST_type') ){
598
+		switch ($QFI->get('QST_type')) {
599 599
 
600 600
 			case 'TEXTAREA' :
601
-					return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
601
+					return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
602 602
 				break;
603 603
 
604 604
 			case 'DROPDOWN' :
605
-					return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE );
605
+					return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE);
606 606
 				break;
607 607
 
608 608
 
609 609
 			case 'RADIO_BTN' :
610
-					return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label );
610
+					return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label);
611 611
 				break;
612 612
 
613 613
 			case 'CHECKBOX' :
614
-					return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities );
614
+					return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities);
615 615
 				break;
616 616
 
617 617
 			case 'DATE' :
618
-					return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
618
+					return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
619 619
 				break;
620 620
 
621 621
 			case 'TEXT' :
622 622
 			default:
623
-					return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
623
+					return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
624 624
 				break;
625 625
 
626 626
 		}
@@ -646,31 +646,31 @@  discard block
 block discarded – undo
646 646
 	 * @param string $disabled 		disabled="disabled" or null
647 647
 	 * @return string HTML
648 648
 	 */
649
-	static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
649
+	static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
650 650
 		// need these
651
-		if ( ! $question || ! $name ) {
651
+		if ( ! $question || ! $name) {
652 652
 			return NULL;
653 653
 		}
654 654
 		// prep the answer
655
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
655
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
656 656
 		// prep the required array
657
-		$required = self::prep_required( $required );
657
+		$required = self::prep_required($required);
658 658
 		// set disabled tag
659
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
659
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
660 660
 		// ya gots ta have style man!!!
661 661
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
662
-		$class = empty( $class ) ? $txt_class : $class;
663
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
664
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
662
+		$class = empty($class) ? $txt_class : $class;
663
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
664
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
665 665
 
666
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
666
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
667 667
 		// filter label but ensure required text comes before it
668
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
668
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
669 669
 
670
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . esc_attr( $answer ) . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>';
670
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.esc_attr($answer).'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
671 671
 
672
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
673
-		return  $label_html . $input_html;
672
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
673
+		return  $label_html.$input_html;
674 674
 
675 675
 	}
676 676
 
@@ -692,35 +692,35 @@  discard block
 block discarded – undo
692 692
 	 * @param string $disabled 		disabled="disabled" or null
693 693
 	 * @return string HTML
694 694
 	 */
695
-	static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
695
+	static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
696 696
 		// need these
697
-		if ( ! $question || ! $name ) {
697
+		if ( ! $question || ! $name) {
698 698
 			return NULL;
699 699
 		}
700 700
 		// prep the answer
701
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
701
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
702 702
 		// prep the required array
703
-		$required = self::prep_required( $required );
703
+		$required = self::prep_required($required);
704 704
 		// make sure $dimensions is an array
705
-		$dimensions = is_array( $dimensions ) ? $dimensions : array();
705
+		$dimensions = is_array($dimensions) ? $dimensions : array();
706 706
 		// and set some defaults
707
-		$dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions );
707
+		$dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions);
708 708
 		// set disabled tag
709
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
709
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
710 710
 		// ya gots ta have style man!!!
711 711
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp';
712
-		$class = empty( $class ) ? $txt_class : $class;
713
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
714
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
712
+		$class = empty($class) ? $txt_class : $class;
713
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
714
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
715 715
 
716
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
716
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
717 717
 		// filter label but ensure required text comes before it
718
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
718
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
719 719
 
720
-		$input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>';
720
+		$input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'"  title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>';
721 721
 
722
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
723
-		return  $label_html . $input_html;
722
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
723
+		return  $label_html.$input_html;
724 724
 
725 725
 	}
726 726
 
@@ -743,47 +743,47 @@  discard block
 block discarded – undo
743 743
 	 * @param string $disabled 		disabled="disabled" or null
744 744
 	 * @return string HTML
745 745
 	 */
746
-	static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) {
746
+	static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) {
747 747
 
748 748
 		// need these
749
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
749
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
750 750
 			return NULL;
751 751
 		}
752 752
 		// prep the answer
753
-		$answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer ), $use_html_entities) : self::prep_answer( $answer, $use_html_entities );
753
+		$answer = is_array($answer) ? self::prep_answer(array_shift($answer), $use_html_entities) : self::prep_answer($answer, $use_html_entities);
754 754
 		// prep the required array
755
-		$required = self::prep_required( $required );
755
+		$required = self::prep_required($required);
756 756
 		// set disabled tag
757
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
757
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
758 758
 		// ya gots ta have style man!!!
759 759
 		$txt_class = is_admin() ? 'wide' : 'espresso-select-inp';
760
-		$class = empty( $class ) ? $txt_class : $class;
761
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
762
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
760
+		$class = empty($class) ? $txt_class : $class;
761
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
762
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
763 763
 
764
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
764
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
765 765
 		// filter label but ensure required text comes before it
766
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
766
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
767 767
 
768
-		$input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>';
768
+		$input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
769 769
 		// recursively count array elements, to determine total number of options
770
-		$only_option = count( $options, 1 ) == 1 ? TRUE : FALSE;
771
-		if ( ! $only_option ) {
770
+		$only_option = count($options, 1) == 1 ? TRUE : FALSE;
771
+		if ( ! $only_option) {
772 772
 			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
773 773
 			$selected = $answer === NULL ? ' selected="selected"' : '';
774
-			$input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : '';
774
+			$input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : '';
775 775
 		}
776
-		foreach ( $options as $key => $value ) {
776
+		foreach ($options as $key => $value) {
777 777
 			// if value is an array, then create option groups, else create regular ol' options
778
-			$input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer, $use_html_entities ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option, $use_html_entities );
778
+			$input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer, $use_html_entities) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option, $use_html_entities);
779 779
 		}
780 780
 
781
-		$input_html .= "\n\t\t\t" . '</select>';
781
+		$input_html .= "\n\t\t\t".'</select>';
782 782
 
783
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID );
783
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID);
784 784
 
785
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
786
-		return  $label_html . $input_html;
785
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
786
+		return  $label_html.$input_html;
787 787
 
788 788
 	}
789 789
 
@@ -801,12 +801,12 @@  discard block
 block discarded – undo
801 801
 	 * @param boolean $use_html_entities
802 802
 	 * @return string
803 803
 	 */
804
-	private static function _generate_select_option_group( $opt_group, $QSOs, $answer, $use_html_entities = true ){
805
-		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">';
806
-		foreach ( $QSOs as $QSO ) {
807
-			$html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer, false, $use_html_entities );
804
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true) {
805
+		$html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
806
+		foreach ($QSOs as $QSO) {
807
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities);
808 808
 		}
809
-		$html .= "\n\t\t\t\t" . '</optgroup>';
809
+		$html .= "\n\t\t\t\t".'</optgroup>';
810 810
 		return $html;
811 811
 	}
812 812
 
@@ -821,12 +821,12 @@  discard block
 block discarded – undo
821 821
 	 * @param boolean $use_html_entities
822 822
 	 * @return string
823 823
 	 */
824
-	private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE, $use_html_entities = true ){
825
-		$key = self::prep_answer( $key, $use_html_entities );
826
-		$value = self::prep_answer( $value, $use_html_entities );
827
-		$value = ! empty( $value ) ? $value : $key;
828
-		$selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : '';
829
-		return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . '&nbsp;&nbsp;&nbsp;</option>';
824
+	private static function _generate_select_option($key, $value, $answer, $only_option = FALSE, $use_html_entities = true) {
825
+		$key = self::prep_answer($key, $use_html_entities);
826
+		$value = self::prep_answer($value, $use_html_entities);
827
+		$value = ! empty($value) ? $value : $key;
828
+		$selected = ($answer == $key || $only_option) ? ' selected="selected"' : '';
829
+		return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.'&nbsp;&nbsp;&nbsp;</option>';
830 830
 	}
831 831
 
832 832
 
@@ -850,56 +850,56 @@  discard block
 block discarded – undo
850 850
 	 * @param bool        $use_desc_4_label
851 851
 	 * @return string HTML
852 852
 	 */
853
-	static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) {
853
+	static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) {
854 854
 		// need these
855
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
855
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
856 856
 			return NULL;
857 857
 		}
858 858
 		// prep the answer
859
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
859
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
860 860
 		// prep the required array
861
-		$required = self::prep_required( $required );
861
+		$required = self::prep_required($required);
862 862
 		// set disabled tag
863
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
863
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
864 864
 		// ya gots ta have style man!!!
865 865
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
866
-		$class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp';
867
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
866
+		$class = ! empty($class) ? $class : 'espresso-radio-btn-inp';
867
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
868 868
 
869
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
869
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
870 870
 		// filter label but ensure required text comes before it
871
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
871
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
872 872
 
873
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">';
873
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">';
874 874
 
875
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
876
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
875
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
876
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
877 877
 
878
-		foreach ( $options as $OPT ) {
879
-			if ( $OPT instanceof EE_Question_Option ) {
880
-				$value = self::prep_option_value( $OPT->value() );
878
+		foreach ($options as $OPT) {
879
+			if ($OPT instanceof EE_Question_Option) {
880
+				$value = self::prep_option_value($OPT->value());
881 881
 				$label = $use_desc_4_label ? $OPT->desc() : $OPT->value();
882
-				$size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() );
883
-				$desc = $OPT->desc();//no self::prep_answer
884
-				$answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer;
885
-				$checked = (string)$value == (string)$answer ? ' checked="checked"' : '';
886
-				$opt = '-' . sanitize_key( $value );
887
-
888
-				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
889
-				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
890
-				$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : '';
891
-				$input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
892
-				$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : '';
893
-				$input_html .= "\n\t\t\t\t\t" . '</label>';
894
-				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
895
-				$input_html .= "\n\t\t\t\t" . '</li>';
882
+				$size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value());
883
+				$desc = $OPT->desc(); //no self::prep_answer
884
+				$answer = is_numeric($value) && empty($answer) ? 0 : $answer;
885
+				$checked = (string) $value == (string) $answer ? ' checked="checked"' : '';
886
+				$opt = '-'.sanitize_key($value);
887
+
888
+				$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
889
+				$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
890
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : '';
891
+				$input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
892
+				$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : '';
893
+				$input_html .= "\n\t\t\t\t\t".'</label>';
894
+				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
895
+				$input_html .= "\n\t\t\t\t".'</li>';
896 896
 			}
897 897
 		}
898 898
 
899
-		$input_html .= "\n\t\t\t" . '</ul>';
899
+		$input_html .= "\n\t\t\t".'</ul>';
900 900
 
901
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
902
-		return  $label_html . $input_html;
901
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
902
+		return  $label_html.$input_html;
903 903
 
904 904
 	}
905 905
 
@@ -922,65 +922,65 @@  discard block
 block discarded – undo
922 922
 	 * @param string $disabled 		disabled="disabled" or null
923 923
 	 * @return string HTML
924 924
 	 */
925
-	static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
925
+	static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
926 926
 		// need these
927
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
927
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
928 928
 			return NULL;
929 929
 		}
930
-		$answer = maybe_unserialize( $answer );
930
+		$answer = maybe_unserialize($answer);
931 931
 
932 932
 		// prep the answer(s)
933
-		$answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer );
933
+		$answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer);
934 934
 
935
-		foreach ( $answer as $key => $value ) {
936
-			$key = self::prep_option_value( $key );
937
-			$answer[$key] = self::prep_answer( $value, $use_html_entities );
935
+		foreach ($answer as $key => $value) {
936
+			$key = self::prep_option_value($key);
937
+			$answer[$key] = self::prep_answer($value, $use_html_entities);
938 938
 		}
939 939
 
940 940
 		// prep the required array
941
-		$required = self::prep_required( $required );
941
+		$required = self::prep_required($required);
942 942
 		// set disabled tag
943
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
943
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
944 944
 		// ya gots ta have style man!!!
945 945
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
946
-		$class = empty( $class ) ? 'espresso-radio-btn-inp' : $class;
947
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
946
+		$class = empty($class) ? 'espresso-radio-btn-inp' : $class;
947
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
948 948
 
949
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
949
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
950 950
 		// filter label but ensure required text comes before it
951
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
952
-
953
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">';
954
-
955
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
956
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
957
-
958
-		foreach ( $options as $OPT ) {
959
-			$value = $OPT->value();//self::prep_option_value( $OPT->value() );
960
-			$size = self::get_label_size_class(  $OPT->value() . ' ' . $OPT->desc() );
961
-			$text = self::prep_answer( $OPT->value() );
962
-			$desc = $OPT->desc() ;
963
-			$opt = '-' . sanitize_key( $value );
964
-
965
-			$checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : '';
966
-
967
-			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
968
-			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
969
-			$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
970
-			$input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
971
-			$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
972
- 			$input_html .= "\n\t\t\t\t\t" . '</label>';
973
-			if ( ! empty( $desc ) && $desc != $text ) {
974
-	 			$input_html .= "\n\t\t\t\t\t" . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>';
951
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
952
+
953
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">';
954
+
955
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
956
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
957
+
958
+		foreach ($options as $OPT) {
959
+			$value = $OPT->value(); //self::prep_option_value( $OPT->value() );
960
+			$size = self::get_label_size_class($OPT->value().' '.$OPT->desc());
961
+			$text = self::prep_answer($OPT->value());
962
+			$desc = $OPT->desc();
963
+			$opt = '-'.sanitize_key($value);
964
+
965
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : '';
966
+
967
+			$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
968
+			$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
969
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
970
+			$input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
971
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
972
+ 			$input_html .= "\n\t\t\t\t\t".'</label>';
973
+			if ( ! empty($desc) && $desc != $text) {
974
+	 			$input_html .= "\n\t\t\t\t\t".' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>';
975 975
 			}
976
-			$input_html .= "\n\t\t\t\t" . '</li>';
976
+			$input_html .= "\n\t\t\t\t".'</li>';
977 977
 
978 978
 		}
979 979
 
980
-		$input_html .= "\n\t\t\t" . '</ul>';
980
+		$input_html .= "\n\t\t\t".'</ul>';
981 981
 
982
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
983
-		return  $label_html . $input_html;
982
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
983
+		return  $label_html.$input_html;
984 984
 
985 985
 	}
986 986
 
@@ -1002,36 +1002,36 @@  discard block
 block discarded – undo
1002 1002
 	 * @param string $disabled 		disabled="disabled" or null
1003 1003
 	 * @return string HTML
1004 1004
 	 */
1005
-	static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
1005
+	static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
1006 1006
 		// need these
1007
-		if ( ! $question || ! $name ) {
1007
+		if ( ! $question || ! $name) {
1008 1008
 			return NULL;
1009 1009
 		}
1010 1010
 		// prep the answer
1011
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
1011
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1012 1012
 		// prep the required array
1013
-		$required = self::prep_required( $required );
1013
+		$required = self::prep_required($required);
1014 1014
 		// set disabled tag
1015
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
1015
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
1016 1016
 		// ya gots ta have style man!!!
1017 1017
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1018
-		$class = empty( $class ) ? $txt_class : $class;
1019
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
1020
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
1018
+		$class = empty($class) ? $txt_class : $class;
1019
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
1020
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1021 1021
 
1022
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
1022
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
1023 1023
 		// filter label but ensure required text comes before it
1024
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
1024
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
1025 1025
 
1026
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>';
1026
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
1027 1027
 
1028 1028
 		// enqueue scripts
1029
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION );
1030
-		wp_enqueue_style( 'espresso-ui-theme');
1031
-		wp_enqueue_script( 'jquery-ui-datepicker' );
1029
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1030
+		wp_enqueue_style('espresso-ui-theme');
1031
+		wp_enqueue_script('jquery-ui-datepicker');
1032 1032
 
1033
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
1034
-		return  $label_html . $input_html;
1033
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1034
+		return  $label_html.$input_html;
1035 1035
 
1036 1036
 	}
1037 1037
 
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 	 * 	@access public
1044 1044
 	 * 	@return 	string
1045 1045
 	 */
1046
-	public static function remove_label_keep_required_msg( $label_html, $required_text ) {
1046
+	public static function remove_label_keep_required_msg($label_html, $required_text) {
1047 1047
 		return $required_text;
1048 1048
 	}
1049 1049
 
@@ -1057,9 +1057,9 @@  discard block
 block discarded – undo
1057 1057
 	 * @param string $value
1058 1058
 	 * @return string HTML
1059 1059
 	 */
1060
-	static function hidden_input( $name, $value, $id = '' ){
1061
-		$id = ! empty( $id ) ? $id : $name;
1062
-		return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' .  $value . '"/>';
1060
+	static function hidden_input($name, $value, $id = '') {
1061
+		$id = ! empty($id) ? $id : $name;
1062
+		return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1063 1063
 	}
1064 1064
 
1065 1065
 
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 	 * @param string $question
1072 1072
 	 * @return string
1073 1073
 	 */
1074
-	static function prep_question( $question ){
1074
+	static function prep_question($question) {
1075 1075
 		return $question;
1076 1076
 //		$link = '';
1077 1077
 //		// does this label have a help link attached ?
@@ -1094,13 +1094,13 @@  discard block
 block discarded – undo
1094 1094
 	 * @param mixed $answer
1095 1095
 	 * @return string
1096 1096
 	 */
1097
-	static function prep_answer( $answer, $use_html_entities = TRUE ){
1097
+	static function prep_answer($answer, $use_html_entities = TRUE) {
1098 1098
 		//make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired, we want "0".
1099
-		if ( is_bool( $answer ) ) {
1099
+		if (is_bool($answer)) {
1100 1100
 			$answer = $answer ? 1 : 0;
1101 1101
 		}
1102
-		$answer = trim( stripslashes( str_replace( '&#039;', "'", $answer )));
1103
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1102
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1103
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1104 1104
 	}
1105 1105
 
1106 1106
 
@@ -1110,18 +1110,18 @@  discard block
 block discarded – undo
1110 1110
 	 * 	@param array $QSOs  array of EE_Question_Option objects
1111 1111
 	 * 	@return array
1112 1112
 	 */
1113
-	public static function prep_answer_options( $QSOs = array() ){
1113
+	public static function prep_answer_options($QSOs = array()) {
1114 1114
 		$prepped_answer_options = array();
1115
-		if ( is_array( $QSOs ) && ! empty( $QSOs )) {
1116
-			foreach( $QSOs as $key => $QSO ) {
1117
-				if ( ! $QSO instanceof EE_Question_Option ) {
1118
-					$QSO = EE_Question_Option::new_instance( array(
1119
-						'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key,
1120
-						'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO
1115
+		if (is_array($QSOs) && ! empty($QSOs)) {
1116
+			foreach ($QSOs as $key => $QSO) {
1117
+				if ( ! $QSO instanceof EE_Question_Option) {
1118
+					$QSO = EE_Question_Option::new_instance(array(
1119
+						'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key,
1120
+						'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO
1121 1121
 					));
1122 1122
 				}
1123
-				if ( $QSO->opt_group() ) {
1124
-					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1123
+				if ($QSO->opt_group()) {
1124
+					$prepped_answer_options[$QSO->opt_group()][] = $QSO;
1125 1125
 				} else {
1126 1126
 					$prepped_answer_options[] = $QSO;
1127 1127
 				}
@@ -1137,8 +1137,8 @@  discard block
 block discarded – undo
1137 1137
 	 * @param string $option_value
1138 1138
 	 * @return string
1139 1139
 	 */
1140
-	static function prep_option_value( $option_value ){
1141
-		return esc_attr( trim( stripslashes( $option_value ) ) );
1140
+	static function prep_option_value($option_value) {
1141
+		return esc_attr(trim(stripslashes($option_value)));
1142 1142
 	}
1143 1143
 
1144 1144
 
@@ -1149,11 +1149,11 @@  discard block
 block discarded – undo
1149 1149
 	 * @param string|array 	$required
1150 1150
 	 * @return array
1151 1151
 	 */
1152
-	static function prep_required( $required = array() ){
1152
+	static function prep_required($required = array()) {
1153 1153
 		// make sure required is an array
1154
-		$required = is_array( $required ) ? $required : array();
1154
+		$required = is_array($required) ? $required : array();
1155 1155
 		// and set some defaults
1156
-		$required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required );
1156
+		$required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required);
1157 1157
 		return $required;
1158 1158
 	}
1159 1159
 
@@ -1164,30 +1164,30 @@  discard block
 block discarded – undo
1164 1164
 	 * @param string 	$value
1165 1165
 	 * @return string
1166 1166
 	 */
1167
-	static function get_label_size_class( $value = FALSE ){
1168
-			if ( $value === FALSE || $value == '' ) {
1167
+	static function get_label_size_class($value = FALSE) {
1168
+			if ($value === FALSE || $value == '') {
1169 1169
 				return ' class="medium-lbl"';
1170 1170
 			}
1171 1171
 			// determine length of option value
1172
-			$val_size = strlen( $value );
1173
-			switch( $val_size ){
1172
+			$val_size = strlen($value);
1173
+			switch ($val_size) {
1174 1174
 				case $val_size < 3 :
1175
-					$size =  ' class="nano-lbl"';
1175
+					$size = ' class="nano-lbl"';
1176 1176
 					break;
1177 1177
 				case $val_size < 6 :
1178
-					$size =  ' class="micro-lbl"';
1178
+					$size = ' class="micro-lbl"';
1179 1179
 					break;
1180 1180
 				case $val_size < 12 :
1181
-					$size =  ' class="tiny-lbl"';
1181
+					$size = ' class="tiny-lbl"';
1182 1182
 					break;
1183 1183
 				case $val_size < 25 :
1184
-					$size =  ' class="small-lbl"';
1184
+					$size = ' class="small-lbl"';
1185 1185
 					break;
1186 1186
 				case $val_size > 100 :
1187
-					$size =  ' class="big-lbl"';
1187
+					$size = ' class="big-lbl"';
1188 1188
 					break;
1189 1189
 				default:
1190
-					$size =  ' class="medium-lbl"';
1190
+					$size = ' class="medium-lbl"';
1191 1191
 					break;
1192 1192
 			}
1193 1193
 		return $size;
@@ -1201,20 +1201,20 @@  discard block
 block discarded – undo
1201 1201
 	 * @param array 	$QFI
1202 1202
 	 * @return array
1203 1203
 	 */
1204
-	private static function _load_system_dropdowns( $QFI ){
1204
+	private static function _load_system_dropdowns($QFI) {
1205 1205
 		$QST_system = $QFI->get('QST_system');
1206
-		switch ( $QST_system ) {
1206
+		switch ($QST_system) {
1207 1207
 			case 'state' :
1208
-				$QFI = self::generate_state_dropdown( $QFI );
1208
+				$QFI = self::generate_state_dropdown($QFI);
1209 1209
 				break;
1210 1210
 			case 'country' :
1211
-				$QFI = self::generate_country_dropdown( $QFI );
1211
+				$QFI = self::generate_country_dropdown($QFI);
1212 1212
 				break;
1213 1213
 			case 'admin-state' :
1214
-				$QFI = self::generate_state_dropdown( $QFI, TRUE );
1214
+				$QFI = self::generate_state_dropdown($QFI, TRUE);
1215 1215
 				break;
1216 1216
 			case 'admin-country' :
1217
-				$QFI = self::generate_country_dropdown( $QFI, TRUE );
1217
+				$QFI = self::generate_country_dropdown($QFI, TRUE);
1218 1218
 				break;
1219 1219
 		}
1220 1220
 		return $QFI;
@@ -1231,13 +1231,13 @@  discard block
 block discarded – undo
1231 1231
 	 *
1232 1232
 	 * @return EE_Question_Form_Input
1233 1233
 	 */
1234
-	protected static function _load_specialized_dropdowns( $QFI ) {
1235
-		switch( $QFI->get( 'QST_type' ) ) {
1234
+	protected static function _load_specialized_dropdowns($QFI) {
1235
+		switch ($QFI->get('QST_type')) {
1236 1236
 			case 'STATE' :
1237
-				$QFI = self::generate_state_dropdown( $QFI );
1237
+				$QFI = self::generate_state_dropdown($QFI);
1238 1238
 				break;
1239 1239
 			case 'COUNTRY' :
1240
-				$QFI = self::generate_country_dropdown( $QFI );
1240
+				$QFI = self::generate_country_dropdown($QFI);
1241 1241
 				break;
1242 1242
 		}
1243 1243
 		return $QFI;
@@ -1251,23 +1251,23 @@  discard block
 block discarded – undo
1251 1251
 	 * @param bool  $get_all
1252 1252
 	 * @return array
1253 1253
 	 */
1254
-	public static function generate_state_dropdown( $QST, $get_all = FALSE ){
1254
+	public static function generate_state_dropdown($QST, $get_all = FALSE) {
1255 1255
 		$states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries();
1256
-		if ( $states && count( $states ) != count( $QST->options() )) {
1257
-			$QST->set( 'QST_type', 'DROPDOWN' );
1256
+		if ($states && count($states) != count($QST->options())) {
1257
+			$QST->set('QST_type', 'DROPDOWN');
1258 1258
 			// if multiple countries, we'll create option groups within the dropdown
1259
-			foreach ( $states as $state ) {
1260
-				if ( $state instanceof EE_State ) {
1261
-					$QSO = EE_Question_Option::new_instance ( array (
1259
+			foreach ($states as $state) {
1260
+				if ($state instanceof EE_State) {
1261
+					$QSO = EE_Question_Option::new_instance(array(
1262 1262
 						'QSO_value' => $state->ID(),
1263 1263
 						'QSO_desc' => $state->name(),
1264
-						'QST_ID' => $QST->get( 'QST_ID' ),
1264
+						'QST_ID' => $QST->get('QST_ID'),
1265 1265
 						'QSO_deleted' => FALSE
1266 1266
 					));
1267 1267
 					// set option group
1268
-					$QSO->set_opt_group( $state->country()->name() );
1268
+					$QSO->set_opt_group($state->country()->name());
1269 1269
 					// add option to question
1270
-					$QST->add_temp_option( $QSO );
1270
+					$QST->add_temp_option($QSO);
1271 1271
 				}
1272 1272
 			}
1273 1273
 		}
@@ -1283,20 +1283,20 @@  discard block
 block discarded – undo
1283 1283
 	 * @internal param array $question
1284 1284
 	 * @return array
1285 1285
 	 */
1286
-	public static function generate_country_dropdown( $QST, $get_all = FALSE ){
1286
+	public static function generate_country_dropdown($QST, $get_all = FALSE) {
1287 1287
 		$countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
1288
-		if ( $countries && count( $countries ) != count( $QST->options() ) ) {
1289
-			$QST->set( 'QST_type', 'DROPDOWN' );
1288
+		if ($countries && count($countries) != count($QST->options())) {
1289
+			$QST->set('QST_type', 'DROPDOWN');
1290 1290
 			// now add countries
1291
-			foreach ( $countries as $country ) {
1292
-				if ( $country instanceof EE_Country ) {
1293
-					$QSO = EE_Question_Option::new_instance ( array (
1291
+			foreach ($countries as $country) {
1292
+				if ($country instanceof EE_Country) {
1293
+					$QSO = EE_Question_Option::new_instance(array(
1294 1294
 						'QSO_value' => $country->ID(),
1295 1295
 						'QSO_desc' => $country->name(),
1296
-						'QST_ID' => $QST->get( 'QST_ID' ),
1296
+						'QST_ID' => $QST->get('QST_ID'),
1297 1297
 						'QSO_deleted' => FALSE
1298 1298
 					));
1299
-					$QST->add_temp_option( $QSO );
1299
+					$QST->add_temp_option($QSO);
1300 1300
 				}
1301 1301
 			}
1302 1302
 		}
@@ -1313,11 +1313,11 @@  discard block
 block discarded – undo
1313 1313
 	 */
1314 1314
 	public static function two_digit_months_dropdown_options() {
1315 1315
 		$options = array();
1316
-		for ( $x = 1; $x <= 12; $x++ ) {
1317
-			$mm = str_pad( $x, 2, '0', STR_PAD_LEFT );
1318
-			$options[ (string)$mm ] = (string)$mm;
1316
+		for ($x = 1; $x <= 12; $x++) {
1317
+			$mm = str_pad($x, 2, '0', STR_PAD_LEFT);
1318
+			$options[(string) $mm] = (string) $mm;
1319 1319
 		}
1320
-		return EEH_Form_Fields::prep_answer_options( $options );
1320
+		return EEH_Form_Fields::prep_answer_options($options);
1321 1321
 	}
1322 1322
 
1323 1323
 
@@ -1332,11 +1332,11 @@  discard block
 block discarded – undo
1332 1332
 		$options = array();
1333 1333
 		$current_year = date('y');
1334 1334
 		$next_decade = $current_year + 10;
1335
-		for ( $x = $current_year; $x <= $next_decade; $x++ ) {
1336
-			$yy = str_pad( $x, 2, '0', STR_PAD_LEFT );
1337
-			$options[ (string)$yy ] = (string)$yy;
1335
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1336
+			$yy = str_pad($x, 2, '0', STR_PAD_LEFT);
1337
+			$options[(string) $yy] = (string) $yy;
1338 1338
 		}
1339
-		return EEH_Form_Fields::prep_answer_options( $options );
1339
+		return EEH_Form_Fields::prep_answer_options($options);
1340 1340
 	}
1341 1341
 
1342 1342
 
@@ -1350,17 +1350,17 @@  discard block
 block discarded – undo
1350 1350
 	 * @param  integer $evt_category Event Category ID if the Event Category filter is selected
1351 1351
 	 * @return string                html
1352 1352
 	 */
1353
-	public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) {
1353
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) {
1354 1354
 		$_where = array();
1355
-		if ( !empty( $status ) ) {
1355
+		if ( ! empty($status)) {
1356 1356
 			$_where['STS_ID'] = $status;
1357 1357
 		}
1358 1358
 
1359
-		if ( $evt_category > 0 ) {
1359
+		if ($evt_category > 0) {
1360 1360
 			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1361 1361
 		}
1362 1362
 
1363
-		$regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where );
1363
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1364 1364
 
1365 1365
 		//setup vals for select input helper
1366 1366
 		$options = array(
@@ -1370,15 +1370,15 @@  discard block
 block discarded – undo
1370 1370
 				)
1371 1371
 			);
1372 1372
 
1373
-		foreach ( $regdtts as $regdtt ) {
1374
-			$date = $regdtt->reg_month. ' ' . $regdtt->reg_year;
1373
+		foreach ($regdtts as $regdtt) {
1374
+			$date = $regdtt->reg_month.' '.$regdtt->reg_year;
1375 1375
 			$options[] = array(
1376 1376
 				'text' => $date,
1377 1377
 				'id' => $date
1378 1378
 				);
1379 1379
 		}
1380 1380
 
1381
-		return self::select_input('month_range', $options, $cur_date, '', 'wide' );
1381
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1382 1382
 	}
1383 1383
 
1384 1384
 
@@ -1392,18 +1392,18 @@  discard block
 block discarded – undo
1392 1392
 	 * @param  string $evt_active_status "upcoming", "expired", "active", or "inactive"
1393 1393
 	 * @return string                    html
1394 1394
 	 */
1395
-	public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) {
1395
+	public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) {
1396 1396
 		//determine what post_status our condition will have for the query.
1397
-		switch ( $status ) {
1397
+		switch ($status) {
1398 1398
 			case 'month' :
1399 1399
 			case 'today' :
1400 1400
 			case NULL :
1401 1401
 			case 'all' :
1402
-				$where['Event.status'] = array( 'NOT IN', array('trash') );
1402
+				$where['Event.status'] = array('NOT IN', array('trash'));
1403 1403
 				break;
1404 1404
 
1405 1405
 			case 'draft' :
1406
-				$where['Event.status'] = array( 'IN', array('draft', 'auto-draft') );
1406
+				$where['Event.status'] = array('IN', array('draft', 'auto-draft'));
1407 1407
 
1408 1408
 			default :
1409 1409
 				$where['Event.status'] = $status;
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 		//categories?
1413 1413
 
1414 1414
 
1415
-		if ( !empty ( $evt_category ) ) {
1415
+		if ( ! empty ($evt_category)) {
1416 1416
 			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1417 1417
 			$where['Event.Term_Taxonomy.term_id'] = $evt_category;
1418 1418
 		}
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
 //		$where['DTT_is_primary'] = 1;
1422 1422
 
1423
-		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status );
1423
+		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status);
1424 1424
 
1425 1425
 		//let's setup vals for select input helper
1426 1426
 		$options = array(
@@ -1435,9 +1435,9 @@  discard block
 block discarded – undo
1435 1435
 		//translate month and date
1436 1436
 		global $wp_locale;
1437 1437
 
1438
-		foreach ( $DTTS as $DTT ) {
1439
-			$localized_date = $wp_locale->get_month( $DTT->dtt_month_num ) . ' ' . $DTT->dtt_year;
1440
-			$id = $DTT->dtt_month . ' ' . $DTT->dtt_year;
1438
+		foreach ($DTTS as $DTT) {
1439
+			$localized_date = $wp_locale->get_month($DTT->dtt_month_num).' '.$DTT->dtt_year;
1440
+			$id = $DTT->dtt_month.' '.$DTT->dtt_year;
1441 1441
 			$options[] = array(
1442 1442
 				'text' => $localized_date,
1443 1443
 				'id' => $id
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 		}
1446 1446
 
1447 1447
 
1448
-		return self::select_input( 'month_range', $options, $cur_date, '', 'wide' );
1448
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1449 1449
 	}
1450 1450
 
1451 1451
 
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 	 * @param  integer $current_cat currently selected category
1457 1457
 	 * @return string               html for dropdown
1458 1458
 	 */
1459
-	public static function generate_event_category_dropdown( $current_cat = -1 ) {
1459
+	public static function generate_event_category_dropdown($current_cat = -1) {
1460 1460
 		$categories = EEM_Term::instance()->get_all_ee_categories(TRUE);
1461 1461
 		$options = array(
1462 1462
 			'0' => array(
@@ -1466,14 +1466,14 @@  discard block
 block discarded – undo
1466 1466
 			);
1467 1467
 
1468 1468
 		//setup categories for dropdown
1469
-		foreach ( $categories as $category ) {
1469
+		foreach ($categories as $category) {
1470 1470
 			$options[] = array(
1471 1471
 				'text' => $category->get('name'),
1472 1472
 				'id' => $category->ID()
1473 1473
 				);
1474 1474
 		}
1475 1475
 
1476
-		return self::select_input( 'EVT_CAT', $options, $current_cat );
1476
+		return self::select_input('EVT_CAT', $options, $current_cat);
1477 1477
 	}
1478 1478
 
1479 1479
 
@@ -1492,20 +1492,20 @@  discard block
 block discarded – undo
1492 1492
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1493 1493
 	 * @return    void
1494 1494
 	 */
1495
-	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1495
+	public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') {
1496 1496
 		$btn = '';
1497
-		if ( empty( $url ) || empty( $ID )) {
1497
+		if (empty($url) || empty($ID)) {
1498 1498
 			return $btn;
1499 1499
 		}
1500
-		$text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' );
1501
-		$btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
1502
-		if ( ! $input_only ) {
1503
-			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
1504
-			$btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : '';
1500
+		$text = ! empty($text) ? $text : __('Submit', 'event_espresso');
1501
+		$btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>';
1502
+		if ( ! $input_only) {
1503
+			$btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
1504
+			$btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : '';
1505 1505
 			$btn_frm .= $btn;
1506 1506
 			$btn_frm .= '</form>';
1507 1507
 			$btn = $btn_frm;
1508
-			unset ( $btn_frm );
1508
+			unset ($btn_frm);
1509 1509
 		}
1510 1510
 		return $btn;
1511 1511
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Schema.helper.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function location( $location = null ) {
31 31
 		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
32
-		                              . $location
33
-		                              . '</div>' : '';
32
+									  . $location
33
+									  . '</div>' : '';
34 34
 	}
35 35
 
36 36
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	public static function postalCode( EEI_Address $obj_with_address = null ) {
152 152
 		return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
153
-		                                                                              . $obj_with_address->zip()
154
-		                                                                              . '</span>' : '';
153
+																					  . $obj_with_address->zip()
154
+																					  . '</span>' : '';
155 155
 	}
156 156
 
157 157
 
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 * @param string $location
28 28
 	 * @return string
29 29
 	 */
30
-	public static function location( $location = null ) {
31
-		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
30
+	public static function location($location = null) {
31
+		return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
32 32
 		                              . $location
33 33
 		                              . '</div>' : '';
34 34
 	}
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @param string $name
44 44
 	 * @return string
45 45
 	 */
46
-	public static function name( $name = null ) {
47
-		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
46
+	public static function name($name = null) {
47
+		return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : '';
48 48
 	}
49 49
 
50 50
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 * @param EEI_Address $obj_with_address
58 58
 	 * @return string
59 59
 	 */
60
-	public static function streetAddress( EEI_Address $obj_with_address = null ) {
60
+	public static function streetAddress(EEI_Address $obj_with_address = null) {
61 61
 		return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
62
-			? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
62
+			? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : '';
63 63
 	}
64 64
 
65 65
 
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 	 * @param EEI_Address $obj_with_address
73 73
 	 * @return string
74 74
 	 */
75
-	public static function postOfficeBoxNumber( EEI_Address $obj_with_address = null ) {
75
+	public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null) {
76 76
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
77
-		if ( preg_match(
77
+		if (preg_match(
78 78
 			"/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i",
79 79
 			$obj_with_address->address2()
80
-		) ) {
80
+		)) {
81 81
 			return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
82
-				? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
82
+				? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : '';
83 83
 		} else {
84 84
 			return $obj_with_address->address2();
85 85
 		}
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * @param EEI_Address $obj_with_address
96 96
 	 * @return string
97 97
 	 */
98
-	public static function addressLocality( EEI_Address $obj_with_address = null ) {
98
+	public static function addressLocality(EEI_Address $obj_with_address = null) {
99 99
 		return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
100
-			? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
100
+			? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : '';
101 101
 	}
102 102
 
103 103
 
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 * @param EEI_Address $obj_with_address
111 111
 	 * @return string
112 112
 	 */
113
-	public static function addressRegion( EEI_Address $obj_with_address = null ) {
113
+	public static function addressRegion(EEI_Address $obj_with_address = null) {
114 114
 		$state = $obj_with_address->state_name();
115
-		if ( ! empty( $state ) ) {
116
-			return '<span itemprop="addressRegion">' . $state . '</span>';
115
+		if ( ! empty($state)) {
116
+			return '<span itemprop="addressRegion">'.$state.'</span>';
117 117
 		} else {
118 118
 			return '';
119 119
 		}
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	 * @param EEI_Address $obj_with_address
130 130
 	 * @return string
131 131
 	 */
132
-	public static function addressCountry( EEI_Address $obj_with_address = null ) {
132
+	public static function addressCountry(EEI_Address $obj_with_address = null) {
133 133
 		$country = $obj_with_address->country_name();
134
-		if ( ! empty( $country ) ) {
135
-			return '<span itemprop="addressCountry">' . $country . '</span>';
134
+		if ( ! empty($country)) {
135
+			return '<span itemprop="addressCountry">'.$country.'</span>';
136 136
 		} else {
137 137
 			return '';
138 138
 		}
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param EEI_Address $obj_with_address
149 149
 	 * @return string
150 150
 	 */
151
-	public static function postalCode( EEI_Address $obj_with_address = null ) {
151
+	public static function postalCode(EEI_Address $obj_with_address = null) {
152 152
 		return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
153 153
 		                                                                              . $obj_with_address->zip()
154 154
 		                                                                              . '</span>' : '';
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 * @param string $phone_nmbr
165 165
 	 * @return string
166 166
 	 */
167
-	public static function telephone( $phone_nmbr = null ) {
168
-		return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
167
+	public static function telephone($phone_nmbr = null) {
168
+		return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>'
169 169
 			: '';
170 170
 	}
171 171
 
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
 	 * @param array  $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
182 182
 	 * @return string (link)
183 183
 	 */
184
-	public static function url( $url = null, $text = null, $attributes = array() ) {
184
+	public static function url($url = null, $text = null, $attributes = array()) {
185 185
 		$atts = '';
186
-		foreach ( $attributes as $attribute => $value ) {
187
-			$atts .= ' ' . $attribute . '="' . $value . '"';
186
+		foreach ($attributes as $attribute => $value) {
187
+			$atts .= ' '.$attribute.'="'.$value.'"';
188 188
 		}
189 189
 		$text = $text !== null && $text !== '' ? $text : $url;
190
-		return $url !== null && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>'
190
+		return $url !== null && $url !== '' ? '<a itemprop="url" href="'.$url.'"'.$atts.'>'.$text.'</a>'
191 191
 			: '';
192 192
 	}
193 193
 
Please login to merge, or discard this patch.
core/db_classes/EE_CSV.class.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  * CSV Import Export class
4 4
  *
@@ -45,31 +45,31 @@  discard block
 block discarded – undo
45 45
 		global $wpdb;
46 46
 
47 47
 		$this->_primary_keys = array(
48
-				$wpdb->prefix . 'esp_answer' => array( 'ANS_ID' ),
49
-				$wpdb->prefix . 'esp_attendee' => array( 'ATT_ID' ),
50
-				$wpdb->prefix . 'esp_datetime'	=> array( 'DTT_ID' ),
51
-				$wpdb->prefix . 'esp_event_question_group'	=> array( 'EQG_ID' ),
52
-				$wpdb->prefix . 'esp_message_template'	=> array( 'MTP_ID' ),
53
-				$wpdb->prefix . 'esp_payment'	=> array( 'PAY_ID' ),
54
-				$wpdb->prefix . 'esp_price'	=> array( 'PRC_ID' ),
55
-				$wpdb->prefix . 'esp_price_type'	=> array( 'PRT_ID' ),
56
-				$wpdb->prefix . 'esp_question'	=> array( 'QST_ID' ),
57
-				$wpdb->prefix . 'esp_question_group'	=> array( 'QSG_ID' ),
58
-				$wpdb->prefix . 'esp_question_group_question'	=> array( 'QGQ_ID' ),
59
-				$wpdb->prefix . 'esp_question_option'	=> array( 'QSO_ID' ),
60
-				$wpdb->prefix . 'esp_registration'	=> array( 'REG_ID' ),
61
-				$wpdb->prefix . 'esp_status'	=> array( 'STS_ID' ),
62
-				$wpdb->prefix . 'esp_transaction'	=> array( 'TXN_ID' ),
63
-				$wpdb->prefix . 'esp_transaction'	=> array( 'TXN_ID' ),
64
-				$wpdb->prefix . 'events_detail'	=> array( 'id' ),
65
-				$wpdb->prefix . 'events_category_detail'	=> array( 'id' ),
66
-				$wpdb->prefix . 'events_category_rel'	=> array( 'id' ),
67
-				$wpdb->prefix . 'events_venue'	=> array( 'id' ),
68
-				$wpdb->prefix . 'events_venue_rel' =>  array( 'emeta_id' ),
69
-				$wpdb->prefix . 'events_locale'	=> array( 'id' ),
70
-				$wpdb->prefix . 'events_locale_rel'	=> array( 'id' ),
71
-				$wpdb->prefix . 'events_personnel' =>  array( 'id' ),
72
-				$wpdb->prefix . 'events_personnel_rel' =>  array( 'id' ),
48
+				$wpdb->prefix.'esp_answer' => array('ANS_ID'),
49
+				$wpdb->prefix.'esp_attendee' => array('ATT_ID'),
50
+				$wpdb->prefix.'esp_datetime'	=> array('DTT_ID'),
51
+				$wpdb->prefix.'esp_event_question_group'	=> array('EQG_ID'),
52
+				$wpdb->prefix.'esp_message_template'	=> array('MTP_ID'),
53
+				$wpdb->prefix.'esp_payment'	=> array('PAY_ID'),
54
+				$wpdb->prefix.'esp_price'	=> array('PRC_ID'),
55
+				$wpdb->prefix.'esp_price_type'	=> array('PRT_ID'),
56
+				$wpdb->prefix.'esp_question'	=> array('QST_ID'),
57
+				$wpdb->prefix.'esp_question_group'	=> array('QSG_ID'),
58
+				$wpdb->prefix.'esp_question_group_question'	=> array('QGQ_ID'),
59
+				$wpdb->prefix.'esp_question_option'	=> array('QSO_ID'),
60
+				$wpdb->prefix.'esp_registration'	=> array('REG_ID'),
61
+				$wpdb->prefix.'esp_status'	=> array('STS_ID'),
62
+				$wpdb->prefix.'esp_transaction'	=> array('TXN_ID'),
63
+				$wpdb->prefix.'esp_transaction'	=> array('TXN_ID'),
64
+				$wpdb->prefix.'events_detail'	=> array('id'),
65
+				$wpdb->prefix.'events_category_detail'	=> array('id'),
66
+				$wpdb->prefix.'events_category_rel'	=> array('id'),
67
+				$wpdb->prefix.'events_venue'	=> array('id'),
68
+				$wpdb->prefix.'events_venue_rel' =>  array('emeta_id'),
69
+				$wpdb->prefix.'events_locale'	=> array('id'),
70
+				$wpdb->prefix.'events_locale_rel'	=> array('id'),
71
+				$wpdb->prefix.'events_personnel' =>  array('id'),
72
+				$wpdb->prefix.'events_personnel_rel' =>  array('id'),
73 73
 			);
74 74
 
75 75
 	}
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	 *		@ access public
82 82
 	 *		@return EE_CSV
83 83
 	 */
84
-	public static function instance ( ) {
84
+	public static function instance( ) {
85 85
 		// check if class object is instantiated
86
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_CSV )) {
86
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_CSV)) {
87 87
 			self::$_instance = new self();
88 88
 		}
89 89
 		return self::$_instance;
@@ -95,22 +95,22 @@  discard block
 block discarded – undo
95 95
 	 * @return string
96 96
 	 * @throws EE_Error
97 97
 	 */
98
-	private function read_unicode_file($file_path){
98
+	private function read_unicode_file($file_path) {
99 99
 		$fc = "";
100
-		$fh = fopen($file_path,"rb");
101
-		if( ! $fh ){
102
-			throw new EE_Error( sprintf( __("Cannot open file for read: %s<br>\n", 'event_espresso'), $file_path ) );
100
+		$fh = fopen($file_path, "rb");
101
+		if ( ! $fh) {
102
+			throw new EE_Error(sprintf(__("Cannot open file for read: %s<br>\n", 'event_espresso'), $file_path));
103 103
 		}
104 104
 		$flen = filesize($file_path);
105 105
 		$bc = fread($fh, $flen);
106
-		for ($i=0; $i<$flen; $i++){
107
-			$c = substr($bc,$i,1);
108
-			if ((ord($c) != 0) && (ord($c) != 13)){
109
-			  $fc = $fc . $c;
106
+		for ($i = 0; $i < $flen; $i++) {
107
+			$c = substr($bc, $i, 1);
108
+			if ((ord($c) != 0) && (ord($c) != 13)) {
109
+			  $fc = $fc.$c;
110 110
 			}
111 111
 		}
112
-		if ((ord(substr($fc,0,1)) == 255) && (ord(substr($fc,1,1)) == 254))
113
-		$fc = substr($fc,2);
112
+		if ((ord(substr($fc, 0, 1)) == 255) && (ord(substr($fc, 1, 1)) == 254))
113
+		$fc = substr($fc, 2);
114 114
 		return ($fc);
115 115
 }
116 116
 
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 	 * @param string $path_to_file
123 123
 	 * @return array of arrays. Top-level array has rows, second-level array has each item
124 124
 	 */
125
-	public function import_csv_to_multi_dimensional_array($path_to_file){
125
+	public function import_csv_to_multi_dimensional_array($path_to_file) {
126 126
 		// needed to deal with Mac line endings
127
-		ini_set('auto_detect_line_endings',TRUE);
127
+		ini_set('auto_detect_line_endings', TRUE);
128 128
 
129 129
 		// because fgetcsv does not correctly deal with backslashed quotes such as \"
130 130
 		// we'll read the file into a string
131
-		$file_contents = $this->read_unicode_file( $path_to_file );
131
+		$file_contents = $this->read_unicode_file($path_to_file);
132 132
 		// replace backslashed quotes with CSV enclosures
133
-		$file_contents = str_replace ( '\\"', '"""', $file_contents );
133
+		$file_contents = str_replace('\\"', '"""', $file_contents);
134 134
 		// HEY YOU! PUT THAT FILE BACK!!!
135 135
 		file_put_contents($path_to_file, $file_contents);
136 136
 
@@ -140,25 +140,25 @@  discard block
 block discarded – undo
140 140
 			$csvarray = array();
141 141
 
142 142
 			// in PHP 5.3 fgetcsv accepts a 5th parameter, but the pre 5.3 versions of fgetcsv choke if passed more than 4 - is that crazy or what?
143
-			if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) {
143
+			if (version_compare(PHP_VERSION, '5.3.0') < 0) {
144 144
 
145 145
 				//  PHP 5.2- version
146 146
 
147 147
 				// loop through each row of the file
148
-				while(($data = fgetcsv($file_handle, 0, ',', '"' )) !== FALSE){
149
-					$csvarray[]= $data;
148
+				while (($data = fgetcsv($file_handle, 0, ',', '"')) !== FALSE) {
149
+					$csvarray[] = $data;
150 150
 				}
151
-			}else{
151
+			} else {
152 152
 				// loop through each row of the file
153
-				while (( $data = fgetcsv( $file_handle, 0, ',', '"', '\\' )) !== FALSE ) {
154
-					$csvarray[]=$data;
153
+				while (($data = fgetcsv($file_handle, 0, ',', '"', '\\')) !== FALSE) {
154
+					$csvarray[] = $data;
155 155
 				}
156 156
 			}
157 157
 			# Close the File.
158 158
 			fclose($file_handle);
159 159
 			return $csvarray;
160
-		}else{
161
-			EE_Error::add_error( sprintf(__("An error occurred - the file: %s could not opened.", "event_espresso"),$path_to_file), __FILE__, __FUNCTION__, __LINE__ );
160
+		} else {
161
+			EE_Error::add_error(sprintf(__("An error occurred - the file: %s could not opened.", "event_espresso"), $path_to_file), __FILE__, __FUNCTION__, __LINE__);
162 162
 			return false;
163 163
 		}
164 164
 	}
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 	 *						...
189 189
 	 *						)
190 190
 	 */
191
-	public function import_csv_to_model_data_array( $path_to_file, $model_name = FALSE, $first_row_is_headers = TRUE ) {
191
+	public function import_csv_to_model_data_array($path_to_file, $model_name = FALSE, $first_row_is_headers = TRUE) {
192 192
 		$multi_dimensional_array = $this->import_csv_to_multi_dimensional_array($path_to_file);
193
-		if( ! $multi_dimensional_array ){
193
+		if ( ! $multi_dimensional_array) {
194 194
 			return false;
195 195
 		}
196 196
 		// gotta start somewhere
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 		$ee_formatted_data = array();
200 200
 		// array to store headers (column names)
201 201
 		$headers = array();
202
-		foreach($multi_dimensional_array as $data){
202
+		foreach ($multi_dimensional_array as $data) {
203 203
 			// if first cell is MODEL, then second cell is the MODEL name
204
-			if ( $data[0]	== 'MODEL' ) {
204
+			if ($data[0] == 'MODEL') {
205 205
 				$model_name = $data[1];
206 206
 				//don't bother looking for model data in this row. The rest of this
207 207
 				//row should be blank
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 				$headers = array();
212 212
 				continue;
213 213
 			}
214
-			if( strpos( $data[0], EE_CSV::metadata_header ) !==FALSE ){
214
+			if (strpos($data[0], EE_CSV::metadata_header) !== FALSE) {
215 215
 				$model_name = EE_CSV::metadata_header;
216 216
 				//store like model data, we just won't try importing it etc.
217 217
 				$row = 1;
@@ -224,31 +224,31 @@  discard block
 block discarded – undo
224 224
 
225 225
 			$model_entry = array();
226 226
 			// loop through each column
227
-			for ( $i=0; $i < $columns; $i++ ) {
227
+			for ($i = 0; $i < $columns; $i++) {
228 228
 
229 229
 				//replace csv_enclosures with backslashed quotes
230
-				$data[$i] = str_replace ( '"""', '\\"', $data[$i] );
230
+				$data[$i] = str_replace('"""', '\\"', $data[$i]);
231 231
 				// do we need to grab the column names?
232
-				if ( $row === 1){
233
-					if( $first_row_is_headers ) {
232
+				if ($row === 1) {
233
+					if ($first_row_is_headers) {
234 234
 						// store the column names to use for keys
235 235
 						$column_name = $data[$i];
236 236
 						//check it's not blank... sometimes CSV editign programs adda bunch of empty columns onto the end...
237
-						if(!$column_name){continue;}
237
+						if ( ! $column_name) {continue; }
238 238
 						$matches = array();
239
-						if($model_name == EE_CSV::metadata_header){
239
+						if ($model_name == EE_CSV::metadata_header) {
240 240
 							$headers[$i] = $column_name;
241
-						}else{
241
+						} else {
242 242
 							//now get the db table name from it (the part between square brackets)
243
-							$success = preg_match('~(.*)\[(.*)\]~', $column_name,$matches);
244
-							if (!$success){
245
-								EE_Error::add_error( sprintf(__("The column titled %s is invalid for importing. It must be be in the format of 'Nice Name[model_field_name]' in row %s", "event_espresso"),$column_name,implode(",",$data)), __FILE__, __FUNCTION__, __LINE__ );
243
+							$success = preg_match('~(.*)\[(.*)\]~', $column_name, $matches);
244
+							if ( ! $success) {
245
+								EE_Error::add_error(sprintf(__("The column titled %s is invalid for importing. It must be be in the format of 'Nice Name[model_field_name]' in row %s", "event_espresso"), $column_name, implode(",", $data)), __FILE__, __FUNCTION__, __LINE__);
246 246
 								return false;
247 247
 							}
248 248
 							$headers[$i] = $matches[2];
249 249
 						}
250 250
 
251
-					}else{
251
+					} else {
252 252
 						// no column names means our final array will just use counters for keys
253 253
 						$model_entry[$headers[$i]] = $data[$i];
254 254
 						$headers[$i] = $i;
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 					// and we need to store csv data
257 257
 				} else {
258 258
 					// this column isn' ta header, store it if there is a header for it
259
-					if(isset($headers[$i])){
259
+					if (isset($headers[$i])) {
260 260
 						$model_entry[$headers[$i]] = $data[$i];
261 261
 					}
262 262
 				}
263 263
 
264 264
 			}
265 265
 			//save the row's data IF it's a non-header-row
266
-			if( ! $first_row_is_headers || ($first_row_is_headers && $row > 1)){
266
+			if ( ! $first_row_is_headers || ($first_row_is_headers && $row > 1)) {
267 267
 				$ee_formatted_data[$model_name][] = $model_entry;
268 268
 			}
269 269
 			// advance to next row
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 	}
283 283
 
284 284
 
285
-	public function save_csv_to_db( $csv_data_array, $model_name = FALSE ) {
286
-		EE_Error::doing_it_wrong('save_csv_to_db', __( 'Function moved to EE_Import and renamed to save_csv_data_array_to_db', 'event_espresso' ), '4.6.7' );
287
-		return EE_Import::instance()->save_csv_data_array_to_db( $csv_data_array, $model_name );
285
+	public function save_csv_to_db($csv_data_array, $model_name = FALSE) {
286
+		EE_Error::doing_it_wrong('save_csv_to_db', __('Function moved to EE_Import and renamed to save_csv_data_array_to_db', 'event_espresso'), '4.6.7');
287
+		return EE_Import::instance()->save_csv_data_array_to_db($csv_data_array, $model_name);
288 288
 	}
289 289
 
290 290
 	/**
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 	 * @param string $new_filename the name of the file that the user will download
295 295
 	 * @return resource, like the results of fopen(), which can be used for fwrite, fputcsv2, etc.
296 296
 	 */
297
-	public function begin_sending_csv($filename){
297
+	public function begin_sending_csv($filename) {
298 298
 		// grab file extension
299 299
 		$ext = substr(strrchr($filename, '.'), 1);
300
-		if ( $ext == '.csv' or  $ext == '.xls' ) {
301
-			str_replace( $ext, '', $filename );
300
+		if ($ext == '.csv' or $ext == '.xls') {
301
+			str_replace($ext, '', $filename);
302 302
 		}
303 303
 		$filename .= '.csv';
304 304
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 //		header("Content-Type: application/download");
320 320
 		header('Content-disposition: attachment; filename='.$filename);
321 321
 		header("Content-Type: text/csv; charset=utf-8");
322
-                do_action( 'AHEE__EE_CSV__begin_sending_csv__headers' );
323
-		echo apply_filters('FHEE__EE_CSV__begin_sending_csv__start_writing', "\xEF\xBB\xBF" ); // makes excel open it as UTF-8. UTF-8 BOM, see http://stackoverflow.com/a/4440143/2773835
322
+                do_action('AHEE__EE_CSV__begin_sending_csv__headers');
323
+		echo apply_filters('FHEE__EE_CSV__begin_sending_csv__start_writing', "\xEF\xBB\xBF"); // makes excel open it as UTF-8. UTF-8 BOM, see http://stackoverflow.com/a/4440143/2773835
324 324
 		$fh = fopen('php://output', 'w');
325 325
 		return $fh;
326 326
 	}
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 	 * mentioning the version and timezone
331 331
 	 * @param resource $filehandle
332 332
 	 */
333
-	public function write_metadata_to_csv($filehandle){
334
-		$data_row = array(EE_CSV::metadata_header);//do NOT translate because this exact string is used when importing
333
+	public function write_metadata_to_csv($filehandle) {
334
+		$data_row = array(EE_CSV::metadata_header); //do NOT translate because this exact string is used when importing
335 335
 		$this->fputcsv2($filehandle, $data_row);
336
-		$meta_data = array( 0=> array(
336
+		$meta_data = array(0=> array(
337 337
 			'version'=>espresso_version(),
338 338
 			'timezone'=>  EEH_DTT_Helper::get_timezone(),
339 339
 			'time_of_export'=>current_time('mysql'),
@@ -351,29 +351,29 @@  discard block
 block discarded – undo
351 351
 	 * then the first row we'd write to the CSV would be "EVT_ID,EVT_name,..."
352 352
 	 * @return boolean if we successfully wrote to the CSV or not. If there's no $data, we consider that a success (because we wrote everything there was...nothing)
353 353
 	 */
354
-	public function write_data_array_to_csv($filehandle, $data){
354
+	public function write_data_array_to_csv($filehandle, $data) {
355 355
 
356 356
 
357 357
 		//determine if $data is actually a 2d array
358
-		if ( $data && is_array($data) && is_array(EEH_Array::get_one_item_from_array($data))){
358
+		if ($data && is_array($data) && is_array(EEH_Array::get_one_item_from_array($data))) {
359 359
 			//make sure top level is numerically indexed,
360 360
 
361
-			if( EEH_Array::is_associative_array($data)){
362
-				throw new EE_Error(sprintf(__("top-level array must be numerically indexed. Does these look like numbers to you? %s","event_espresso"),implode(",",array_keys($data))));
361
+			if (EEH_Array::is_associative_array($data)) {
362
+				throw new EE_Error(sprintf(__("top-level array must be numerically indexed. Does these look like numbers to you? %s", "event_espresso"), implode(",", array_keys($data))));
363 363
 			}
364 364
 			$item_in_top_level_array = EEH_Array::get_one_item_from_array($data);
365 365
 			//now, is the last item in the top-level array of $data an associative or numeric array?
366
-			if(EEH_Array::is_associative_array($item_in_top_level_array)){
366
+			if (EEH_Array::is_associative_array($item_in_top_level_array)) {
367 367
 				//its associative, so we want to output its keys as column headers
368 368
 				$keys = array_keys($item_in_top_level_array);
369 369
 				echo $this->fputcsv2($filehandle, $keys);
370 370
 			}
371 371
 			//start writing data
372
-			foreach($data as $data_row){
372
+			foreach ($data as $data_row) {
373 373
 				echo $this->fputcsv2($filehandle, $data_row);
374 374
 			}
375 375
 			return true;
376
-		}else{
376
+		} else {
377 377
 			//no data TO write... so we can assume that's a success
378 378
 			return true;
379 379
 		}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 * Calls exit to prevent polluting the CSV file with other junk
419 419
 	 * @param resource $fh filehandle where we're writing the CSV to
420 420
 	 */
421
-	public function end_sending_csv($fh){
421
+	public function end_sending_csv($fh) {
422 422
 		fclose($fh);
423 423
 		exit(0);
424 424
 	}
@@ -431,23 +431,23 @@  discard block
 block discarded – undo
431 431
 	 * has all the attributes o fthat model object (eg, the event's id, name, etc)
432 432
 	 * @return boolean success
433 433
 	 */
434
-	public function write_model_data_to_csv($filehandle,$model_data_array){
434
+	public function write_model_data_to_csv($filehandle, $model_data_array) {
435 435
 		$this->write_metadata_to_csv($filehandle);
436
-		foreach($model_data_array as $model_name => $model_instance_arrays){
436
+		foreach ($model_data_array as $model_name => $model_instance_arrays) {
437 437
 			//first: output a special row stating the model
438
-			echo $this->fputcsv2($filehandle,array('MODEL',$model_name));
438
+			echo $this->fputcsv2($filehandle, array('MODEL', $model_name));
439 439
 			//if we have items to put in the CSV, do it normally
440 440
 
441
-			if( ! empty($model_instance_arrays) ){
441
+			if ( ! empty($model_instance_arrays)) {
442 442
 				$this->write_data_array_to_csv($filehandle, $model_instance_arrays);
443
-			}else{
443
+			} else {
444 444
 //				echo "no data to write... so just write the headers";
445 445
 				//so there's actually NO model objects for that model.
446 446
 				//probably still want to show the columns
447 447
 				$model = EE_Registry::instance()->load_model($model_name);
448 448
 				$column_names = array();
449
-				foreach($model->field_settings() as $field){
450
-					$column_names[$field->get_nicename()."[".$field->get_name()."]"] = null ;
449
+				foreach ($model->field_settings() as $field) {
450
+					$column_names[$field->get_nicename()."[".$field->get_name()."]"] = null;
451 451
 				}
452 452
 				$this->write_data_array_to_csv($filehandle, array($column_names));
453 453
 			}
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 * @param array $model_data_array 3d array, as described in EE_CSV::write_model_data_to_csv()
462 462
 	 * @return bool | void writes CSV file to output and dies
463 463
 	 */
464
-	public function export_multiple_model_data_to_csv($filename,$model_data_array){
464
+	public function export_multiple_model_data_to_csv($filename, $model_data_array) {
465 465
 		$filehandle = $this->begin_sending_csv($filename);
466 466
 		$this->write_model_data_to_csv($filehandle, $model_data_array);
467 467
 		$this->end_sending_csv($filehandle);
@@ -473,15 +473,15 @@  discard block
 block discarded – undo
473 473
 	 *			@param string $filename - name for newly created csv file
474 474
 	 *			@return TRUE on success, FALSE on fail
475 475
 	 */
476
-	public function export_array_to_csv( $data = FALSE, $filename = FALSE  ) {
476
+	public function export_array_to_csv($data = FALSE, $filename = FALSE) {
477 477
 
478 478
 		// no data file?? get outta here
479
-		if ( ! $data or ! is_array( $data ) or empty( $data ) ) {
479
+		if ( ! $data or ! is_array($data) or empty($data)) {
480 480
 			return FALSE;
481 481
 		}
482 482
 
483 483
 		// no filename?? get outta here
484
-		if ( ! $filename ) {
484
+		if ( ! $filename) {
485 485
 			return FALSE;
486 486
 		}
487 487
 
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 	 *			@param int $percent_of_max - desired percentage of the max upload_mb
508 508
 	 *			@return int KB
509 509
 	 */
510
-	public function get_max_upload_size ( $percent_of_max = FALSE ) {
510
+	public function get_max_upload_size($percent_of_max = FALSE) {
511 511
 
512
-		$max_upload = (int)(ini_get('upload_max_filesize'));
513
-		$max_post = (int)(ini_get('post_max_size'));
514
-		$memory_limit = (int)(ini_get('memory_limit'));
512
+		$max_upload = (int) (ini_get('upload_max_filesize'));
513
+		$max_post = (int) (ini_get('post_max_size'));
514
+		$memory_limit = (int) (ini_get('memory_limit'));
515 515
 
516 516
 		// determine the smallest of the three values from above
517 517
 		$upload_mb = min($max_upload, $max_post, $memory_limit);
@@ -520,9 +520,9 @@  discard block
 block discarded – undo
520 520
 		$upload_mb = $upload_mb * 1024;
521 521
 
522 522
 		// don't want the full monty? then reduce the max uplaod size
523
-		if ( $percent_of_max ) {
523
+		if ($percent_of_max) {
524 524
 			// is percent_of_max like this -> 50 or like this -> 0.50 ?
525
-			if ( $percent_of_max > 1 ) {
525
+			if ($percent_of_max > 1) {
526 526
 				// chnages 50 to 0.50
527 527
 				$percent_of_max = $percent_of_max / 100;
528 528
 			}
@@ -544,17 +544,17 @@  discard block
 block discarded – undo
544 544
 	 *			@param string $mysql_null - allows php NULL to be overridden with MySQl's insertable NULL value
545 545
 	 *			@return void
546 546
 	 */
547
-	private function fputcsv2 ($fh, array $row, $delimiter = ',', $enclosure = '"', $mysql_null = FALSE) {
547
+	private function fputcsv2($fh, array $row, $delimiter = ',', $enclosure = '"', $mysql_null = FALSE) {
548 548
 		//Allow user to filter the csv delimiter and enclosure for other countries csv standards
549
-		$delimiter = apply_filters( 'FHEE__EE_CSV__fputcsv2__delimiter', $delimiter );
550
-		$enclosure = apply_filters( 'FHEE__EE_CSV__fputcsv2__enclosure', $enclosure );
549
+		$delimiter = apply_filters('FHEE__EE_CSV__fputcsv2__delimiter', $delimiter);
550
+		$enclosure = apply_filters('FHEE__EE_CSV__fputcsv2__enclosure', $enclosure);
551 551
 
552 552
 		$delimiter_esc = preg_quote($delimiter, '/');
553 553
 		$enclosure_esc = preg_quote($enclosure, '/');
554 554
 
555 555
 		$output = array();
556 556
 		foreach ($row as $field_value) {
557
-			if(is_object($field_value) || is_array($field_value)){
557
+			if (is_object($field_value) || is_array($field_value)) {
558 558
 				$field_value = serialize($field_value);
559 559
 			}
560 560
 			if ($field_value === null && $mysql_null) {
@@ -563,10 +563,10 @@  discard block
 block discarded – undo
563 563
 			}
564 564
 
565 565
 			$output[] = preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field_value) ?
566
-				( $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field_value) . $enclosure ) : $field_value;
566
+				($enclosure.str_replace($enclosure, $enclosure.$enclosure, $field_value).$enclosure) : $field_value;
567 567
 		}
568 568
 
569
-		fwrite($fh, join($delimiter, $output) . PHP_EOL);
569
+		fwrite($fh, join($delimiter, $output).PHP_EOL);
570 570
 	}
571 571
 
572 572
 
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
 	 * @param string $current_format
605 605
 	 * @return string
606 606
 	 */
607
-	public function get_date_format_for_csv( $current_format = null ) {
608
-		return apply_filters( 'FHEE__EE_CSV__get_date_format_for_csv__format', 'Y-m-d', $current_format );
607
+	public function get_date_format_for_csv($current_format = null) {
608
+		return apply_filters('FHEE__EE_CSV__get_date_format_for_csv__format', 'Y-m-d', $current_format);
609 609
 	}
610 610
 
611 611
 	/**
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 	 * @param string $current_format
614 614
 	 * @return string
615 615
 	 */
616
-	public function get_time_format_for_csv( $current_format = null ) {
617
-		return apply_filters( 'FHEE__EE_CSV__get_time_format_for_csv__format', 'H:i:s', $current_format );
616
+	public function get_time_format_for_csv($current_format = null) {
617
+		return apply_filters('FHEE__EE_CSV__get_time_format_for_csv__format', 'H:i:s', $current_format);
618 618
 	}
619 619
 
620 620
 
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Venue_Strategy.core.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 	 * @param 	array 	$arguments
40 40
 	 * @return \EE_CPT_Venue_Strategy
41 41
 	 */
42
-	public function __construct( $arguments = array() ) {
43
-		$this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL;
44
-		$WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL;
45
-		if ( $WP_Query instanceof WP_Query && ! $WP_Query->is_tag ) {
46
-			$WP_Query->is_espresso_venue_single = is_singular() && isset( $WP_Query->query->post_type ) && $WP_Query->query->post_type == 'espresso_venues' ? TRUE : FALSE;
42
+	public function __construct($arguments = array()) {
43
+		$this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL;
44
+		$WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL;
45
+		if ($WP_Query instanceof WP_Query && ! $WP_Query->is_tag) {
46
+			$WP_Query->is_espresso_venue_single = is_singular() && isset($WP_Query->query->post_type) && $WP_Query->query->post_type == 'espresso_venues' ? TRUE : FALSE;
47 47
 			$WP_Query->is_espresso_venue_archive = is_post_type_archive('espresso_venues') ? TRUE : FALSE;
48
-			$WP_Query->is_espresso_venue_taxonomy = is_tax( 'espresso_venue_categories' ) ? TRUE : FALSE;
48
+			$WP_Query->is_espresso_venue_taxonomy = is_tax('espresso_venue_categories') ? TRUE : FALSE;
49 49
 		}
50
-		add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
50
+		add_filter('the_posts', array($this, 'the_posts'), 1, 2);
51 51
 	}
52 52
 
53 53
 
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	 * @param WP_Query $wp_query
61 61
 	 * @return    void
62 62
 	 */
63
-	public function the_posts( $posts, WP_Query $wp_query) {
63
+	public function the_posts($posts, WP_Query $wp_query) {
64 64
 		// automagically load the EEH_Venue_View helper so that it's functions are available
65
-		if ( isset( EE_Registry::instance()->CFG->map_settings->use_google_maps ) && EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
65
+		if (isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) && EE_Registry::instance()->CFG->map_settings->use_google_maps) {
66 66
 			EEH_Maps::espresso_google_map_js();
67 67
 		}
68
-		remove_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
68
+		remove_filter('the_posts', array($this, 'the_posts'), 1, 2);
69 69
 		return $posts;
70 70
 	}
71 71
 
Please login to merge, or discard this patch.
core/services/address/formatters/NullAddressFormatter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\address\formatters;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string $CNT_ISO
29 29
 	 * @return string
30 30
 	 */
31
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
31
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
32 32
 		return null;
33 33
 	}
34 34
 
Please login to merge, or discard this patch.
core/services/address/formatters/AddressFormatter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\address\formatters;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 		// swap address part placeholders for the real text
42 42
 		$formatted_address = str_replace(
43 43
 		// find
44
-			array( '{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}' ),
44
+			array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'),
45 45
 			// replace
46
-			array( $address, $address2, $city, $state, $zip, $country ),
46
+			array($address, $address2, $city, $state, $zip, $country),
47 47
 			// string
48 48
 			$formatted_address
49 49
 		);
50 50
 		// remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks
51
-		return preg_replace( '/%+/', $sub, trim( $formatted_address, '%' ) );
51
+		return preg_replace('/%+/', $sub, trim($formatted_address, '%'));
52 52
 	}
53 53
 
54 54
 
Please login to merge, or discard this patch.
core/services/address/formatters/InlineAddressFormatter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\address\formatters;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string $CNT_ISO
29 29
 	 * @return string
30 30
 	 */
31
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
31
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
32 32
 		$address_formats = apply_filters(
33 33
 			'FHEE__EE_Inline_Address_Formatter__address_formats',
34 34
 			array(
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			)
40 40
 		);
41 41
 		// if the incoming country has a set format, use that, else use the default
42
-		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ]
42
+		$formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO]
43 43
 			: $address_formats['ZZZ'];
44 44
 		return $this->parse_formatted_address(
45 45
 			$address,
Please login to merge, or discard this patch.