Completed
Branch BUG-10015-set-curl-ssl-version (7bdf86)
by
unknown
30:31 queued 13:32
created
core/db_models/EEM_WP_User.model.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,24 +22,24 @@  discard block
 block discarded – undo
22 22
 	 * @param null $timezone
23 23
 	 * @throws \EE_Error
24 24
 	 */
25
-	protected function __construct( $timezone = NULL ){
26
-		$this->singular_item = __('WP_User','event_espresso');
27
-		$this->plural_item = __('WP_Users','event_espresso');
25
+	protected function __construct($timezone = NULL) {
26
+		$this->singular_item = __('WP_User', 'event_espresso');
27
+		$this->plural_item = __('WP_Users', 'event_espresso');
28 28
 		global $wpdb;
29 29
 		$this->_tables = array(
30
-			'WP_User'=> new EE_Primary_Table( $wpdb->users, 'ID', true)
30
+			'WP_User'=> new EE_Primary_Table($wpdb->users, 'ID', true)
31 31
 		);
32 32
 		$this->_fields = array(
33 33
 			'WP_User'=>array(
34
-				'ID'=> new EE_Primary_Key_Int_Field('ID', __('WP_User ID','event_espresso')),
35
-				'user_login'=>new EE_Plain_Text_Field('user_login', __('User Login','event_espresso'), false, '' ),
36
-				'user_pass'=>new EE_Plain_Text_Field('user_pass', __('User Password','event_espresso'), false, '' ),
37
-				'user_nicename'=>new EE_Plain_Text_Field('user_nicename', __(' User Nice Name','event_espresso'), false, ''),
38
-				'user_email' => new EE_Email_Field('user_email', __( 'User Email', 'event_espresso' ), false),
39
-				'user_registered' => new EE_Datetime_Field( 'user_registered', __( 'Date User Registered', 'event_espresso' ), false, EE_Datetime_Field::now, $timezone ),
40
-				'user_activation_key' => new EE_Plain_Text_Field( 'user_activation_key', __( 'User Activation Key', 'event_espresso' ), false, '' ),
41
-				'user_status' => new EE_Integer_Field( 'user_status', __( 'User Status', 'event_espresso' ), false, 0 ),
42
-				'display_name' => new EE_Plain_Text_Field( 'display_name', __( 'Display Name', 'event_espresso' ), false, '' )
34
+				'ID'=> new EE_Primary_Key_Int_Field('ID', __('WP_User ID', 'event_espresso')),
35
+				'user_login'=>new EE_Plain_Text_Field('user_login', __('User Login', 'event_espresso'), false, ''),
36
+				'user_pass'=>new EE_Plain_Text_Field('user_pass', __('User Password', 'event_espresso'), false, ''),
37
+				'user_nicename'=>new EE_Plain_Text_Field('user_nicename', __(' User Nice Name', 'event_espresso'), false, ''),
38
+				'user_email' => new EE_Email_Field('user_email', __('User Email', 'event_espresso'), false),
39
+				'user_registered' => new EE_Datetime_Field('user_registered', __('Date User Registered', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
40
+				'user_activation_key' => new EE_Plain_Text_Field('user_activation_key', __('User Activation Key', 'event_espresso'), false, ''),
41
+				'user_status' => new EE_Integer_Field('user_status', __('User Status', 'event_espresso'), false, 0),
42
+				'display_name' => new EE_Plain_Text_Field('display_name', __('Display Name', 'event_espresso'), false, '')
43 43
 			));
44 44
 		$this->_model_relations = array(
45 45
 			'Attendee' => new EE_Has_Many_Relation(),
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 		);
57 57
 		$this->_wp_core_model = true;
58 58
 		$this->_caps_slug = 'users';
59
-		$this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read ] = 'list';
60
-		$this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read_admin ] = 'list';
61
-		foreach( $this->_cap_contexts_to_cap_action_map as $context => $action ) {
62
-			$this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_WP_User();
59
+		$this->_cap_contexts_to_cap_action_map[EEM_Base::caps_read] = 'list';
60
+		$this->_cap_contexts_to_cap_action_map[EEM_Base::caps_read_admin] = 'list';
61
+		foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
62
+			$this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_WP_User();
63 63
 		}
64 64
 		//@todo: account for create_users controls whether they can create users at all
65 65
 
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 	}
68 68
 
69 69
 	/**
Please login to merge, or discard this patch.
core/db_models/fields/EE_Datetime_Field.php 1 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/EEM_Payment.model.php 1 patch
Spacing   +51 added lines, -51 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 . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * Payment Model
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @author				Michael Nelson, Brent Christensen
10 10
  *
11 11
  */
12
-class EEM_Payment extends EEM_Base implements EEMI_Payment{
12
+class EEM_Payment extends EEM_Base implements EEMI_Payment {
13 13
 
14 14
   	// private instance of the Payment object
15 15
 	protected static $_instance = NULL;
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
58 58
 	 *		@return EEM_Payment
59 59
 	 */
60
-	protected function __construct( $timezone ) {
60
+	protected function __construct($timezone) {
61 61
 
62
-		$this->singular_item = __('Payment','event_espresso');
63
-		$this->plural_item = __('Payments','event_espresso');
62
+		$this->singular_item = __('Payment', 'event_espresso');
63
+		$this->plural_item = __('Payments', 'event_espresso');
64 64
 
65 65
 		$this->_tables = array(
66
-			'Payment'=>new EE_Primary_Table('esp_payment','PAY_ID')
66
+			'Payment'=>new EE_Primary_Table('esp_payment', 'PAY_ID')
67 67
 		);
68 68
 		$this->_fields = array(
69 69
 			'Payment'=>array(
70
-				'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID','event_espresso')),
71
-				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'),
72
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Payment::status_id_failed, 'Status'),
73
-				'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
74
-				'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment','event_espresso'), false, 'CART'),
75
-				'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for','event_espresso'), false, 0),
70
+				'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso')),
71
+				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'),
72
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Payment::status_id_failed, 'Status'),
73
+				'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
74
+				'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment', 'event_espresso'), false, 'CART'),
75
+				'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for', 'event_espresso'), false, 0),
76 76
 				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Payment Method ID", 'event_espresso'), false, NULL, 'Payment_Method'),
77
-				'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment','event_espresso'), false, ''),
78
-				'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number','event_espresso'), true, ''),
79
-				'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number','event_espresso'), true, ''),
80
-				'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info','event_espresso'), true, ''),
81
-				'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment','event_espresso'), true, ''),
77
+				'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment', 'event_espresso'), false, ''),
78
+				'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number', 'event_espresso'), true, ''),
79
+				'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number', 'event_espresso'), true, ''),
80
+				'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info', 'event_espresso'), true, ''),
81
+				'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment', 'event_espresso'), true, ''),
82 82
 				'PAY_redirect_url'=>new EE_Plain_Text_Field('PAY_redirect_url', __("Redirect URL", 'event_espresso'), true),
