Completed
Branch BUG-9583-fix-fetching-term-rel... (646110)
by
unknown
539:15 queued 523:53
created
core/helpers/EEH_Base.helper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 *		@ override magic methods
34 34
 	 *		@ return void
35 35
 	 */	
36
-	public function __set($a,$b) { return FALSE; }
36
+	public function __set($a, $b) { return FALSE; }
37 37
 	public function __get($a) { return FALSE; }
38 38
 	public function __isset($a) { return FALSE; }
39 39
 	public function __unset($a) { return FALSE; }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/helpers/EEH_DTT_Helper.helper.php 3 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -799,7 +799,6 @@
 block discarded – undo
799 799
 
800 800
 
801 801
 	/**
802
-
803 802
 	 *
804 803
 	 * 	 If the the first date starts at midnight on one day, and the next date ends at midnight on the
805 804
 	 * 	 very next day then this method will return true.
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -264,10 +265,11 @@  discard block
 block discarded – undo
264 265
 					// Set TZ so localtime works.
265 266
 					date_default_timezone_set($timezone_string);
266 267
 					$now = localtime(time(), true);
267
-					if ($now['tm_isdst'])
268
-						_e('This timezone is currently in daylight saving time.');
269
-					else
270
-						_e('This timezone is currently in standard time.');
268
+					if ($now['tm_isdst']) {
269
+											_e('This timezone is currently in daylight saving time.');
270
+					} else {
271
+											_e('This timezone is currently in standard time.');
272
+					}
271 273
 					?>
272 274
 					<br />
273 275
 					<?php
Please login to merge, or discard this patch.
Spacing   +115 added lines, -116 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @return string
54 54
 	 * @throws \EE_Error
55 55
 	 */
