Completed
Branch BUG-8372-txn-meta-box-errors (d9e527)
by
unknown
33:55 queued 16:24
created
core/db_models/fields/EE_DB_Only_Field_Base.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * special default values for them, or some other column-specific functionality. So we can add them as fields,
8 8
  * but db-only ones
9 9
  */
10
-abstract class EE_DB_Only_Field_Base extends EE_Model_Field_Base{
10
+abstract class EE_DB_Only_Field_Base extends EE_Model_Field_Base {
11 11
 	/**
12 12
 	 * All these children classes are for the db-only (meaning, we should select them
13 13
 	 * on get_all queries, update, delete, and will still want to set their default value
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Float_Field.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php');
3
-class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base{
4
-	function get_wpdb_data_type(){
2
+require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php');
3
+class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base {
4
+	function get_wpdb_data_type() {
5 5
 		return '%f';
6 6
 	}
7 7
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Int_Field.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php');
4
-class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base{
5
-	function get_wpdb_data_type(){
3
+require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php');
4
+class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base {
5
+	function get_wpdb_data_type() {
6 6
 		return '%d';
7 7
 	}
8 8
 }
9 9
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Text_Field.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php');
3
-class EE_DB_Only_Text_Field extends EE_DB_Only_Field_Base{
4
-	function get_wpdb_data_type(){
2
+require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php');
3
+class EE_DB_Only_Text_Field extends EE_DB_Only_Field_Base {
4
+	function get_wpdb_data_type() {
5 5
 		return '%s';
6 6
 	}
7 7
 }
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Datetime_Field.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@
 block discarded – undo
459 459
 				//must be explicit because schema could equal true.
460 460
 				if( $schema === 'no_html' ){
461 461
 					$timezone_string = ' (' . $DateTime->format( 'T' )  . ')';
462
-				}else{
462
+				} else{
463 463
 					$timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format( 'T' ) . ')</span>';
464 464
 				}
465 465
 			} else {
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_Datetime_Field
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 	 * @param string 	$pretty_date_format
112 112
 	 * @param string 	$pretty_time_format
113 113
 	 */
114
-	public function __construct( $table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '' ){
114
+	public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '') {
115 115
 
116
-		$this->_date_format = ! empty( $date_format ) ? $date_format : get_option('date_format');
117
-		$this->_time_format = ! empty( $time_format ) ? $time_format : get_option('time_format');
118
-		$this->_pretty_date_format = ! empty( $pretty_date_format ) ? $pretty_date_format : get_option('date_format');
119
-		$this->_pretty_time_format = ! empty( $pretty_time_format ) ? $pretty_time_format : get_option('time_format');
116
+		$this->_date_format = ! empty($date_format) ? $date_format : get_option('date_format');
117
+		$this->_time_format = ! empty($time_format) ? $time_format : get_option('time_format');
118
+		$this->_pretty_date_format = ! empty($pretty_date_format) ? $pretty_date_format : get_option('date_format');
119
+		$this->_pretty_time_format = ! empty($pretty_time_format) ? $pretty_time_format : get_option('time_format');
120 120
 
121
-		parent::__construct( $table_column, $nice_name, $nullable, $default_value );
122
-		$this->set_timezone( $timezone_string );
121
+		parent::__construct($table_column, $nice_name, $nullable, $default_value);
122
+		$this->set_timezone($timezone_string);
123 123
 
124 124
 	}
125 125
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return DateTimeZone
139 139
 	 */
140 140
 	public function get_UTC_DateTimeZone() {
141
-		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string( 'UTC' );
141
+		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string('UTC');
142 142
 	}
143 143
 
144 144
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return DateTimeZone
148 148
 	 */
149 149
 	public function get_blog_DateTimeZone() {
150
-		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string( '' );
150
+		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string('');
151 151
 	}
152 152
 
153 153
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 * @param  string|int $value_inputted_for_field_on_model_object could be a string formatted date time or int unix timestamp
158 158
 	 * @return DateTime
159 159
 	 */
160
-	public function prepare_for_set( $value_inputted_for_field_on_model_object ) {
161
-		return $this->_get_date_object( $value_inputted_for_field_on_model_object );
160
+	public function prepare_for_set($value_inputted_for_field_on_model_object) {
161
+		return $this->_get_date_object($value_inputted_for_field_on_model_object);
162 162
 	}
163 163
 
164 164
 
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	 * @param bool $pretty If we're returning the pretty formats or standard format string.
175 175
 	 * @return string    The final assembled format string.
176 176
 	 */
177
-	protected function _get_date_time_output( $pretty = FALSE ) {
177
+	protected function _get_date_time_output($pretty = FALSE) {
178 178
 
179
-		switch ( $this->_date_time_output ) {
179
+		switch ($this->_date_time_output) {
180 180
 			case 'time' :
181 181
 				return $pretty ? $this->_pretty_time_format : $this->_time_format;
182 182
 				break;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 				break;
187 187
 
188 188
 			default :
189
-				return $pretty ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format : $this->_date_format . ' ' . $this->_time_format;
189
+				return $pretty ? $this->_pretty_date_format.' '.$this->_pretty_time_format : $this->_date_format.' '.$this->_time_format;
190 190
 		}
191 191
 	}
192 192
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param string $what acceptable values are 'time' or 'date'.  Any other value will be set but will always result in both 'date' and 'time' being returned.
201 201
 	 * @return void
202 202
 	 */
203
-	public function set_date_time_output( $what = NULL ) {
203
+	public function set_date_time_output($what = NULL) {
204 204
 		$this->_date_time_output = $what;
205 205
 	}
206 206
 
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 	 * @param string $timezone_string A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php
217 217
 	 * @return void
218 218
 	 */
219
-	public function set_timezone( $timezone_string ) {
220
-		if( empty( $timezone_string ) && $this->_timezone_string != NULL ){
219
+	public function set_timezone($timezone_string) {
220
+		if (empty($timezone_string) && $this->_timezone_string != NULL) {
221 221
 			// leave the timezone AS-IS if we already have one and
222 222
 			// the function arg didn't provide one
223 223
 			return;
224 224
 		}
225
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
226
-		$this->_timezone_string = ! empty( $timezone_string ) ? $timezone_string : 'UTC';
227
-		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string( $this->_timezone_string );
225
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
226
+		$this->_timezone_string = ! empty($timezone_string) ? $timezone_string : 'UTC';
227
+		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string($this->_timezone_string);
228 228
 	}
229 229
 
230 230
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	 * @param string $timezone_string
237 237
 	 * @return \DateTimeZone
238 238
 	 */
239
-	protected function _create_timezone_object_from_timezone_string( $timezone_string = '' ) {
240
-		return new DateTimeZone( EEH_DTT_Helper::get_valid_timezone_string( $timezone_string ) );
239
+	protected function _create_timezone_object_from_timezone_string($timezone_string = '') {
240
+		return new DateTimeZone(EEH_DTT_Helper::get_valid_timezone_string($timezone_string));
241 241
 	}
242 242
 
243 243
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @param bool   $pretty Whether to set pretty format or not.
263 263
 	 * @return void
264 264
 	 */
265
-	public function set_date_format( $format, $pretty = false ) {
266
-		if ( $pretty ) {
265
+	public function set_date_format($format, $pretty = false) {
266
+		if ($pretty) {
267 267
 			$this->_pretty_date_format = $format;
268 268
 		} else {
269 269
 			$this->_date_format = $format;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @param bool   $pretty Whether to get pretty format or not.
279 279
 	 * @return string
280 280
 	 */
281
-	public function get_date_format( $pretty = false ) {
281
+	public function get_date_format($pretty = false) {
282 282
 		return $pretty ? $this->_pretty_date_format : $this->_date_format;
283 283
 	}
284 284
 
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	 * @param bool   $pretty Whether to set pretty format or not.
294 294
 	 * @return void
295 295
 	 */
296
-	public function set_time_format( $format, $pretty = false ) {
297
-		if ( $pretty ) {
296
+	public function set_time_format($format, $pretty = false) {
297
+		if ($pretty) {
298 298
 			$this->_pretty_time_format = $format;
299 299
 		} else {
300 300
 			$this->_time_format = $format;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @param bool   $pretty Whether to get pretty format or not.
310 310
 	 * @return string
311 311
 	 */
312
-	public function get_time_format( $pretty = false ) {
312
+	public function get_time_format($pretty = false) {
313 313
 		return $pretty ? $this->_pretty_time_format : $this->_time_format;
314 314
 	}
315 315
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function)
325 325
 	 * @return void
326 326
 	 */
327
-	public function set_pretty_date_format( $format ) {
327
+	public function set_pretty_date_format($format) {
328 328
 		$this->_pretty_date_format = $format;
329 329
 	}
330 330
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function)
342 342
 	 * @return void
343 343
 	 */
344
-	public function set_pretty_time_format( $format ) {
344
+	public function set_pretty_time_format($format) {
345 345
 		$this->_pretty_time_format = $format;
346 346
 	}
347 347
 
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 	 * @param DateTime    $current current DateTime object for the datetime field
354 354
 	 * @return DateTime
355 355
 	 */
356
-	public function prepare_for_set_with_new_time( $time_to_set_string, DateTime $current ){
356
+	public function prepare_for_set_with_new_time($time_to_set_string, DateTime $current) {
357 357
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
358
-		if ( $time_to_set_string instanceof DateTime ) {
358
+		if ($time_to_set_string instanceof DateTime) {
359 359
 			$parsed = array(
360 360
 				'hour' => $time_to_set_string->format('H'),
361 361
 				'minute' => $time_to_set_string->format('i'),
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 				);
364 364
 		} else {
365 365
 			//parse incoming string
366
-			$parsed = date_parse_from_format( $this->_time_format, $time_to_set_string );
366
+			$parsed = date_parse_from_format($this->_time_format, $time_to_set_string);
367 367
 		}
368 368
 
369 369
 		//make sure $current is in the correct timezone.
370
-		$current->setTimezone( $this->_DateTimeZone );
371
-		return $current->setTime( $parsed['hour'], $parsed['minute'], $parsed['second'] );
370
+		$current->setTimezone($this->_DateTimeZone);
371
+		return $current->setTime($parsed['hour'], $parsed['minute'], $parsed['second']);
372 372
 	}
373 373
 
374 374
 
@@ -379,9 +379,9 @@  discard block
 block discarded – undo
379 379
 	 * @param DateTime    $current current DateTime object for the datetime field
380 380
 	 * @return DateTime
381 381
 	 */
382
-	public function prepare_for_set_with_new_date( $date_to_set_string, DateTime $current ){
382
+	public function prepare_for_set_with_new_date($date_to_set_string, DateTime $current) {
383 383
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
384
-		if ( $date_to_set_string instanceof DateTime ) {
384
+		if ($date_to_set_string instanceof DateTime) {
385 385
 			$parsed = array(
386 386
 				'year' => $date_to_set_string->format('Y'),
387 387
 				'month' => $date_to_set_string->format('m'),
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 				);
390 390
 		} else {
391 391
 			//parse incoming string
392
-			$parsed = date_parse_from_format( $this->_date_format, $date_to_set_string );
392
+			$parsed = date_parse_from_format($this->_date_format, $date_to_set_string);
393 393
 		}
394 394
 
395 395
 		//make sure $current is in the correct timezone
396
-		$current->setTimezone( $this->_DateTimeZone );
397
-		return $current->setDate( $parsed['year'], $parsed['month'], $parsed['day'] );
396
+		$current->setTimezone($this->_DateTimeZone);
397
+		return $current->setDate($parsed['year'], $parsed['month'], $parsed['day']);
398 398
 	}
399 399
 
400 400
 
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 	 * @param  DateTime $DateTime
407 407
 	 * @return string formatted date time for given timezone
408 408
 	 */
409
-	public function prepare_for_get( $DateTime ) {
410
-		return $this->_prepare_for_display( $DateTime  );
409
+	public function prepare_for_get($DateTime) {
410
+		return $this->_prepare_for_display($DateTime);
411 411
 	}
412 412
 
413 413
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	 * @param null     $schema
423 423
 	 * @return string
424 424
 	 */
425
-	public function prepare_for_pretty_echoing( $DateTime, $schema = null ) {
426
-		return $this->_prepare_for_display( $DateTime, $schema ? $schema : true );
425
+	public function prepare_for_pretty_echoing($DateTime, $schema = null) {
426
+		return $this->_prepare_for_display($DateTime, $schema ? $schema : true);
427 427
 	}
428 428
 
429 429
 
@@ -437,36 +437,36 @@  discard block
 block discarded – undo
437 437
 	 * @return string
438 438
 	 * @throws \EE_Error
439 439
 	 */
440
-	protected function _prepare_for_display( $DateTime, $schema = false ) {
441
-		if ( ! $DateTime instanceof DateTime  ) {
442
-			if ( $this->_nullable ) {
440
+	protected function _prepare_for_display($DateTime, $schema = false) {
441
+		if ( ! $DateTime instanceof DateTime) {
442
+			if ($this->_nullable) {
443 443
 				return '';
444 444
 			} else {
445
-				if ( WP_DEBUG ) {
446
-					throw new EE_Error( sprintf( __('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.', 'event_espresso' ), $this->_nicename ) );
445
+				if (WP_DEBUG) {
446
+					throw new EE_Error(sprintf(__('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.', 'event_espresso'), $this->_nicename));
447 447
 				} else {
448
-					$DateTime = new DateTime( "now" );
449
-					EE_Error::add_error( sprintf( __('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.', 'event_espresso' ), $this->_nicename ) );
448
+					$DateTime = new DateTime("now");
449
+					EE_Error::add_error(sprintf(__('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.', 'event_espresso'), $this->_nicename));
450 450
 				}
451 451
 			}
452 452
 		}
453
-		$format_string = $this->_get_date_time_output( $schema );
453
+		$format_string = $this->_get_date_time_output($schema);
454 454
 		//make sure datetime_value is in the correct timezone (in case that's been updated).
455
-		$DateTime->setTimezone( $this->_DateTimeZone );
456
-		if ( $schema ) {
457
-			if( $this->_display_timezone() ) {
455
+		$DateTime->setTimezone($this->_DateTimeZone);
456
+		if ($schema) {
457
+			if ($this->_display_timezone()) {
458 458
 				//must be explicit because schema could equal true.
459
-				if( $schema === 'no_html' ){
460
-					$timezone_string = ' (' . $DateTime->format( 'T' )  . ')';
461
-				}else{
462
-					$timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format( 'T' ) . ')</span>';
459
+				if ($schema === 'no_html') {
460
+					$timezone_string = ' ('.$DateTime->format('T').')';
461
+				} else {
462
+					$timezone_string = ' <span class="ee_dtt_timezone_string">('.$DateTime->format('T').')</span>';
463 463
 				}
464 464
 			} else {
465 465
 				$timezone_string = '';
466 466
 			}
467
-			return $DateTime->format( $format_string ) . $timezone_string;
467
+			return $DateTime->format($format_string).$timezone_string;
468 468
 		} else {
469
-			return $DateTime->format( $format_string );
469
+			return $DateTime->format($format_string);
470 470
 		}
471 471
 	}
472 472
 
@@ -480,18 +480,18 @@  discard block
 block discarded – undo
480 480
 	 * @return string mysql timestamp in UTC
481 481
 	 * @throws \EE_Error
482 482
 	 */
483
-	public function prepare_for_use_in_db( $datetime_value ) {
483
+	public function prepare_for_use_in_db($datetime_value) {
484 484
 		//we allow an empty value or DateTime object, but nothing else.
485
-		if ( ! empty( $datetime_value ) && ! $datetime_value instanceof DateTime ) {
486
-			throw new EE_Error( __('The incoming value being prepared for setting in the database must either be empty or a php DateTime object', 'event_espresso' ) );
485
+		if ( ! empty($datetime_value) && ! $datetime_value instanceof DateTime) {
486
+			throw new EE_Error(__('The incoming value being prepared for setting in the database must either be empty or a php DateTime object', 'event_espresso'));
487 487
 		}
488 488
 
489
-		if ( $datetime_value instanceof DateTime ) {
490
-			return $datetime_value->setTimezone( $this->get_UTC_DateTimeZone() )->format( EE_Datetime_Field::mysql_timestamp_format );
489
+		if ($datetime_value instanceof DateTime) {
490
+			return $datetime_value->setTimezone($this->get_UTC_DateTimeZone())->format(EE_Datetime_Field::mysql_timestamp_format);
491 491
 		}
492 492
 
493 493
 		// if $datetime_value is empty, and ! $this->_nullable, use current_time() but set the GMT flag to true
494
-		return ! $this->_nullable && empty( $datetime_value ) ? current_time( 'mysql', true ) : null;
494
+		return ! $this->_nullable && empty($datetime_value) ? current_time('mysql', true) : null;
495 495
 	}
496 496
 
497 497
 
@@ -504,20 +504,20 @@  discard block
 block discarded – undo
504 504
 	 * @param string $datetime_string mysql timestamp in UTC
505 505
 	 * @return  mixed null | DateTime
506 506
 	 */
507
-	public function prepare_for_set_from_db( $datetime_string ) {
507
+	public function prepare_for_set_from_db($datetime_string) {
508 508
 		//if $datetime_value is empty, and ! $this->_nullable, just use time()
509
-		if ( empty( $datetime_string) && $this->_nullable ) {
509
+		if (empty($datetime_string) && $this->_nullable) {
510 510
 			return null;
511 511
 		}
512 512
 		// datetime strings from the db should ALWAYS be in UTC+0, so use UTC_DateTimeZone when creating
513
-		$DateTime = empty( $datetime_string ) ? new DateTime( 'now', $this->get_UTC_DateTimeZone() ) : DateTime::createFromFormat( EE_Datetime_Field::mysql_timestamp_format, $datetime_string, $this->get_UTC_DateTimeZone() );
513
+		$DateTime = empty($datetime_string) ? new DateTime('now', $this->get_UTC_DateTimeZone()) : DateTime::createFromFormat(EE_Datetime_Field::mysql_timestamp_format, $datetime_string, $this->get_UTC_DateTimeZone());
514 514
 
515
-		if ( ! $DateTime instanceof DateTime ) {
515
+		if ( ! $DateTime instanceof DateTime) {
516 516
 			//if still no datetime object, then let's just use now
517
-			$DateTime = new DateTime( 'now', $this->get_UTC_DateTimeZone() );
517
+			$DateTime = new DateTime('now', $this->get_UTC_DateTimeZone());
518 518
 		}
519 519
 		// THEN apply the field's set DateTimeZone
520
-		$DateTime->setTimezone( $this->_DateTimeZone );
520
+		$DateTime->setTimezone($this->_DateTimeZone);
521 521
 		return $DateTime;
522 522
 	}
523 523
 
@@ -534,15 +534,15 @@  discard block
 block discarded – undo
534 534
 	protected function _display_timezone() {
535 535
 
536 536
 		// first let's do a comparison of timezone strings.  If they match then we can get out without any further calculations
537
-		$blog_string = get_option( 'timezone_string' );
538
-		if ( $blog_string == $this->_timezone_string ) {
537
+		$blog_string = get_option('timezone_string');
538
+		if ($blog_string == $this->_timezone_string) {
539 539
 			return FALSE;
540 540
 		}
541 541
 		// now we need to calc the offset for the timezone string so we can compare with the blog offset.
542
-		$this_offset = $this->get_timezone_offset( $this->_DateTimeZone );
543
-		$blog_offset = $this->get_timezone_offset( $this->get_blog_DateTimeZone() );
542
+		$this_offset = $this->get_timezone_offset($this->_DateTimeZone);
543
+		$blog_offset = $this->get_timezone_offset($this->get_blog_DateTimeZone());
544 544
 		// now compare
545
-		if ( $blog_offset === $this_offset ) {
545
+		if ($blog_offset === $this_offset) {
546 546
 			return FALSE;
547 547
 		}
548 548
 		return TRUE;
@@ -560,24 +560,24 @@  discard block
 block discarded – undo
560 560
 	 *
561 561
 	 * @return DateTime
562 562
 	 */
563
-	protected function _get_date_object( $date_string ) {
563
+	protected function _get_date_object($date_string) {
564 564
 		//first if this is an empty date_string and nullable is allowed, just return null.
565
-		if ( $this->_nullable && empty( $date_string ) ) {
565
+		if ($this->_nullable && empty($date_string)) {
566 566
 			return null;
567 567
 		}
568 568
 
569 569
 		// if incoming date
570
-		if ( $date_string instanceof DateTime ) {
571
-			$date_string->setTimezone( $this->_DateTimeZone );
570
+		if ($date_string instanceof DateTime) {
571
+			$date_string->setTimezone($this->_DateTimeZone);
572 572
 			return $date_string;
573 573
 		}
574 574
 		// if empty date_string and made it here.
575 575
 		// Return a datetime object for now in the given timezone.
576
-		if ( empty( $date_string ) ) {
577
-			return new DateTime( "now", $this->_DateTimeZone );
576
+		if (empty($date_string)) {
577
+			return new DateTime("now", $this->_DateTimeZone);
578 578
 		}
579 579
 		// if $date_string is matches something that looks like a Unix timestamp let's just use it.
580
-		if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $date_string ) ) {
580
+		if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $date_string)) {
581 581
 			try {
582 582
 				/**
583 583
 				 * This is operating under the assumption that the incoming Unix timestamp is
@@ -585,29 +585,29 @@  discard block
 block discarded – undo
585 585
 				 * current_time('timestamp');
586 586
 				 *
587 587
 				 */
588
-				$DateTime = new DateTime( "now", $this->_DateTimeZone );
589
-				return $DateTime->setTimestamp( $date_string );
590
-			 } catch ( Exception $e )  {
588
+				$DateTime = new DateTime("now", $this->_DateTimeZone);
589
+				return $DateTime->setTimestamp($date_string);
590
+			 } catch (Exception $e) {
591 591
 			 	// should be rare, but if things got fooled then let's just continue
592 592
 			 }
593 593
 		}
594 594
 		//not a unix timestamp.  So we will use the set format on this object and set timezone to
595 595
 		//create the DateTime object.
596
-		$format = $this->_date_format . ' ' . $this->_time_format;
596
+		$format = $this->_date_format.' '.$this->_time_format;
597 597
 		try {
598
-			$DateTime = DateTime::createFromFormat( $format, $date_string, $this->_DateTimeZone );
599
-			if ( ! $DateTime instanceof DateTime ) {
598
+			$DateTime = DateTime::createFromFormat($format, $date_string, $this->_DateTimeZone);
599
+			if ( ! $DateTime instanceof DateTime) {
600 600
 				throw new EE_Error(
601 601
 					sprintf(
602
-						__( '"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso' ),
602
+						__('"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso'),
603 603
 						$date_string,
604 604
 						$format
605 605
 					)
606 606
 				);
607 607
 			}
608
-		} catch ( Exception $e ) {
608
+		} catch (Exception $e) {
609 609
 			// if we made it here then likely then something went really wrong.  Instead of throwing an exception, let's just return a DateTime object for now, in the set timezone.
610
-			$DateTime = new DateTime( "now", $this->_DateTimeZone );
610
+			$DateTime = new DateTime("now", $this->_DateTimeZone);
611 611
 		}
612 612
 		return $DateTime;
613 613
 	}
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 	 * @param null          $time
622 622
 	 * @return mixed
623 623
 	 */
624
-	public function get_timezone_offset( DateTimeZone $DateTimeZone, $time = null ) {
625
-		$time = preg_match( EE_Datetime_Field::unix_timestamp_regex, $time ) ? $time : time();
626
-		$transitions = $DateTimeZone->getTransitions( $time );
624
+	public function get_timezone_offset(DateTimeZone $DateTimeZone, $time = null) {
625
+		$time = preg_match(EE_Datetime_Field::unix_timestamp_regex, $time) ? $time : time();
626
+		$transitions = $DateTimeZone->getTransitions($time);
627 627
 		return $transitions[0]['offset'];
628 628
 	}
629 629
 
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 	 * @param  string $timezone_string
636 636
 	 * @return string           abbreviation
637 637
 	 */
638
-	public function get_timezone_abbrev( $timezone_string ) {
639
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
640
-		$dateTime = new DateTime( 'now', new DateTimeZone( $timezone_string ) );
641
-		return $dateTime->format( 'T' );
638
+	public function get_timezone_abbrev($timezone_string) {
639
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
640
+		$dateTime = new DateTime('now', new DateTimeZone($timezone_string));
641
+		return $dateTime->format('T');
642 642
 	}
643 643
 
644 644
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 * This prepares the datetime for internal usage as a PHP DateTime object OR null (if nullable is
503 503
 	 * allowed)
504 504
 	 * @param string $datetime_string mysql timestamp in UTC
505
-	 * @return  mixed null | DateTime
505
+	 * @return  null|DateTime null | DateTime
506 506
 	 */
507 507
 	public function prepare_for_set_from_db( $datetime_string ) {
508 508
 		//if $datetime_value is empty, and ! $this->_nullable, just use time()
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	 *
620 620
 	 * @param \DateTimeZone $DateTimeZone
621 621
 	 * @param null          $time
622
-	 * @return mixed
622
+	 * @return string
623 623
 	 */
624 624
 	public function get_timezone_offset( DateTimeZone $DateTimeZone, $time = null ) {
625 625
 		$time = preg_match( EE_Datetime_Field::unix_timestamp_regex, $time ) ? $time : time();
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Integer_Field.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once( EE_MODELS . 'fields/EE_Integer_Field.php' );
2
+require_once(EE_MODELS.'fields/EE_Integer_Field.php');
3 3
 /**
4 4
  * Class EE_Enum_Integer_Field
5 5
  *
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @author				Mike Nelson
9 9
  *
10 10
  */
11
-class EE_Enum_Integer_Field extends EE_Integer_Field{
11
+class EE_Enum_Integer_Field extends EE_Integer_Field {
12 12
 
13 13
 	var $_allowed_enum_values;
14 14
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param int $default_value
21 21
 	 * @param array $allowed_enum_values  keys are values to be used in the DB, values are how they should be displayed
22 22
 	 */
23
-	function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values){
23
+	function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values) {
24 24
 		$this->_allowed_enum_values = $allowed_enum_values;
25 25
 		parent::__construct($table_column, $nicename, $nullable, $default_value);
26 26
 	}
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 	 * @throws EE_Error
33 33
 	 */
34 34
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
35
-		if( $value_inputted_for_field_on_model_object !== NULL && ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values )){
36
-			if( defined( 'WP_DEBUG' ) && WP_DEBUG ){
35
+		if ($value_inputted_for_field_on_model_object !== NULL && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)) {
36
+			if (defined('WP_DEBUG') && WP_DEBUG) {
37 37
 				$msg = sprintf(
38
-					__('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'),
38
+					__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
39 39
 					$value_inputted_for_field_on_model_object,
40 40
 					$this->_name
41 41
 				);
42 42
 				$msg2 = sprintf(
43
-					__('Allowed values for "%1$s" are "%2$s". You provided "%3$s"','event_espresso'),
43
+					__('Allowed values for "%1$s" are "%2$s". You provided "%3$s"', 'event_espresso'),
44 44
 					$this->_name,
45
-					implode( ', ', array_keys( $this->_allowed_enum_values )),
45
+					implode(', ', array_keys($this->_allowed_enum_values)),
46 46
 					$value_inputted_for_field_on_model_object
47 47
 				);
48
-				 EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__ );
48
+				 EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__);
49 49
 			}
50 50
 			return $this->get_default_value();
51 51
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @param null         $schema
63 63
 	 * @return string
64 64
 	 */
65
-	function prepare_for_pretty_echoing( $value_on_field_to_be_outputted, $schema = NULL ) {
65
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = NULL) {
66 66
 		return $this->_allowed_enum_values[$value_on_field_to_be_outputted];
67 67
 	}
68 68
 }
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/db_models/fields/EE_Float_Field.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Text_Fields is a base class for any fields which are have float value. (Exception: foreign and private key fields. Wish PHP had multiple-inheritance for this...)
4 4
  */
5
-class EE_Float_Field extends EE_Model_Field_Base{
6
-	function get_wpdb_data_type(){
5
+class EE_Float_Field extends EE_Model_Field_Base {
6
+	function get_wpdb_data_type() {
7 7
 		return '%f';
8 8
 	}
9 9
 	/**
@@ -17,26 +17,26 @@  discard block
 block discarded – undo
17 17
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
18 18
 //		echo __LINE__."$value_inputted_for_field_on_model_object<br>";
19 19
 		//remove whitespaces and thousands separators
20
-		if(is_string($value_inputted_for_field_on_model_object)){
21
-			$value_inputted_for_field_on_model_object = str_replace(array(" ",EE_Config::instance()->currency->thsnds),"",$value_inputted_for_field_on_model_object);
20
+		if (is_string($value_inputted_for_field_on_model_object)) {
21
+			$value_inputted_for_field_on_model_object = str_replace(array(" ", EE_Config::instance()->currency->thsnds), "", $value_inputted_for_field_on_model_object);
22 22
 //echo __LINE__."$value_inputted_for_field_on_model_object<br>";
23 23
 //normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now)
24
-			$value_inputted_for_field_on_model_object = str_replace( EE_Config::instance()->currency->dec_mrk, ".", $value_inputted_for_field_on_model_object) ;
24
+			$value_inputted_for_field_on_model_object = str_replace(EE_Config::instance()->currency->dec_mrk, ".", $value_inputted_for_field_on_model_object);
25 25
 //echo __LINE__."$value_inputted_for_field_on_model_object<br>";
26 26
 //double-check there's absolutely nothing left on this string besides numbers
27
-			$value_inputted_for_field_on_model_object = preg_replace( "/[^0-9,.]/", "", $value_inputted_for_field_on_model_object);
27
+			$value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "", $value_inputted_for_field_on_model_object);
28 28
 		}
29 29
 //		echo __LINE__."$value_inputted_for_field_on_model_object<br>";
30
-		return floatval( $value_inputted_for_field_on_model_object );
30
+		return floatval($value_inputted_for_field_on_model_object);
31 31
 	}
32 32
 	/**
33 33
 	 * Returns the number formatted according to local custom (set by the country of the blog).
34 34
 	 * @param float $value_on_field_to_be_outputted
35 35
 	 * @return string
36 36
 	 */
37
-	function prepare_for_pretty_echoing($value_on_field_to_be_outputted,$schema = null){
37
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
38 38
 		$EE = EE_Registry::instance();
39
-		return number_format( $value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk, $EE->CFG->currency->thsnds) ;
39
+		return number_format($value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk, $EE->CFG->currency->thsnds);
40 40
 	}
41 41
 
42 42
 	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
Please login to merge, or discard this patch.
core/db_models/fields/EE_Foreign_Key_Field_Base.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,6 +4,6 @@
 block discarded – undo
4 4
  * needed functions from its parent, but because all foreign key fields inherit from
5 5
  * this one, its easy ot check if a field is a foreign key.
6 6
  */
7
-abstract class EE_Foreign_Key_Field_Base extends EE_Field_With_Model_Name{
7
+abstract class EE_Foreign_Key_Field_Base extends EE_Field_With_Model_Name {
8 8
 	//all needed functionality inherited from parent
9 9
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Foreign_Key_Int_Field.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Foreign_Key_Field_Base.php');
3
-class EE_Foreign_Key_Int_Field extends EE_Foreign_Key_Field_Base{
4
-	function get_wpdb_data_type(){
2
+require_once(EE_MODELS.'fields/EE_Foreign_Key_Field_Base.php');
3
+class EE_Foreign_Key_Int_Field extends EE_Foreign_Key_Field_Base {
4
+	function get_wpdb_data_type() {
5 5
 		return '%d';
6 6
 	}
7 7
 	/**
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	 * @return int
11 11
 	 */
12 12
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
13
-		if($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)){
13
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
14 14
 			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
15 15
 		}
16 16
 		return absint($value_inputted_for_field_on_model_object);
Please login to merge, or discard this patch.