83 83
 				'PAY_redirect_args'=>new EE_Serialized_Text_Field('PAY_redirect_args', __("Key-Value POST vars to send along with redirect", 'event_espresso'), true)
84 84
 			)
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 			'Status'=> new EE_Belongs_To_Relation(),
89 89
 			'Payment_Method'=>new EE_Belongs_To_Relation(),
90 90
 			'Registration_Payment' => new EE_Has_Many_Relation(),
91
-			'Registration' => new EE_HABTM_Relation( 'Registration_Payment' ),
91
+			'Registration' => new EE_HABTM_Relation('Registration_Payment'),
92 92
 		);
93 93
 		$this->_model_chain_to_wp_user = 'Payment_Method';
94 94
 		$this->_caps_slug = 'transactions';
95
-		parent::__construct( $timezone );
95
+		parent::__construct($timezone);
96 96
 	}
97 97
 
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @param string $PAY_txn_id_chq_nmbr
105 105
 	 * @return EE_Payment
106 106
 	 */
107
-	public function get_payment_by_txn_id_chq_nmbr( $PAY_txn_id_chq_nmbr ){
107
+	public function get_payment_by_txn_id_chq_nmbr($PAY_txn_id_chq_nmbr) {
108 108
 		return $this->get_one(array(array('PAY_txn_id_chq_nmbr'=>$PAY_txn_id_chq_nmbr)));
109 109
 	}
110 110
 
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
 	 *		@param	string	$status_of_payment one of EEM_Payment::status_id_*, like 'PAP','PCN',etc. If none is provided, gets payments with any status
121 121
 	*		@return		EE_Payment[]
122 122
 	*/
123
-	public function get_payments_for_transaction( $TXN_ID = FALSE, $status_of_payment = null ) {
123
+	public function get_payments_for_transaction($TXN_ID = FALSE, $status_of_payment = null) {
124 124
 		// all payments for a TXN ordered chronologically
125
-		$query_params = array( array( 'TXN_ID' => $TXN_ID ), 'order_by' => array( 'PAY_timestamp' => 'ASC' ));
125
+		$query_params = array(array('TXN_ID' => $TXN_ID), 'order_by' => array('PAY_timestamp' => 'ASC'));
126 126
 		// if provided with a status, search specifically for that status. Otherwise get them all
127
-		if ( $status_of_payment ){
127
+		if ($status_of_payment) {
128 128
 			$query_params[0]['STS_ID'] = $status_of_payment;
129 129
 		}
130 130
 		// retrieve payments
131
-		return $this->get_all ( $query_params );
131
+		return $this->get_all($query_params);
132 132
 	}
133 133
 
134 134
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @param int $TXN_ID
139 139
 	 * @return EE_Payment[]
140 140
 	 */
141
-	public function get_approved_payments_for_transaction( $TXN_ID = 0 ) {
142
-		return $this->get_payments_for_transaction( $TXN_ID, EEM_Payment::status_id_approved );
141
+	public function get_approved_payments_for_transaction($TXN_ID = 0) {
142
+		return $this->get_payments_for_transaction($TXN_ID, EEM_Payment::status_id_approved);
143 143
 
144 144
 	}
145 145
 
@@ -160,36 +160,36 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return EE_Payment[]
162 162
 	 */
163
-	public function get_payments_made_between_dates( $start_date = '', $end_date = '', $format = '', $timezone = '' ) {
164
-		$timezone = empty( $timezone ) ? EEH_DTT_Helper::get_timezone() : $timezone;
163
+	public function get_payments_made_between_dates($start_date = '', $end_date = '', $format = '', $timezone = '') {
164
+		$timezone = empty($timezone) ? EEH_DTT_Helper::get_timezone() : $timezone;
165 165
 		//if $start_date or $end date, verify $format is included.
166
-		if ( ( ! empty( $start_date ) || ! empty( $end_date ) ) && empty( $format ) ) {
167
-			throw new EE_Error( __('You included a start date and/or a end date for this method but did not include a format string.  The format string is needed for setting up the query', 'event_espresso' ) );
166
+		if (( ! empty($start_date) || ! empty($end_date)) && empty($format)) {
167
+			throw new EE_Error(__('You included a start date and/or a end date for this method but did not include a format string.  The format string is needed for setting up the query', 'event_espresso'));
168 168
 		}
169
-		$now = new DateTime( 'now' );
169
+		$now = new DateTime('now');
170 170
 		// setup timezone objects once
171
-		$modelDateTimeZone = new DateTimeZone( $this->_timezone );
172
-		$passedDateTimeZone = new DateTimeZone( $timezone );
171
+		$modelDateTimeZone = new DateTimeZone($this->_timezone);
172
+		$passedDateTimeZone = new DateTimeZone($timezone);
173 173
 		// setup start date
174
-		$start_date = ! empty( $start_date ) ? date_create_from_format( $format, $start_date, $passedDateTimeZone ) : $now;
175
-		$start_date->setTimeZone( $modelDateTimeZone );
176
-		$start_date = $start_date->format( 'Y-m-d' ) . ' 00:00:00';
177
-		$start_date = strtotime( $start_date );
174
+		$start_date = ! empty($start_date) ? date_create_from_format($format, $start_date, $passedDateTimeZone) : $now;
175
+		$start_date->setTimeZone($modelDateTimeZone);
176
+		$start_date = $start_date->format('Y-m-d').' 00:00:00';
177
+		$start_date = strtotime($start_date);
178 178
 		// setup end date
179
-		$end_date = ! empty( $end_date ) ? date_create_from_format( $format, $end_date, $passedDateTimeZone ) : $now;
180
-		$end_date->setTimeZone( $modelDateTimeZone );
181
-		$end_date = $end_date->format('Y-m-d') . ' 23:59:59';
182
-		$end_date = strtotime( $end_date );
179
+		$end_date = ! empty($end_date) ? date_create_from_format($format, $end_date, $passedDateTimeZone) : $now;
180
+		$end_date->setTimeZone($modelDateTimeZone);
181
+		$end_date = $end_date->format('Y-m-d').' 23:59:59';
182
+		$end_date = strtotime($end_date);
183 183
 
184 184
 		// make sure our start date is the lowest value and vice versa
185
-		$start = min( $start_date, $end_date );
186
-		$end = max( $start_date, $end_date );
185
+		$start = min($start_date, $end_date);
186
+		$end = max($start_date, $end_date);
187 187
 
188 188
 		//yes we generated the date and time string in utc but we WANT this start date and time used in the set timezone on the model.
189
-		$start_date = $this->convert_datetime_for_query( 'PAY_timestamp', date( 'Y-m-d', $start ) . ' 00:00:00', 'Y-m-d H:i:s', $this->get_timezone() );
190
-		$end_date = $this->convert_datetime_for_query( 'PAY_timestamp', date( 'Y-m-d', $end) . ' 23:59:59' , 'Y-m-d H:i:s', $this->get_timezone() );
189
+		$start_date = $this->convert_datetime_for_query('PAY_timestamp', date('Y-m-d', $start).' 00:00:00', 'Y-m-d H:i:s', $this->get_timezone());
190
+		$end_date = $this->convert_datetime_for_query('PAY_timestamp', date('Y-m-d', $end).' 23:59:59', 'Y-m-d H:i:s', $this->get_timezone());
191 191
 
192
-		return $this->get_all(array(array('PAY_timestamp'=>array('>=',$start_date),'PAY_timestamp*'=>array('<=',$end_date))));
192
+		return $this->get_all(array(array('PAY_timestamp'=>array('>=', $start_date), 'PAY_timestamp*'=>array('<=', $end_date))));
193 193
 	}
194 194
 
195 195
 	/**
@@ -199,35 +199,35 @@  discard block
 block discarded – undo
199 199
 	 * returns a string for the approved status
200 200
 	 * @return 	string
201 201
 	 */
202
-	function approved_status(){
202
+	function approved_status() {
203 203
 		return self::status_id_approved;
204 204
 	}
205 205
 	/**
206 206
 	 * returns a string for the pending status
207 207
 	 * @return 	string
208 208
 	 */
209
-	function pending_status(){
209
+	function pending_status() {
210 210
 		return self::status_id_pending;
211 211
 	}
212 212
 	/**
213 213
 	 * returns a string for the cancelled status
214 214
 	 * @return 	string
215 215
 	 */
216
-	function cancelled_status(){
216
+	function cancelled_status() {
217 217
 		return self::status_id_cancelled;
218 218
 	}
219 219
 	/**
220 220
 	 * returns a string for the failed status
221 221
 	 * @return 	string
222 222
 	 */
223
-	function failed_status(){
223
+	function failed_status() {
224 224
 		return self::status_id_failed;
225 225
 	}
226 226
 	/**
227 227
 	 * returns a string for the declined status
228 228
 	 * @return 	string
229 229
 	 */
230
-	function declined_status(){
230
+	function declined_status() {
231 231
 		return self::status_id_declined;
232 232
 	}
233 233
 
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket.model.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Ticket.class.php');
26 26
 
27 27
 class EEM_Ticket extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Ticket','event_espresso');
40
-		$this->plural_item = __('Tickets','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Ticket', 'event_espresso');
40
+		$this->plural_item = __('Tickets', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Ticket'=>array(
47
-				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')),
48
-				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'),
47
+				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')),
48
+				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'),
49 49
 				'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''),
50
-				'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ),
51
-				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
52
-				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
53
-				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ),
54
-				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ),
50
+				'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''),
51
+				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
52
+				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
53
+				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0),
54
+				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF),
55 55
 				'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0),
56 56
 				'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0),
57
-				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF),
58
-				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ),
59
-				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ),
60
-				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false),
61
-				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ),
57
+				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF),
58
+				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF),
59
+				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false),
60
+				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false),
61
+				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false),
62 62
 				'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0),