56
-	public static function get_valid_timezone_string( $timezone_string = '' ) {
56
+	public static function get_valid_timezone_string($timezone_string = '') {
57 57
 		// if passed a value, then use that, else get WP option
58
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
58
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
59 59
 		// value from above exists, use that, else get timezone string from gmt_offset
60
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
-		EEH_DTT_Helper::validate_timezone( $timezone_string );
60
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
+		EEH_DTT_Helper::validate_timezone($timezone_string);
62 62
 		return $timezone_string;
63 63
 	}
64 64
 
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 	 * @return bool
75 75
 	 * @throws \EE_Error
76 76
 	 */
77
-	public static function validate_timezone( $timezone_string, $throw_error = true ) {
77
+	public static function validate_timezone($timezone_string, $throw_error = true) {
78 78
 		// easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it
79 79
 		try {
80
-			new DateTimeZone( $timezone_string );
81
-		} catch ( Exception $e ) {
80
+			new DateTimeZone($timezone_string);
81
+		} catch (Exception $e) {
82 82
 			// sometimes we take exception to exceptions
83
-			if ( ! $throw_error ) {
83
+			if ( ! $throw_error) {
84 84
 				return false;
85 85
 			}
86 86
 			throw new EE_Error(
87 87
 				sprintf(
88
-					__( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
88
+					__('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
89 89
 					$timezone_string,
90 90
 					'<a href="http://www.php.net/manual/en/timezones.php">',
91 91
 					'</a>'
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 	 * @param string $gmt_offset
105 105
 	 * @return string
106 106
 	 */
107
-	public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) {
107
+	public static function get_timezone_string_from_gmt_offset($gmt_offset = '') {
108 108
 		$timezone_string = 'UTC';
109
-		$gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' );
110
-		if ( $gmt_offset !== '' ) {
109
+		$gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset');
110
+		if ($gmt_offset !== '') {
111 111
 			// convert GMT offset to seconds
112 112
 			$gmt_offset = $gmt_offset * HOUR_IN_SECONDS;
113 113
 			// account for WP offsets that aren't valid UTC
114
-			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset );
114
+			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset);
115 115
 			// although we don't know the TZ abbreviation, we know the UTC offset
116
-			$timezone_string = timezone_name_from_abbr( null, $gmt_offset );
116
+			$timezone_string = timezone_name_from_abbr(null, $gmt_offset);
117 117
 		}
118 118
 		// better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()...
119
-		$timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
119
+		$timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset);
120 120
 		return $timezone_string;
121 121
 	}
122 122
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	 * @param int $gmt_offset
130 130
 	 * @return int
131 131
 	 */
132
-	public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) {
132
+	public static function adjust_invalid_gmt_offsets($gmt_offset = 0) {
133 133
 		//make sure $gmt_offset is int
134 134
 		$gmt_offset = (int) $gmt_offset;
135
-		switch ( $gmt_offset ) {
135
+		switch ($gmt_offset) {
136 136
 
137 137
 			//			case -30600 :
138 138
 			//				$gmt_offset = -28800;
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 	 * @return string
185 185
 	 * @throws \EE_Error
186 186
 	 */
187
-	public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) {
187
+	public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) {
188 188
 		$abbreviations = timezone_abbreviations_list();
189
-		foreach ( $abbreviations as $abbreviation ) {
190
-			foreach ( $abbreviation as $city ) {
191
-				if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) {
189
+		foreach ($abbreviations as $abbreviation) {
190
+			foreach ($abbreviation as $city) {
191
+				if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) {
192 192
 					// check if the timezone is valid but don't throw any errors if it isn't
193
-					if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) {
193
+					if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) {
194 194
 						return $city['timezone_id'];
195 195
 					}
196 196
 				}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		}
199 199
 		throw new EE_Error(
200 200
 			sprintf(
201
-				__( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
201
+				__('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
202 202
 				$gmt_offset,
203 203
 				'<a href="http://www.php.net/manual/en/timezones.php">',
204 204
 				'</a>'
@@ -212,23 +212,23 @@  discard block
 block discarded – undo
212 212
 	 * @access public
213 213
 	 * @param string $timezone_string
214 214
 	 */
215
-	public static function timezone_select_input( $timezone_string = '' ) {
215
+	public static function timezone_select_input($timezone_string = '') {
216 216
 		// get WP date time format
217
-		$datetime_format = get_option('date_format') . ' '  . get_option('time_format');
217
+		$datetime_format = get_option('date_format').' '.get_option('time_format');
218 218
 		// if passed a value, then use that, else get WP option
219
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
219
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
220 220
 		// check if the timezone is valid but don't throw any errors if it isn't
221
-		$timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false );
221
+		$timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false);
222 222
 		$gmt_offset = get_option('gmt_offset');
223 223
 
224 224
 		$check_zone_info = true;
225
-		if ( empty( $timezone_string )) {
225
+		if (empty($timezone_string)) {
226 226
 			// Create a UTC+- zone if no timezone string exists
227 227
 			$check_zone_info = false;
228
-			if ( $gmt_offset > 0 ) {
229
-				$timezone_string = 'UTC+' . $gmt_offset;
230
-			} elseif ( $gmt_offset < 0 ) {
231
-				$timezone_string = 'UTC' . $gmt_offset;
228
+			if ($gmt_offset > 0) {
229
+				$timezone_string = 'UTC+'.$gmt_offset;
230
+			} elseif ($gmt_offset < 0) {
231
+				$timezone_string = 'UTC'.$gmt_offset;
232 232
 			} else {
233 233
 				$timezone_string = 'UTC';
234 234
 			}
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 					__('%1$sUTC%2$s time is %3$s'),
251 251
 					'<abbr title="Coordinated Universal Time">',
252 252
 					'</abbr>',
253
-					'<code>' . date_i18n( $datetime_format , false, 'gmt') . '</code>'
253
+					'<code>'.date_i18n($datetime_format, false, 'gmt').'</code>'
254 254
 				);
255 255
 				?></span>
256
-			<?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?>
257
-				<br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span>
256
+			<?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?>
257
+				<br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span>
258 258
 		<?php endif; ?>
259 259
 
260 260
 				<?php if ($check_zone_info && $timezone_string) : ?>
@@ -286,10 +286,9 @@  discard block
 block discarded – undo
286 286
 
287 287
 						if ($found) {
288 288
 							$message = $tr['isdst'] ?
289
-											__(' Daylight saving time begins on: %s.' ) :
290
-											__(' Standard time begins  on: %s.');
289
+											__(' Daylight saving time begins on: %s.') : __(' Standard time begins  on: %s.');
291 290
 							// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
292
-							printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' );
291
+							printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >');
293 292
 						} else {
294 293
 							_e('This timezone does not observe daylight saving time.');
295 294
 						}
@@ -319,14 +318,14 @@  discard block
 block discarded – undo
319 318
 	 *
320 319
 	 * @return int      $unix_timestamp with the offset applied for the given timezone.
321 320
 	 */
322
-	public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) {
321
+	public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') {
323 322
 		$unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp;
324
-		$timezone_string = self::get_valid_timezone_string( $timezone_string );
325
-		$TimeZone = new DateTimeZone( $timezone_string );
323
+		$timezone_string = self::get_valid_timezone_string($timezone_string);
324
+		$TimeZone = new DateTimeZone($timezone_string);
326 325
 
327
-		$DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone );
328
-		$offset = timezone_offset_get( $TimeZone, $DateTime );
329
-		return (int)$DateTime->format( 'U' ) + (int)$offset;
326
+		$DateTime = new DateTime('@'.$unix_timestamp, $TimeZone);
327
+		$offset = timezone_offset_get($TimeZone, $DateTime);
328
+		return (int) $DateTime->format('U') + (int) $offset;
330 329
 	}
331 330
 
332 331
 
@@ -341,17 +340,17 @@  discard block
 block discarded – undo
341 340
 	 * @param  string					$datetime_field_name 	the datetime fieldname to be manipulated
342 341
 	 * @return 	EE_Base_Class
343 342
 	 */
344
-	protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) {
343
+	protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) {
345 344
 		// grab current datetime format
346 345
 		$current_format = $obj->get_format();
347 346
 		// set new full timestamp format
348
-		$obj->set_date_format( EE_Datetime_Field::mysql_date_format );
349
-		$obj->set_time_format( EE_Datetime_Field::mysql_time_format );
347
+		$obj->set_date_format(EE_Datetime_Field::mysql_date_format);
348
+		$obj->set_time_format(EE_Datetime_Field::mysql_time_format);
350 349
 		// set the new date value using a full timestamp format so that no data is lost
351
-		$obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) );
350
+		$obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format));
352 351
 		// reset datetime formats
353
-		$obj->set_date_format( $current_format[0] );
354
-		$obj->set_time_format( $current_format[1] );
352
+		$obj->set_date_format($current_format[0]);
353
+		$obj->set_time_format($current_format[1]);
355 354
 		return $obj;
356 355
 	}
357 356
 
@@ -368,11 +367,11 @@  discard block
 block discarded – undo
368 367
 	 * @param  integer 	$value    what you want to increment the time by
369 368
 	 * @return EE_Base_Class		   return the EE_Base_Class object so right away you can do something with it (chaining)
370 369
 	 */
371
-	public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
370
+	public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
372 371
 		//get the raw UTC date.
373
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
374
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value );
375
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
372
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
373
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value);
374
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
376 375
 	}
377 376
 
378 377
 
@@ -387,11 +386,11 @@  discard block
 block discarded – undo
387 386
 	 * @param int            $value
388 387
 	 * @return \EE_Base_Class
389 388
 	 */
390
-	public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
389
+	public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
391 390
 		//get the raw UTC date
392
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
393
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' );
394
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
391
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
392
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-');
393
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
395 394
 	}
396 395
 
397 396
 
@@ -404,44 +403,44 @@  discard block
 block discarded – undo
404 403
 	 * @return \DateTime return whatever type came in.
405 404
 	 * @throws \EE_Error
406 405
 	 */
407
-	protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) {
408
-		if ( ! $DateTime instanceof DateTime ) {
406
+	protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') {
407
+		if ( ! $DateTime instanceof DateTime) {
409 408
 			throw new EE_Error(
410 409
 				sprintf(
411
-					__( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ),
412
-					print_r( $DateTime, true )
410
+					__('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'),
411
+					print_r($DateTime, true)
413 412
 				)
414 413
 			);
415 414
 		}
416
-		switch ( $period ) {
415
+		switch ($period) {
417 416
 			case 'years' :
418
-				$value = 'P' . $value . 'Y';
417
+				$value = 'P'.$value.'Y';
419 418
 				break;
420 419
 			case 'months' :
421
-				$value = 'P' . $value . 'M';
420
+				$value = 'P'.$value.'M';
422 421
 				break;
423 422
 			case 'weeks' :
424
-				$value = 'P' . $value . 'W';
423
+				$value = 'P'.$value.'W';
425 424
 				break;
426 425
 			case 'days' :
427
-				$value = 'P' . $value . 'D';
426
+				$value = 'P'.$value.'D';
428 427
 				break;
429 428
 			case 'hours' :
430
-				$value = 'PT' . $value . 'H';
429
+				$value = 'PT'.$value.'H';
431 430
 				break;
432 431
 			case 'minutes' :
433
-				$value = 'PT' . $value . 'M';
432
+				$value = 'PT'.$value.'M';
434 433
 				break;
435 434
 			case 'seconds' :
436
-				$value = 'PT' . $value . 'S';
435
+				$value = 'PT'.$value.'S';
437 436
 				break;
438 437
 		}
439
-		switch ( $operand ) {
438
+		switch ($operand) {
440 439
 			case '+':
441
-				$DateTime->add( new DateInterval( $value ) );
440
+				$DateTime->add(new DateInterval($value));
442 441
 				break;
443 442
 			case '-':
444
-				$DateTime->sub( new DateInterval( $value ) );
443
+				$DateTime->sub(new DateInterval($value));
445 444
 				break;
446 445
 		}
447 446
 		return $DateTime;
@@ -457,16 +456,16 @@  discard block
 block discarded – undo
457 456
 	 * @return \DateTime return whatever type came in.
458 457
 	 * @throws \EE_Error
459 458
 	 */
460
-	protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) {
461
-		if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) {
459
+	protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') {
460
+		if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) {
462 461
 			throw new EE_Error(
463 462
 				sprintf(
464
-					__( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ),
465
-					print_r( $timestamp, true )
463
+					__('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'),
464
+					print_r($timestamp, true)
466 465
 				)
467 466
 			);
468 467
 		}
469
-		switch ( $period ) {
468
+		switch ($period) {
470 469
 			case 'years' :
471 470
 				$value = YEAR_IN_SECONDS * $value;
472 471
 				break;
@@ -486,9 +485,9 @@  discard block
 block discarded – undo
486 485
 				$value = MINUTE_IN_SECONDS * $value;
487 486
 				break;
488 487
 		}
489
-		switch ( $operand ) {
488
+		switch ($operand) {
490 489
 			case '+':
491
-				$timestamp  += $value;
490
+				$timestamp += $value;
492 491
 				break;
493 492
 			case '-':
494 493
 				$timestamp -= $value;
@@ -508,11 +507,11 @@  discard block
 block discarded – undo
508 507
 	 * @param  string  $operand What operand you wish to use for the calculation
509 508
 	 * @return mixed string|DateTime          return whatever type came in.
510 509
 	 */
511
-	public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) {
512
-		if ( $DateTime_or_timestamp instanceof DateTime ) {
513
-			return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand );
514
-		} else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) {
515
-			return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand );
510
+	public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') {
511
+		if ($DateTime_or_timestamp instanceof DateTime) {
512
+			return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand);
513
+		} else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) {
514
+			return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand);
516 515
 		} else {
517 516
 			//error
518 517
 			return $DateTime_or_timestamp;
@@ -542,24 +541,24 @@  discard block
 block discarded – undo
542 541
 	 * 			'moment' => //date and time format.
543 542
 	 * 		)
544 543
 	 */
545
-	public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) {
546
-		if ( $date_format_string === null ) {
547
-			$date_format_string = get_option( 'date_format' );
544
+	public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) {
545
+		if ($date_format_string === null) {
546
+			$date_format_string = get_option('date_format');
548 547
 		}
549 548
 
550
-		if ( $time_format_string === null ) {
551
-			$time_format_string = get_option( 'time_format' );
549
+		if ($time_format_string === null) {
550
+			$time_format_string = get_option('time_format');
552 551
 		}
553 552
 
554
-		$date_format = self::_php_to_js_moment_converter( $date_format_string );
555
-		$time_format = self::_php_to_js_moment_converter( $time_format_string );
553
+		$date_format = self::_php_to_js_moment_converter($date_format_string);
554
+		$time_format = self::_php_to_js_moment_converter($time_format_string);
556 555
 
557 556
 		return array(
558 557
 			'js' => array(
559 558
 				'date' => $date_format['js'],
560 559
 				'time' => $time_format['js']
561 560
 				),
562
-			'moment' => $date_format['moment'] . ' ' . $time_format['moment' ]
561
+			'moment' => $date_format['moment'].' '.$time_format['moment']
563 562
 			);
564 563
 	}
565 564
 
@@ -573,7 +572,7 @@  discard block
 block discarded – undo
573 572
 	 *
574 573
 	 * @return array js and moment formats.
575 574
 	 */
576
-	protected static function _php_to_js_moment_converter( $format_string ) {
575
+	protected static function _php_to_js_moment_converter($format_string) {
577 576
 		/**
578 577
 		 * This is a map of symbols for formats.
579 578
 		 * The index is the php symbol, the equivalent values are in the array.
@@ -730,15 +729,15 @@  discard block
 block discarded – undo
730 729
 		$jquery_ui_format = "";
731 730
 		$moment_format = "";
732 731
 		$escaping = false;
733
-		for ( $i = 0; $i < strlen($format_string); $i++ ) {
732
+		for ($i = 0; $i < strlen($format_string); $i++) {
734 733
 			$char = $format_string[$i];
735
-			if ( $char === '\\' )  { // PHP date format escaping character
734
+			if ($char === '\\') { // PHP date format escaping character
736 735
 				$i++;
737
-				if ( $escaping ) {
736
+				if ($escaping) {
738 737
 					$jquery_ui_format .= $format_string[$i];
739 738
 					$moment_format .= $format_string[$i];
740 739
 				} else {
741
-					$jquery_ui_format .= '\'' . $format_string[$i];
740
+					$jquery_ui_format .= '\''.$format_string[$i];
742 741
 					$moment_format .= $format_string[$i];
743 742
 				}
744 743
 				$escaping = true;
@@ -757,7 +756,7 @@  discard block
 block discarded – undo
757 756
 				}
758 757
 			}
759 758
 		}
760
-		return array( 'js' => $jquery_ui_format, 'moment' => $moment_format );
759
+		return array('js' => $jquery_ui_format, 'moment' => $moment_format);
761 760
 	}
762 761
 
763 762
 
@@ -772,25 +771,25 @@  discard block
 block discarded – undo
772 771
 	 *                           		errors is returned.  So for client code calling, check for is_array() to
773 772
 	 *                           		indicate failed validations.
774 773
 	 */
775
-	public static function validate_format_string( $format_string ) {
774
+	public static function validate_format_string($format_string) {
776 775
 		$error_msg = array();
777 776
 		//time format checks
778
-		switch ( true ) {
779
-			case   strpos( $format_string, 'h' )  !== false  :
780
-			case   strpos( $format_string, 'g' ) !== false :
777
+		switch (true) {
778
+			case   strpos($format_string, 'h') !== false  :
779
+			case   strpos($format_string, 'g') !== false :
781 780
 				/**
782 781
 				 * if the time string has a lowercase 'h' which == 12 hour time format and there
783 782
 				 * is not any ante meridiem format ('a' or 'A').  Then throw an error because its
784 783
 				 * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am.
785 784
 				 */
786
-				if ( strpos( strtoupper( $format_string ), 'A' )  === false ) {
787
-					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' );
785
+				if (strpos(strtoupper($format_string), 'A') === false) {
786
+					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso');
788 787
 				}
789 788
 				break;
790 789
 
791 790
 		}
792 791
 
793
-		return empty( $error_msg ) ? true : $error_msg;
792
+		return empty($error_msg) ? true : $error_msg;
794 793
 	}
795 794
 
796 795
 
@@ -812,11 +811,11 @@  discard block
 block discarded – undo
812 811
 	 * @param mixed $date_2
813 812
 	 * @return bool
814 813
 	 */
815
-	public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) {
814
+	public static function dates_represent_one_24_hour_date($date_1, $date_2) {
816 815
 
817 816
 		if (
818
-			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) ||
819
-			( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' )
817
+			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) ||
818
+			($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00')
820 819
 		) {
821 820
 			return false;
822 821
 		}
@@ -833,11 +832,11 @@  discard block
 block discarded – undo
833 832
 	 * @param string $field_for_interval  The Database field that is the interval is applied to in the query.
834 833
 	 * @return string
835 834
 	 */
836
-	public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) {
835
+	public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) {
837 836
 		try {
838 837
 			/** need to account for timezone offset on the selects */
839
-			$DateTimeZone = new DateTimeZone( $timezone_string );
840
-		} catch ( Exception $e ) {
838
+			$DateTimeZone = new DateTimeZone($timezone_string);
839
+		} catch (Exception $e) {
841 840
 			$DateTimeZone = null;
842 841
 		}
843 842
 
@@ -845,10 +844,10 @@  discard block
 block discarded – undo
845 844
 		 * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds.
846 845
 		 * Hence we do the calc for DateTimeZone::getOffset.
847 846
 		 */
848
-		$offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' );
847
+		$offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset');
849 848
 		$query_interval = $offset < 0
850
-			? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)'
851
-			: 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)';
849
+			? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)'
850
+			: 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)';
852 851
 		return $query_interval;
853 852
 	}
854 853
 
Please login to merge, or discard this patch.
core/helpers/EEH_HTML.helper.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EEH_HTML
5
- *
3
+  *
4
+  * Class EEH_HTML
5
+  *
6 6
   * Sometimes when writing PHP you need to generate some standard HTML,
7 7
   * but either not enough to warrant creating a template file,
8 8
   * or the amount of PHP conditionals and/or loops peppered throughout the HTML
9 9
   * just make it really ugly and difficult to read.
10 10
   * This class simply adds a bunch of methods for generating basic HTML tags.
11 11
   * Most of the methods have the same name as the HTML tag they generate, and most have the same set of parameters.
12
- *
13
- * @package         Event Espresso
14
- * @subpackage    core
15
- * @author				Brent Christensen
16
- * @since		 	   $VID:$
17
- *
18
- */
12
+  *
13
+  * @package         Event Espresso
14
+  * @subpackage    core
15
+  * @author				Brent Christensen
16
+  * @since		 	   $VID:$
17
+  *
18
+  */
19 19
 
20 20
 class EEH_HTML {
21 21
 
Please login to merge, or discard this patch.
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function instance() {
43 43
 		// check if class object is instantiated, and instantiated properly
44
-		if ( ! self::$_instance instanceof EEH_HTML ) {
44
+		if ( ! self::$_instance instanceof EEH_HTML) {
45 45
 			self::$_instance = new EEH_HTML();
46 46
 		}
47 47
 		return self::$_instance;
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 		$other_attributes = '',
103 103
 		$force_close = false
104 104
 	) {
105
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
106
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
107
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
108
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
109
-		$html = EEH_HTML::nl( 0, $tag ) . '<' . $tag . $attributes . '>';
110
-		$html .= ! empty( $content ) ? EEH_HTML::nl( 1, $tag  ) . $content : '';
111
-		$indent = ! empty( $content ) || $force_close ? TRUE : FALSE;
112
-		$html .= ! empty( $content ) || $force_close ? EEH_HTML::_close_tag( $tag, $id, $class, $indent ) : '';
105
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
106
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
107
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
108
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
109
+		$html = EEH_HTML::nl(0, $tag).'<'.$tag.$attributes.'>';
110
+		$html .= ! empty($content) ? EEH_HTML::nl(1, $tag).$content : '';
111
+		$indent = ! empty($content) || $force_close ? TRUE : FALSE;
112
+		$html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : '';
113 113
 		return $html;
114 114
 	}
115 115
 
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
 	 * @param bool   $indent
127 127
 	 * @return string
128 128
 	 */
129
-	protected static function _close_tag( $tag = 'div', $id = '', $class = '', $indent = TRUE ) {
129
+	protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = TRUE) {
130 130
 		$comment = '';
131
-		if ( $id ) {
132
-			$comment = EEH_HTML::comment( 'close ' . $id ) . EEH_HTML::nl( 0, $tag );
133
-		} else if ( $class ) {
134
-			$comment = EEH_HTML::comment( 'close ' . $class ) . EEH_HTML::nl( 0, $tag );
131
+		if ($id) {
132
+			$comment = EEH_HTML::comment('close '.$id).EEH_HTML::nl(0, $tag);
133
+		} else if ($class) {
134
+			$comment = EEH_HTML::comment('close '.$class).EEH_HTML::nl(0, $tag);
135 135
 		}
136 136
 		$html = $indent ? EEH_HTML::nl( -1, $tag ) : '';
137
-		$html .= '</' . $tag . '>' . $comment;
137
+		$html .= '</'.$tag.'>'.$comment;
138 138
 		return $html;
139 139
 	}
140 140
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
154 154
 	 * @return string
155 155
 	 */
156
-	public static function div( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
157
-		return EEH_HTML::_open_tag( 'div', $content, $id, $class, $style, $other_attributes );
156
+	public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
157
+		return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes);
158 158
 	}
159 159
 
160 160
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param string $class - html class attribute
168 168
 	 * @return string
169 169
 	 */
170
-	public static function divx( $id = '', $class = '' ) {
171
-		return EEH_HTML::_close_tag( 'div', $id, $class );
170
+	public static function divx($id = '', $class = '') {
171
+		return EEH_HTML::_close_tag('div', $id, $class);
172 172
 	}
173 173
 
174 174
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
185 185
 	 * @return string
186 186
 	 */
187
-	public static function h1( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
188
-		return EEH_HTML::_open_tag( 'h1', $content, $id, $class, $style, $other_attributes, TRUE );
187
+	public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
188
+		return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, TRUE);
189 189
 	}
190 190
 
191 191
 
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
202 202
 	 * @return string
203 203
 	 */
204
-	public static function h2( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
205
-		return EEH_HTML::_open_tag( 'h2', $content, $id, $class, $style, $other_attributes, TRUE );
204
+	public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
205
+		return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, TRUE);
206 206
 	}
207 207
 
208 208
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
219 219
 	 * @return string
220 220
 	 */
221
-	public static function h3( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
222
-		return EEH_HTML::_open_tag( 'h3', $content, $id, $class, $style, $other_attributes, TRUE );
221
+	public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
222
+		return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, TRUE);
223 223
 	}
224 224
 
225 225
 
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
236 236
 	 * @return string
237 237
 	 */
238
-	public static function h4( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
239
-		return EEH_HTML::_open_tag( 'h4', $content, $id, $class, $style, $other_attributes, TRUE );
238
+	public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
239
+		return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, TRUE);
240 240
 	}
241 241
 
242 242
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
253 253
 	 * @return string
254 254
 	 */
255
-	public static function h5( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
256
-		return EEH_HTML::_open_tag( 'h5', $content, $id, $class, $style, $other_attributes, TRUE );
255
+	public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
256
+		return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, TRUE);
257 257
 	}
258 258
 
259 259
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
270 270
 	 * @return string
271 271
 	 */
272
-	public static function h6( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
273
-		return EEH_HTML::_open_tag( 'h6', $content, $id, $class, $style, $other_attributes, TRUE );
272
+	public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
273
+		return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, TRUE);
274 274
 	}
275 275
 
276 276
 
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
287 287
 	 * @return string
288 288
 	 */
289
-	public static function p( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
290
-		return EEH_HTML::_open_tag( 'p', $content, $id, $class, $style, $other_attributes, TRUE );
289
+	public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
290
+		return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, TRUE);
291 291
 	}
292 292
 
293 293
 
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
303 303
 	 * @return string
304 304
 	 */
305
-	public static function ul( $id = '', $class = '', $style = '', $other_attributes = '' ) {
306
-		return EEH_HTML::_open_tag( 'ul', '', $id, $class, $style, $other_attributes );
305
+	public static function ul($id = '', $class = '', $style = '', $other_attributes = '') {
306
+		return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes);
307 307
 	}
308 308
 
309 309
 
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
 	 * @param string $class - html class attribute
317 317
 	 * @return string
318 318
 	 */
319
-	public static function ulx( $id = '', $class = '' ) {
320
-		return EEH_HTML::_close_tag( 'ul', $id, $class );
319
+	public static function ulx($id = '', $class = '') {
320
+		return EEH_HTML::_close_tag('ul', $id, $class);
321 321
 	}
322 322
 
323 323
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
335 335
 	 * @return string
336 336
 	 */
337
-	public static function li( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
338
-		return EEH_HTML::_open_tag( 'li', $content, $id, $class, $style, $other_attributes );
337
+	public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
338
+		return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes);
339 339
 	}
340 340
 
341 341
 
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
 	 * @param string $class - html class attribute
349 349
 	 * @return string
350 350
 	 */
351
-	public static function lix( $id = '', $class = '' ) {
352
-		return EEH_HTML::_close_tag( 'li', $id, $class );
351
+	public static function lix($id = '', $class = '') {
352
+		return EEH_HTML::_close_tag('li', $id, $class);
353 353
 	}
354 354
 
355 355
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
366 366
 	 * @return string
367 367
 	 */
368
-	public static function table( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
369
-		return EEH_HTML::_open_tag( 'table', $content, $id, $class, $style, $other_attributes );
368
+	public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
369
+		return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes);
370 370
 	}
371 371
 
372 372
 
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 	 * @param string $class - html class attribute
379 379
 	 * @return string
380 380
 	 */
381
-	public static function tablex( $id = '', $class = '' ) {
382
-		return EEH_HTML::_close_tag( 'table', $id, $class );
381
+	public static function tablex($id = '', $class = '') {
382
+		return EEH_HTML::_close_tag('table', $id, $class);
383 383
 	}
384 384
 
385 385
 
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
396 396
 	 * @return string
397 397
 	 */
398
-	public static function thead( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
399
-		return EEH_HTML::_open_tag( 'thead', $content, $id, $class, $style, $other_attributes );
398
+	public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
399
+		return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes);
400 400
 	}
401 401
 
402 402
 
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 	 * @param string $class - html class attribute
409 409
 	 * @return string
410 410
 	 */
411
-	public static function theadx( $id = '', $class = '' ) {
412
-		return EEH_HTML::_close_tag( 'thead', $id, $class );
411
+	public static function theadx($id = '', $class = '') {
412
+		return EEH_HTML::_close_tag('thead', $id, $class);
413 413
 	}
414 414
 
415 415
 
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
426 426
 	 * @return string
427 427
 	 */
428
-	public static function tbody( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
429
-		return EEH_HTML::_open_tag( 'tbody', $content, $id, $class, $style, $other_attributes );
428
+	public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
429
+		return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes);
430 430
 	}
431 431
 
432 432
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	 * @param string $class - html class attribute
439 439
 	 * @return string
440 440
 	 */
441
-	public static function tbodyx( $id = '', $class = '' ) {
442
-		return EEH_HTML::_close_tag( 'tbody', $id, $class );
441
+	public static function tbodyx($id = '', $class = '') {
442
+		return EEH_HTML::_close_tag('tbody', $id, $class);
443 443
 	}
444 444
 
445 445
 
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
456 456
 	 * @return string
457 457
 	 */
458
-	public static function tr( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
459
-		return EEH_HTML::_open_tag( 'tr', $content, $id, $class, $style, $other_attributes );
458
+	public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
459
+		return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes);
460 460
 	}
461 461
 
462 462
 
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
 	 * @param string $class - html class attribute
469 469
 	 * @return string
470 470
 	 */
471
-	public static function trx( $id = '', $class = '' ) {
472
-		return EEH_HTML::_close_tag( 'tr', $id, $class );
471
+	public static function trx($id = '', $class = '') {
472
+		return EEH_HTML::_close_tag('tr', $id, $class);
473 473
 	}
474 474
 
475 475
 
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
486 486
 	 * @return string
487 487
 	 */
488
-	public static function th( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
489
-		return EEH_HTML::_open_tag( 'th', $content, $id, $class, $style, $other_attributes );
488
+	public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
489
+		return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes);
490 490
 	}
491 491
 
492 492
 
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 	 * @param string $class - html class attribute
499 499
 	 * @return string
500 500
 	 */
501
-	public static function thx( $id = '', $class = '' ) {
502
-		return EEH_HTML::_close_tag( 'th', $id, $class );
501
+	public static function thx($id = '', $class = '') {
502
+		return EEH_HTML::_close_tag('th', $id, $class);
503 503
 	}
504 504
 
505 505
 
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
516 516
 	 * @return string
517 517
 	 */
518
-	public static function td( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
519
-		return EEH_HTML::_open_tag( 'td', $content, $id, $class, $style, $other_attributes );
518
+	public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
519
+		return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes);
520 520
 	}
521 521
 
522 522
 
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
 	 * @param string $class - html class attribute
529 529
 	 * @return string
530 530
 	 */
531
-	public static function tdx( $id = '', $class = '' ) {
532
-		return EEH_HTML::_close_tag( 'td', $id, $class );
531
+	public static function tdx($id = '', $class = '') {
532
+		return EEH_HTML::_close_tag('td', $id, $class);
533 533
 	}
534 534
 
535 535
 
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 	 * @param int    $colspan
544 544
 	 * @return string
545 545
 	 */
546
-	public static function no_row( $content = '', $colspan = 2 ) {
546
+	public static function no_row($content = '', $colspan = 2) {
547 547
 		return EEH_HTML::tr(
548
-			EEH_HTML::td( $content, '', '',  'padding:0; border:none;', 'colspan="' . $colspan . '"' ),
549
-			'', '',  'padding:0; border:none;'
548
+			EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="'.$colspan.'"'),
549
+			'', '', 'padding:0; border:none;'
550 550
 		);
551 551
 	}
552 552
 
@@ -566,14 +566,14 @@  discard block
 block discarded – undo
566 566
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
567 567
 	 * @return string
568 568
 	 */
569
-	public static function link( $href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
570
-		$link_text = ! empty( $link_text ) ? $link_text : $href;
571
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
572
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
573
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
574
-		$attributes .= ! empty( $title ) ? ' title="' . esc_attr( $title ) . '"' : '';
575
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
576
-		return '<a href="' . $href . '" ' . $attributes . '>'  . $link_text  . '</a>';
569
+	public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '') {
570
+		$link_text = ! empty($link_text) ? $link_text : $href;
571
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
572
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
573
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
574
+		$attributes .= ! empty($title) ? ' title="'.esc_attr($title).'"' : '';
575
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
576
+		return '<a href="'.$href.'" '.$attributes.'>'.$link_text.'</a>';
577 577
 	}
578 578
 
579 579
 
@@ -590,14 +590,14 @@  discard block
 block discarded – undo
590 590
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
591 591
 	 * @return string
592 592
 	 */
593
-	public static function img( $src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
594
-		$attributes = ! empty( $src ) ? ' src="' . esc_url_raw( $src ) . '"' : '';
595
-		$attributes .= ! empty( $alt ) ? ' alt="' . esc_attr( $alt ) . '"' : '';
596
-		$attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
597
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
598
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
599
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
600
-		return '<img' . $attributes  . '/>';
593
+	public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '') {
594
+		$attributes = ! empty($src) ? ' src="'.esc_url_raw($src).'"' : '';
595
+		$attributes .= ! empty($alt) ? ' alt="'.esc_attr($alt).'"' : '';
596
+		$attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
597
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
598
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
599
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
600
+		return '<img'.$attributes.'/>';
601 601
 	}
602 602
 
603 603
 
@@ -615,12 +615,12 @@  discard block
 block discarded – undo
615 615
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
616 616
 	 * @return string
617 617
 	 */
618
-	protected static function _inline_tag( $tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
619
-		$attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : '';
620
-		$attributes .= ! empty( $class ) ? ' class="' . $class . '"' : '';
621
-		$attributes .= ! empty( $style ) ? ' style="' . $style . '"' : '';
622
-		$attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : '';
623
-		return '<' . $tag . ' ' . $attributes . '>'  . $content  . '</' . $tag . '>';
618
+	protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
619
+		$attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : '';
620
+		$attributes .= ! empty($class) ? ' class="'.$class.'"' : '';
621
+		$attributes .= ! empty($style) ? ' style="'.$style.'"' : '';
622
+		$attributes .= ! empty($other_attributes) ? ' '.$other_attributes : '';
623
+		return '<'.$tag.' '.$attributes.'>'.$content.'</'.$tag.'>';
624 624
 	}
625 625
 
626 626
 
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
637 637
 	 * @return string
638 638
 	 */
639
-	public static function label( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
640
-		return EEH_HTML::_inline_tag( 'label', $content, $id, $class, $style, $other_attributes );
639
+	public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
640
+		return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes);
641 641
 	}
642 642
 
643 643
 
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
654 654
 	 * @return string
655 655
 	 */
656
-	public static function span( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
657
-		return EEH_HTML::_inline_tag( 'span', $content, $id, $class, $style, $other_attributes );
656
+	public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
657
+		return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes);
658 658
 	}
659 659
 
660 660
 
@@ -670,8 +670,8 @@  discard block
 block discarded – undo
670 670
 	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
671 671
 	 * @return string
672 672
 	 */
673
-	public static function strong( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) {
674
-		return EEH_HTML::_inline_tag( 'strong', $content, $id, $class, $style, $other_attributes );
673
+	public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '') {
674
+		return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes);
675 675
 	}
676 676
 
677 677
 
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 	 * @param string $comment
684 684
 	 * @return string
685 685
 	 */
686
-	public static function comment( $comment = '' ) {
687
-		return ! empty( $comment ) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : '';
686
+	public static function comment($comment = '') {
687
+		return ! empty($comment) ? EEH_HTML::nl().'<!-- '.$comment.' -->' : '';
688 688
 	}
689 689
 
690 690
 
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
 	 * @param int $nmbr - the number of line breaks to return
696 696
 	 * @return string
697 697
 	 */
698
-	public static function br( $nmbr = 1 ) {
699
-		return str_repeat( '<br />', $nmbr );
698
+	public static function br($nmbr = 1) {
699
+		return str_repeat('<br />', $nmbr);
700 700
 	}
701 701
 
702 702
 
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
 	 * @param int $nmbr - the number of non-breaking spaces to return
708 708
 	 * @return string
709 709
 	 */
710
-	public static function nbsp( $nmbr = 1 ) {
711
-		return str_repeat( '&nbsp;', $nmbr );
710
+	public static function nbsp($nmbr = 1) {
711
+		return str_repeat('&nbsp;', $nmbr);
712 712
 	}
713 713
 
714 714
 
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 	 * @param string $id
723 723
 	 * @return string
724 724
 	 */
725
-	public static function sanitize_id( $id = '' ) {
726
-		$key = str_replace( ' ', '-', trim( $id ) );
727
-		return preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key );
725
+	public static function sanitize_id($id = '') {
726
+		$key = str_replace(' ', '-', trim($id));
727
+		return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key);
728 728
 	}
729 729
 
730 730
 
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 	 * @param string $tag
737 737
 	 * @return string - newline character plus # of indents passed (can be + or -)
738 738
 	 */
739
-	public static function nl( $indent = 0, $tag = 'none' ) {
739
+	public static function nl($indent = 0, $tag = 'none') {
740 740
 		$html = "\n";
741
-		EEH_HTML::indent( $indent, $tag );
742
-		for ( $x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++ ) {
741
+		EEH_HTML::indent($indent, $tag);
742
+		for ($x = 0; $x < EEH_HTML::$_indent[$tag]; $x++) {
743 743
 			$html .= "\t";
744 744
 		}
745 745
 		return $html;
@@ -754,17 +754,17 @@  discard block
 block discarded – undo
754 754
 	 * @param int    $indent can be negative to decrease the indentation level
755 755
 	 * @param string $tag
756 756
 	 */
757
-	public static function indent( $indent, $tag = 'none' ){
757
+	public static function indent($indent, $tag = 'none') {
758 758
 		static $default_indentation = FALSE;
759
-		if ( ! $default_indentation ) {
759
+		if ( ! $default_indentation) {
760 760
 			EEH_HTML::_set_default_indentation();
761 761
 			$default_indentation = TRUE;
762 762
 		}
763
-		if ( ! isset( EEH_HTML::$_indent[ $tag ] )) {
764
-			EEH_HTML::$_indent[ $tag ] = 0;
763
+		if ( ! isset(EEH_HTML::$_indent[$tag])) {
764
+			EEH_HTML::$_indent[$tag] = 0;
765 765
 		}
766
-		EEH_HTML::$_indent[ $tag ] += (int)$indent;
767
-		EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0;
766
+		EEH_HTML::$_indent[$tag] += (int) $indent;
767
+		EEH_HTML::$_indent[$tag] = EEH_HTML::$_indent[$tag] >= 0 ? EEH_HTML::$_indent[$tag] : 0;
768 768
 	}
769 769
 
770 770
 
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
 	 * @global array $allowedtags
811 811
 	 * @return array
812 812
 	 */
813
-	public static function get_simple_tags(){
813
+	public static function get_simple_tags() {
814 814
 		global $allowedtags;
815 815
 		$tags_we_allow = $allowedtags;
816
-		$tags_we_allow['ol']=array();
817
-		$tags_we_allow['ul']=array();
818
-		$tags_we_allow['li']=array();
819
-		$tags_we_allow['br']=array();
820
-		$tags_we_allow['p']=array();
821
-		return apply_filters( 'FHEE__EEH_HTML__get_simple_tags', $tags_we_allow );
816
+		$tags_we_allow['ol'] = array();
817
+		$tags_we_allow['ul'] = array();
818
+		$tags_we_allow['li'] = array();
819
+		$tags_we_allow['br'] = array();
820
+		$tags_we_allow['p'] = array();
821
+		return apply_filters('FHEE__EEH_HTML__get_simple_tags', $tags_we_allow);
822 822
 	}
823 823
 
824 824
 
Please login to merge, or discard this patch.
core/helpers/EEH_Inflector.helper.php 3 patches
Indentation   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
  * @version $Revision 0.1 $
36 36
  */
37 37
 class EEH_Inflector{
38
-    // ------ CLASS METHODS ------ //
39
-    // ---- Public methods ---- //
40
-    // {{{ pluralize()
38
+	// ------ CLASS METHODS ------ //
39
+	// ---- Public methods ---- //
40
+	// {{{ pluralize()
41 41
 
42 42
 	/**
43 43
 	 * Just calls self::pluralize and strtolower on $word and returns it
@@ -51,319 +51,319 @@  discard block
 block discarded – undo
51 51
 	static function singularize_and_upper( $word ) {
52 52
 		return str_replace( ' ', '_', self::humanize( self::singularize( $word ), 'all' ) );
53 53
 	}
54
-    /**
55
-     * Pluralizes English nouns.
56
-     *
57
-     * @access public
58
-     * @static
59
-     * @param    string    $word    English noun to pluralize
60
-     * @return string Plural noun
61
-     */
62
-    static function pluralize($word){
63
-        $plural = array(
64
-            '/(quiz)$/i'               => '\1zes',
65
-            '/^(ox)$/i'                => '\1en',
66
-            '/([m|l])ouse$/i'          => '\1ice',
67
-            '/(matr|vert|ind)ix|ex$/i' => '\1ices',
68
-            '/(x|ch|ss|sh)$/i'         => '\1es',
69
-            '/([^aeiouy]|qu)ies$/i'    => '\1y',
70
-            '/([^aeiouy]|qu)y$/i'      => '\1ies',
71
-            '/(hive)$/i'               => '\1s',
72
-            '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
73
-            '/sis$/i'                  => 'ses',
74
-            '/([ti])um$/i'             => '\1a',
75
-            '/(buffal|tomat)o$/i'      => '\1oes',
76
-            '/(bu)s$/i'                => '\1ses',
77
-            '/(alias|status)/i'        => '\1es',
78
-            '/(octop|vir)us$/i'        => '\1i',
79
-            '/(ax|test)is$/i'          => '\1es',
80
-            '/s$/i'                    => 's',
81
-            '/$/'                      => 's');
82
-
83
-        $uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
84
-
85
-        $irregular = array(
86
-            'person' => 'people',
87
-            'man'    => 'men',
88
-            'child'  => 'children',
89
-            'sex'    => 'sexes',
90
-            'move'   => 'moves');
91
-
92
-        $lowercased_word = strtolower($word);
93
-
94
-        foreach($uncountable as $_uncountable){
95
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
54
+	/**
55
+	 * Pluralizes English nouns.
56
+	 *
57
+	 * @access public
58
+	 * @static
59
+	 * @param    string    $word    English noun to pluralize
60
+	 * @return string Plural noun
61
+	 */
62
+	static function pluralize($word){
63
+		$plural = array(
64
+			'/(quiz)$/i'               => '\1zes',
65
+			'/^(ox)$/i'                => '\1en',
66
+			'/([m|l])ouse$/i'          => '\1ice',
67
+			'/(matr|vert|ind)ix|ex$/i' => '\1ices',
68
+			'/(x|ch|ss|sh)$/i'         => '\1es',
69
+			'/([^aeiouy]|qu)ies$/i'    => '\1y',
70
+			'/([^aeiouy]|qu)y$/i'      => '\1ies',
71
+			'/(hive)$/i'               => '\1s',
72
+			'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
73
+			'/sis$/i'                  => 'ses',
74
+			'/([ti])um$/i'             => '\1a',
75
+			'/(buffal|tomat)o$/i'      => '\1oes',
76
+			'/(bu)s$/i'                => '\1ses',
77
+			'/(alias|status)/i'        => '\1es',
78
+			'/(octop|vir)us$/i'        => '\1i',
79
+			'/(ax|test)is$/i'          => '\1es',
80
+			'/s$/i'                    => 's',
81
+			'/$/'                      => 's');
82
+
83
+		$uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
84
+
85
+		$irregular = array(
86
+			'person' => 'people',
87
+			'man'    => 'men',
88
+			'child'  => 'children',
89
+			'sex'    => 'sexes',
90
+			'move'   => 'moves');
91
+
92
+		$lowercased_word = strtolower($word);
93
+
94
+		foreach($uncountable as $_uncountable){
95
+			if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
96 96
 					! ctype_alpha( $lowercased_word[ strlen( $lowercased_word ) - strlen($_uncountable) ] ) ){
97
-                return $word;
98
-            }
99
-        }
100
-
101
-        foreach($irregular as $_plural => $_singular){
102
-            if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
103
-                return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
104
-            }
105
-        }
106
-
107
-        foreach($plural as $rule => $replacement){
108
-            if(preg_match($rule, $word)){
109
-                return preg_replace($rule, $replacement, $word);
110
-            }
111
-        }
112
-        return false;
113
-    }
114
-
115
-    // }}}
116
-    // {{{ singularize()
117
-
118
-    /**
119
-     * Singularizes English nouns.
120
-     *
121
-     * @access public
122
-     * @static
123
-     * @param    string    $word    English noun to singularize
124
-     * @return string Singular noun.
125
-     */
126
-    static function singularize($word){
127
-        $singular = array(
128
-            '/(quiz)zes$/i'                                                    => '\1',
129
-            '/(matr)ices$/i'                                                   => '\1ix',
130
-            '/(vert|ind)ices$/i'                                               => '\1ex',
131
-            '/^(ox)en/i'                                                       => '\1',
132
-            '/(alias|status)es$/i'                                             => '\1',
133
-            '/([octop|vir])i$/i'                                               => '\1us',
134
-            '/(cris|ax|test)es$/i'                                             => '\1is',
135
-            '/(shoe)s$/i'                                                      => '\1',
136
-            '/(o)es$/i'                                                        => '\1',
137
-            '/(bus)es$/i'                                                      => '\1',
138
-            '/([m|l])ice$/i'                                                   => '\1ouse',
139
-            '/(x|ch|ss|sh)es$/i'                                               => '\1',
140
-            '/(m)ovies$/i'                                                     => '\1ovie',
141
-            '/(s)eries$/i'                                                     => '\1eries',
142
-            '/([^aeiouy]|qu)ies$/i'                                            => '\1y',
143
-            '/([lr])ves$/i'                                                    => '\1f',
144
-            '/(tive)s$/i'                                                      => '\1',
145
-            '/(hive)s$/i'                                                      => '\1',
146
-            '/([^f])ves$/i'                                                    => '\1fe',
147
-            '/(^analy)ses$/i'                                                  => '\1sis',
148
-            '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
149
-            '/([ti])a$/i'                                                      => '\1um',
150
-            '/(n)ews$/i'                                                       => '\1ews',
151
-            '/s$/i'                                                            => '',
152
-        );
153
-
154
-        $uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
155
-
156
-        $irregular = array(
157
-            'person' => 'people',
158
-            'man'    => 'men',
159
-            'child'  => 'children',
160
-            'sex'    => 'sexes',
161
-            'move'   => 'moves');
162
-
163
-        $lowercased_word = strtolower($word);
164
-        foreach($uncountable as $_uncountable){
165
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
166
-                return $word;
167
-            }
168
-        }
169
-
170
-        foreach($irregular as $_plural => $_singular){
171
-            if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
172
-                return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
173
-            }
174
-        }
175
-
176
-        foreach($singular as $rule => $replacement){
177
-            if(preg_match($rule, $word)){
178
-                return preg_replace($rule, $replacement, $word);
179
-            }
180
-        }
181
-
182
-        return $word;
183
-    }
184
-
185
-    // }}}
186
-    // {{{ titleize()
187
-
188
-    /**
189
-     * Converts an underscored or CamelCase word into a English
190
-     * sentence.
191
-     *
192
-     * The titleize static function converts text like "WelcomePage",
193
-     * "welcome_page" or  "welcome page" to this "Welcome
194
-     * Page".
195
-     * If second parameter is set to 'first' it will only
196
-     * capitalize the first character of the title.
197
-     *
198
-     * @access public
199
-     * @static
200
-     * @param    string    $word    Word to format as tile
201
-     * @param    string    $uppercase    If set to 'first' it will only uppercase the
202
-     * first character. Otherwise it will uppercase all
203
-     * the words in the title.
204
-     * @return string Text formatted as title
205
-     */
206
-    static function titleize($word, $uppercase = ''){
207
-        $uppercase = $uppercase == 'first' ? 'ucfirst' : 'ucwords';
208
-        return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
209
-    }
210
-
211
-    // }}}
212
-    // {{{ camelize()
213
-
214
-    /**
215
-     * Returns given word as CamelCased
216
-     *
217
-     * Converts a word like "send_email" to "SendEmail". It
218
-     * will remove non alphanumeric character from the word, so
219
-     * "who's online" will be converted to "WhoSOnline"
220
-     *
221
-     * @access public
222
-     * @static
223
-     * @see variablize
224
-     * @param    string    $word    Word to convert to camel case
225
-     * @return string UpperCamelCasedWord
226
-     */
227
-    static function camelize($word){
228
-        return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
229
-    }
230
-
231
-    // }}}
232
-    // {{{ underscore()
233
-
234
-    /**
235
-     * Converts a word "into_it_s_underscored_version"
236
-     *
237
-     * Convert any "CamelCased" or "ordinary Word" into an
238
-     * "underscored_word".
239
-     *
240
-     * This can be really useful for creating friendly URLs.
241
-     *
242
-     * @access public
243
-     * @static
244
-     * @param    string    $word    Word to underscore
245
-     * @return string Underscored word
246
-     */
247
-    static function underscore($word){
248
-        return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
249
-    }
250
-
251
-    // }}}
252
-    // {{{ humanize()
253
-
254
-    /**
255
-     * Returns a human-readable string from $word
256
-     *
257
-     * Returns a human-readable string from $word, by replacing
258
-     * underscores with a space, and by upper-casing the initial
259
-     * character by default.
260
-     *
261
-     * If you need to uppercase all the words you just have to
262
-     * pass 'all' as a second parameter.
263
-     *
264
-     * @access public
265
-     * @static
266
-     * @param    string    $word    String to "humanize"
267
-     * @param    string    $uppercase    If set to 'all' it will uppercase all the words
268
-     * instead of just the first one.
269
-     * @return string Human-readable word
270
-     */
271
-    static function humanize($word, $uppercase = ''){
97
+				return $word;
98
+			}
99
+		}
100
+
101
+		foreach($irregular as $_plural => $_singular){
102
+			if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
103
+				return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
104
+			}
105
+		}
106
+
107
+		foreach($plural as $rule => $replacement){
108
+			if(preg_match($rule, $word)){
109
+				return preg_replace($rule, $replacement, $word);
110
+			}
111
+		}
112
+		return false;
113
+	}
114
+
115
+	// }}}
116
+	// {{{ singularize()
117
+
118
+	/**
119
+	 * Singularizes English nouns.
120
+	 *
121
+	 * @access public
122
+	 * @static
123
+	 * @param    string    $word    English noun to singularize
124
+	 * @return string Singular noun.
125
+	 */
126
+	static function singularize($word){
127
+		$singular = array(
128
+			'/(quiz)zes$/i'                                                    => '\1',
129
+			'/(matr)ices$/i'                                                   => '\1ix',
130
+			'/(vert|ind)ices$/i'                                               => '\1ex',
131
+			'/^(ox)en/i'                                                       => '\1',
132
+			'/(alias|status)es$/i'                                             => '\1',
133
+			'/([octop|vir])i$/i'                                               => '\1us',
134
+			'/(cris|ax|test)es$/i'                                             => '\1is',
135
+			'/(shoe)s$/i'                                                      => '\1',
136
+			'/(o)es$/i'                                                        => '\1',
137
+			'/(bus)es$/i'                                                      => '\1',
138
+			'/([m|l])ice$/i'                                                   => '\1ouse',
139
+			'/(x|ch|ss|sh)es$/i'                                               => '\1',
140
+			'/(m)ovies$/i'                                                     => '\1ovie',
141
+			'/(s)eries$/i'                                                     => '\1eries',
142
+			'/([^aeiouy]|qu)ies$/i'                                            => '\1y',
143
+			'/([lr])ves$/i'                                                    => '\1f',
144
+			'/(tive)s$/i'                                                      => '\1',
145
+			'/(hive)s$/i'                                                      => '\1',
146
+			'/([^f])ves$/i'                                                    => '\1fe',
147
+			'/(^analy)ses$/i'                                                  => '\1sis',
148
+			'/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
149
+			'/([ti])a$/i'                                                      => '\1um',
150
+			'/(n)ews$/i'                                                       => '\1ews',
151
+			'/s$/i'                                                            => '',
152
+		);
153
+
154
+		$uncountable = array('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
155
+
156
+		$irregular = array(
157
+			'person' => 'people',
158
+			'man'    => 'men',
159
+			'child'  => 'children',
160
+			'sex'    => 'sexes',
161
+			'move'   => 'moves');
162
+
163
+		$lowercased_word = strtolower($word);
164
+		foreach($uncountable as $_uncountable){
165
+			if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
166
+				return $word;
167
+			}
168
+		}
169
+
170
+		foreach($irregular as $_plural => $_singular){
171
+			if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
172
+				return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
173
+			}
174
+		}
175
+
176
+		foreach($singular as $rule => $replacement){
177
+			if(preg_match($rule, $word)){
178
+				return preg_replace($rule, $replacement, $word);
179
+			}
180
+		}
181
+
182
+		return $word;
183
+	}
184
+
185
+	// }}}
186
+	// {{{ titleize()
187
+
188
+	/**
189
+	 * Converts an underscored or CamelCase word into a English
190
+	 * sentence.
191
+	 *
192
+	 * The titleize static function converts text like "WelcomePage",
193
+	 * "welcome_page" or  "welcome page" to this "Welcome
194
+	 * Page".
195
+	 * If second parameter is set to 'first' it will only
196
+	 * capitalize the first character of the title.
197
+	 *
198
+	 * @access public
199
+	 * @static
200
+	 * @param    string    $word    Word to format as tile
201
+	 * @param    string    $uppercase    If set to 'first' it will only uppercase the
202
+	 * first character. Otherwise it will uppercase all
203
+	 * the words in the title.
204
+	 * @return string Text formatted as title
205
+	 */
206
+	static function titleize($word, $uppercase = ''){
207
+		$uppercase = $uppercase == 'first' ? 'ucfirst' : 'ucwords';
208
+		return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
209
+	}
210
+
211
+	// }}}
212
+	// {{{ camelize()
213
+
214
+	/**
215
+	 * Returns given word as CamelCased
216
+	 *
217
+	 * Converts a word like "send_email" to "SendEmail". It
218
+	 * will remove non alphanumeric character from the word, so
219
+	 * "who's online" will be converted to "WhoSOnline"
220
+	 *
221
+	 * @access public
222
+	 * @static
223
+	 * @see variablize
224
+	 * @param    string    $word    Word to convert to camel case
225
+	 * @return string UpperCamelCasedWord
226
+	 */
227
+	static function camelize($word){
228
+		return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
229
+	}
230
+
231
+	// }}}
232
+	// {{{ underscore()
233
+
234
+	/**
235
+	 * Converts a word "into_it_s_underscored_version"
236
+	 *
237
+	 * Convert any "CamelCased" or "ordinary Word" into an
238
+	 * "underscored_word".
239
+	 *
240
+	 * This can be really useful for creating friendly URLs.
241
+	 *
242
+	 * @access public
243
+	 * @static
244
+	 * @param    string    $word    Word to underscore
245
+	 * @return string Underscored word
246
+	 */
247
+	static function underscore($word){
248
+		return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
249
+	}
250
+
251
+	// }}}
252
+	// {{{ humanize()
253
+
254
+	/**
255
+	 * Returns a human-readable string from $word
256
+	 *
257
+	 * Returns a human-readable string from $word, by replacing
258
+	 * underscores with a space, and by upper-casing the initial
259
+	 * character by default.
260
+	 *
261
+	 * If you need to uppercase all the words you just have to
262
+	 * pass 'all' as a second parameter.
263
+	 *
264
+	 * @access public
265
+	 * @static
266
+	 * @param    string    $word    String to "humanize"
267
+	 * @param    string    $uppercase    If set to 'all' it will uppercase all the words
268
+	 * instead of just the first one.
269
+	 * @return string Human-readable word
270
+	 */
271
+	static function humanize($word, $uppercase = ''){
272 272
 		//make special exceptions for acronyms
273 273
 		$word = str_replace('wp_', 'WP_', $word );
274
-        $uppercase = $uppercase == 'all' ? 'ucwords' : 'ucfirst';
275
-        return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
276
-    }
277
-
278
-    // }}}
279
-    // {{{ variablize()
280
-
281
-    /**
282
-     * Same as camelize but first char is underscored
283
-     *
284
-     * Converts a word like "send_email" to "sendEmail". It
285
-     * will remove non alphanumeric character from the word, so
286
-     * "who's online" will be converted to "whoSOnline"
287
-     *
288
-     * @access public
289
-     * @static
290
-     * @see camelize
291
-     * @param    string    $word    Word to lowerCamelCase
292
-     * @return string Returns a lowerCamelCasedWord
293
-     */
294
-    static function variablize($word){
295
-        $word = EEH_Inflector::camelize($word);
296
-        return strtolower($word[0]) . substr($word, 1);
297
-    }
298
-
299
-    // }}}
300
-    // {{{ tableize()
301
-
302
-    /**
303
-     * Converts a class name to its table name according to rails
304
-     * naming conventions.
305
-     *
306
-     * Converts "Person" to "people"
307
-     *
308
-     * @access public
309
-     * @static
310
-     * @see classify
311
-     * @param    string    $class_name    Class name for getting related table_name.
312
-     * @return string plural_table_name
313
-     */
314
-    static function tableize($class_name){
315
-        return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
316
-    }
317
-
318
-    // }}}
319
-    // {{{ classify()
320
-
321
-    /**
322
-     * Converts a table name to its class name according to rails
323
-     * naming conventions.
324
-     *
325
-     * Converts "people" to "Person"
326
-     *
327
-     * @access public
328
-     * @static
329
-     * @see tableize
330
-     * @param    string    $table_name    Table name for getting related ClassName.
331
-     * @return string SingularClassName
332
-     */
333
-    static function classify($table_name){
334
-        return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
335
-    }
336
-
337
-    // }}}
338
-    // {{{ ordinalize()
339
-
340
-    /**
341
-     * Converts number to its ordinal English form.
342
-     *
343
-     * This method converts 13 to 13th, 2 to 2nd ...
344
-     *
345
-     * @access public
346
-     * @static
347
-     * @param    integer    $number    Number to get its ordinal value
348
-     * @return string Ordinal representation of given string.
349
-     */
350
-    static function ordinalize($number){
351
-        if(in_array(($number % 100), range(11, 13))){
352
-            return $number . 'th';
353
-        }else{
354
-            switch(($number % 10)){
355
-                case 1:
356
-                    return $number . 'st';
357
-                    break;
358
-                case 2:
359
-                    return $number . 'nd';
360
-                    break;
361
-                case 3:
362
-                    return $number . 'rd';
363
-                default:
364
-                    return $number . 'th';
365
-                    break;
366
-            }
367
-        }
368
-    }
274
+		$uppercase = $uppercase == 'all' ? 'ucwords' : 'ucfirst';
275
+		return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
276
+	}
277
+
278
+	// }}}
279
+	// {{{ variablize()
280
+
281
+	/**
282
+	 * Same as camelize but first char is underscored
283
+	 *
284
+	 * Converts a word like "send_email" to "sendEmail". It
285
+	 * will remove non alphanumeric character from the word, so
286
+	 * "who's online" will be converted to "whoSOnline"
287
+	 *
288
+	 * @access public
289
+	 * @static
290
+	 * @see camelize
291
+	 * @param    string    $word    Word to lowerCamelCase
292
+	 * @return string Returns a lowerCamelCasedWord
293
+	 */
294
+	static function variablize($word){
295
+		$word = EEH_Inflector::camelize($word);
296
+		return strtolower($word[0]) . substr($word, 1);
297
+	}
298
+
299
+	// }}}
300
+	// {{{ tableize()
301
+
302
+	/**
303
+	 * Converts a class name to its table name according to rails
304
+	 * naming conventions.
305
+	 *
306
+	 * Converts "Person" to "people"
307
+	 *
308
+	 * @access public
309
+	 * @static
310
+	 * @see classify
311
+	 * @param    string    $class_name    Class name for getting related table_name.
312
+	 * @return string plural_table_name
313
+	 */
314
+	static function tableize($class_name){
315
+		return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
316
+	}
317
+
318
+	// }}}
319
+	// {{{ classify()
320
+
321
+	/**
322
+	 * Converts a table name to its class name according to rails
323
+	 * naming conventions.
324
+	 *
325
+	 * Converts "people" to "Person"
326
+	 *
327
+	 * @access public
328
+	 * @static
329
+	 * @see tableize
330
+	 * @param    string    $table_name    Table name for getting related ClassName.
331
+	 * @return string SingularClassName
332
+	 */
333
+	static function classify($table_name){
334
+		return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
335
+	}
336
+
337
+	// }}}
338
+	// {{{ ordinalize()
339
+
340
+	/**
341
+	 * Converts number to its ordinal English form.
342
+	 *
343
+	 * This method converts 13 to 13th, 2 to 2nd ...
344
+	 *
345
+	 * @access public
346
+	 * @static
347
+	 * @param    integer    $number    Number to get its ordinal value
348
+	 * @return string Ordinal representation of given string.
349
+	 */
350
+	static function ordinalize($number){
351
+		if(in_array(($number % 100), range(11, 13))){
352
+			return $number . 'th';
353
+		}else{
354
+			switch(($number % 10)){
355
+				case 1:
356
+					return $number . 'st';
357
+					break;
358
+				case 2:
359
+					return $number . 'nd';
360
+					break;
361
+				case 3:
362
+					return $number . 'rd';
363
+				default:
364
+					return $number . 'th';
365
+					break;
366
+			}
367
+		}
368
+	}
369 369
 }
370 370
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 // +----------------------------------------------------------------------+
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @since 0.1
35 35
  * @version $Revision 0.1 $
36 36
  */
37
-class EEH_Inflector{
37
+class EEH_Inflector {
38 38
     // ------ CLASS METHODS ------ //
39 39
     // ---- Public methods ---- //
40 40
     // {{{ pluralize()
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 * @param string $word
45 45
 	 * @return string
46 46
 	 */
47
-	static function pluralize_and_lower( $word ){
48
-		return strtolower( self::pluralize( $word ) );
47
+	static function pluralize_and_lower($word) {
48
+		return strtolower(self::pluralize($word));
49 49
 	}
50 50
 
51
-	static function singularize_and_upper( $word ) {
52
-		return str_replace( ' ', '_', self::humanize( self::singularize( $word ), 'all' ) );
51
+	static function singularize_and_upper($word) {
52
+		return str_replace(' ', '_', self::humanize(self::singularize($word), 'all'));
53 53
 	}
54 54
     /**
55 55
      * Pluralizes English nouns.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param    string    $word    English noun to pluralize
60 60
      * @return string Plural noun
61 61
      */
62
-    static function pluralize($word){
62
+    static function pluralize($word) {
63 63
         $plural = array(
64 64
             '/(quiz)$/i'               => '\1zes',
65 65
             '/^(ox)$/i'                => '\1en',
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 
92 92
         $lowercased_word = strtolower($word);
93 93
 
94
-        foreach($uncountable as $_uncountable){
95
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
96
-					! ctype_alpha( $lowercased_word[ strlen( $lowercased_word ) - strlen($_uncountable) ] ) ){
94
+        foreach ($uncountable as $_uncountable) {
95
+            if (substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable && //even though the word "price" ends in "rice", it can be pluralized, so check the previous character isnt a letter
96
+					! ctype_alpha($lowercased_word[strlen($lowercased_word) - strlen($_uncountable)])) {
97 97
                 return $word;
98 98
             }
99 99
         }
100 100
 
101
-        foreach($irregular as $_plural => $_singular){
102
-            if(preg_match('/(' . $_plural . ')$/i', $word, $arr)){
103
-                return preg_replace('/(' . $_plural . ')$/i', substr($arr[0], 0, 1) . substr($_singular, 1), $word);
101
+        foreach ($irregular as $_plural => $_singular) {
102
+            if (preg_match('/('.$_plural.')$/i', $word, $arr)) {
103
+                return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word);
104 104
             }
105 105
         }
106 106
 
107
-        foreach($plural as $rule => $replacement){
108
-            if(preg_match($rule, $word)){
107
+        foreach ($plural as $rule => $replacement) {
108
+            if (preg_match($rule, $word)) {
109 109
                 return preg_replace($rule, $replacement, $word);
110 110
             }
111 111
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @param    string    $word    English noun to singularize
124 124
      * @return string Singular noun.
125 125
      */
126
-    static function singularize($word){
126
+    static function singularize($word) {
127 127
         $singular = array(
128 128
             '/(quiz)zes$/i'                                                    => '\1',
129 129
             '/(matr)ices$/i'                                                   => '\1ix',
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
             'move'   => 'moves');
162 162
 
163 163
         $lowercased_word = strtolower($word);
164
-        foreach($uncountable as $_uncountable){
165
-            if(substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable){
164
+        foreach ($uncountable as $_uncountable) {
165
+            if (substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable) {
166 166
                 return $word;
167 167
             }
168 168
         }
169 169
 
170
-        foreach($irregular as $_plural => $_singular){
171
-            if(preg_match('/(' . $_singular . ')$/i', $word, $arr)){
172
-                return preg_replace('/(' . $_singular . ')$/i', substr($arr[0], 0, 1) . substr($_plural, 1), $word);
170
+        foreach ($irregular as $_plural => $_singular) {
171
+            if (preg_match('/('.$_singular.')$/i', $word, $arr)) {
172
+                return preg_replace('/('.$_singular.')$/i', substr($arr[0], 0, 1).substr($_plural, 1), $word);
173 173
             }
174 174
         }
175 175
 
176
-        foreach($singular as $rule => $replacement){
177
-            if(preg_match($rule, $word)){
176
+        foreach ($singular as $rule => $replacement) {
177
+            if (preg_match($rule, $word)) {
178 178
                 return preg_replace($rule, $replacement, $word);
179 179
             }
180 180
         }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * the words in the title.
204 204
      * @return string Text formatted as title
205 205
      */
206
-    static function titleize($word, $uppercase = ''){
206
+    static function titleize($word, $uppercase = '') {
207 207
         $uppercase = $uppercase == 'first' ? 'ucfirst' : 'ucwords';
208 208
         return $uppercase(EEH_Inflector::humanize(EEH_Inflector::underscore($word)));
209 209
     }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      * @param    string    $word    Word to convert to camel case
225 225
      * @return string UpperCamelCasedWord
226 226
      */
227
-    static function camelize($word){
227
+    static function camelize($word) {
228 228
         return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word)));
229 229
     }
230 230
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      * @param    string    $word    Word to underscore
245 245
      * @return string Underscored word
246 246
      */
247
-    static function underscore($word){
247
+    static function underscore($word) {
248 248
         return strtolower(preg_replace('/[^A-Z^a-z^0-9]+/', '_', preg_replace('/([a-zd])([A-Z])/', '1_2', preg_replace('/([A-Z]+)([A-Z][a-z])/', '1_2', $word))));
249 249
     }
250 250
 
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
      * instead of just the first one.
269 269
      * @return string Human-readable word
270 270
      */
271
-    static function humanize($word, $uppercase = ''){
271
+    static function humanize($word, $uppercase = '') {
272 272
 		//make special exceptions for acronyms
273
-		$word = str_replace('wp_', 'WP_', $word );
273
+		$word = str_replace('wp_', 'WP_', $word);
274 274
         $uppercase = $uppercase == 'all' ? 'ucwords' : 'ucfirst';
275 275
         return $uppercase(str_replace('_', ' ', preg_replace('/_id$/', '', $word)));
276 276
     }
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
      * @param    string    $word    Word to lowerCamelCase
292 292
      * @return string Returns a lowerCamelCasedWord
293 293
      */
294
-    static function variablize($word){
294
+    static function variablize($word) {
295 295
         $word = EEH_Inflector::camelize($word);
296
-        return strtolower($word[0]) . substr($word, 1);
296
+        return strtolower($word[0]).substr($word, 1);
297 297
     }
298 298
 
299 299
     // }}}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      * @param    string    $class_name    Class name for getting related table_name.
312 312
      * @return string plural_table_name
313 313
      */
314
-    static function tableize($class_name){
314
+    static function tableize($class_name) {
315 315
         return EEH_Inflector::pluralize(EEH_Inflector::underscore($class_name));
316 316
     }
317 317
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      * @param    string    $table_name    Table name for getting related ClassName.
331 331
      * @return string SingularClassName
332 332
      */
333
-    static function classify($table_name){
333
+    static function classify($table_name) {
334 334
         return EEH_Inflector::camelize(EEH_Inflector::singularize($table_name));
335 335
     }
336 336
 
@@ -347,21 +347,21 @@  discard block
 block discarded – undo
347 347
      * @param    integer    $number    Number to get its ordinal value
348 348
      * @return string Ordinal representation of given string.
349 349
      */
350
-    static function ordinalize($number){
351
-        if(in_array(($number % 100), range(11, 13))){
352
-            return $number . 'th';
353
-        }else{
354
-            switch(($number % 10)){
350
+    static function ordinalize($number) {
351
+        if (in_array(($number % 100), range(11, 13))) {
352
+            return $number.'th';
353
+        } else {
354
+            switch (($number % 10)) {
355 355
                 case 1:
356
-                    return $number . 'st';
356
+                    return $number.'st';
357 357
                     break;
358 358
                 case 2:
359
-                    return $number . 'nd';
359
+                    return $number.'nd';
360 360
                     break;
361 361
                 case 3:
362
-                    return $number . 'rd';
362
+                    return $number.'rd';
363 363
                 default:
364
-                    return $number . 'th';
364
+                    return $number.'th';
365 365
                     break;
366 366
             }
367 367
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@
 block discarded – undo
350 350
     static function ordinalize($number){
351 351
         if(in_array(($number % 100), range(11, 13))){
352 352
             return $number . 'th';
353
-        }else{
353
+        } else{
354 354
             switch(($number % 10)){
355 355
                 case 1:
356 356
                     return $number . 'st';
Please login to merge, or discard this patch.
core/helpers/EEH_Money.helper.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
  */
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
10 10
  /**
11
- *
12
- * Money helper class.
13
- * This class has helper methods that help with money related conversions and calculations.
14
- *
15
- * @since %VER%
16
- *
17
- * @package		Event Espresso
18
- * @subpackage	helpers
19
- * @author		Darren Ethier
20
- *
21
- * ------------------------------------------------------------------------
22
- */
11
+  *
12
+  * Money helper class.
13
+  * This class has helper methods that help with money related conversions and calculations.
14
+  *
15
+  * @since %VER%
16
+  *
17
+  * @package		Event Espresso
18
+  * @subpackage	helpers
19
+  * @author		Darren Ethier
20
+  *
21
+  * ------------------------------------------------------------------------
22
+  */
23 23
 class EEH_Money extends EEH_Base  {
24 24
 
25 25
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Use this to register or deregister a new message template pack variation for the EE messages system.
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * ------------------------------------------------------------------------
22 22
  */
23
-class EEH_Money extends EEH_Base  {
23
+class EEH_Money extends EEH_Base {
24 24
 
25 25
 
26 26
 	/**
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	 * @param int|string $incoming_value
30 30
 	 * @return float
31 31
 	 */
32
-	public static function convert_to_float_from_localized_money( $incoming_value ) {
32
+	public static function convert_to_float_from_localized_money($incoming_value) {
33 33
 		//remove thousands separator
34
-		$money_value = str_replace( EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value );
34
+		$money_value = str_replace(EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value);
35 35
 
36 36
 		//replace decimal place with standard decimal.
37
-		$money_value = str_replace( EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value );
37
+		$money_value = str_replace(EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value);
38 38
 
39 39
 		//float it! and round to three decimal places
40
-		$money_value = round ( (float) $money_value, 3 );
40
+		$money_value = round((float) $money_value, 3);
41 41
 		return $money_value;
42 42
 	}
43 43
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * @throws \EE_Error
58 58
 	 */
59 59
 
60
-	public static function compare_floats( $float1, $float2, $operator='=' ) {
60
+	public static function compare_floats($float1, $float2, $operator = '=') {
61 61
 		// Check numbers to 5 digits of precision
62 62
 		$epsilon = 0.00001;
63 63
 
64
-		$float1 = (float)$float1;
65
-		$float2 = (float)$float2;
64
+		$float1 = (float) $float1;
65
+		$float2 = (float) $float2;
66 66
 
67 67
 		switch ($operator) {
68 68
 			// equal
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 				}
117 117
 				break;
118 118
 			default:
119
-				throw new EE_Error(__( "Unknown operator '" . $operator . "' in EEH_Money::compare_floats()", 'event_espresso' ) );
119
+				throw new EE_Error(__("Unknown operator '".$operator."' in EEH_Money::compare_floats()", 'event_espresso'));
120 120
 		}
121 121
 
122 122
 		return false;
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return string
133 133
 	 */
134
-	public static function get_format_for_jqplot( $CNT_ISO = '') {
134
+	public static function get_format_for_jqplot($CNT_ISO = '') {
135 135
 		//default format
136 136
 		$format = 'f';
137 137
 		//if CNT_ISO passed lets try to get currency settings for it.
138
-		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
138
+		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
139 139
 		//default currency settings for site if not set
140
-		if ( ! $currency_config instanceof EE_Currency_Config ) {
140
+		if ( ! $currency_config instanceof EE_Currency_Config) {
141 141
 			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
142 142
 		}
143 143
 
144 144
 		//first get the decimal place and number of places
145
-		$format = "%'." . $currency_config->dec_plc . $format;
145
+		$format = "%'.".$currency_config->dec_plc.$format;
146 146
 
147 147
 		//currency symbol on right side.
148
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
148
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
149 149
 		return $format;
150 150
 	}
151 151
 
@@ -160,27 +160,27 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return string
162 162
 	 */
163
-	public static function get_format_for_google_charts( $CNT_ISO = '' ) {
163
+	public static function get_format_for_google_charts($CNT_ISO = '') {
164 164
 		//if CNT_ISO passed lets try to get currency settings for it.
165
-		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
165
+		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
166 166
 		//default currency settings for site if not set
167
-		if ( ! $currency_config instanceof EE_Currency_Config ) {
167
+		if ( ! $currency_config instanceof EE_Currency_Config) {
168 168
 			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
169 169
 		}
170 170
 
171
-		$decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' );
171
+		$decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0');
172 172
 
173 173
 		//first get the decimal place and number of places
174
-		$format = '#,##0.' . $decimal_places_placeholder;
174
+		$format = '#,##0.'.$decimal_places_placeholder;
175 175
 
176 176
 		//currency symbol on right side.
177
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
177
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
178 178
 		$formatterObject = array(
179 179
 			'decimalSymbol' => $currency_config->dec_mrk,
180 180
 			'groupingSymbol' => $currency_config->thsnds,
181 181
 			'fractionDigits' => $currency_config->dec_plc,
182 182
 		);
183
-		if ( $currency_config->sign_b4 ) {
183
+		if ($currency_config->sign_b4) {
184 184
 			$formatterObject['prefix'] = $currency_config->sign;
185 185
 		} else {
186 186
 			$formatterObject['suffix'] = $currency_config->sign;
Please login to merge, or discard this patch.
core/helpers/EEH_Sideloader.helper.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 
30 30
 
31
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
31
+require_once(EE_HELPERS.'EEH_Base.helper.php');
32 32
 class EEH_Sideloader extends EEH_Base {
33 33
 
34 34
 	private $_upload_to;
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @access public
44 44
 	 * @param array $init array fo initializing the sideloader if keys match the properties.
45 45
 	 */
46
-	public function __construct( $init = array() ) {
47
-		$this->_init( $init );
46
+	public function __construct($init = array()) {
47
+		$this->_init($init);
48 48
 	}
49 49
 
50 50
 
@@ -55,24 +55,24 @@  discard block
 block discarded – undo
55 55
 	 * @param  array  $init array on init (keys match properties others ignored)
56 56
 	 * @return void
57 57
 	 */
58
-	private function _init( $init ) {
58
+	private function _init($init) {
59 59
 		$defaults = array(
60 60
 			'_upload_to' => $this->_get_wp_uploads_dir(),
61 61
 			'_upload_from' => '',
62 62
 			'_permissions' => 0644,
63
-			'_new_file_name' => 'EE_Sideloader_' . uniqid() . '.default'
63
+			'_new_file_name' => 'EE_Sideloader_'.uniqid().'.default'
64 64
 			);
65 65
 
66
-		$props = array_merge( $defaults, $init );
66
+		$props = array_merge($defaults, $init);
67 67
 
68
-		foreach ( $props as $key => $val ) {
69
-			if ( EEH_Class_Tools::has_property( $this, $key ) ) {
68
+		foreach ($props as $key => $val) {
69
+			if (EEH_Class_Tools::has_property($this, $key)) {
70 70
 				$this->$key = $val;
71 71
 			}
72 72
 		}
73 73
 
74 74
 		//make sure we include the required wp file for needed functions
75
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
75
+		require_once(ABSPATH.'wp-admin/includes/file.php');
76 76
 	}
77 77
 
78 78
 
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 	private function _get_wp_uploads_dir() {}
81 81
 
82 82
 	//setters
83
-	public function set_upload_to( $upload_to_folder ) {
83
+	public function set_upload_to($upload_to_folder) {
84 84
 		$this->_upload_to = $upload_to_folder;
85 85
 	}
86
-	public function set_upload_from( $upload_from_folder ) {
86
+	public function set_upload_from($upload_from_folder) {
87 87
 		$this->_upload_from_folder = $upload_from_folder;
88 88
 	}
89
-	public function set_permissions( $permissions ) {
89
+	public function set_permissions($permissions) {
90 90
 		$this->_permissions = $permissions;
91 91
 	}
92
-	public function set_new_file_name( $new_file_name ) {
92
+	public function set_new_file_name($new_file_name) {
93 93
 		$this->_new_file_name = $new_file_name;
94 94
 	}
95 95
 
@@ -111,34 +111,34 @@  discard block
 block discarded – undo
111 111
 	//upload methods
112 112
 	public function sideload() {
113 113
 		//setup temp dir
114
-		$temp_file = wp_tempnam( $this->_upload_from );
114
+		$temp_file = wp_tempnam($this->_upload_from);
115 115
 
116
-		if ( !$temp_file ) {
117
-			EE_Error::add_error( __('Something went wrong with the upload.  Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
116
+		if ( ! $temp_file) {
117
+			EE_Error::add_error(__('Something went wrong with the upload.  Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
118 118
 			return false;
119 119
 		}
120 120
 
121
-		do_action( 'AHEE__EEH_Sideloader__sideload__before', $this, $temp_file );
121
+		do_action('AHEE__EEH_Sideloader__sideload__before', $this, $temp_file);
122 122
 
123
-		$wp_remote_args = apply_filters( 'FHEE__EEH_Sideloader__sideload__wp_remote_args', array( 'timeout' => 500, 'stream' => true, 'filename' => $temp_file ), $this, $temp_file );
123
+		$wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array('timeout' => 500, 'stream' => true, 'filename' => $temp_file), $this, $temp_file);
124 124
 
125
-		$response = wp_safe_remote_get( $this->_upload_from, $wp_remote_args );
125
+		$response = wp_safe_remote_get($this->_upload_from, $wp_remote_args);
126 126
 
127
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
128
-			unlink( $temp_file );
129
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
130
-				EE_Error::add_error( sprintf( __('Unable to upload the file.  Either the path given to upload from is incorrect, or something else happened.  Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export( $response, true ), $this->_upload_from ), __FILE__, __FUNCTION__, __LINE__ );
127
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
128
+			unlink($temp_file);
129
+			if (defined('WP_DEBUG') && WP_DEBUG) {
130
+				EE_Error::add_error(sprintf(__('Unable to upload the file.  Either the path given to upload from is incorrect, or something else happened.  Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export($response, true), $this->_upload_from), __FILE__, __FUNCTION__, __LINE__);
131 131
 			}
132 132
 			return false;
133 133
 		}
134 134
 
135 135
 		//possible md5 check
136
-		$content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
137
-		if ( $content_md5 ) {
138
-			$md5_check = verify_file_md5( $temp_file, $content_md5 );
139
-			if ( is_wp_error( $md5_check ) ) {
140
-				unlink( $temp_file );
141
-				EE_Error::add_error( $md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
136
+		$content_md5 = wp_remote_retrieve_header($response, 'content-md5');
137
+		if ($content_md5) {
138
+			$md5_check = verify_file_md5($temp_file, $content_md5);
139
+			if (is_wp_error($md5_check)) {
140
+				unlink($temp_file);
141
+				EE_Error::add_error($md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
142 142
 				return false;
143 143
 			}
144 144
 		}
@@ -146,24 +146,24 @@  discard block
 block discarded – undo
146 146
 		$file = $temp_file;
147 147
 
148 148
 		//now we have the file, let's get it in the right directory with the right name.
149
-		$path = apply_filters( 'FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to . $this->_new_file_name, $this );
149
+		$path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to.$this->_new_file_name, $this);
150 150
 
151 151
 		//move file in
152
-		if ( false === @ rename( $file, $path ) ) {
153
-			unlink( $temp_file );
154
-			EE_Error::add_error(  sprintf( __('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso' ), $path ), __FILE__, __FUNCTION__, __LINE__ );
152
+		if (false === @ rename($file, $path)) {
153
+			unlink($temp_file);
154
+			EE_Error::add_error(sprintf(__('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso'), $path), __FILE__, __FUNCTION__, __LINE__);
155 155
 			return false;
156 156
 		}
157 157
 
158 158
 		//set permissions
159
-		$permissions = apply_filters( 'FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this );
160
-		chmod( $path, $permissions );
159
+		$permissions = apply_filters('FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this);
160
+		chmod($path, $permissions);
161 161
 
162 162
 		//that's it.  let's allow for actions after file uploaded.
163
-		do_action( 'AHEE__EE_Sideloader__sideload_after', $this, $path );
163
+		do_action('AHEE__EE_Sideloader__sideload_after', $this, $path);
164 164
 
165 165
 		//unlink tempfile
166
-		@unlink( $temp_file );
166
+		@unlink($temp_file);
167 167
 		return true;
168 168
 	}
169 169
 
Please login to merge, or discard this patch.
core/helpers/EEH_Tabbed_Content.helper.php 2 patches
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -98,8 +99,9 @@  discard block
 block discarded – undo
98 99
 	 * @param array $nav_tabs tab array for nav tabs
99 100
 	 */
100 101
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
101
-		if ( empty($nav_tabs) )
102
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
102
+		if ( empty($nav_tabs) ) {
103
+					throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
104
+		}
103 105
 
104 106
 		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
105 107
 		foreach ( $nav_tabs as $slug => $tab ) {
@@ -165,8 +167,10 @@  discard block
 block discarded – undo
165 167
 	 * @return string                  a html snippet of of all the formatted link elements.
166 168
 	 */
167 169
 	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
168
-		if ( !is_array($item_array) || empty( $item_array ) )
169
-			return false; //get out we don't have even the basic thing we need!
170
+		if ( !is_array($item_array) || empty( $item_array ) ) {
171
+					return false;
172
+		}
173
+		//get out we don't have even the basic thing we need!
170 174
 
171 175
 
172 176
 		$defaults = array(
@@ -184,8 +188,9 @@  discard block
 block discarded – undo
184 188
 			$item = wp_parse_args( $item, $defaults );
185 189
 			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
186 190
 			$list .= self::_text_link_item($item);
187
-			if ( !empty($sep) && $ci != count($item_array) )
188
-				$list .= self::_text_link_item($sep);
191
+			if ( !empty($sep) && $ci != count($item_array) ) {
192
+							$list .= self::_text_link_item($sep);
193
+			}
189 194
 			$ci++;
190 195
 		}
191 196
 
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 	 * @return string the assembled html string containing the tabbed content for display.
47 47
 	 * @throws \EE_Error
48 48
 	 */
49
-	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) {
49
+	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) {
50 50
 
51 51
 		//first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston
52
-		if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) {
53
-			throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') );
52
+		if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) {
53
+			throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso'));
54 54
 		}
55 55
 
56 56
 		//make sure we've got incoming data setup properly
57
-		$tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents );
58
-		$tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents;
57
+		$tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents);
58
+		$tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents;
59 59
 
60
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
60
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
61 61
 		$all_tabs_content = '';
62 62
 
63 63
 		$index = 0;
64
-		foreach ( $tabs as $tab ) {
64
+		foreach ($tabs as $tab) {
65 65
 			$active = $index === 0 ? true : false;
66 66
 			$all_tabs .= self::tab($tab, $active);
67 67
 			$all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		$tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs';
80 80
 
81
-		return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>';
81
+		return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>';
82 82
 	}
83 83
 
84 84
 
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 * @throws \EE_Error
103 103
 	 */
104 104
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
105
-		if ( empty($nav_tabs) )
106
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
105
+		if (empty($nav_tabs))
106
+			throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso'));
107 107
 
108
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
109
-		foreach ( $nav_tabs as $slug => $tab ) {
108
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
109
+		foreach ($nav_tabs as $slug => $tab) {
110 110
 			$all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']);
111 111
 		}
112 112
 		$all_tabs .= '</h2>';
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	 * @param bool|string $css If string given then the generated tab will include that as the class.
123 123
 	 * @return string          html for tab
124 124
 	 */
125
-	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) {
125
+	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) {
126 126
 		$name = str_replace(' ', '-', $name);
127 127
 		$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
128
-		$class = $css ? $class . ' ' . $css : $class;
129
-		$nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) );
130
-		$url = $url ? $url : '#' . $name;
131
-		$tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t";
128
+		$class = $css ? $class.' '.$css : $class;
129
+		$nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name));
130
+		$url = $url ? $url : '#'.$name;
131
+		$tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t";
132 132
 		return $tab;
133 133
 	}
134 134
 
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	private static function tab_content($name, $tab_content, $active = false) {
146 146
 		$class = $active ? 'nav-tab-content' : 'nav-tab-content hidden';
147
-		$name = str_replace( ' ', '-', $name);
148
-		$content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n";
149
-		$content .= "\t" . $tab_content . "\n";
147
+		$name = str_replace(' ', '-', $name);
148
+		$content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n";
149
+		$content .= "\t".$tab_content."\n";
150 150
 		$content .= '<div style="clear:both"></div></div>';
151 151
 		return $content;
152 152
 	}
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 * @param string $default 			You can include a string for the item that will receive the "item_display" class for the js.
173 173
 	 * @return string                  a html snippet of of all the formatted link elements.
174 174
 	 */
175
-	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
176
-		$item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class );
177
-		if ( !is_array($item_array) || empty( $item_array ) )
175
+	public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') {
176
+		$item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class);
177
+		if ( ! is_array($item_array) || empty($item_array))
178 178
 			return false; //get out we don't have even the basic thing we need!
179 179
 
180 180
 
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 			'title' => esc_attr__('Link for Item', 'event_espresso'),
186 186
 			'slug' => 'item_slug'
187 187
 		);
188
-		$container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links';
189
-		$list = '<ul class="' . $container_class . '">';
188
+		$container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links';
189
+		$list = '<ul class="'.$container_class.'">';
190 190
 
191 191
 		$ci = 1;
192
-		foreach ( $item_array as $item ) {
193
-			$item = wp_parse_args( $item, $defaults );
194
-			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
192
+		foreach ($item_array as $item) {
193
+			$item = wp_parse_args($item, $defaults);
194
+			$item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class'];
195 195
 			$list .= self::_text_link_item($item);
196
-			if ( !empty($sep) && $ci != count($item_array) )
196
+			if ( ! empty($sep) && $ci != count($item_array))
197 197
 				$list .= self::_text_link_item($sep);
198 198
 			$ci++;
199 199
 		}
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 
206 206
 
207
-	private static function _text_link_item( $item ) {
207
+	private static function _text_link_item($item) {
208 208
 		//if this isn't an array then we're doing a separator
209
-		if ( !is_array( $item ) ) {
209
+		if ( ! is_array($item)) {
210 210
 			$label = $item;
211 211
 			$class = 'ee-text-link-sep';
212 212
 			$href = '';
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 			extract($item);
216 216
 		}
217 217
 
218
-		$class = $class != 'ee-text-link-sep'  ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"';
218
+		$class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"';
219 219
 
220
-		$content = '<li ' . $class . '>';
221
-		$content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : '';
220
+		$content = '<li '.$class.'>';
221
+		$content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : '';
222 222
 		$content .= $label;
223
-		$content .= !empty($href) ? '</a>' : '';
223
+		$content .= ! empty($href) ? '</a>' : '';
224 224
 		$content .= '</li>';
225 225
 		return $content;
226 226
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 4 patches
Braces   +19 added lines, -16 removed lines patch added patch discarded remove patch
@@ -160,8 +160,9 @@  discard block
 block discarded – undo
160 160
 		// first use WP locate_template to check for template in the current theme folder
161 161
 		$template_path = locate_template( $templates );
162 162
 
163
-		if ( $check_if_custom && !empty( $template_path ) )
164
-			return TRUE;
163
+		if ( $check_if_custom && !empty( $template_path ) ) {
164
+					return TRUE;
165
+		}
165 166
 
166 167
 		// not in the theme
167 168
 		if ( empty( $template_path )) {
@@ -364,11 +365,11 @@  discard block
 block discarded – undo
364 365
 				if( $mny->sign_b4 ){
365 366
 					if( $amount >= 0 ){
366 367
 						$amount_formatted = $mny->sign . $amount_formatted;
367
-					}else{
368
+					} else{
368 369
 						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
369 370
 					}
370 371
 
371
-				}else{
372
+				} else{
372 373
 					$amount_formatted =  $amount_formatted . $mny->sign;
373 374
 				}
374 375
 
@@ -432,11 +433,13 @@  discard block
 block discarded – undo
432 433
 	 */
433 434
 	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
434 435
 
435
-		if ( ! $page )
436
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
436
+		if ( ! $page ) {
437
+					$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
438
+		}
437 439
 
438
-		if ( ! $action )
439
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
440
+		if ( ! $action ) {
441
+					$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
442
+		}
440 443
 
441 444
 		$action = empty($action) ? 'default' : $action;
442 445
 
@@ -510,8 +513,9 @@  discard block
 block discarded – undo
510 513
 	 * @return string               html structure for status.
511 514
 	 */
512 515
 	public static function status_legend( $status_array, $active_status = '' ) {
513
-		if ( !is_array( $status_array ) )
514
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
516
+		if ( !is_array( $status_array ) ) {
517
+					throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
518
+		}
515 519
 
516 520
 		$setup_array = array();
517 521
 		foreach ( $status_array as $item => $status ) {
@@ -572,8 +576,7 @@  discard block
 block discarded – undo
572 576
 				</tbody>
573 577
 			</table>
574 578
 			<?php
575
-		}
576
-		else {
579
+		} else {
577 580
 			?>
578 581
 			<ul>
579 582
 				<?php
@@ -583,8 +586,7 @@  discard block
 block discarded – undo
583 586
 			</ul>
584 587
 			<?php
585 588
 		}
586
-	}
587
-	else {
589
+	} else {
588 590
 		//simple value
589 591
 		echo $data;
590 592
 	}
@@ -664,8 +666,9 @@  discard block
 block discarded – undo
664 666
 
665 667
 		$total_pages = ceil( $total_items / $per_page );
666 668
 
667
-		if ( $total_pages <= 1 )
668
-			return '';
669
+		if ( $total_pages <= 1 ) {
670
+					return '';
671
+		}
669 672
 
670 673
 		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
671 674
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * given two paths, this determines if there is a common base path between the two
284 284
 	 *
285
-	 * @param array $paths
285
+	 * @param string[] $paths
286 286
 	 * @return string
287 287
 	 */
288 288
 	protected static function _find_common_base_path( $paths ) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @param bool|string $template_path server path to the file to be loaded, including file name and extension
310 310
 	 * @param  array      $template_args an array of arguments to be extracted for use in the template
311 311
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
312
-	 * @return mixed string
312
+	 * @return string string
313 313
 	 */
314 314
 	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
315 315
 		//require the template validator for verifying variables are set according to how the template requires
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				return array();
100 100
 			}
101 101
 			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
102
+				unset( $espresso_themes[ $key ] );
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105 105
 			foreach ( $espresso_themes as $espresso_theme ) {
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
 		);
710 710
 
711 711
 		if ( empty( $items_label )
712
-		     || ! is_array( $items_label )
713
-		     || ! isset( $items_label['single'] )
714
-		     || ! isset( $items_label['plural'] ) ) {
712
+			 || ! is_array( $items_label )
713
+			 || ! isset( $items_label['single'] )
714
+			 || ! isset( $items_label['plural'] ) ) {
715 715
 			$items_label = array(
716 716
 				'single' => __( '1 item', 'event_espresso' ),
717 717
 				'plural' => __( '%s items', 'event_espresso' )
Please login to merge, or discard this patch.
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 
18
-if ( ! function_exists( 'espresso_get_template_part' )) {
18
+if ( ! function_exists('espresso_get_template_part')) {
19 19
 	/**
20 20
 	 * espresso_get_template_part
21 21
 	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param string $name The name of the specialised template.
26 26
 	 * @return string        the html output for the formatted money value
27 27
 	 */
28
-	function espresso_get_template_part( $slug = NULL, $name = NULL ) {
29
-		EEH_Template::get_template_part( $slug, $name );
28
+	function espresso_get_template_part($slug = NULL, $name = NULL) {
29
+		EEH_Template::get_template_part($slug, $name);
30 30
 	}
31 31
 }
32 32
 
33 33
 
34 34
 
35
-if ( ! function_exists( 'espresso_get_object_css_class' )) {
35
+if ( ! function_exists('espresso_get_object_css_class')) {
36 36
 	/**
37 37
 	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38 38
 	 *
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  string $suffix added to the end of the generated class
43 43
 	 * @return string
44 44
 	 */
45
-	function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
46
-		return EEH_Template::get_object_css_class( $object, $prefix, $suffix );
45
+	function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47 47
 	}
48 48
 }
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * 	@return boolean
71 71
 	 */
72 72
 	public static function is_espresso_theme() {
73
-		return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE;
73
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * 	@return void
80 80
 	 */
81 81
 	public static function load_espresso_theme_functions() {
82
-		if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) {
83
-			if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) {
84
-				require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' );
82
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
83
+			if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
84
+				require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
85 85
 			}
86 86
 		}
87 87
 	}
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 * 	@return array
94 94
 	 */
95 95
 	public static function get_espresso_themes() {
96
-		if ( empty( EEH_Template::$_espresso_themes )) {
97
-			$espresso_themes =  glob( EE_PUBLIC . '*', GLOB_ONLYDIR );
98
-			if ( empty( $espresso_themes ) ) {
96
+		if (empty(EEH_Template::$_espresso_themes)) {
97
+			$espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
98
+			if (empty($espresso_themes)) {
99 99
 				return array();
100 100
 			}
101
-			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
101
+			if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) {
102
+			    unset($espresso_themes[$key]);
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105
-			foreach ( $espresso_themes as $espresso_theme ) {
106
-				EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme;
105
+			foreach ($espresso_themes as $espresso_theme) {
106
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
107 107
 			}
108 108
 		}
109 109
 		return EEH_Template::$_espresso_themes;
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 	 * @param bool   $return_string
123 123
 	 * @return string        the html output for the formatted money value
124 124
 	 */
125
-	public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE  ) {
126
-		do_action( "get_template_part_{$slug}-{$name}", $slug, $name );
125
+	public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) {
126
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127 127
 		$templates = array();
128 128
 		$name = (string) $name;
129
-		if ( $name != '' ) {
129
+		if ($name != '') {
130 130
 			$templates[] = "{$slug}-{$name}.php";
131 131
 		}
132 132
 		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-		if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) {
134
-			EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) {
134
+			EEH_Template::locate_template($templates, $template_args, TRUE, $return_string);
135 135
 		}
136 136
 	}
137 137
 
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	 * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
183 183
 	 * @return mixed
184 184
 	 */
185
-	public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) {
185
+	public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) {
186 186
 		// first use WP locate_template to check for template in the current theme folder
187
-		$template_path = locate_template( $templates );
187
+		$template_path = locate_template($templates);
188 188
 
189
-		if ( $check_if_custom && !empty( $template_path ) )
189
+		if ($check_if_custom && ! empty($template_path))
190 190
 			return TRUE;
191 191
 
192 192
 		// not in the theme
193
-		if ( empty( $template_path )) {
193
+		if (empty($template_path)) {
194 194
 			// not even a template to look for ?
195
-			if ( empty( $templates )) {
195
+			if (empty($templates)) {
196 196
 				// get post_type
197
-				$post_type = EE_Registry::instance()->REQ->get( 'post_type' );
197
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
198 198
 				// get array of EE Custom Post Types
199 199
 				$EE_CPTs = EE_Register_CPTs::get_CPTs();
200 200
 				// build template name based on request
201
-				if ( isset( $EE_CPTs[ $post_type ] )) {
202
-					$archive_or_single =  is_archive() ? 'archive' : '';
203
-					$archive_or_single =  is_single() ? 'single' : $archive_or_single;
204
-					$templates = $archive_or_single . '-' . $post_type . '.php';
201
+				if (isset($EE_CPTs[$post_type])) {
202
+					$archive_or_single = is_archive() ? 'archive' : '';
203
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
204
+					$templates = $archive_or_single.'-'.$post_type.'.php';
205 205
 				}
206 206
 			}
207 207
 			// currently active EE template theme
@@ -210,81 +210,81 @@  discard block
 block discarded – undo
210 210
 			// array of paths to folders that may contain templates
211 211
 			$template_folder_paths = array(
212 212
 				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
213
-				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
213
+				EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
214 214
 				// then in the root of the /wp-content/uploads/espresso/templates/ folder
215 215
 				EVENT_ESPRESSO_TEMPLATE_DIR
216 216
 			);
217 217
 
218 218
 			//add core plugin folders for checking only if we're not $check_if_custom
219
-			if ( ! $check_if_custom ) {
219
+			if ( ! $check_if_custom) {
220 220
 				$core_paths = array(
221 221
 					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
222
-					EE_PUBLIC . $current_theme,
222
+					EE_PUBLIC.$current_theme,
223 223
 					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
224
-					EE_TEMPLATES . $current_theme,
224
+					EE_TEMPLATES.$current_theme,
225 225
 					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
226 226
 					EE_PLUGIN_DIR_PATH
227 227
 					);
228
-				$template_folder_paths = array_merge( $template_folder_paths, $core_paths );
228
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
229 229
 			}
230 230
 
231 231
 			// now filter that array
232
-			$template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths );
233
-			$templates = is_array( $templates ) ? $templates : array( $templates );
234
-			$template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths );
232
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
233
+			$templates = is_array($templates) ? $templates : array($templates);
234
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
235 235
 			// array to hold all possible template paths
236 236
 			$full_template_paths = array();
237 237
 
238 238
 			// loop through $templates
239
-			foreach ( $templates as $template ) {
239
+			foreach ($templates as $template) {
240 240
 				// normalize directory separators
241
-				$template = EEH_File::standardise_directory_separators( $template );
242
-				$file_name = basename( $template );
243
-				$template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) );
241
+				$template = EEH_File::standardise_directory_separators($template);
242
+				$file_name = basename($template);
243
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
244 244
 				// while looping through all template folder paths
245
-				foreach ( $template_folder_paths as $template_folder_path ) {
245
+				foreach ($template_folder_paths as $template_folder_path) {
246 246
 					// normalize directory separators
247
-					$template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path );
247
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
248 248
 					// determine if any common base path exists between the two paths
249 249
 					$common_base_path = EEH_Template::_find_common_base_path(
250
-						array( $template_folder_path, $template_path_minus_file_name )
250
+						array($template_folder_path, $template_path_minus_file_name)
251 251
 					);
252
-					if ( $common_base_path !== '' ) {
252
+					if ($common_base_path !== '') {
253 253
 						// both paths have a common base, so just tack the filename onto our search path
254
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name;
254
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
255 255
 					} else {
256 256
 						// no common base path, so let's just concatenate
257
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template;
257
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
258 258
 					}
259 259
 					// build up our template locations array by adding our resolved paths
260 260
 					$full_template_paths[] = $resolved_path;
261 261
 				}
262 262
 				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
263
-				array_unshift( $full_template_paths, $template );
263
+				array_unshift($full_template_paths, $template);
264 264
 				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
265
-				array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name );
265
+				array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name);
266 266
 			}
267 267
 			// filter final array of full template paths
268
-			$full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name );
268
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name);
269 269
 			// now loop through our final array of template location paths and check each location
270
-			foreach ( (array)$full_template_paths as $full_template_path ) {
271
-				if ( is_readable( $full_template_path )) {
272
-					$template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path );
270
+			foreach ((array) $full_template_paths as $full_template_path) {
271
+				if (is_readable($full_template_path)) {
272
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
273 273
 					// hook that can be used to display the full template path that will be used
274
-					do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path );
274
+					do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
275 275
 					break;
276 276
 				}
277 277
 			}
278 278
 		}
279 279
 		// if we got it and you want to see it...
280
-		if ( $template_path && $load && ! $check_if_custom  ) {
281
-			if ( $return_string ) {
282
-				return EEH_Template::display_template( $template_path, $template_args, TRUE );
280
+		if ($template_path && $load && ! $check_if_custom) {
281
+			if ($return_string) {
282
+				return EEH_Template::display_template($template_path, $template_args, TRUE);
283 283
 			} else {
284
-				EEH_Template::display_template( $template_path, $template_args, FALSE );
284
+				EEH_Template::display_template($template_path, $template_args, FALSE);
285 285
 			}
286 286
 		}
287
-		return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path;
287
+		return $check_if_custom && ! empty($template_path) ? TRUE : $template_path;
288 288
 	}
289 289
 
290 290
 
@@ -297,21 +297,21 @@  discard block
 block discarded – undo
297 297
 	 * @param array $paths
298 298
 	 * @return string
299 299
 	 */
300
-	protected static function _find_common_base_path( $paths ) {
300
+	protected static function _find_common_base_path($paths) {
301 301
 		$last_offset = 0;
302 302
 		$common_base_path = '';
303
-		while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) {
303
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
304 304
 			$dir_length = $index - $last_offset + 1;
305
-			$directory = substr( $paths[ 0 ], $last_offset, $dir_length );
306
-			foreach ( $paths as $path ) {
307
-				if ( substr( $path, $last_offset, $dir_length ) != $directory ) {
305
+			$directory = substr($paths[0], $last_offset, $dir_length);
306
+			foreach ($paths as $path) {
307
+				if (substr($path, $last_offset, $dir_length) != $directory) {
308 308
 					return $common_base_path;
309 309
 				}
310 310
 			}
311 311
 			$common_base_path .= $directory;
312 312
 			$last_offset = $index + 1;
313 313
 		}
314
-		return substr( $common_base_path, 0, -1 );
314
+		return substr($common_base_path, 0, -1);
315 315
 	}
316 316
 
317 317
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
324 324
 	 * @return mixed string
325 325
 	 */
326
-	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
326
+	public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) {
327 327
 
328 328
 		/**
329 329
 		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
@@ -334,26 +334,26 @@  discard block
 block discarded – undo
334 334
 		 *
335 335
 		 * @since 4.6.0
336 336
 		 */
337
-		$template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path );
338
-		$template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args );
337
+		$template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
338
+		$template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
339 339
 
340 340
 		// you gimme nuttin - YOU GET NUTTIN !!
341
-		if ( ! $template_path || ! is_readable( $template_path )) {
341
+		if ( ! $template_path || ! is_readable($template_path)) {
342 342
 			return '';
343 343
 		}
344 344
 		// if $template_args are not in an array, then make it so
345
-		if ( ! is_array( $template_args ) && ! is_object( $template_args )) {
346
-			$template_args = array( $template_args );
345
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
346
+			$template_args = array($template_args);
347 347
 		}
348
-		extract( (array) $template_args);
348
+		extract((array) $template_args);
349 349
 
350
-		if ( $return_string ) {
350
+		if ($return_string) {
351 351
 			// because we want to return a string, we are going to capture the output
352 352
 			ob_start();
353
-			include( $template_path );
353
+			include($template_path);
354 354
 			return ob_get_clean();
355 355
 		} else {
356
-			include( $template_path );
356
+			include($template_path);
357 357
 		}
358 358
 		return '';
359 359
 	}
@@ -371,27 +371,27 @@  discard block
 block discarded – undo
371 371
 	 * @param  string $suffix added to the end of the generated class
372 372
 	 * @return string
373 373
 	 */
374
-	public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
374
+	public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
375 375
 		// in the beginning...
376
-		$prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : '';
376
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
377 377
 		// da muddle
378 378
 		$class = '';
379 379
 		// the end
380
-		$suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : '';
380
+		$suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
381 381
 		// is the passed object an EE object ?
382
-		if ( $object instanceof EE_Base_Class ) {
382
+		if ($object instanceof EE_Base_Class) {
383 383
 			// grab the exact type of object
384
-			$obj_class = get_class( $object );
384
+			$obj_class = get_class($object);
385 385
 			// depending on the type of object...
386
-			switch ( $obj_class ) {
386
+			switch ($obj_class) {
387 387
 				// no specifics just yet...
388 388
 				default :
389
-					$class = strtolower( str_replace( '_', '-', $obj_class ));
390
-					$class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : '';
389
+					$class = strtolower(str_replace('_', '-', $obj_class));
390
+					$class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
391 391
 
392 392
 			}
393 393
 		}
394
-		return $prefix . $class . $suffix;
394
+		return $prefix.$class.$suffix;
395 395
 	}
396 396
 
397 397
 
@@ -407,54 +407,54 @@  discard block
 block discarded – undo
407 407
 	 * @param string      $cur_code_span_class
408 408
 	 * @return string        the html output for the formatted money value
409 409
 	 */
410
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) {
410
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') {
411 411
 		// ensure amount was received
412
-		if ( is_null( $amount ) ) {
413
-			$msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' );
414
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
412
+		if (is_null($amount)) {
413
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
414
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
415 415
 			return '';
416 416
 		}
417 417
 		//ensure amount is float
418
-		$amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount );
419
-		$CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount );
418
+		$amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
419
+		$CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
420 420
 		// filter raw amount (allows 0.00 to be changed to "free" for example)
421
-		$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw );
421
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
422 422
 		// still a number or was amount converted to a string like "free" ?
423
-		if ( is_float( $amount_formatted )) {
423
+		if (is_float($amount_formatted)) {
424 424
 			// was a country ISO code passed ? if so generate currency config object for that country
425
-			$mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL;
425
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL;
426 426
 			// verify results
427
-			if ( ! $mny instanceof EE_Currency_Config ) {
427
+			if ( ! $mny instanceof EE_Currency_Config) {
428 428
 				// set default config country currency settings
429 429
 				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
430 430
 			}
431 431
 			// format float
432
-			$amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds );
432
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
433 433
 			// add formatting ?
434
-			if ( ! $return_raw ) {
434
+			if ( ! $return_raw) {
435 435
 				// add currency sign
436
-				if( $mny->sign_b4 ){
437
-					if( $amount >= 0 ){
438
-						$amount_formatted = $mny->sign . $amount_formatted;
439
-					}else{
440
-						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
436
+				if ($mny->sign_b4) {
437
+					if ($amount >= 0) {
438
+						$amount_formatted = $mny->sign.$amount_formatted;
439
+					} else {
440
+						$amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
441 441
 					}
442 442
 
443
-				}else{
444
-					$amount_formatted =  $amount_formatted . $mny->sign;
443
+				} else {
444
+					$amount_formatted = $amount_formatted.$mny->sign;
445 445
 				}
446 446
 
447 447
 				// filter to allow global setting of display_code
448
-				$display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code );
448
+				$display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
449 449
 
450 450
 				// add currency code ?
451
-				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
451
+				$amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
452 452
 			}
453 453
 			// filter results
454
-			$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw );
454
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw);
455 455
 		}
456 456
 		// clean up vars
457
-		unset( $mny );
457
+		unset($mny);
458 458
 		// return formatted currency amount
459 459
 		return $amount_formatted;
460 460
 	}
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
470 470
 	 * @return string             The localized label for the status id.
471 471
 	 */
472
-	public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) {
472
+	public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') {
473 473
 		/** @type EEM_Status $EEM_Status */
474
-		$EEM_Status = EE_Registry::instance()->load_model( 'Status' );
475
-		$status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema );
476
-		return $status[ $status_id ];
474
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
475
+		$status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema);
476
+		return $status[$status_id];
477 477
 	}
478 478
 
479 479
 
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
 	 * @param string  $icon
487 487
 	 * @return string 	the html output for the button
488 488
 	 */
489
-	public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) {
490
-		$label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label;
491
-		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>';
489
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') {
490
+		$label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label;
491
+		$button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>';
492 492
 		return $button;
493 493
 	}
494 494
 
@@ -505,21 +505,21 @@  discard block
 block discarded – undo
505 505
 	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
506 506
 	 * @return string              generated link
507 507
 	 */
508
-	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
508
+	public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) {
509 509
 
510
-		if ( ! $page )
511
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
510
+		if ( ! $page)
511
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
512 512
 
513
-		if ( ! $action )
514
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
513
+		if ( ! $action)
514
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
515 515
 
516 516
 		$action = empty($action) ? 'default' : $action;
517 517
 
518 518
 
519
-		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
520
-		$icon = !$icon_style ? ' dashicons-editor-help' : $icon_style;
521
-		$help_text = !$help_text ? '' : $help_text;
522
-		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>';
519
+		$help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
520
+		$icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
521
+		$help_text = ! $help_text ? '' : $help_text;
522
+		return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>';
523 523
 	}
524 524
 
525 525
 
@@ -531,31 +531,31 @@  discard block
 block discarded – undo
531 531
 	 * @param EE_Help_Tour
532 532
 	 * @return string         html
533 533
 	 */
534
-	public static function help_tour_stops_generator( EE_Help_Tour $tour ) {
534
+	public static function help_tour_stops_generator(EE_Help_Tour $tour) {
535 535
 		$id = $tour->get_slug();
536 536
 		$stops = $tour->get_stops();
537 537
 
538
-		$content = '<ol style="display:none" id="' . $id . '">';
538
+		$content = '<ol style="display:none" id="'.$id.'">';
539 539
 
540
-		foreach ( $stops as $stop ) {
541
-			$data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : '';
542
-			$data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : '';
540
+		foreach ($stops as $stop) {
541
+			$data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
542
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
543 543
 
544 544
 			//if container is set to modal then let's make sure we set the options accordingly
545
-			if ( empty( $data_id ) && empty( $data_class ) ) {
545
+			if (empty($data_id) && empty($data_class)) {
546 546
 				$stop['options']['modal'] = true;
547 547
 				$stop['options']['expose'] = true;
548 548
 			}
549 549
 
550
-			$custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : '';
551
-			$button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : '';
550
+			$custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
551
+			$button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
552 552
 			$inner_content = isset($stop['content']) ? $stop['content'] : '';
553 553
 
554 554
 			//options
555
-			if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) {
555
+			if (isset($stop['options']) && is_array($stop['options'])) {
556 556
 				$options = ' data-options="';
557
-				foreach ( $stop['options'] as $option => $value ) {
558
-					$options .= $option . ':' . $value . ';';
557
+				foreach ($stop['options'] as $option => $value) {
558
+					$options .= $option.':'.$value.';';
559 559
 				}
560 560
 				$options .= '"';
561 561
 			} else {
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 			}
564 564
 
565 565
 			//let's put all together
566
-			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
566
+			$content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
567 567
 		}
568 568
 
569 569
 		$content .= '</ol>';
@@ -584,31 +584,31 @@  discard block
 block discarded – undo
584 584
 	 * @throws EE_Error
585 585
 	 * @return string               html structure for status.
586 586
 	 */
587
-	public static function status_legend( $status_array, $active_status = '' ) {
588
-		if ( !is_array( $status_array ) )
589
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
587
+	public static function status_legend($status_array, $active_status = '') {
588
+		if ( ! is_array($status_array))
589
+			throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso'));
590 590
 
591 591
 		$setup_array = array();
592
-		foreach ( $status_array as $item => $status ) {
592
+		foreach ($status_array as $item => $status) {
593 593
 			$setup_array[$item] = array(
594
-					'class' => 'ee-status-legend ee-status-legend-' . $status,
595
-					'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ),
594
+					'class' => 'ee-status-legend ee-status-legend-'.$status,
595
+					'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'),
596 596
 					'status' => $status
597 597
 				);
598 598
 		}
599 599
 
600
-		$content = '<div class="ee-list-table-legend-container">' . "\n";
601
-		$content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n";
602
-		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
603
-		foreach ( $setup_array as $item => $details ) {
600
+		$content = '<div class="ee-list-table-legend-container">'."\n";
601
+		$content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n";
602
+		$content .= '<dl class="ee-list-table-legend">'."\n\t";
603
+		foreach ($setup_array as $item => $details) {
604 604
 			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
605
-			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
606
-			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
607
-			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
608
-			$content .= '</dt>' . "\n";
605
+			$content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
606
+			$content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
607
+			$content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
608
+			$content .= '</dt>'."\n";
609 609
 		}
610
-		$content .= '</dl>' . "\n";
611
-		$content .= '</div>' . "\n";
610
+		$content .= '</dl>'."\n";
611
+		$content .= '</div>'."\n";
612 612
 		return $content;
613 613
 	}
614 614
 
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
 	 * @return string
622 622
 	 */
623 623
 	public static function layout_array_as_table($data) {
624
-	if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) {
625
-		$data = (array)$data;
624
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
625
+		$data = (array) $data;
626 626
 	}
627 627
 	ob_start();
628 628
 	if (is_array($data)) {
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 						?>
636 636
 						<tr>
637 637
 							<td>
638
-								<?php echo $data_key;?>
638
+								<?php echo $data_key; ?>
639 639
 							</td>
640 640
 							<td>
641
-								<?php echo self::layout_array_as_table($data_values);?>
641
+								<?php echo self::layout_array_as_table($data_values); ?>
642 642
 							</td>
643 643
 						</tr>
644 644
 						<?php
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 			<ul>
653 653
 				<?php
654 654
 				foreach ($data as $datum) {
655
-					echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>";
655
+					echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>";
656 656
 				}?>
657 657
 			</ul>
658 658
 			<?php
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 	 *
683 683
 	 * @return string
684 684
 	 */
685
-	public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
686
-		echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label );
685
+	public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
686
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label);
687 687
 	}
688 688
 
689 689
 
@@ -707,13 +707,13 @@  discard block
 block discarded – undo
707 707
 	 *                                 )
708 708
 	 * @return  string
709 709
 	 */
710
-	public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
710
+	public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
711 711
 		$page_links = array();
712 712
 		$disable_first = $disable_last = '';
713 713
 		$total_items = (int) $total_items;
714 714
 		$per_page = (int) $per_page;
715 715
 		$current = (int) $current;
716
-		$paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name );
716
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
717 717
 
718 718
 		//filter items_label
719 719
 		$items_label = apply_filters(
@@ -721,68 +721,68 @@  discard block
 block discarded – undo
721 721
 			$items_label
722 722
 		);
723 723
 
724
-		if ( empty( $items_label )
725
-		     || ! is_array( $items_label )
726
-		     || ! isset( $items_label['single'] )
727
-		     || ! isset( $items_label['plural'] ) ) {
724
+		if (empty($items_label)
725
+		     || ! is_array($items_label)
726
+		     || ! isset($items_label['single'])
727
+		     || ! isset($items_label['plural'])) {
728 728
 			$items_label = array(
729
-				'single' => __( '1 item', 'event_espresso' ),
730
-				'plural' => __( '%s items', 'event_espresso' )
729
+				'single' => __('1 item', 'event_espresso'),
730
+				'plural' => __('%s items', 'event_espresso')
731 731
 			);
732 732
 		} else {
733 733
 			$items_label = array(
734
-				'single' => '1 ' . esc_html( $items_label['single'] ),
735
-				'plural' => '%s ' . esc_html( $items_label['plural'] )
734
+				'single' => '1 '.esc_html($items_label['single']),
735
+				'plural' => '%s '.esc_html($items_label['plural'])
736 736
 			);
737 737
 		}
738 738
 
739
-		$total_pages = ceil( $total_items / $per_page );
739
+		$total_pages = ceil($total_items / $per_page);
740 740
 
741
-		if ( $total_pages <= 1 )
741
+		if ($total_pages <= 1)
742 742
 			return '';
743 743
 
744
-		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
744
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
745 745
 
746
-		$output = '<span class="displaying-num">' . $item_label . '</span>';
746
+		$output = '<span class="displaying-num">'.$item_label.'</span>';
747 747
 
748
-		if ( $current === 1 ) {
748
+		if ($current === 1) {
749 749
 			$disable_first = ' disabled';
750 750
 		}
751
-		if ( $current == $total_pages ) {
751
+		if ($current == $total_pages) {
752 752
 			$disable_last = ' disabled';
753 753
 		}
754 754
 
755
-		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
756
-			'first-page' . $disable_first,
757
-			esc_attr__( 'Go to the first page' ),
758
-			esc_url( remove_query_arg( $paged_arg_name, $url ) ),
755
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
756
+			'first-page'.$disable_first,
757
+			esc_attr__('Go to the first page'),
758
+			esc_url(remove_query_arg($paged_arg_name, $url)),
759 759
 			'&laquo;'
760 760
 		);
761 761
 
762 762
 		$page_links[] = sprintf(
763 763
 			'<a class="%s" title="%s" href="%s">%s</a>',
764
-			'prev-page' . $disable_first,
765
-			esc_attr__( 'Go to the previous page' ),
766
-			esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ),
764
+			'prev-page'.$disable_first,
765
+			esc_attr__('Go to the previous page'),
766
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
767 767
 			'&lsaquo;'
768 768
 		);
769 769
 
770
-		if ( ! $show_num_field ) {
770
+		if ( ! $show_num_field) {
771 771
 			$html_current_page = $current;
772 772
 		} else {
773
-			$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
774
-				esc_attr__( 'Current page' ),
773
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
774
+				esc_attr__('Current page'),
775 775
 				$current,
776
-				strlen( $total_pages )
776
+				strlen($total_pages)
777 777
 			);
778 778
 		}
779 779
 
780 780
 		$html_total_pages = sprintf(
781 781
 			'<span class="total-pages">%s</span>',
782
-			number_format_i18n( $total_pages )
782
+			number_format_i18n($total_pages)
783 783
 		);
784 784
 		$page_links[] = sprintf(
785
-			_x( '%3$s%1$s of %2$s%4$s', 'paging' ),
785
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
786 786
 			$html_current_page,
787 787
 			$html_total_pages,
788 788
 			'<span class="paging-input">',
@@ -791,29 +791,29 @@  discard block
 block discarded – undo
791 791
 
792 792
 		$page_links[] = sprintf(
793 793
 			'<a class="%s" title="%s" href="%s">%s</a>',
794
-			'next-page' . $disable_last,
795
-			esc_attr__( 'Go to the next page' ),
796
-			esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ),
794
+			'next-page'.$disable_last,
795
+			esc_attr__('Go to the next page'),
796
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
797 797
 			'&rsaquo;'
798 798
 		);
799 799
 
800 800
 		$page_links[] = sprintf(
801 801
 			'<a class="%s" title="%s" href="%s">%s</a>',
802
-			'last-page' . $disable_last,
803
-			esc_attr__( 'Go to the last page' ),
804
-			esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ),
802
+			'last-page'.$disable_last,
803
+			esc_attr__('Go to the last page'),
804
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
805 805
 			'&raquo;'
806 806
 		);
807 807
 
808
-		$output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>';
808
+		$output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
809 809
 		// set page class
810
-		if ( $total_pages ) {
810
+		if ($total_pages) {
811 811
 			$page_class = $total_pages < 2 ? ' one-page' : '';
812 812
 		} else {
813 813
 			$page_class = ' no-pages';
814 814
 		}
815 815
 
816
-		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
816
+		return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
817 817
 	}
818 818
 
819 819
 
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 );
830 830
 
831 831
 
832
-if ( ! function_exists( 'espresso_pagination' ) ) {
832
+if ( ! function_exists('espresso_pagination')) {
833 833
 	/**
834 834
 	 *    espresso_pagination
835 835
 	 *
@@ -841,21 +841,21 @@  discard block
 block discarded – undo
841 841
 		$big = 999999999; // need an unlikely integer
842 842
 		$pagination = paginate_links(
843 843
 		array(
844
-		'base'         => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
844
+		'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
845 845
 		'format'       => '?paged=%#%',
846
-		'current'      => max( 1, get_query_var( 'paged' ) ),
846
+		'current'      => max(1, get_query_var('paged')),
847 847
 		'total'        => $wp_query->max_num_pages,
848 848
 		'show_all'     => true,
849 849
 		'end_size'     => 10,
850 850
 		'mid_size'     => 6,
851 851
 		'prev_next'    => true,
852
-		'prev_text'    => __( '&lsaquo; PREV', 'event_espresso' ),
853
-		'next_text'    => __( 'NEXT &rsaquo;', 'event_espresso' ),
852
+		'prev_text'    => __('&lsaquo; PREV', 'event_espresso'),
853
+		'next_text'    => __('NEXT &rsaquo;', 'event_espresso'),
854 854
 		'type'         => 'plain',
855 855
 		'add_args'     => false,
856 856
 		'add_fragment' => ''
857 857
 		)
858 858
 		);
859
-		echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : '';
859
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : '';
860 860
 	}
861 861
 }
862 862
\ No newline at end of file
Please login to merge, or discard this patch.
core/interfaces/EEI_Collection.interface.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param mixed  $info
26 26
 	 * @return bool
27 27
 	 */
28
-	public function add( $object, $info = null );
28
+	public function add($object, $info = null);
29 29
 
30 30
 
31 31
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param mixed  $info
40 40
 	 * @return bool
41 41
 	 */
42
-	public function set_info( $object, $info = null );
42
+	public function set_info($object, $info = null);
43 43
 
44 44
 
45 45
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @param mixed
53 53
 	 * @return null | object
54 54
 	 */
55
-	public function get_by_info( $info );
55
+	public function get_by_info($info);
56 56
 
57 57
 
58 58
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param object $object
66 66
 	 * @return bool
67 67
 	 */
68
-	public function has( $object );
68
+	public function has($object);
69 69
 
70 70
 
71 71
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @param $object
79 79
 	 * @return void
80 80
 	 */
81
-	public function remove( $object );
81
+	public function remove($object);
82 82
 
83 83
 
84 84
 
Please login to merge, or discard this patch.