Completed
Branch ENH-9844-update-decaf-rating-l... (cc0077)
by
unknown
93:19 queued 81:05
created
core/db_models/fields/EE_Boolean_Field.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
5 5
 		if ($value_inputted_for_field_on_model_object){
6 6
 			return true;
7
-		}else{
7
+		} else{
8 8
 			return false;
9 9
 		}
10 10
 	}
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Integer_Field.php');
3
-class EE_Boolean_Field extends EE_Integer_Field{
2
+require_once(EE_MODELS.'fields/EE_Integer_Field.php');
3
+class EE_Boolean_Field extends EE_Integer_Field {
4 4
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
5
-		if ($value_inputted_for_field_on_model_object){
5
+		if ($value_inputted_for_field_on_model_object) {
6 6
 			return true;
7
-		}else{
7
+		} else {
8 8
 			return false;
9 9
 		}
10 10
 	}
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 * @return boolean
15 15
 	 */
16 16
 	function prepare_for_set_from_db($value_inputted_for_field_on_model_object) {
17
-		return intval( $value_inputted_for_field_on_model_object ) ? true : false;
17
+		return intval($value_inputted_for_field_on_model_object) ? true : false;
18 18
 	}
19 19
 	
20 20
 	/**
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 	 * @param boolean $value_on_field_to_be_outputted
23 23
 	 * @return string Yes or No
24 24
 	 */
25
-	function prepare_for_pretty_echoing( $value_on_field_to_be_outputted ) {
25
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted) {
26 26
 		return apply_filters( 
27 27
 			'FHEE__EE_Boolean_Field__prepare_for_pretty_echoing__return',
28
-			$value_on_field_to_be_outputted ? __( 'Yes', 'event_espresso' ) : __( 'No', 'event_espresso' ),
28
+			$value_on_field_to_be_outputted ? __('Yes', 'event_espresso') : __('No', 'event_espresso'),
29 29
 			$value_on_field_to_be_outputted
30 30
 		);
31 31
 	}
Please login to merge, or discard this patch.
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.
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.
Spacing   +104 added lines, -104 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
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 * @param string 	$pretty_date_format
119 119
 	 * @param string 	$pretty_time_format
120 120
 	 */
121
-	public function __construct( $table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '' ){
121
+	public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '') {
122 122
 
123
-		$this->_date_format = ! empty( $date_format ) ? $date_format : get_option('date_format');
124
-		$this->_time_format = ! empty( $time_format ) ? $time_format : get_option('time_format');
125
-		$this->_pretty_date_format = ! empty( $pretty_date_format ) ? $pretty_date_format : get_option('date_format');
126
-		$this->_pretty_time_format = ! empty( $pretty_time_format ) ? $pretty_time_format : get_option('time_format');
123
+		$this->_date_format = ! empty($date_format) ? $date_format : get_option('date_format');
124
+		$this->_time_format = ! empty($time_format) ? $time_format : get_option('time_format');
125
+		$this->_pretty_date_format = ! empty($pretty_date_format) ? $pretty_date_format : get_option('date_format');
126
+		$this->_pretty_time_format = ! empty($pretty_time_format) ? $pretty_time_format : get_option('time_format');
127 127
 
128
-		parent::__construct( $table_column, $nice_name, $nullable, $default_value );
129
-		$this->set_timezone( $timezone_string );
128
+		parent::__construct($table_column, $nice_name, $nullable, $default_value);
129
+		$this->set_timezone($timezone_string);
130 130
 
131 131
 	}
132 132
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return DateTimeZone
146 146
 	 */
147 147
 	public function get_UTC_DateTimeZone() {
148
-		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string( 'UTC' );
148
+		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string('UTC');
149 149
 	}
150 150
 
151 151
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return DateTimeZone
155 155
 	 */
156 156
 	public function get_blog_DateTimeZone() {
157
-		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string( '' );
157
+		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string('');
158 158
 	}
159 159
 
160 160
 
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 * @param  string|int $value_inputted_for_field_on_model_object could be a string formatted date time or int unix timestamp
165 165
 	 * @return DateTime
166 166
 	 */
167
-	public function prepare_for_set( $value_inputted_for_field_on_model_object ) {
168
-		return $this->_get_date_object( $value_inputted_for_field_on_model_object );
167
+	public function prepare_for_set($value_inputted_for_field_on_model_object) {
168
+		return $this->_get_date_object($value_inputted_for_field_on_model_object);
169 169
 	}
170 170
 
171 171
 
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 	 * @param bool $pretty If we're returning the pretty formats or standard format string.
182 182
 	 * @return string    The final assembled format string.
183 183
 	 */
184
-	protected function _get_date_time_output( $pretty = FALSE ) {
184
+	protected function _get_date_time_output($pretty = FALSE) {
185 185
 
186
-		switch ( $this->_date_time_output ) {
186
+		switch ($this->_date_time_output) {
187 187
 			case 'time' :
188 188
 				return $pretty ? $this->_pretty_time_format : $this->_time_format;
189 189
 				break;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 				break;
194 194
 
195 195
 			default :
196
-				return $pretty ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format : $this->_date_format . ' ' . $this->_time_format;
196
+				return $pretty ? $this->_pretty_date_format.' '.$this->_pretty_time_format : $this->_date_format.' '.$this->_time_format;
197 197
 		}
198 198
 	}
199 199
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @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.
208 208
 	 * @return void
209 209
 	 */
210
-	public function set_date_time_output( $what = NULL ) {
210
+	public function set_date_time_output($what = NULL) {
211 211
 		$this->_date_time_output = $what;
212 212
 	}
213 213
 
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 	 * @param string $timezone_string A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php
224 224
 	 * @return void
225 225
 	 */
226
-	public function set_timezone( $timezone_string ) {
227
-		if( empty( $timezone_string ) && $this->_timezone_string != NULL ){
226
+	public function set_timezone($timezone_string) {
227
+		if (empty($timezone_string) && $this->_timezone_string != NULL) {
228 228
 			// leave the timezone AS-IS if we already have one and
229 229
 			// the function arg didn't provide one
230 230
 			return;
231 231
 		}
232
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
233
-		$this->_timezone_string = ! empty( $timezone_string ) ? $timezone_string : 'UTC';
234
-		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string( $this->_timezone_string );
232
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
233
+		$this->_timezone_string = ! empty($timezone_string) ? $timezone_string : 'UTC';
234
+		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string($this->_timezone_string);
235 235
 	}
236 236
 
237 237
 
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 	 * @param string $timezone_string
244 244
 	 * @return \DateTimeZone
245 245
 	 */
246
-	protected function _create_timezone_object_from_timezone_string( $timezone_string = '' ) {
247
-		return new DateTimeZone( EEH_DTT_Helper::get_valid_timezone_string( $timezone_string ) );
246
+	protected function _create_timezone_object_from_timezone_string($timezone_string = '') {
247
+		return new DateTimeZone(EEH_DTT_Helper::get_valid_timezone_string($timezone_string));
248 248
 	}
249 249
 
250 250
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @param bool   $pretty Whether to set pretty format or not.
270 270
 	 * @return void
271 271
 	 */
272
-	public function set_date_format( $format, $pretty = false ) {
273
-		if ( $pretty ) {
272
+	public function set_date_format($format, $pretty = false) {
273
+		if ($pretty) {
274 274
 			$this->_pretty_date_format = $format;
275 275
 		} else {
276 276
 			$this->_date_format = $format;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @param bool   $pretty Whether to get pretty format or not.
286 286
 	 * @return string
287 287
 	 */
288
-	public function get_date_format( $pretty = false ) {
288
+	public function get_date_format($pretty = false) {
289 289
 		return $pretty ? $this->_pretty_date_format : $this->_date_format;
290 290
 	}
291 291
 
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
 	 * @param bool   $pretty Whether to set pretty format or not.
301 301
 	 * @return void
302 302
 	 */
303
-	public function set_time_format( $format, $pretty = false ) {
304
-		if ( $pretty ) {
303
+	public function set_time_format($format, $pretty = false) {
304
+		if ($pretty) {
305 305
 			$this->_pretty_time_format = $format;
306 306
 		} else {
307 307
 			$this->_time_format = $format;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * @param bool   $pretty Whether to get pretty format or not.
317 317
 	 * @return string
318 318
 	 */
319
-	public function get_time_format( $pretty = false ) {
319
+	public function get_time_format($pretty = false) {
320 320
 		return $pretty ? $this->_pretty_time_format : $this->_time_format;
321 321
 	}
322 322
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function)
332 332
 	 * @return void
333 333
 	 */
334
-	public function set_pretty_date_format( $format ) {
334
+	public function set_pretty_date_format($format) {
335 335
 		$this->_pretty_date_format = $format;
336 336
 	}
337 337
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function)
349 349
 	 * @return void
350 350
 	 */
351
-	public function set_pretty_time_format( $format ) {
351
+	public function set_pretty_time_format($format) {
352 352
 		$this->_pretty_time_format = $format;
353 353
 	}
354 354
 
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 	 * @param DateTime    $current current DateTime object for the datetime field
361 361
 	 * @return DateTime
362 362
 	 */
363
-	public function prepare_for_set_with_new_time( $time_to_set_string, DateTime $current ){
363
+	public function prepare_for_set_with_new_time($time_to_set_string, DateTime $current) {
364 364
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
365
-		if ( $time_to_set_string instanceof DateTime ) {
365
+		if ($time_to_set_string instanceof DateTime) {
366 366
 			$parsed = array(
367 367
 				'hour' => $time_to_set_string->format('H'),
368 368
 				'minute' => $time_to_set_string->format('i'),
@@ -370,12 +370,12 @@  discard block
 block discarded – undo
370 370
 				);
371 371
 		} else {
372 372
 			//parse incoming string
373
-			$parsed = date_parse_from_format( $this->_time_format, $time_to_set_string );
373
+			$parsed = date_parse_from_format($this->_time_format, $time_to_set_string);
374 374
 		}
375 375
 
376 376
 		//make sure $current is in the correct timezone.
377
-		$current->setTimezone( $this->_DateTimeZone );
378
-		return $current->setTime( $parsed['hour'], $parsed['minute'], $parsed['second'] );
377
+		$current->setTimezone($this->_DateTimeZone);
378
+		return $current->setTime($parsed['hour'], $parsed['minute'], $parsed['second']);
379 379
 	}
380 380
 
381 381
 
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 	 * @param DateTime    $current current DateTime object for the datetime field
387 387
 	 * @return DateTime
388 388
 	 */
389
-	public function prepare_for_set_with_new_date( $date_to_set_string, DateTime $current ){
389
+	public function prepare_for_set_with_new_date($date_to_set_string, DateTime $current) {
390 390
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
391
-		if ( $date_to_set_string instanceof DateTime ) {
391
+		if ($date_to_set_string instanceof DateTime) {
392 392
 			$parsed = array(
393 393
 				'year' => $date_to_set_string->format('Y'),
394 394
 				'month' => $date_to_set_string->format('m'),
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 				);
397 397
 		} else {
398 398
 			//parse incoming string
399
-			$parsed = date_parse_from_format( $this->_date_format, $date_to_set_string );
399
+			$parsed = date_parse_from_format($this->_date_format, $date_to_set_string);
400 400
 		}
401 401
 
402 402
 		//make sure $current is in the correct timezone
403
-		$current->setTimezone( $this->_DateTimeZone );
404
-		return $current->setDate( $parsed['year'], $parsed['month'], $parsed['day'] );
403
+		$current->setTimezone($this->_DateTimeZone);
404
+		return $current->setDate($parsed['year'], $parsed['month'], $parsed['day']);
405 405
 	}
406 406
 
407 407
 
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 	 * @param  DateTime $DateTime
414 414
 	 * @return string formatted date time for given timezone
415 415
 	 */
416
-	public function prepare_for_get( $DateTime ) {
417
-		return $this->_prepare_for_display( $DateTime  );
416
+	public function prepare_for_get($DateTime) {
417
+		return $this->_prepare_for_display($DateTime);
418 418
 	}
419 419
 
420 420
 
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	 * @param null     $schema
430 430
 	 * @return string
431 431
 	 */
432
-	public function prepare_for_pretty_echoing( $DateTime, $schema = null ) {
433
-		return $this->_prepare_for_display( $DateTime, $schema ? $schema : true );
432
+	public function prepare_for_pretty_echoing($DateTime, $schema = null) {
433
+		return $this->_prepare_for_display($DateTime, $schema ? $schema : true);
434 434
 	}
435 435
 
436 436
 
@@ -444,36 +444,36 @@  discard block
 block discarded – undo
444 444
 	 * @return string
445 445
 	 * @throws \EE_Error
446 446
 	 */
447
-	protected function _prepare_for_display( $DateTime, $schema = false ) {
448
-		if ( ! $DateTime instanceof DateTime  ) {
449
-			if ( $this->_nullable ) {
447
+	protected function _prepare_for_display($DateTime, $schema = false) {
448
+		if ( ! $DateTime instanceof DateTime) {
449
+			if ($this->_nullable) {
450 450
 				return '';
451 451
 			} else {
452
-				if ( WP_DEBUG ) {
453
-					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 ) );
452
+				if (WP_DEBUG) {
453
+					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));
454 454
 				} else {
455
-					$DateTime = new DateTime( "now" );
456
-					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 ) );
455
+					$DateTime = new DateTime("now");
456
+					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));
457 457
 				}
458 458
 			}
459 459
 		}
460
-		$format_string = $this->_get_date_time_output( $schema );
460
+		$format_string = $this->_get_date_time_output($schema);
461 461
 		//make sure datetime_value is in the correct timezone (in case that's been updated).
462
-		$DateTime->setTimezone( $this->_DateTimeZone );
463
-		if ( $schema ) {
464
-			if( $this->_display_timezone() ) {
462
+		$DateTime->setTimezone($this->_DateTimeZone);
463
+		if ($schema) {
464
+			if ($this->_display_timezone()) {
465 465
 				//must be explicit because schema could equal true.
466
-				if( $schema === 'no_html' ){
467
-					$timezone_string = ' (' . $DateTime->format( 'T' )  . ')';
468
-				}else{
469
-					$timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format( 'T' ) . ')</span>';
466
+				if ($schema === 'no_html') {
467
+					$timezone_string = ' ('.$DateTime->format('T').')';
468
+				} else {
469
+					$timezone_string = ' <span class="ee_dtt_timezone_string">('.$DateTime->format('T').')</span>';
470 470
 				}
471 471
 			} else {
472 472
 				$timezone_string = '';
473 473
 			}
474
-			return $DateTime->format( $format_string ) . $timezone_string;
474
+			return $DateTime->format($format_string).$timezone_string;
475 475
 		} else {
476
-			return $DateTime->format( $format_string );
476
+			return $DateTime->format($format_string);
477 477
 		}
478 478
 	}
479 479
 
@@ -487,18 +487,18 @@  discard block
 block discarded – undo
487 487
 	 * @return string mysql timestamp in UTC
488 488
 	 * @throws \EE_Error
489 489
 	 */
490
-	public function prepare_for_use_in_db( $datetime_value ) {
490
+	public function prepare_for_use_in_db($datetime_value) {
491 491
 		//we allow an empty value or DateTime object, but nothing else.
492
-		if ( ! empty( $datetime_value ) && ! $datetime_value instanceof DateTime ) {
493
-			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' ) );
492
+		if ( ! empty($datetime_value) && ! $datetime_value instanceof DateTime) {
493
+			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'));
494 494
 		}
495 495
 
496
-		if ( $datetime_value instanceof DateTime ) {
497
-			return $datetime_value->setTimezone( $this->get_UTC_DateTimeZone() )->format( EE_Datetime_Field::mysql_timestamp_format );
496
+		if ($datetime_value instanceof DateTime) {
497
+			return $datetime_value->setTimezone($this->get_UTC_DateTimeZone())->format(EE_Datetime_Field::mysql_timestamp_format);
498 498
 		}
499 499
 
500 500
 		// if $datetime_value is empty, and ! $this->_nullable, use current_time() but set the GMT flag to true
501
-		return ! $this->_nullable && empty( $datetime_value ) ? current_time( 'mysql', true ) : null;
501
+		return ! $this->_nullable && empty($datetime_value) ? current_time('mysql', true) : null;
502 502
 	}
503 503
 
504 504
 
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
 	 * @param string $datetime_string mysql timestamp in UTC
512 512
 	 * @return  mixed null | DateTime
513 513
 	 */
514
-	public function prepare_for_set_from_db( $datetime_string ) {
514
+	public function prepare_for_set_from_db($datetime_string) {
515 515
 		//if $datetime_value is empty, and ! $this->_nullable, just use time()
516
-		if ( empty( $datetime_string) && $this->_nullable ) {
516
+		if (empty($datetime_string) && $this->_nullable) {
517 517
 			return null;
518 518
 		}
519 519
 		// datetime strings from the db should ALWAYS be in UTC+0, so use UTC_DateTimeZone when creating
520
-		$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() );
520
+		$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());
521 521
 
522
-		if ( ! $DateTime instanceof DateTime ) {
522
+		if ( ! $DateTime instanceof DateTime) {
523 523
 			//if still no datetime object, then let's just use now
524
-			$DateTime = new DateTime( 'now', $this->get_UTC_DateTimeZone() );
524
+			$DateTime = new DateTime('now', $this->get_UTC_DateTimeZone());
525 525
 		}
526 526
 		// THEN apply the field's set DateTimeZone
527
-		$DateTime->setTimezone( $this->_DateTimeZone );
527
+		$DateTime->setTimezone($this->_DateTimeZone);
528 528
 		return $DateTime;
529 529
 	}
530 530
 
@@ -541,15 +541,15 @@  discard block
 block discarded – undo
541 541
 	protected function _display_timezone() {
542 542
 
543 543
 		// first let's do a comparison of timezone strings.  If they match then we can get out without any further calculations
544
-		$blog_string = get_option( 'timezone_string' );
545
-		if ( $blog_string == $this->_timezone_string ) {
544
+		$blog_string = get_option('timezone_string');
545
+		if ($blog_string == $this->_timezone_string) {
546 546
 			return FALSE;
547 547
 		}
548 548
 		// now we need to calc the offset for the timezone string so we can compare with the blog offset.
549
-		$this_offset = $this->get_timezone_offset( $this->_DateTimeZone );
550
-		$blog_offset = $this->get_timezone_offset( $this->get_blog_DateTimeZone() );
549
+		$this_offset = $this->get_timezone_offset($this->_DateTimeZone);
550
+		$blog_offset = $this->get_timezone_offset($this->get_blog_DateTimeZone());
551 551
 		// now compare
552
-		if ( $blog_offset === $this_offset ) {
552
+		if ($blog_offset === $this_offset) {
553 553
 			return FALSE;
554 554
 		}
555 555
 		return TRUE;
@@ -567,24 +567,24 @@  discard block
 block discarded – undo
567 567
 	 *
568 568
 	 * @return DateTime
569 569
 	 */
570
-	protected function _get_date_object( $date_string ) {
570
+	protected function _get_date_object($date_string) {
571 571
 		//first if this is an empty date_string and nullable is allowed, just return null.
572
-		if ( $this->_nullable && empty( $date_string ) ) {
572
+		if ($this->_nullable && empty($date_string)) {
573 573
 			return null;
574 574
 		}
575 575
 
576 576
 		// if incoming date
577
-		if ( $date_string instanceof DateTime ) {
578
-			$date_string->setTimezone( $this->_DateTimeZone );
577
+		if ($date_string instanceof DateTime) {
578
+			$date_string->setTimezone($this->_DateTimeZone);
579 579
 			return $date_string;
580 580
 		}
581 581
 		// if empty date_string and made it here.
582 582
 		// Return a datetime object for now in the given timezone.
583
-		if ( empty( $date_string ) ) {
584
-			return new DateTime( "now", $this->_DateTimeZone );
583
+		if (empty($date_string)) {
584
+			return new DateTime("now", $this->_DateTimeZone);
585 585
 		}
586 586
 		// if $date_string is matches something that looks like a Unix timestamp let's just use it.
587
-		if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $date_string ) ) {
587
+		if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $date_string)) {
588 588
 			try {
589 589
 				/**
590 590
 				 * This is operating under the assumption that the incoming Unix timestamp is
@@ -592,29 +592,29 @@  discard block
 block discarded – undo
592 592
 				 * current_time('timestamp');
593 593
 				 *
594 594
 				 */
595
-				$DateTime = new DateTime( "now", $this->_DateTimeZone );
596
-				return $DateTime->setTimestamp( $date_string );
597
-			 } catch ( Exception $e )  {
595
+				$DateTime = new DateTime("now", $this->_DateTimeZone);
596
+				return $DateTime->setTimestamp($date_string);
597
+			 } catch (Exception $e) {
598 598
 			 	// should be rare, but if things got fooled then let's just continue
599 599
 			 }
600 600
 		}
601 601
 		//not a unix timestamp.  So we will use the set format on this object and set timezone to
602 602
 		//create the DateTime object.
603
-		$format = $this->_date_format . ' ' . $this->_time_format;
603
+		$format = $this->_date_format.' '.$this->_time_format;
604 604
 		try {
605
-			$DateTime = DateTime::createFromFormat( $format, $date_string, $this->_DateTimeZone );
606
-			if ( ! $DateTime instanceof DateTime ) {
605
+			$DateTime = DateTime::createFromFormat($format, $date_string, $this->_DateTimeZone);
606
+			if ( ! $DateTime instanceof DateTime) {
607 607
 				throw new EE_Error(
608 608
 					sprintf(
609
-						__( '"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso' ),
609
+						__('"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso'),
610 610
 						$date_string,
611 611
 						$format
612 612
 					)
613 613
 				);
614 614
 			}
615
-		} catch ( Exception $e ) {
615
+		} catch (Exception $e) {
616 616
 			// 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.
617
-			$DateTime = new DateTime( "now", $this->_DateTimeZone );
617
+			$DateTime = new DateTime("now", $this->_DateTimeZone);
618 618
 		}
619 619
 		return $DateTime;
620 620
 	}
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 	 * @param null          $time
629 629
 	 * @return mixed
630 630
 	 */
631
-	public function get_timezone_offset( DateTimeZone $DateTimeZone, $time = null ) {
632
-		$time = preg_match( EE_Datetime_Field::unix_timestamp_regex, $time ) ? $time : time();
633
-		$transitions = $DateTimeZone->getTransitions( $time );
631
+	public function get_timezone_offset(DateTimeZone $DateTimeZone, $time = null) {
632
+		$time = preg_match(EE_Datetime_Field::unix_timestamp_regex, $time) ? $time : time();
633
+		$transitions = $DateTimeZone->getTransitions($time);
634 634
 		return $transitions[0]['offset'];
635 635
 	}
636 636
 
@@ -642,10 +642,10 @@  discard block
 block discarded – undo
642 642
 	 * @param  string $timezone_string
643 643
 	 * @return string           abbreviation
644 644
 	 */
645
-	public function get_timezone_abbrev( $timezone_string ) {
646
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
647
-		$dateTime = new DateTime( 'now', new DateTimeZone( $timezone_string ) );
648
-		return $dateTime->format( 'T' );
645
+	public function get_timezone_abbrev($timezone_string) {
646
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
647
+		$dateTime = new DateTime('now', new DateTimeZone($timezone_string));
648
+		return $dateTime->format('T');
649 649
 	}
650 650
 
651 651
 	/**
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @return 
654 654
 	 */
655 655
 	public function get_default_value() {
656
-		if( $this->_default_value === EE_Datetime_Field::now ) {
656
+		if ($this->_default_value === EE_Datetime_Field::now) {
657 657
 			return time();
658 658
 		} else {
659 659
 			return parent::get_default_value();
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
 require_once( EE_MODELS . 'fields/EE_Integer_Field.php' );
3 5
 /**
4 6
  * Class EE_Enum_Integer_Field
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.