63
-				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ),
63
+				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0),
64 64
 				'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false),
65
-				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ),
66
-				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 )
65
+				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE),
66
+				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0)
67 67
 			));
68 68
 		$this->_model_relations = array(
69 69
 			'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		);
76 76
 
77 77
 		//this model is generally available for reading
78
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
78
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
79 79
 		//account for default tickets in the caps
80
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
81
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
82
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
83
-		parent::__construct( $timezone );
80
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
81
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
82
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
83
+		parent::__construct($timezone);
84 84
 	}
85 85
 
86 86
 
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_all_default_tickets() {
93 93
 		/** @type EE_Ticket[] $tickets */
94
-		$tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')) );
94
+		$tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')));
95 95
 		//we need to set the start date and end date to today's date and the start of the default dtt
96
-		return $this->_set_default_dates( $tickets );
96
+		return $this->_set_default_dates($tickets);
97 97
 	}
98 98
 
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @param EE_Ticket[] $tickets
104 104
 	 * @return EE_Ticket[]
105 105
 	 */
106
-	private function _set_default_dates( $tickets ) {
107
-		foreach ( $tickets as $ticket ) {
108
-			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) );
109
-			$ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) );
110
-			$ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) );
106
+	private function _set_default_dates($tickets) {
107
+		foreach ($tickets as $ticket) {
108
+			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true));
109
+			$ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30));
110
+			$ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone));
111 111
 		}
112 112
 
113 113
 		return $tickets;
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @param array $query_params
123 123
 	 * @return int
124 124
 	 */
125
-	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){
126
-		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params );
125
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
126
+		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params);
127 127
 	}
128 128
 
129 129
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @param EE_Ticket[] $tickets
134 134
 	 * @return void
135 135
 	 */
136
-	public function update_tickets_sold($tickets){
137
-		foreach($tickets as $ticket){
136
+	public function update_tickets_sold($tickets) {
137
+		foreach ($tickets as $ticket) {
138 138
 			/* @var  $ticket EE_Ticket */
139 139
 			$ticket->update_tickets_sold();
140 140
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 1 patch
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Datetime','event_espresso');
40
-		$this->plural_item = __('Datetimes','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Datetime', 'event_espresso');
40
+		$this->plural_item = __('Datetimes', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Datetime'=>array(
47
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
48
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
47
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
48
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
49 49
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
50 50
 				'DTT_description' => new EE_Post_Content_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
51
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
52
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
53
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF),
54
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
55
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
51
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
52
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
53
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF),
54
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
55
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
56 56
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
57
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
58
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
57
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
58
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
59 59
 			));
60 60
 		$this->_model_relations = array(
61 61
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 		$this->_model_chain_to_wp_user = 'Event';
66 66
 		//this model is generally available for reading
67
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
68
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
69
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
70
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
71
-		parent::__construct( $timezone );
67
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
68
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
69
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
70
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
71
+		parent::__construct($timezone);
72 72
 	}
73 73
 
74 74
 
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
86
-				'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30),
87
-				'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30),
86
+				'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30),
87
+				'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30),
88 88
 				'DTT_order' => 1,
89 89
 				'DTT_reg_limit' => EE_INF
90 90
 			),
91 91
 			$this->_timezone
92 92
 		);
93
-		$blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) );
94
-		$blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) );
95
-		return array( $blank_datetime );
93
+		$blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone));
94
+		$blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone));
95
+		return array($blank_datetime);
96 96
 	}
97 97
 
98 98
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	* 		@param		int 			$EVT_ID
107 107
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108 108
 	*/
109
-	public function get_all_event_dates( $EVT_ID = 0 ) {
110
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
109
+	public function get_all_event_dates($EVT_ID = 0) {
110
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
112 112
 		}
113
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
113
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
114 114
 
115
-		if ( empty( $results ) ) {
115
+		if (empty($results)) {
116 116
 			return $this->create_new_blank_datetime();
117 117
 		}
118 118
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 	 *                        	the given number
134 134
 	 * @return EE_Datetime[]
135 135
 	 */
136
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
136
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
137 137
 
138 138
 		//sanitize EVT_ID
139
-		$EVT_ID = intval( $EVT_ID );
139
+		$EVT_ID = intval($EVT_ID);
140 140
 
141 141
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
142
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
143
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
142
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
143
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
144 144
 
145
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
145
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
146 146
 
147
-		if( ! $include_expired){
148
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
147
+		if ( ! $include_expired) {
148
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
149 149
 		}
150
-		if( $include_deleted){
151
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
150
+		if ($include_deleted) {
151
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
152 152
 		}
153 153
 
154
-		$result = $this->get_all( $query_params );
155
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
154
+		$result = $this->get_all($query_params);
155
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
156 156
 		return $result;
157 157
 	}
158 158
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param int $limit
168 168
 	 * @return EE_Datetime[]
169 169
 	 */
170
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){
171
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
170
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) {
171
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
172 172
 			'limit'=>$limit,
173 173
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
174 174
 			'default_where_conditions' => 'none'));
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param boolean $include_deleted
184 184
 	 * @return EE_Datetime
185 185
 	 */
186
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
187
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
-		if($results){
186
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
187
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
+		if ($results) {
189 189
 			return array_shift($results);
190
-		}else{
190
+		} else {
191 191
 			return NULL;
192 192
 		}
193 193
 	}
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
 	 * @param bool $try_to_exclude_deleted
202 202
 	 * @return \EE_Datetime
203 203
 	 */
204
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
205
-		if($try_to_exclude_expired){
206
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
207
-			if($non_expired){
204
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
205
+		if ($try_to_exclude_expired) {
206
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
207
+			if ($non_expired) {
208 208
 				return $non_expired;
209 209
 			}
210 210
 		}
211
-		if($try_to_exclude_deleted){
211
+		if ($try_to_exclude_deleted) {
212 212
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
213
-			if($expired_even){
213
+			if ($expired_even) {
214 214
 				return $expired_even;
215 215
 			}
216 216
 		}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 	 * @param int $limit
230 230
 	 * @return EE_Datetime[]
231 231
 	 */
232
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
232
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
233 233
 		//sanitize EVT_ID
234
-		$EVT_ID = intval( $EVT_ID );
234
+		$EVT_ID = intval($EVT_ID);
235 235
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
236
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
237
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
238
-		if( ! $include_expired){
239
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
236
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
237
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
238
+		if ( ! $include_expired) {
239
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
240 240
 		}
241
-		if( $include_deleted){
242
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
241
+		if ($include_deleted) {
242
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
243 243
 		}
244
-		if($limit){
244
+		if ($limit) {
245 245
 			$query_params['limit'] = $limit;
246 246
 		}
247
-		$result = $this->get_all( $query_params );
248
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
247
+		$result = $this->get_all($query_params);
248
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
249 249
 		return $result;
250 250
 	}
251 251
 
@@ -258,23 +258,23 @@  discard block
 block discarded – undo
258 258
 	 * @param int $limit
259 259
 	 * @return EE_Datetime[]
260 260
 	 */
261
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
261
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
262 262
 		//sanitize TKT_ID
263
-		$TKT_ID =  intval( $TKT_ID );
263
+		$TKT_ID = intval($TKT_ID);
264 264
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
265
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
266
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
267
-		if( ! $include_expired){
268
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
265
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
266
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
267
+		if ( ! $include_expired) {
268
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
269 269
 		}
270
-		if( $include_deleted){
271
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
270
+		if ($include_deleted) {
271
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
272 272
 		}
273
-		if($limit){
273
+		if ($limit) {
274 274
 			$query_params['limit'] = $limit;
275 275
 		}
276
-		$result = $this->get_all( $query_params );
277
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
276
+		$result = $this->get_all($query_params);
277
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
278 278
 		return $result;
279 279
 	}
280 280
 
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 	 *                                  that number
291 291
 	 * @return EE_Datetime[]
292 292
 	 */
293
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
293
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
294 294
 		//sanitize id.
295
-		$TKT_ID =  intval( $TKT_ID );
295
+		$TKT_ID = intval($TKT_ID);
296 296
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
297
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
298
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
299
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
300
-		if( ! $include_expired){
301
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
297
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
298
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
299
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
300
+		if ( ! $include_expired) {
301
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
302 302
 		}
303
-		if( $include_deleted){
304
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
303
+		if ($include_deleted) {
304
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
305 305
 		}
306
-		if($limit){
306
+		if ($limit) {
307 307
 			$query_params['limit'] = $limit;
308 308
 		}
309
-		$result = $this->get_all( $query_params );
310
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
309
+		$result = $this->get_all($query_params);
310
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
311 311
 		return $result;
312 312
 	}
313 313
 
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	 * @param int $EVT_ID
319 319
 	 * @return EE_Datetime
320 320
 	 */
321
-	public function get_most_important_datetime_for_event($EVT_ID){
321
+	public function get_most_important_datetime_for_event($EVT_ID) {
322 322
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323
-		if($results){
323
+		if ($results) {
324 324
 			return array_shift($results);
325
-		}else{
325
+		} else {
326 326
 			return null;
327 327
 		}
328 328
 	}
@@ -341,77 +341,77 @@  discard block
 block discarded – undo
341 341
 	 * 			- inactive = Events that are either not published.
342 342
 	 * @return wpdb results array
343 343
 	 */
344
-	public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) {
345
-		$current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' );
346
-		$current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' );
344
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '') {
345
+		$current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start');
346
+		$current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end');
347 347
 
348
-		switch ( $evt_active_status ) {
348
+		switch ($evt_active_status) {
349 349
 			case 'upcoming' :
350 350
 					$where_params['Event.status'] = 'publish';
351 351
 					//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
352
-					if ( isset( $where_params['DTT_EVT_start'] ) ) {
352
+					if (isset($where_params['DTT_EVT_start'])) {
353 353
 						$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
354 354
 					}
355
-					$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start );
355
+					$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start);
356 356
 					break;
357 357
 
358 358
 			case 'expired' :
359
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
359
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
360 360
 				//get events to exclude
361
-				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) );
361
+				$exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end)));
362 362
 				//first get all events that have datetimes where its not expired.
363
-				$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' );
364
-				$event_ids = array_keys( $event_ids );
363
+				$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID');
364
+				$event_ids = array_keys($event_ids);
365 365
 
366
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
366
+				if (isset($where_params['DTT_EVT_end'])) {
367 367
 					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
368 368
 				}
369
-				$where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end );
370
-				$where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids );
369
+				$where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end);
370
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
371 371
 				break;
372 372
 
373 373
 			case 'active' :
374 374
 				$where_params['Event.status'] = 'publish';
375
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
375
+				if (isset($where_params['DTT_EVT_start'])) {
376 376
 					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
377 377
 				}
378
-				if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
378
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
379 379
 					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
380 380
 				}
381
-				$where_params['DTT_EVT_start'] = array('<',  $current_time_for_DTT_EVT_start );
382
-				$where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end );
381
+				$where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start);
382
+				$where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end);
383 383
 				break;
384 384
 
385 385
 			case 'inactive' :
386
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
387
-				if ( isset( $where_params['OR'] ) ) {
386
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
387
+				if (isset($where_params['OR'])) {
388 388
 					$where_params['AND']['OR'] = $where_params['OR'];
389 389
 				}
390
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
390
+				if (isset($where_params['DTT_EVT_end'])) {
391 391
 					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
392
-					unset( $where_params['DTT_EVT_end'] );
392
+					unset($where_params['DTT_EVT_end']);
393 393
 				}
394 394
 
395
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
395
+				if (isset($where_params['DTT_EVT_start'])) {
396 396
 					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
397
-					unset( $where_params['DTT_EVT_start'] );
397
+					unset($where_params['DTT_EVT_start']);
398 398
 				}
399
-				$where_params['AND']['Event.status'] = array( '!=', 'publish' );
399
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
400 400
 				break;
401 401
 		}
402 402
 
403 403
 		$query_params[0] = $where_params;
404 404
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
405
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
405
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
406 406
 
407
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' );
407
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start');
408 408
 
409 409
 		$columns_to_select = array(
410
-			'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'),
411
-			'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'),
412
-			'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s')
410
+			'dtt_year' => array('YEAR('.$query_interval.')', '%s'),
411
+			'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'),
412
+			'dtt_month_num' => array('MONTH('.$query_interval.')', '%s')
413 413
 			);
414
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
414
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
415 415
 	}
416 416
 
417 417
 	/**
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	 * for the tickets for each datetime)
420 420
 	 * @param EE_Datetime[] $datetimes
421 421
 	 */
422
-	public function update_sold($datetimes){
423
-		foreach($datetimes as $datetime){
422
+	public function update_sold($datetimes) {
423
+		foreach ($datetimes as $datetime) {
424 424
 			$datetime->update_sold();
425 425
 		}
426 426
 	}
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
 	 * @param array $query_params
436 436
 	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO tickets attached to datetime then FALSE is returned.
437 437
 	 */
438
-	public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) {
439
-		$datetime = $this->get_one_by_ID( $DTT_ID );
440
-		if ( $datetime instanceof EE_Datetime ) {
441
-			return $datetime->tickets_remaining( $query_params );
438
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
439
+		$datetime = $this->get_one_by_ID($DTT_ID);
440
+		if ($datetime instanceof EE_Datetime) {
441
+			return $datetime->tickets_remaining($query_params);
442 442
 		}
443 443
 		return 0;
444 444
 	}
@@ -460,36 +460,36 @@  discard block
 block discarded – undo
460 460
 	 *                EE_Datetime::upcoming
461 461
 	 *                EE_Datetime::expired
462 462
 	 */
463
-	public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) {
463
+	public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) {
464 464
 		//only accept where conditions for this query.
465
-		$_where = isset( $query_params[0] ) ? $query_params[0] : array();
465
+		$_where = isset($query_params[0]) ? $query_params[0] : array();
466 466
 		$status_query_args = array(
467 467
 				EE_Datetime::active => array_merge(
468 468
 						$_where,
469
-						array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) )
469
+						array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
470 470
 				),
471 471
 				EE_Datetime::upcoming => array_merge(
472 472
 						$_where,
473
-						array( 'DTT_EVT_start' => array( '>', time() ) )
473
+						array('DTT_EVT_start' => array('>', time()))
474 474
 				),
475 475
 				EE_Datetime::expired => array_merge(
476 476
 						$_where,
477
-						array( 'DTT_EVT_end' => array('<', time() ) )
477
+						array('DTT_EVT_end' => array('<', time()))
478 478
 				)
479 479
 		);
480 480
 
481
-		if ( ! empty( $stati_to_include ) ) {
482
-			foreach( array_keys( $status_query_args ) as $status ) {
483
-				if ( ! in_array( $status, $stati_to_include ) ) {
484
-					unset( $status_query_args[$status] );
481
+		if ( ! empty($stati_to_include)) {
482
+			foreach (array_keys($status_query_args) as $status) {
483
+				if ( ! in_array($status, $stati_to_include)) {
484
+					unset($status_query_args[$status]);
485 485
 				}
486 486
 			}
487 487
 		}
488 488
 
489 489
 		//loop through and query counts for each stati.
490 490
 		$status_query_results = array();
491
-		foreach( $status_query_args as $status => $status_where_conditions ) {
492
-			$status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true );
491
+		foreach ($status_query_args as $status => $status_where_conditions) {
492
+			$status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true);
493 493
 		}
494 494
 
495 495
 		return $status_query_results;
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
 	 * @param array $query_params
504 504
 	 * @return int
505 505
 	 */
506
-	public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) {
507
-		$count = $this->get_datetime_counts_by_status( array( $status ), $query_params );
508
-		return ! empty( $count[$status] ) ? $count[$status] : 0;
506
+	public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) {
507
+		$count = $this->get_datetime_counts_by_status(array($status), $query_params);
508
+		return ! empty($count[$status]) ? $count[$status] : 0;
509 509
 	}
510 510
 
511 511
 
Please login to merge, or discard this patch.
core/db_models/EEM_Venue.model.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25 25
 
26 26
 class EEM_Venue extends EEM_CPT_Base {
27 27
 
28 28
   	// private instance of the Attendee object
29 29
 	protected static $_instance = NULL;
30 30
 
31
-	protected function __construct( $timezone = NULL ) {
32
-		$this->singular_item = __('Venue','event_espresso');
33
-		$this->plural_item = __('Venues','event_espresso');
31
+	protected function __construct($timezone = NULL) {
32
+		$this->singular_item = __('Venue', 'event_espresso');
33
+		$this->plural_item = __('Venues', 'event_espresso');
34 34
 		$this->_tables = array(
35 35
 			'Venue_CPT'=> new EE_Primary_Table('posts', 'ID'),
36 36
 			'Venue_Meta'=>new EE_Secondary_Table('esp_venue_meta', 'VNUM_ID', 'VNU_ID')
@@ -39,32 +39,32 @@  discard block
 block discarded – undo
39 39
 			'Venue_CPT'=>array(
40 40
 				'VNU_ID'=>new EE_Primary_Key_Int_Field('ID', __("Venue ID", "event_espresso")),
41 41
 				'VNU_name'=>new EE_Plain_Text_Field('post_title', __("Venue Name", "event_espresso"), false, ''),
42
-				'VNU_desc'=>new EE_Post_Content_Field('post_content', __("Venue Description", "event_espresso"), false,''),
43
-				'VNU_identifier'=>new EE_Slug_Field('post_name', __("Venue Identifier", "event_espresso"), false,''),
44
-				'VNU_created'=>new EE_Datetime_Field('post_date', __("Date Venue Created", "event_espresso"), FALSE, EE_Datetime_Field::now ),
45
-				'VNU_short_desc'=>new EE_Plain_Text_Field('post_excerpt', __("Short Description of Venue", "event_espresso"), true,''),
46
-				'VNU_modified'=>new EE_Datetime_Field('post_modified', __("Venue Modified Date", "event_espresso"), FALSE, EE_Datetime_Field::now ),
47
-				'VNU_wp_user'=>new EE_WP_User_Field('post_author', __("Venue Creator ID", "event_espresso"), false ),
48
-				'parent'=>new EE_Integer_Field('post_parent', __("Venue Parent ID", "event_espresso"), false,0),
42
+				'VNU_desc'=>new EE_Post_Content_Field('post_content', __("Venue Description", "event_espresso"), false, ''),
43
+				'VNU_identifier'=>new EE_Slug_Field('post_name', __("Venue Identifier", "event_espresso"), false, ''),
44
+				'VNU_created'=>new EE_Datetime_Field('post_date', __("Date Venue Created", "event_espresso"), FALSE, EE_Datetime_Field::now),
45
+				'VNU_short_desc'=>new EE_Plain_Text_Field('post_excerpt', __("Short Description of Venue", "event_espresso"), true, ''),
46
+				'VNU_modified'=>new EE_Datetime_Field('post_modified', __("Venue Modified Date", "event_espresso"), FALSE, EE_Datetime_Field::now),
47
+				'VNU_wp_user'=>new EE_WP_User_Field('post_author', __("Venue Creator ID", "event_espresso"), false),
48
+				'parent'=>new EE_Integer_Field('post_parent', __("Venue Parent ID", "event_espresso"), false, 0),
49 49
 				'VNU_order'=>new EE_Integer_Field('menu_order', __("Venue order", "event_espresso"), false, 1),
50
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_venues'),// EE_Plain_Text_Field('post_type', __("Venue post type", "event_espresso"), false, 'espresso_venues'),
50
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_venues'), // EE_Plain_Text_Field('post_type', __("Venue post type", "event_espresso"), false, 'espresso_venues'),
51 51
 				),
52 52
 			'Venue_Meta'=>array(
53 53
 				'VNUM_ID'=>new EE_DB_Only_Int_Field('VNUM_ID', __("ID of Venue Meta Row", "event_espresso"), false),
54 54
 				'VNU_ID_fk'=>new EE_DB_Only_Int_Field('VNU_ID', __("Foreign Key to Venue Post ", "event_espresso"), false),
55 55
 				'VNU_address'=>new EE_Plain_Text_Field('VNU_address', __("Venue Address line 1", "event_espresso"), true, ''),
56
-				'VNU_address2'=>new EE_Plain_Text_Field('VNU_address2', __("Venue Address line 2", "event_espresso"), true,''),
56
+				'VNU_address2'=>new EE_Plain_Text_Field('VNU_address2', __("Venue Address line 2", "event_espresso"), true, ''),
57 57
 				'VNU_city'=>new EE_Plain_Text_Field('VNU_city', __("Venue City", "event_espresso"), true, ''),
58 58
 				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __("State ID", "event_espresso"), true, null, 'State'),
59 59
 				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __("Country Code", "event_espresso"), true, null, 'Country'),
60 60
 				'VNU_zip'=>new EE_Plain_Text_Field('VNU_zip', __("Venue Zip/Postal Code", "event_espresso"), true),
61 61
 				'VNU_phone'=>new EE_Plain_Text_Field('VNU_phone', __("Venue Phone", "event_espresso"), true),
62
-				'VNU_capacity'=>new EE_Infinite_Integer_Field('VNU_capacity', __("Venue Capacity", "event_espresso"), true,EE_INF),
62
+				'VNU_capacity'=>new EE_Infinite_Integer_Field('VNU_capacity', __("Venue Capacity", "event_espresso"), true, EE_INF),
63 63
 				'VNU_url'=>new EE_Plain_Text_Field('VNU_url', __('Venue Website', 'event_espresso'), true),
64 64
 				'VNU_virtual_phone'=>new EE_Plain_Text_Field('VNU_virtual_phone', __('Call in Number', 'event_espresso'), true),
65
-				'VNU_virtual_url'=>new EE_Plain_Text_Field('VNU_virtual_url', __('Virtual URL', 'event_espresso'), true ),
66
-				'VNU_google_map_link'=>new EE_Plain_Text_Field('VNU_google_map_link', __('Google Map Link', 'event_espresso'), true ),
67
-				'VNU_enable_for_gmap'=>new EE_Boolean_Field('VNU_enable_for_gmap', __('Show Google Map?', 'event_espresso'), false, false )
65
+				'VNU_virtual_url'=>new EE_Plain_Text_Field('VNU_virtual_url', __('Virtual URL', 'event_espresso'), true),
66
+				'VNU_google_map_link'=>new EE_Plain_Text_Field('VNU_google_map_link', __('Google Map Link', 'event_espresso'), true),
67
+				'VNU_enable_for_gmap'=>new EE_Boolean_Field('VNU_enable_for_gmap', __('Show Google Map?', 'event_espresso'), false, false)
68 68
 
69 69
 			));
70 70
 		$this->_model_relations = array(
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 			'WP_User' => new EE_Belongs_To_Relation()
76 76
 		);
77 77
 		//this model is generally available for reading
78
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
79
-		parent::__construct( $timezone );
78
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
79
+		parent::__construct($timezone);
80 80
 	}
81 81
 
82 82
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Checkin.model.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * ------------------------------------------------------------------------
25 25
  */
26
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
27
-require_once ( EE_CLASSES . 'EE_Checkin.class.php' );
26
+require_once (EE_MODELS.'EEM_Base.model.php');
27
+require_once (EE_CLASSES.'EE_Checkin.class.php');
28 28
 
29 29
 class EEM_Checkin extends EEM_Base {
30 30
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	 * 		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
41 41
 	 * 		@return void
42 42
 	 */
43
-	protected function __construct( $timezone = NULL ) {
44
-		$this->singular_item = __('Check-In','event_espresso');
45
-		$this->plural_item = __('Check-Ins','event_espresso');
43
+	protected function __construct($timezone = NULL) {
44
+		$this->singular_item = __('Check-In', 'event_espresso');
45
+		$this->plural_item = __('Check-Ins', 'event_espresso');
46 46
 
47 47
 		$this->_tables = array(
48
-			'Checkin'=>new EE_Primary_Table('esp_checkin','CHK_ID')
48
+			'Checkin'=>new EE_Primary_Table('esp_checkin', 'CHK_ID')
49 49
 		);
50 50
 		$this->_fields = array(
51 51
 			'Checkin'=> array(
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', 'Registration Id', false, 0, 'Registration'),
54 54
 				'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', 'Datetime Id', false, 0, 'Datetime'),
55 55
 				'CHK_in'=>new EE_Boolean_Field('CHK_in', 'Whether a person has checked in or checked out', false, true),
56
-				'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified','event_espresso'), false, EE_Datetime_Field::now, $timezone )
56
+				'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified', 'event_espresso'), false, EE_Datetime_Field::now, $timezone)
57 57
 			)
58 58
 		);
59 59
 		$this->_model_relations = array(
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			'Datetime'=>new EE_Belongs_To_Relation()
62 62
 		);
63 63
 		$this->_model_chain_to_wp_user = 'Registration.Event';
64
-		parent::__construct( $timezone );
64
+		parent::__construct($timezone);
65 65
 
66 66
 	}
67 67
 
Please login to merge, or discard this patch.
core/db_models/EEM_Change_Log.model.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Change_Log extends EEM_Base{
28
+class EEM_Change_Log extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * the related object was created log type
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 	 *	@access protected
69 69
 	 *	@return EEM_Change_Log
70 70
 	 */
71
-	protected function __construct( $timezone = null ){
71
+	protected function __construct($timezone = null) {
72 72
 		global $current_user;
73
-		$this->singular_item = __('Log','event_espresso');
74
-		$this->plural_item = __('Logs','event_espresso');
73
+		$this->singular_item = __('Log', 'event_espresso');
74
+		$this->plural_item = __('Logs', 'event_espresso');
75 75
 		$this->_tables = array(
76 76
 			'Log'=> new EE_Primary_Table('esp_log', 'LOG_ID')
77 77
 		);
78 78
 		$models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
79 79
 		$this->_fields = array(
80 80
 			'Log'=>array(
81
-				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID','event_espresso')),
82
-				'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, EE_Datetime_Field::now ),
83
-				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL,$models_this_can_attach_to),
81
+				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID', 'event_espresso')),
82
+				'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, EE_Datetime_Field::now),
83
+				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL, $models_this_can_attach_to),
84 84
 				'OBJ_type'=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Object Type", 'event_espresso'), true, NULL, $models_this_can_attach_to),
85 85
 				'LOG_type'=>new EE_Enum_Text_Field('LOG_type', __("Type of log entry", "event_espresso"), false, self::type_debug,
86 86
 						array(
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 							self::type_gateway=> __("Gateway Interaction (IPN or Direct Payment)", 'event_espresso'),
93 93
 							)),
94 94
 				'LOG_message'=>new EE_Maybe_Serialized_Text_Field('LOG_message', __("Log Message (body)", 'event_espresso'), true),
95
-				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true ),
95
+				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true),
96 96
 
97 97
 			));
98 98
 		$this->_model_relations = array();
99
-		foreach($models_this_can_attach_to as $model){
100
-			if( $model == 'WP_User' ){
101
-				$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
102
-			}elseif( $model != 'Change_Log' ) {
99
+		foreach ($models_this_can_attach_to as $model) {
100
+			if ($model == 'WP_User') {
101
+				$this->_model_relations[$model] = new EE_Belongs_To_Relation();
102
+			}elseif ($model != 'Change_Log') {
103 103
 				$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
104 104
 			}
105 105
 		}
106 106
 		//use completely custom caps for this
107 107
 		$this->_cap_restriction_generators = false;
108 108
 		//caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing
109
-		foreach( $this->_cap_contexts_to_cap_action_map as $cap_context => $action ) {
110
-			$this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ] = new EE_Return_None_Where_Conditions();
109
+		foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) {
110
+			$this->_cap_restrictions[$cap_context][EE_Restriction_Generator_Base::get_default_restrictions_cap()] = new EE_Return_None_Where_Conditions();
111 111
 		}
112
-		parent::__construct( $timezone );
112
+		parent::__construct($timezone);
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @param EE_Base_Class $related_model_obj
120 120
 	 * @return EE_Change_Log
121 121
 	 */
122
-	public function log($log_type,$message,$related_model_obj){
123
-		if($related_model_obj instanceof EE_Base_Class){
122
+	public function log($log_type, $message, $related_model_obj) {
123
+		if ($related_model_obj instanceof EE_Base_Class) {
124 124
 			$obj_id = $related_model_obj->ID();
125 125
 			$obj_type = $related_model_obj->get_model()->get_this_model_name();
126
-		}else{
126
+		} else {
127 127
 			$obj_id = NULL;
128 128
 			$obj_type = NULL;
129 129
 		}
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @throws EE_Error
148 148
 	 * @return EE_Change_Log
149 149
 	 */
150
-	public function gateway_log( $message, $related_obj_id, $related_obj_type ){
151
-		if( ! EE_Registry::instance()->is_model_name($related_obj_type)){
152
-			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"),$related_obj_type));
150
+	public function gateway_log($message, $related_obj_id, $related_obj_type) {
151
+		if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) {
152
+			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"), $related_obj_type));
153 153
 		}
154 154
 		$log = EE_Change_Log::new_instance(array(
155 155
 				'LOG_type'=>EEM_Change_Log::type_gateway,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param array $query_params @see EEM_Base::get_all
169 169
 	 * @return array of arrays
170 170
 	 */
171
-	public function get_all_efficiently($query_params){
171
+	public function get_all_efficiently($query_params) {
172 172
 		return $this->_get_all_wpdb_results($query_params);
173 173
 	}
174 174
 
Please login to merge, or discard this patch.
core/db_models/EEM_Attendee.model.php 1 patch
Spacing   +55 added lines, -55 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 . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 
4 4
 /**
5 5
  *
@@ -21,60 +21,60 @@  discard block
 block discarded – undo
21 21
 	 * Please instead use the EEM_Attendee::system_question_* constants
22 22
 	 * @deprecated
23 23
 	 */
24
-	const fname_question_id=1;
24
+	const fname_question_id = 1;
25 25
 
26 26
 	/**
27 27
 	 * @deprecated
28 28
 	 */
29
-	const lname_question_id=2;
29
+	const lname_question_id = 2;
30 30
 
31 31
 
32 32
 	/**
33 33
 	 * @deprecated
34 34
 	 */
35
-	const email_question_id=3;
35
+	const email_question_id = 3;
36 36
 
37 37
 
38 38
 	/**
39 39
 	 * @deprecated
40 40
 	 */
41
-	const address_question_id=4;
41
+	const address_question_id = 4;
42 42
 
43 43
 
44 44
 	/**
45 45
 	 * @deprecated
46 46
 	 */
47
-	const address2_question_id=5;
47
+	const address2_question_id = 5;
48 48
 
49 49
 
50 50
 	/**
51 51
 	 * @deprecated
52 52
 	 */
53
-	const city_question_id=6;
53
+	const city_question_id = 6;
54 54
 
55 55
 
56 56
 	/**
57 57
 	 * @deprecated
58 58
 	 */
59
-	const state_question_id=7;
59
+	const state_question_id = 7;
60 60
 
61 61
 
62 62
 	/**
63 63
 	 * @deprecated
64 64
 	 */
65
-	const country_question_id=8;
65
+	const country_question_id = 8;
66 66
 
67 67
 
68 68
 	/**
69 69
 	 * @deprecated
70 70
 	 */
71
-	const zip_question_id=9;
71
+	const zip_question_id = 9;
72 72
 
73 73
 
74 74
 	/**
75 75
 	 * @deprecated
76 76
 	 */
77
-	const phone_question_id=10;
77
+	const phone_question_id = 10;
78 78
 
79 79
 	/**
80 80
 	 * When looking for questions that correspond to attendee fields,
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 * @access protected
120 120
 	 * @param null $timezone
121 121
 	 */
122
-	protected function __construct( $timezone = NULL ) {
123
-		$this->singular_item = __('Attendee','event_espresso');
124
-		$this->plural_item = __('Attendees','event_espresso');
122
+	protected function __construct($timezone = NULL) {
123
+		$this->singular_item = __('Attendee', 'event_espresso');
124
+		$this->plural_item = __('Attendees', 'event_espresso');
125 125
 		$this->_tables = array(
126 126
 			'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'),
127 127
 			'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID')
@@ -132,38 +132,38 @@  discard block
 block discarded – undo
132 132
 				'ATT_full_name'=>new EE_Plain_Text_Field('post_title', __("Attendee Full Name", "event_espresso"), false, __("Unknown", "event_espresso")),
133 133
 				'ATT_bio'=>new EE_Post_Content_Field('post_content', __("Attendee Biography", "event_espresso"), false, __("No Biography Provided", "event_espresso")),
134 134
 				'ATT_slug'=>new EE_Slug_Field('post_name', __("Attendee URL Slug", "event_espresso"), false),
135
-				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, EE_Datetime_Field::now ),
135
+				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, EE_Datetime_Field::now),
136 136
 				'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")),
137
-				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, EE_Datetime_Field::now ),
138
-				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ),
137
+				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, EE_Datetime_Field::now),
138
+				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false),
139 139
 				'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0),
140
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
140
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
141 141
 				'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish')
142 142
 			),
143 143
 			'Attendee_Meta'=>array(
144
-				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false),
144
+				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false),
145 145
 				'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false),
146
-				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''),
147
-				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''),
148
-				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''),
149
-				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''),
150
-				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''),
151
-				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'),
152
-				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'),
153
-				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''),
154
-				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''),
155
-				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '')
146
+				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''),
147
+				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''),
148
+				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''),
149
+				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''),
150
+				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''),
151
+				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'),
152
+				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'),
153
+				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''),
154
+				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''),
155
+				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '')
156 156
 			));
157 157
 		$this->_model_relations = array(
158 158
 			'Registration'=>new EE_Has_Many_Relation(),
159 159
 			'State'=>new EE_Belongs_To_Relation(),
160 160
 			'Country'=>new EE_Belongs_To_Relation(),
161
-			'Event'=>new EE_HABTM_Relation('Registration', FALSE ),
161
+			'Event'=>new EE_HABTM_Relation('Registration', FALSE),
162 162
 			'WP_User' => new EE_Belongs_To_Relation(),
163
-			'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletion of attendees even if they have messages in the queue for them.
163
+			'Message' => new EE_Has_Many_Any_Relation(false) //allow deletion of attendees even if they have messages in the queue for them.
164 164
 		);
165 165
 		$this->_caps_slug = 'contacts';
166
-		parent::__construct( $timezone );
166
+		parent::__construct($timezone);
167 167
 
168 168
 	}
169 169
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param string $system_question_string
174 174
 	 * @return string|null if not found
175 175
 	 */
176
-	public function get_attendee_field_for_system_question( $system_question_string ) {
177
-		return isset( $this->_system_question_to_attendee_field_name[ $system_question_string ] ) ? $this->_system_question_to_attendee_field_name[ $system_question_string ] : null;
176
+	public function get_attendee_field_for_system_question($system_question_string) {
177
+		return isset($this->_system_question_to_attendee_field_name[$system_question_string]) ? $this->_system_question_to_attendee_field_name[$system_question_string] : null;
178 178
 	}
179 179
 
180 180
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID
186 186
 	 * @return EE_Attendee[]
187 187
 	 */
188
-	public function get_attendees_for_transaction( $transaction_id_or_obj ){
189
-		return $this->get_all( array( array(
188
+	public function get_attendees_for_transaction($transaction_id_or_obj) {
189
+		return $this->get_all(array(array(
190 190
 			  'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj
191 191
 		  )));
192 192
 	}
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	*		@return 		mixed		array on success, FALSE on fail
202 202
 	 * 		@deprecated
203 203
 	*/
204
-	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
204
+	public function get_attendee_by_ID($ATT_ID = FALSE) {
205 205
 		// retrieve a particular EE_Attendee
206
-		return $this->get_one_by_ID( $ATT_ID );
206
+		return $this->get_one_by_ID($ATT_ID);
207 207
 	}
208 208
 
209 209
 
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 	* 		@param		array $where_cols_n_values
217 217
 	*		@return 		mixed		array on success, FALSE on fail
218 218
 	*/
219
-	public function get_attendee( $where_cols_n_values = array() ) {
219
+	public function get_attendee($where_cols_n_values = array()) {
220 220
 
221
-		if ( empty( $where_cols_n_values )) {
221
+		if (empty($where_cols_n_values)) {
222 222
 			return FALSE;
223 223
 		}
224
-		$attendee = $this->get_all( array($where_cols_n_values ));
225
-		if ( ! empty( $attendee )) {
226
-			return array_shift( $attendee );
224
+		$attendee = $this->get_all(array($where_cols_n_values));
225
+		if ( ! empty($attendee)) {
226
+			return array_shift($attendee);
227 227
 		} else {
228 228
 			return FALSE;
229 229
 		}
@@ -239,20 +239,20 @@  discard block
 block discarded – undo
239 239
 	 * @param array $where_cols_n_values
240 240
 	 * @return bool|mixed
241 241
 	 */
242
-	public function find_existing_attendee( $where_cols_n_values = NULL ) {
242
+	public function find_existing_attendee($where_cols_n_values = NULL) {
243 243
 		// search by combo of first and last names plus the email address
244
-		$attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email );
244
+		$attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email);
245 245
 		// no search params means attendee object already exists.
246
-		$where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys;
246
+		$where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys;
247 247
 		$valid_data = TRUE;
248 248
 		// check for required values
249
-		$valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE;
250
-		$valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE;
251
-		$valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE;
249
+		$valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE;
250
+		$valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE;
251
+		$valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE;
252 252
 
253
-		if ( $valid_data ) {
254
-			$attendee = $this->get_attendee( $where_cols_n_values );
255
-			if ( $attendee instanceof EE_Attendee ) {
253
+		if ($valid_data) {
254
+			$attendee = $this->get_attendee($where_cols_n_values);
255
+			if ($attendee instanceof EE_Attendee) {
256 256
 				return $attendee;
257 257
 			}
258 258
 		}
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
              * @param  array $ids array of EE_Registration ids
271 271
              * @return  EE_Attendee[]
272 272
              */
273
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
273
+            public function get_array_of_contacts_from_reg_ids($ids) {
274 274
                 $ids = (array) $ids;
275 275
                 $_where = array(
276
-                    'Registration.REG_ID' => array( 'in', $ids )
276
+                    'Registration.REG_ID' => array('in', $ids)
277 277
                     );
278
-                return $this->get_all( array( $_where ) );
278
+                return $this->get_all(array($_where));
279 279
             }
280 280
 
281 281
 
Please login to merge, or discard this patch.