@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param null $timezone |
23 | 23 | * @return EE_Event_Message_Template|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array(), $timezone = NULL ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
25 | + public static function new_instance($props_n_values = array(), $timezone = NULL) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
27 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @param null $timezone |
35 | 35 | * @return EE_Event_Message_Template |
36 | 36 | */ |
37 | - public static function new_instance_from_db ( $props_n_values = array(), $timezone = NULL ) { |
|
38 | - return new self( $props_n_values, TRUE, $timezone ); |
|
37 | + public static function new_instance_from_db($props_n_values = array(), $timezone = NULL) { |
|
38 | + return new self($props_n_values, TRUE, $timezone); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,18 +1,18 @@ discard block |
||
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 | * Required by EEM_Event_Question_Group in case someone queries for all its model objects |
6 | 6 | */ |
7 | -class EE_Event_Question_Group extends EE_Base_Class{ |
|
7 | +class EE_Event_Question_Group extends EE_Base_Class { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @param array $props_n_values |
11 | 11 | * @return EE_Event_Question_Group|mixed |
12 | 12 | */ |
13 | - public static function new_instance( $props_n_values = array() ) { |
|
14 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
15 | - return $has_object ? $has_object : new self( $props_n_values); |
|
13 | + public static function new_instance($props_n_values = array()) { |
|
14 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
15 | + return $has_object ? $has_object : new self($props_n_values); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param array $props_n_values |
22 | 22 | * @return EE_Event_Question_Group |
23 | 23 | */ |
24 | - public static function new_instance_from_db ( $props_n_values = array() ) { |
|
25 | - return new self( $props_n_values, TRUE ); |
|
24 | + public static function new_instance_from_db($props_n_values = array()) { |
|
25 | + return new self($props_n_values, TRUE); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -2,15 +2,15 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Required by EEM_Event_Question_Group in case someone queries for all its model objects |
4 | 4 | */ |
5 | -class EE_Event_Venue extends EE_Base_Class{ |
|
5 | +class EE_Event_Venue extends EE_Base_Class { |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * @param array $props_n_values |
9 | 9 | * @return EE_Event_Venue|mixed |
10 | 10 | */ |
11 | - public static function new_instance( $props_n_values = array() ) { |
|
12 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
13 | - return $has_object ? $has_object : new self( $props_n_values); |
|
11 | + public static function new_instance($props_n_values = array()) { |
|
12 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
13 | + return $has_object ? $has_object : new self($props_n_values); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | * @param array $props_n_values |
20 | 20 | * @return EE_Event_Venue |
21 | 21 | */ |
22 | - public static function new_instance_from_db ( $props_n_values = array() ) { |
|
23 | - return new self( $props_n_values, TRUE ); |
|
22 | + public static function new_instance_from_db($props_n_values = array()) { |
|
23 | + return new self($props_n_values, TRUE); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
3 | 3 | /** |
4 | 4 | * Event Espresso |
5 | 5 | * |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * ------------------------------------------------------------------------ |
25 | 25 | */ |
26 | -class EE_Payment_Method extends EE_Base_Class{ |
|
26 | +class EE_Payment_Method extends EE_Base_Class { |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Payment Method type object, which has all the info about this type of payment method, |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param array $props_n_values |
40 | 40 | * @return EE_Payment_Method |
41 | 41 | */ |
42 | - public static function new_instance( $props_n_values = array()) { |
|
43 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
44 | - return $has_object ? $has_object : new self( $props_n_values, FALSE ); |
|
42 | + public static function new_instance($props_n_values = array()) { |
|
43 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
44 | + return $has_object ? $has_object : new self($props_n_values, FALSE); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @param array $props_n_values |
52 | 52 | * @return EE_Payment_Method |
53 | 53 | */ |
54 | - public static function new_instance_from_db ( $props_n_values = array()) { |
|
55 | - return new self( $props_n_values, TRUE ); |
|
54 | + public static function new_instance_from_db($props_n_values = array()) { |
|
55 | + return new self($props_n_values, TRUE); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return boolean |
82 | 82 | */ |
83 | 83 | function active() { |
84 | - return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()),$this->scope()); |
|
84 | + return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()), $this->scope()); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * Sets this PM as active by making it usable within the CART scope. Offline gateways |
91 | 91 | * are also usable from the admin-scope as well. DOES NOT SAVE it |
92 | 92 | */ |
93 | - function set_active(){ |
|
93 | + function set_active() { |
|
94 | 94 | $default_scopes = array(EEM_Payment_Method::scope_cart); |
95 | - if($this->type_obj() && |
|
96 | - $this->type_obj()->payment_occurs() == EE_PMT_Base::offline){ |
|
95 | + if ($this->type_obj() && |
|
96 | + $this->type_obj()->payment_occurs() == EE_PMT_Base::offline) { |
|
97 | 97 | $default_scopes[] = EEM_Payment_Method::scope_admin; |
98 | 98 | } |
99 | 99 | $this->set_scope($default_scopes); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Makes this payment method apply to NO scopes at all. DOES NOT SAVE it. |
106 | 106 | */ |
107 | - function deactivate(){ |
|
107 | + function deactivate() { |
|
108 | 108 | $this->set_scope(array()); |
109 | 109 | } |
110 | 110 | |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @param type $field_value |
296 | 296 | * @param type $use_default |
297 | 297 | */ |
298 | - function set( $field_name, $field_value, $use_default = FALSE ){ |
|
299 | - if( $field_name == 'PMD_type' ){ |
|
298 | + function set($field_name, $field_value, $use_default = FALSE) { |
|
299 | + if ($field_name == 'PMD_type') { |
|
300 | 300 | //the type has probably changed, so forget about its old type object |
301 | 301 | $this->_type_obj = NULL; |
302 | 302 | } |
@@ -370,26 +370,26 @@ discard block |
||
370 | 370 | * @return EE_PMT_Base |
371 | 371 | * @throws EE_Error |
372 | 372 | */ |
373 | - public function type_obj(){ |
|
374 | - if( ! $this->_type_obj ) { |
|
375 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
376 | - if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $this->type() )) { |
|
377 | - $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type( $this->type() ); |
|
378 | - if ( ! class_exists( $class_name )) { |
|
373 | + public function type_obj() { |
|
374 | + if ( ! $this->_type_obj) { |
|
375 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
376 | + if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($this->type())) { |
|
377 | + $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type($this->type()); |
|
378 | + if ( ! class_exists($class_name)) { |
|
379 | 379 | throw new EE_Error( |
380 | 380 | sprintf( |
381 | - __( 'An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', 'event_espresso' ), |
|
381 | + __('An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', 'event_espresso'), |
|
382 | 382 | $class_name, |
383 | 383 | '<br />', |
384 | - '<a href="' . admin_url('plugins.php') . '">', |
|
384 | + '<a href="'.admin_url('plugins.php').'">', |
|
385 | 385 | '</a>' |
386 | 386 | ) |
387 | 387 | ); |
388 | 388 | } |
389 | - $r = new ReflectionClass( $class_name ); |
|
390 | - $this->_type_obj = $r->newInstanceArgs( array( $this )); |
|
389 | + $r = new ReflectionClass($class_name); |
|
390 | + $this->_type_obj = $r->newInstanceArgs(array($this)); |
|
391 | 391 | } else { |
392 | - throw new EE_Error( sprintf( __( 'A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso' ), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names() ) ) ); |
|
392 | + throw new EE_Error(sprintf(__('A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso'), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names()))); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | return $this->_type_obj; |
@@ -402,18 +402,18 @@ discard block |
||
402 | 402 | * and the extra meta. Mostly used for passing off ot gateways. * |
403 | 403 | * @return array |
404 | 404 | */ |
405 | - public function settings_array(){ |
|
405 | + public function settings_array() { |
|
406 | 406 | $fields = $this->model_field_array(); |
407 | 407 | $extra_meta = $this->all_extra_meta_array(); |
408 | 408 | //remove the model's prefix from the fields |
409 | 409 | $combined_settings_array = array(); |
410 | - foreach($fields as $key => $value){ |
|
411 | - if(strpos($key, 'PMD_')===0){ |
|
410 | + foreach ($fields as $key => $value) { |
|
411 | + if (strpos($key, 'PMD_') === 0) { |
|
412 | 412 | $key_sans_model_prefix = str_replace('PMD_', '', $key); |
413 | 413 | $combined_settings_array [$key_sans_model_prefix] = $value; |
414 | 414 | } |
415 | 415 | } |
416 | - $combined_settings_array = array_merge( $extra_meta,$combined_settings_array ); |
|
416 | + $combined_settings_array = array_merge($extra_meta, $combined_settings_array); |
|
417 | 417 | return $combined_settings_array; |
418 | 418 | } |
419 | 419 | |
@@ -425,12 +425,12 @@ discard block |
||
425 | 425 | * @param string $css_class |
426 | 426 | * @return string of HTML for displaying the button |
427 | 427 | */ |
428 | - public function button_html( $url = '', $css_class = '' ){ |
|
428 | + public function button_html($url = '', $css_class = '') { |
|
429 | 429 | $payment_occurs = $this->type_obj()->payment_occurs(); |
430 | 430 | return ' |
431 | - <div id="' . $this->slug() . '-payment-option-dv" class="'. $payment_occurs .'-payment-gateway reg-page-payment-option-dv' . $css_class . '"> |
|
432 | - <a id="payment-gateway-button-' . $this->slug() . '" class="reg-page-payment-option-lnk" rel="' . $this->slug() . '" href="' . $url . '" > |
|
433 | - <img src="' . $this->button_url() . '" alt="' . sprintf( esc_attr__( 'Pay using %s', 'event_espresso' ), $this->get_pretty('PMD_name','form_input') ) . '" /> |
|
431 | + <div id="' . $this->slug().'-payment-option-dv" class="'.$payment_occurs.'-payment-gateway reg-page-payment-option-dv'.$css_class.'"> |
|
432 | + <a id="payment-gateway-button-' . $this->slug().'" class="reg-page-payment-option-lnk" rel="'.$this->slug().'" href="'.$url.'" > |
|
433 | + <img src="' . $this->button_url().'" alt="'.sprintf(esc_attr__('Pay using %s', 'event_espresso'), $this->get_pretty('PMD_name', 'form_input')).'" /> |
|
434 | 434 | </a> |
435 | 435 | </div> |
436 | 436 | '; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * (as defined by the gateway and the currently active currencies) |
444 | 444 | * @return EE_Currency[] |
445 | 445 | */ |
446 | - public function get_all_usable_currencies(){ |
|
446 | + public function get_all_usable_currencies() { |
|
447 | 447 | return EEM_Currency::instance()->get_all_currencies_usable_by($this->type_obj()); |
448 | 448 | } |
449 | 449 | |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | * @param string $currency_code currency ID (code) |
453 | 453 | * @return boolean |
454 | 454 | */ |
455 | - public function usable_for_currency( $currency_code ) { |
|
456 | - foreach( $this->get_all_usable_currencies() as $currency_obj ) { |
|
457 | - if( $currency_obj->ID() == $currency_code ){ |
|
455 | + public function usable_for_currency($currency_code) { |
|
456 | + foreach ($this->get_all_usable_currencies() as $currency_obj) { |
|
457 | + if ($currency_obj->ID() == $currency_code) { |
|
458 | 458 | return TRUE; |
459 | 459 | } |
460 | 460 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * Returns TRUE if this payment method's gateway is an instance of EE_Onsite_Gateway |
468 | 468 | * @return bool |
469 | 469 | */ |
470 | - public function is_on_site(){ |
|
470 | + public function is_on_site() { |
|
471 | 471 | return $this->type_obj()->payment_occurs() == EE_PMT_Base::onsite; |
472 | 472 | } |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * Returns TRUE if this payment method's gateway is an instance of EE_Offsite_Gateway |
478 | 478 | * @return bool |
479 | 479 | */ |
480 | - public function is_off_site(){ |
|
480 | + public function is_off_site() { |
|
481 | 481 | return $this->type_obj()->payment_occurs() == EE_PMT_Base::offsite; |
482 | 482 | } |
483 | 483 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * Returns TRUE if this payment method does not utilize a gateway |
488 | 488 | * @return bool |
489 | 489 | */ |
490 | - public function is_off_line(){ |
|
490 | + public function is_off_line() { |
|
491 | 491 | return $this->type_obj()->payment_occurs() == EE_PMT_Base::offline; |
492 | 492 | } |
493 | 493 | |
@@ -497,10 +497,10 @@ discard block |
||
497 | 497 | * to load the required classes, and don't need them at the time of unserialization |
498 | 498 | * @return array |
499 | 499 | */ |
500 | - public function __sleep(){ |
|
501 | - $properties = get_object_vars( $this ); |
|
502 | - unset( $properties[ '_type_obj' ] ); |
|
503 | - return array_keys( $properties ); |
|
500 | + public function __sleep() { |
|
501 | + $properties = get_object_vars($this); |
|
502 | + unset($properties['_type_obj']); |
|
503 | + return array_keys($properties); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
3 | 5 | /** |
4 | 6 | * Event Espresso |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | /** |
114 | 114 | * Gets button_url |
115 | - * @return string |
|
115 | + * @return boolean |
|
116 | 116 | */ |
117 | 117 | function button_url() { |
118 | 118 | return $this->get('PMD_button_url'); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | /** |
154 | 154 | * Gets description |
155 | - * @return string |
|
155 | + * @return boolean |
|
156 | 156 | */ |
157 | 157 | function description() { |
158 | 158 | return $this->get('PMD_desc'); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | /** |
174 | 174 | * Gets name |
175 | - * @return string |
|
175 | + * @return boolean |
|
176 | 176 | */ |
177 | 177 | function name() { |
178 | 178 | return $this->get('PMD_name'); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | /** |
214 | 214 | * Gets order |
215 | - * @return int |
|
215 | + * @return boolean |
|
216 | 216 | */ |
217 | 217 | function order() { |
218 | 218 | return $this->get('PMD_order'); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | /** |
234 | 234 | * Gets slug |
235 | - * @return string |
|
235 | + * @return boolean |
|
236 | 236 | */ |
237 | 237 | function slug() { |
238 | 238 | return $this->get('PMD_slug'); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | /** |
254 | 254 | * Gets type |
255 | - * @return string |
|
255 | + * @return boolean |
|
256 | 256 | */ |
257 | 257 | function type() { |
258 | 258 | return $this->get('PMD_type'); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | /** |
274 | 274 | * Gets wp_user |
275 | - * @return int |
|
275 | + * @return boolean |
|
276 | 276 | */ |
277 | 277 | function wp_user() { |
278 | 278 | return $this->get('PMD_wp_user'); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Gets admin_name |
310 | - * @return string |
|
310 | + * @return boolean |
|
311 | 311 | */ |
312 | 312 | function admin_name() { |
313 | 313 | return $this->get('PMD_admin_name'); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | /** |
329 | 329 | * Gets admin_desc |
330 | - * @return string |
|
330 | + * @return boolean |
|
331 | 331 | */ |
332 | 332 | function admin_desc() { |
333 | 333 | return $this->get('PMD_admin_desc'); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | /** |
349 | 349 | * Gets scope |
350 | - * @return array |
|
350 | + * @return boolean |
|
351 | 351 | */ |
352 | 352 | function scope() { |
353 | 353 | return $this->get('PMD_scope'); |
@@ -2,15 +2,15 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Required by EEM_Question_Group_Question in case someone queries for all its model objects |
4 | 4 | */ |
5 | -class EE_Question_Group_Question extends EE_Base_Class{ |
|
5 | +class EE_Question_Group_Question extends EE_Base_Class { |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * @param array $props_n_values |
9 | 9 | * @return EE_Question_Group_Question|mixed |
10 | 10 | */ |
11 | - public static function new_instance( $props_n_values = array() ) { |
|
12 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
13 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
11 | + public static function new_instance($props_n_values = array()) { |
|
12 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
13 | + return $has_object ? $has_object : new self($props_n_values); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param array $props_n_values |
20 | 20 | * @return EE_Question_Group_Question |
21 | 21 | */ |
22 | - public static function new_instance_from_db ( $props_n_values = array() ) { |
|
23 | - return new self( $props_n_values, TRUE ); |
|
22 | + public static function new_instance_from_db($props_n_values = array()) { |
|
23 | + return new self($props_n_values, TRUE); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
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_Registration class |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * date_format and the second value is the time format |
42 | 42 | * @return EE_Registration |
43 | 43 | */ |
44 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
45 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
46 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
44 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
45 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
46 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * the website will be used. |
55 | 55 | * @return EE_Registration |
56 | 56 | */ |
57 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
58 | - return new self( $props_n_values, TRUE, $timezone ); |
|
57 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
58 | + return new self($props_n_values, TRUE, $timezone); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @access public |
67 | 67 | * @param int $EVT_ID Event ID |
68 | 68 | */ |
69 | - public function set_event( $EVT_ID = 0 ) { |
|
70 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
69 | + public function set_event($EVT_ID = 0) { |
|
70 | + $this->set('EVT_ID', $EVT_ID); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | * @param mixed $field_value |
79 | 79 | * @param bool $use_default |
80 | 80 | */ |
81 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
82 | - switch( $field_name ) { |
|
81 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
82 | + switch ($field_name) { |
|
83 | 83 | case 'REG_code' : |
84 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
85 | - $this->set_reg_code( $field_value, $use_default ); |
|
84 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
85 | + $this->set_reg_code($field_value, $use_default); |
|
86 | 86 | } |
87 | 87 | break; |
88 | 88 | case 'STS_ID' : |
89 | - $this->set_status( $field_value, $use_default ); |
|
89 | + $this->set_status($field_value, $use_default); |
|
90 | 90 | break; |
91 | 91 | default : |
92 | - parent::set( $field_name, $field_value, $use_default ); |
|
92 | + parent::set($field_name, $field_value, $use_default); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -106,30 +106,30 @@ discard block |
||
106 | 106 | * @param boolean $use_default |
107 | 107 | * @return bool |
108 | 108 | */ |
109 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
109 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
110 | 110 | // get current REG_Status |
111 | 111 | $old_STS_ID = $this->status_ID(); |
112 | 112 | // if status has changed |
113 | - if ( $old_STS_ID != $new_STS_ID ) { |
|
113 | + if ($old_STS_ID != $new_STS_ID) { |
|
114 | 114 | // TO approved |
115 | - if ( $new_STS_ID == EEM_Registration::status_id_approved ) { |
|
115 | + if ($new_STS_ID == EEM_Registration::status_id_approved) { |
|
116 | 116 | // reserve a space by incrementing ticket and datetime sold values |
117 | 117 | $this->_reserve_registration_space(); |
118 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
118 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
119 | 119 | // OR FROM approved |
120 | - } else if ( $old_STS_ID == EEM_Registration::status_id_approved ) { |
|
120 | + } else if ($old_STS_ID == EEM_Registration::status_id_approved) { |
|
121 | 121 | // release a space by decrementing ticket and datetime sold values |
122 | 122 | $this->_release_registration_space(); |
123 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
123 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
124 | 124 | } |
125 | 125 | // update status |
126 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
127 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
126 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
127 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
128 | 128 | return TRUE; |
129 | - }else{ |
|
129 | + } else { |
|
130 | 130 | //even though the old value matches the new value, it's still good to |
131 | 131 | //allow the parent set method to have a say |
132 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
132 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
133 | 133 | return TRUE; |
134 | 134 | } |
135 | 135 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @access public |
142 | 142 | */ |
143 | 143 | public function status_ID() { |
144 | - return $this->get( 'STS_ID' ); |
|
144 | + return $this->get('STS_ID'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | $ticket->increase_sold(); |
156 | 156 | $ticket->save(); |
157 | 157 | $datetimes = $ticket->datetimes(); |
158 | - if ( is_array( $datetimes ) ) { |
|
159 | - foreach ( $datetimes as $datetime ) { |
|
160 | - if ( $datetime instanceof EE_Datetime ) { |
|
158 | + if (is_array($datetimes)) { |
|
159 | + foreach ($datetimes as $datetime) { |
|
160 | + if ($datetime instanceof EE_Datetime) { |
|
161 | 161 | $datetime->increase_sold(); |
162 | 162 | $datetime->save(); |
163 | 163 | } |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | * @param boolean $include_archived whether to include archived tickets or not. |
176 | 176 | * @return EE_Ticket |
177 | 177 | */ |
178 | - public function ticket( $include_archived = TRUE ) { |
|
178 | + public function ticket($include_archived = TRUE) { |
|
179 | 179 | $query_params = array(); |
180 | - if ( $include_archived ) { |
|
181 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
180 | + if ($include_archived) { |
|
181 | + $query_params['default_where_conditions'] = 'none'; |
|
182 | 182 | } |
183 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
183 | + return $this->get_first_related('Ticket', $query_params); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return EE_Event |
191 | 191 | */ |
192 | 192 | public function event() { |
193 | - return $this->get_first_related( 'Event' ); |
|
193 | + return $this->get_first_related('Event'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function wp_user() { |
206 | 206 | $event = $this->event(); |
207 | - if ( $event instanceof EE_Event ) { |
|
207 | + if ($event instanceof EE_Event) { |
|
208 | 208 | return $event->wp_user(); |
209 | 209 | } |
210 | 210 | return 0; |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | $ticket->decrease_sold(); |
222 | 222 | $ticket->save(); |
223 | 223 | $datetimes = $ticket->datetimes(); |
224 | - if ( is_array( $datetimes ) ) { |
|
225 | - foreach ( $datetimes as $datetime ) { |
|
226 | - if ( $datetime instanceof EE_Datetime ) { |
|
224 | + if (is_array($datetimes)) { |
|
225 | + foreach ($datetimes as $datetime) { |
|
226 | + if ($datetime instanceof EE_Datetime) { |
|
227 | 227 | $datetime->decrease_sold(); |
228 | 228 | $datetime->save(); |
229 | 229 | } |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | * @access public |
240 | 240 | * @param int $ATT_ID Attendee ID |
241 | 241 | */ |
242 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
243 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
242 | + public function set_attendee_id($ATT_ID = 0) { |
|
243 | + $this->set('ATT_ID', $ATT_ID); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | * @access public |
252 | 252 | * @param int $TXN_ID Transaction ID |
253 | 253 | */ |
254 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
255 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
254 | + public function set_transaction_id($TXN_ID = 0) { |
|
255 | + $this->set('TXN_ID', $TXN_ID); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | * @access public |
264 | 264 | * @param string $REG_session PHP Session ID |
265 | 265 | */ |
266 | - public function set_session( $REG_session = '' ) { |
|
267 | - $this->set( 'REG_session', $REG_session ); |
|
266 | + public function set_session($REG_session = '') { |
|
267 | + $this->set('REG_session', $REG_session); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | * @access public |
276 | 276 | * @param string $REG_url_link Registration URL Link |
277 | 277 | */ |
278 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
279 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
278 | + public function set_reg_url_link($REG_url_link = '') { |
|
279 | + $this->set('REG_url_link', $REG_url_link); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | * @access public |
288 | 288 | * @param int $REG_count Primary Attendee |
289 | 289 | */ |
290 | - public function set_count( $REG_count = 1 ) { |
|
291 | - $this->set( 'REG_count', $REG_count ); |
|
290 | + public function set_count($REG_count = 1) { |
|
291 | + $this->set('REG_count', $REG_count); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | * @access public |
300 | 300 | * @param boolean $REG_group_size Group Registration |
301 | 301 | */ |
302 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
303 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
302 | + public function set_group_size($REG_group_size = FALSE) { |
|
303 | + $this->set('REG_group_size', $REG_group_size); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | * @access public |
384 | 384 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
385 | 385 | */ |
386 | - public function set_reg_date( $REG_date = FALSE ) { |
|
387 | - $this->set( 'REG_date', $REG_date ); |
|
386 | + public function set_reg_date($REG_date = FALSE) { |
|
387 | + $this->set('REG_date', $REG_date); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -395,8 +395,8 @@ discard block |
||
395 | 395 | * @access public |
396 | 396 | * @param float $REG_final_price |
397 | 397 | */ |
398 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
399 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
398 | + public function set_final_price($REG_final_price = 0.00) { |
|
399 | + $this->set('REG_final_price', $REG_final_price); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | * @access public |
408 | 408 | * @param float $REG_paid |
409 | 409 | */ |
410 | - public function set_paid( $REG_paid = 0.00 ) { |
|
411 | - $this->set( 'REG_paid', $REG_paid ); |
|
410 | + public function set_paid($REG_paid = 0.00) { |
|
411 | + $this->set('REG_paid', $REG_paid); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | * @access public |
420 | 420 | * @param boolean $REG_att_is_going Attendee Is Going |
421 | 421 | */ |
422 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
423 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
422 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
423 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @return EE_Attendee |
431 | 431 | */ |
432 | 432 | public function attendee() { |
433 | - return $this->get_first_related( 'Attendee' ); |
|
433 | + return $this->get_first_related('Attendee'); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @access public |
441 | 441 | */ |
442 | 442 | public function event_ID() { |
443 | - return $this->get( 'EVT_ID' ); |
|
443 | + return $this->get('EVT_ID'); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | */ |
452 | 452 | public function event_name() { |
453 | 453 | $event = $this->event_obj(); |
454 | - if ( $event ) { |
|
454 | + if ($event) { |
|
455 | 455 | return $event->name(); |
456 | 456 | } else { |
457 | 457 | return NULL; |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * @return EE_Event |
466 | 466 | */ |
467 | 467 | public function event_obj() { |
468 | - return $this->get_first_related( 'Event' ); |
|
468 | + return $this->get_first_related('Event'); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * @access public |
476 | 476 | */ |
477 | 477 | public function attendee_ID() { |
478 | - return $this->get( 'ATT_ID' ); |
|
478 | + return $this->get('ATT_ID'); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @access public |
486 | 486 | */ |
487 | 487 | public function session_ID() { |
488 | - return $this->get( 'REG_session' ); |
|
488 | + return $this->get('REG_session'); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
496 | 496 | * @return string |
497 | 497 | */ |
498 | - public function receipt_url( $messenger = 'html' ) { |
|
498 | + public function receipt_url($messenger = 'html') { |
|
499 | 499 | |
500 | 500 | /** |
501 | 501 | * The below will be deprecated one version after this. We check first if there is a custom receipt template already in use on old system. If there is then we just return the standard url for it. |
@@ -504,12 +504,12 @@ discard block |
||
504 | 504 | */ |
505 | 505 | EE_Registry::instance()->load_helper('Template'); |
506 | 506 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
507 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
507 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
508 | 508 | |
509 | - if ( $has_custom ) { |
|
510 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
509 | + if ($has_custom) { |
|
510 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
511 | 511 | } |
512 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
512 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
521 | 521 | * @return string |
522 | 522 | */ |
523 | - public function invoice_url( $messenger = 'html' ) { |
|
523 | + public function invoice_url($messenger = 'html') { |
|
524 | 524 | /** |
525 | 525 | * The below will be deprecated one version after this. We check first if there is a custom invoice template already in use on old system. If there is then we just return the standard url for it. |
526 | 526 | * |
@@ -528,21 +528,21 @@ discard block |
||
528 | 528 | */ |
529 | 529 | EE_Registry::instance()->load_helper('Template'); |
530 | 530 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
531 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
531 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
532 | 532 | |
533 | - if ( $has_custom ) { |
|
534 | - if ( $messenger == 'html' ) { |
|
535 | - return $this->invoice_url( 'launch' ); |
|
533 | + if ($has_custom) { |
|
534 | + if ($messenger == 'html') { |
|
535 | + return $this->invoice_url('launch'); |
|
536 | 536 | } |
537 | 537 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
538 | 538 | |
539 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
540 | - if ( $messenger == 'html' ) { |
|
539 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
540 | + if ($messenger == 'html') { |
|
541 | 541 | $query_args['html'] = TRUE; |
542 | 542 | } |
543 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
543 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
544 | 544 | } |
545 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
545 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | * @access public |
553 | 553 | */ |
554 | 554 | public function reg_url_link() { |
555 | - return $this->get( 'REG_url_link' ); |
|
555 | + return $this->get('REG_url_link'); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
563 | 563 | * @return void |
564 | 564 | */ |
565 | - public function e_invoice_url( $type = 'launch' ) { |
|
566 | - echo $this->invoice_url( $type ); |
|
565 | + public function e_invoice_url($type = 'launch') { |
|
566 | + echo $this->invoice_url($type); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | * @return string |
584 | 584 | */ |
585 | 585 | public function payment_overview_url() { |
586 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
586 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * @return string |
595 | 595 | */ |
596 | 596 | public function edit_attendee_information_url() { |
597 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
597 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | |
@@ -604,8 +604,8 @@ discard block |
||
604 | 604 | * @return string |
605 | 605 | */ |
606 | 606 | public function get_admin_edit_url() { |
607 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
608 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
607 | + EE_Registry::instance()->load_helper('URL'); |
|
608 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | * @access public |
616 | 616 | */ |
617 | 617 | public function is_primary_registrant() { |
618 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
618 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -624,12 +624,12 @@ discard block |
||
624 | 624 | * This returns the primary registration object for this registration group (which may be this object). |
625 | 625 | * @return EE_Registration |
626 | 626 | */ |
627 | - public function get_primary_registration() { |
|
628 | - if ( $this->is_primary_registrant() ) |
|
627 | + public function get_primary_registration() { |
|
628 | + if ($this->is_primary_registrant()) |
|
629 | 629 | return $this; |
630 | 630 | |
631 | 631 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
632 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
632 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
633 | 633 | return $primary_registrant; |
634 | 634 | } |
635 | 635 | |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | * @access public |
641 | 641 | */ |
642 | 642 | public function count() { |
643 | - return $this->get( 'REG_count' ); |
|
643 | + return $this->get('REG_count'); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @access public |
651 | 651 | */ |
652 | 652 | public function group_size() { |
653 | - return $this->get( 'REG_group_size' ); |
|
653 | + return $this->get('REG_group_size'); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | * @access public |
661 | 661 | */ |
662 | 662 | public function date() { |
663 | - return $this->get( 'REG_date' ); |
|
663 | + return $this->get('REG_date'); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | |
@@ -671,8 +671,8 @@ discard block |
||
671 | 671 | * @param string $time_format |
672 | 672 | * @return string |
673 | 673 | */ |
674 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
675 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
674 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
675 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * @return float |
686 | 686 | */ |
687 | 687 | public function final_price() { |
688 | - return $this->get( 'REG_final_price' ); |
|
688 | + return $this->get('REG_final_price'); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | * @return string |
697 | 697 | */ |
698 | 698 | public function pretty_final_price() { |
699 | - return $this->get_pretty( 'REG_final_price' ); |
|
699 | + return $this->get_pretty('REG_final_price'); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * @return float |
708 | 708 | */ |
709 | 709 | public function paid() { |
710 | - return $this->get( 'REG_paid' ); |
|
710 | + return $this->get('REG_paid'); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | * @return float |
719 | 719 | */ |
720 | 720 | public function pretty_paid() { |
721 | - return $this->get_pretty( 'REG_paid' ); |
|
721 | + return $this->get_pretty('REG_paid'); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
@@ -730,11 +730,11 @@ discard block |
||
730 | 730 | * @param array $requires_payment |
731 | 731 | * @return bool |
732 | 732 | */ |
733 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
733 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
734 | 734 | // these reg statuses require payment (if event is not free) |
735 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
735 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
736 | 736 | if ( |
737 | - in_array( $this->status_ID(), $requires_payment ) && |
|
737 | + in_array($this->status_ID(), $requires_payment) && |
|
738 | 738 | $this->final_price() != 0 && |
739 | 739 | $this->final_price() != $this->paid() |
740 | 740 | ) { |
@@ -751,8 +751,8 @@ discard block |
||
751 | 751 | * @param bool $show_icons |
752 | 752 | * @return void |
753 | 753 | */ |
754 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
755 | - echo $this->pretty_status( $show_icons ); |
|
754 | + public function e_pretty_status($show_icons = FALSE) { |
|
755 | + echo $this->pretty_status($show_icons); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | |
@@ -763,10 +763,10 @@ discard block |
||
763 | 763 | * @param bool $show_icons |
764 | 764 | * @return string |
765 | 765 | */ |
766 | - public function pretty_status( $show_icons = FALSE ) { |
|
767 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
766 | + public function pretty_status($show_icons = FALSE) { |
|
767 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
768 | 768 | $icon = ''; |
769 | - switch ( $this->status_ID() ) { |
|
769 | + switch ($this->status_ID()) { |
|
770 | 770 | case EEM_Registration::status_id_approved: |
771 | 771 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
772 | 772 | break; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
787 | 787 | break; |
788 | 788 | } |
789 | - return $icon . $status[ $this->status_ID() ]; |
|
789 | + return $icon.$status[$this->status_ID()]; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @access public |
797 | 797 | */ |
798 | 798 | public function att_is_going() { |
799 | - return $this->get( 'REG_att_is_going' ); |
|
799 | + return $this->get('REG_att_is_going'); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | * @param array $query_params like EEM_Base::get_all |
807 | 807 | * @return EE_Answer[] |
808 | 808 | */ |
809 | - public function answers( $query_params = NULL ) { |
|
810 | - return $this->get_many_related( 'Answer', $query_params ); |
|
809 | + public function answers($query_params = NULL) { |
|
810 | + return $this->get_many_related('Answer', $query_params); |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | |
@@ -821,9 +821,9 @@ discard block |
||
821 | 821 | * (because the answer might be an array of answer values, so passing pretty_value=true |
822 | 822 | * will convert it into some kind of string) |
823 | 823 | */ |
824 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
824 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
825 | 825 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
826 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
826 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | /** |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | * @return string |
833 | 833 | */ |
834 | 834 | public function reg_date() { |
835 | - return $this->get_datetime( 'REG_date' ); |
|
835 | + return $this->get_datetime('REG_date'); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | * @return EE_Datetime_Ticket |
845 | 845 | */ |
846 | 846 | public function datetime_ticket() { |
847 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
847 | + return $this->get_first_related('Datetime_Ticket'); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | |
@@ -854,15 +854,15 @@ discard block |
||
854 | 854 | * @param EE_Datetime_Ticket $datetime_ticket |
855 | 855 | * @return EE_Datetime_Ticket |
856 | 856 | */ |
857 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
858 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
857 | + public function set_datetime_ticket($datetime_ticket) { |
|
858 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
859 | 859 | } |
860 | 860 | /** |
861 | 861 | * Gets deleted |
862 | 862 | * @return boolean |
863 | 863 | */ |
864 | 864 | public function deleted() { |
865 | - return $this->get( 'REG_deleted' ); |
|
865 | + return $this->get('REG_deleted'); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | /** |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | * @return boolean |
872 | 872 | */ |
873 | 873 | public function set_deleted($deleted) { |
874 | - $this->set( 'REG_deleted', $deleted ); |
|
874 | + $this->set('REG_deleted', $deleted); |
|
875 | 875 | } |
876 | 876 | |
877 | 877 | |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | * @return EE_Status |
882 | 882 | */ |
883 | 883 | public function status_obj() { |
884 | - return $this->get_first_related( 'Status' ); |
|
884 | + return $this->get_first_related('Status'); |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | * @return int |
893 | 893 | */ |
894 | 894 | public function count_checkins() { |
895 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
895 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | * @return int |
903 | 903 | */ |
904 | 904 | public function count_checkins_not_checkedout() { |
905 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
905 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | |
@@ -915,20 +915,20 @@ discard block |
||
915 | 915 | * |
916 | 916 | * @return bool |
917 | 917 | */ |
918 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
919 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
918 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
919 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
920 | 920 | |
921 | 921 | //first check registration status |
922 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
922 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
923 | 923 | return false; |
924 | 924 | } |
925 | 925 | //is there a datetime ticket that matches this dtt_ID? |
926 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
926 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
927 | 927 | return false; |
928 | 928 | } |
929 | 929 | |
930 | 930 | //final check is against TKT_uses |
931 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
931 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
@@ -941,10 +941,10 @@ discard block |
||
941 | 941 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
942 | 942 | * @return bool true means can checkin. false means cannot checkin. |
943 | 943 | */ |
944 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
945 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
944 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
945 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
946 | 946 | |
947 | - if ( ! $DTT_ID ) { |
|
947 | + if ( ! $DTT_ID) { |
|
948 | 948 | return false; |
949 | 949 | } |
950 | 950 | |
@@ -952,23 +952,23 @@ discard block |
||
952 | 952 | |
953 | 953 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
954 | 954 | // or not. |
955 | - if ( ! $max_uses || $max_uses === INF ) { |
|
955 | + if ( ! $max_uses || $max_uses === INF) { |
|
956 | 956 | return true; |
957 | 957 | } |
958 | 958 | |
959 | 959 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
960 | 960 | //go ahead and toggle. |
961 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
961 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
962 | 962 | return true; |
963 | 963 | } |
964 | 964 | |
965 | 965 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
966 | 966 | //disallows further check-ins. |
967 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
967 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
968 | 968 | // checkins have already reached their max number of uses |
969 | 969 | // so registrant can NOT checkin |
970 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
971 | - EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
970 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
971 | + EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
972 | 972 | return false; |
973 | 973 | } |
974 | 974 | return true; |
@@ -989,15 +989,15 @@ discard block |
||
989 | 989 | * @param bool $verify If true then can_checkin() is used to verify whether the person can be checked in or not. Otherwise this forces change in checkin status. |
990 | 990 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
991 | 991 | */ |
992 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
993 | - if ( empty( $DTT_ID ) ) { |
|
992 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
993 | + if (empty($DTT_ID)) { |
|
994 | 994 | $datetime = $this->get_related_primary_datetime(); |
995 | 995 | $DTT_ID = $datetime->ID(); |
996 | 996 | // verify the registration can checkin for the given DTT_ID |
997 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
997 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
998 | 998 | EE_Error::add_error( |
999 | 999 | sprintf( |
1000 | - __( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), |
|
1000 | + __('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), |
|
1001 | 1001 | because the registration does not have access', 'event_espresso'), |
1002 | 1002 | $this->ID(), |
1003 | 1003 | $DTT_ID |
@@ -1012,8 +1012,8 @@ discard block |
||
1012 | 1012 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
1013 | 1013 | ); |
1014 | 1014 | //start by getting the current status so we know what status we'll be changing to. |
1015 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
1016 | - $status_to = $status_paths[ $cur_status ]; |
|
1015 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
1016 | + $status_to = $status_paths[$cur_status]; |
|
1017 | 1017 | // database only records true for checked IN or false for checked OUT |
1018 | 1018 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
1019 | 1019 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1021,24 +1021,24 @@ discard block |
||
1021 | 1021 | // because we are keeping track of Check-ins over time. |
1022 | 1022 | // Eventually we'll probably want to show a list table |
1023 | 1023 | // for the individual Check-ins so that they can be managed. |
1024 | - $checkin = EE_Checkin::new_instance( array( |
|
1024 | + $checkin = EE_Checkin::new_instance(array( |
|
1025 | 1025 | 'REG_ID' => $this->ID(), |
1026 | 1026 | 'DTT_ID' => $DTT_ID, |
1027 | 1027 | 'CHK_in' => $new_status |
1028 | - ) ); |
|
1028 | + )); |
|
1029 | 1029 | // if the record could not be saved then return false |
1030 | - if ( $checkin->save() === 0 ) { |
|
1031 | - if ( WP_DEBUG ) { |
|
1030 | + if ($checkin->save() === 0) { |
|
1031 | + if (WP_DEBUG) { |
|
1032 | 1032 | global $wpdb; |
1033 | 1033 | $error = sprintf( |
1034 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
1034 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
1035 | 1035 | '<br />', |
1036 | 1036 | $wpdb->last_error |
1037 | 1037 | ); |
1038 | 1038 | } else { |
1039 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
1039 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
1040 | 1040 | } |
1041 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
1041 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
1042 | 1042 | return false; |
1043 | 1043 | } |
1044 | 1044 | return $status_to; |
@@ -1062,19 +1062,19 @@ discard block |
||
1062 | 1062 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
1063 | 1063 | * @return int Integer representing Check-in status. |
1064 | 1064 | */ |
1065 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
1066 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
1065 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
1066 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
1067 | 1067 | $datetime = $this->get_related_primary_datetime(); |
1068 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1068 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1069 | 1069 | return 0; |
1070 | 1070 | } |
1071 | 1071 | $DTT_ID = $datetime->ID(); |
1072 | 1072 | //verify the registration can checkin for the given DTT_ID |
1073 | 1073 | } |
1074 | 1074 | //get checkin object (if exists) |
1075 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
1076 | - if ( $checkin instanceof EE_Checkin ) { |
|
1077 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
1075 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
1076 | + if ($checkin instanceof EE_Checkin) { |
|
1077 | + if ($checkin->get('CHK_in')) { |
|
1078 | 1078 | return EE_Registration::checkin_status_in; //checked in |
1079 | 1079 | } else { |
1080 | 1080 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1092,28 +1092,28 @@ discard block |
||
1092 | 1092 | * @param bool $error This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name. |
1093 | 1093 | * @return string internationalized message |
1094 | 1094 | */ |
1095 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
1095 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
1096 | 1096 | //let's get the attendee first so we can include the name of the attendee |
1097 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
1098 | - if ( $attendee instanceof EE_Attendee ) { |
|
1099 | - if ( $error ) { |
|
1100 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
1097 | + $attendee = $this->get_first_related('Attendee'); |
|
1098 | + if ($attendee instanceof EE_Attendee) { |
|
1099 | + if ($error) { |
|
1100 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
1101 | 1101 | } |
1102 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
1102 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
1103 | 1103 | //what is the status message going to be? |
1104 | - switch ( $cur_status ) { |
|
1104 | + switch ($cur_status) { |
|
1105 | 1105 | case EE_Registration::checkin_status_never : |
1106 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
1106 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
1107 | 1107 | break; |
1108 | 1108 | case EE_Registration::checkin_status_in : |
1109 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
1109 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
1110 | 1110 | break; |
1111 | 1111 | case EE_Registration::checkin_status_out : |
1112 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
1112 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
1113 | 1113 | break; |
1114 | 1114 | } |
1115 | 1115 | } |
1116 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
1116 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | * @return EE_Transaction |
1124 | 1124 | */ |
1125 | 1125 | public function transaction() { |
1126 | - return $this->get_first_related( 'Transaction' ); |
|
1126 | + return $this->get_first_related('Transaction'); |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | * @access public |
1135 | 1135 | */ |
1136 | 1136 | public function reg_code() { |
1137 | - return $this->get( 'REG_code' ); |
|
1137 | + return $this->get('REG_code'); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | * @access public |
1145 | 1145 | */ |
1146 | 1146 | public function transaction_ID() { |
1147 | - return $this->get( 'TXN_ID' ); |
|
1147 | + return $this->get('TXN_ID'); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | * @return int |
1154 | 1154 | */ |
1155 | 1155 | public function ticket_ID() { |
1156 | - return $this->get( 'TKT_ID' ); |
|
1156 | + return $this->get('TKT_ID'); |
|
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | |
@@ -1165,17 +1165,17 @@ discard block |
||
1165 | 1165 | * @param string $REG_code Registration Code |
1166 | 1166 | * @param boolean $use_default |
1167 | 1167 | */ |
1168 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
1169 | - if ( empty( $REG_code )) { |
|
1170 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1168 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
1169 | + if (empty($REG_code)) { |
|
1170 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1171 | 1171 | return; |
1172 | 1172 | } |
1173 | - if ( ! $this->reg_code() ) { |
|
1174 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
1173 | + if ( ! $this->reg_code()) { |
|
1174 | + parent::set('REG_code', $REG_code, $use_default); |
|
1175 | 1175 | } else { |
1176 | 1176 | EE_Error::doing_it_wrong( |
1177 | - __CLASS__ . '::' . __FUNCTION__, |
|
1178 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
1177 | + __CLASS__.'::'.__FUNCTION__, |
|
1178 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
1179 | 1179 | '4.6.0' |
1180 | 1180 | ); |
1181 | 1181 | } |
@@ -1195,17 +1195,17 @@ discard block |
||
1195 | 1195 | * @return EE_Registration[] or empty array if this isn't a group registration. |
1196 | 1196 | */ |
1197 | 1197 | public function get_all_other_registrations_in_group() { |
1198 | - if ( $this->group_size() < 2 ) { |
|
1198 | + if ($this->group_size() < 2) { |
|
1199 | 1199 | return array(); |
1200 | 1200 | } |
1201 | 1201 | |
1202 | 1202 | $query[0] = array( |
1203 | 1203 | 'TXN_ID' => $this->transaction_ID(), |
1204 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
1204 | + 'REG_ID' => array('!=', $this->ID()), |
|
1205 | 1205 | 'TKT_ID' => $this->ticket_ID() |
1206 | 1206 | ); |
1207 | 1207 | |
1208 | - $registrations = $this->get_model()->get_all( $query ); |
|
1208 | + $registrations = $this->get_model()->get_all($query); |
|
1209 | 1209 | return $registrations; |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | * @access public |
1218 | 1218 | */ |
1219 | 1219 | public function price_paid() { |
1220 | - EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1220 | + EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1221 | 1221 | return $this->final_price(); |
1222 | 1222 | } |
1223 | 1223 | |
@@ -1229,9 +1229,9 @@ discard block |
||
1229 | 1229 | * @access public |
1230 | 1230 | * @param float $REG_final_price |
1231 | 1231 | */ |
1232 | - public function set_price_paid( $REG_final_price = 0.00 ) { |
|
1233 | - EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1234 | - $this->set_final_price( $REG_final_price ); |
|
1232 | + public function set_price_paid($REG_final_price = 0.00) { |
|
1233 | + EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1234 | + $this->set_final_price($REG_final_price); |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | * @return string |
1243 | 1243 | */ |
1244 | 1244 | public function pretty_price_paid() { |
1245 | - EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1245 | + EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1246 | 1246 | return $this->pretty_final_price(); |
1247 | 1247 | } |
1248 | 1248 |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
127 | 127 | do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
128 | 128 | return TRUE; |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | //even though the old value matches the new value, it's still good to |
131 | 131 | //allow the parent set method to have a say |
132 | 132 | parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
@@ -625,8 +625,9 @@ discard block |
||
625 | 625 | * @return EE_Registration |
626 | 626 | */ |
627 | 627 | public function get_primary_registration() { |
628 | - if ( $this->is_primary_registrant() ) |
|
629 | - return $this; |
|
628 | + if ( $this->is_primary_registrant() ) { |
|
629 | + return $this; |
|
630 | + } |
|
630 | 631 | |
631 | 632 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
632 | 633 | $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
@@ -618,9 +618,9 @@ |
||
618 | 618 | |
619 | 619 | |
620 | 620 | /** |
621 | - * get Attendee Number |
|
622 | - * @access public |
|
623 | - */ |
|
621 | + * get Attendee Number |
|
622 | + * @access public |
|
623 | + */ |
|
624 | 624 | public function count() { |
625 | 625 | return $this->get( 'REG_count' ); |
626 | 626 | } |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | * the registration's share of the transaction total, so that the |
683 | 683 | * sum of all the transaction's REG_final_prices equal the transaction's total |
684 | 684 | * @access public |
685 | - * @return float |
|
685 | + * @return boolean |
|
686 | 686 | */ |
687 | 687 | public function final_price() { |
688 | 688 | return $this->get( 'REG_final_price' ); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | /** |
705 | 705 | * get paid (yeah) |
706 | 706 | * @access public |
707 | - * @return float |
|
707 | + * @return boolean |
|
708 | 708 | */ |
709 | 709 | public function paid() { |
710 | 710 | return $this->get( 'REG_paid' ); |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | /** |
869 | 869 | * Sets deleted |
870 | 870 | * @param boolean $deleted |
871 | - * @return boolean |
|
871 | + * @return boolean|null |
|
872 | 872 | */ |
873 | 873 | public function set_deleted($deleted) { |
874 | 874 | $this->set( 'REG_deleted', $deleted ); |
@@ -912,6 +912,7 @@ discard block |
||
912 | 912 | * |
913 | 913 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
914 | 914 | * @param bool $check_approved This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access. |
915 | + * @param integer $DTT_OR_ID |
|
915 | 916 | * |
916 | 917 | * @return bool |
917 | 918 | */ |
@@ -1150,7 +1151,7 @@ discard block |
||
1150 | 1151 | |
1151 | 1152 | |
1152 | 1153 | /** |
1153 | - * @return int |
|
1154 | + * @return boolean |
|
1154 | 1155 | */ |
1155 | 1156 | public function ticket_ID() { |
1156 | 1157 | return $this->get( 'TKT_ID' ); |
@@ -1,5 +1,5 @@ discard block |
||
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 | * Event Espresso |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return boolean success |
34 | 34 | */ |
35 | 35 | public function delete() { |
36 | - return $this->delete_or_restore( TRUE ); |
|
36 | + return $this->delete_or_restore(TRUE); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return boolean success |
44 | 44 | */ |
45 | 45 | public function delete_permanently() { |
46 | - return $this->get_model()->delete_permanently_by_ID( $this->ID() ); |
|
46 | + return $this->get_model()->delete_permanently_by_ID($this->ID()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param bool $delete true=>delete, false=>restore |
54 | 54 | * @return bool |
55 | 55 | */ |
56 | - public function delete_or_restore( $delete = TRUE ) { |
|
56 | + public function delete_or_restore($delete = TRUE) { |
|
57 | 57 | $model = $this->get_model(); |
58 | - return $model->delete_or_restore_by_ID( $delete, $this->ID() ); |
|
58 | + return $model->delete_or_restore_by_ID($delete, $this->ID()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -65,6 +65,6 @@ discard block |
||
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | 67 | public function restore() { |
68 | - return $this->delete_or_restore( FALSE ); |
|
68 | + return $this->delete_or_restore(FALSE); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
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 | * Taxes class |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @param EE_Ticket $ticket incoming EE_Ticket |
33 | 33 | * @return float total taxes to apply to ticket. |
34 | 34 | */ |
35 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
35 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
39 | + if ( ! $ticket->get('TKT_taxable')) |
|
40 | 40 | return $tax; |
41 | 41 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
42 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
43 | 43 | //get taxes |
44 | 44 | $taxes = self::get_taxes_for_admin(); |
45 | 45 | //apply taxes to subtotal |
46 | - foreach ( $taxes as $tax ) { |
|
46 | + foreach ($taxes as $tax) { |
|
47 | 47 | //assuming taxes are not cumulative |
48 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
48 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
49 | 49 | } |
50 | 50 | return $total_tax; |
51 | 51 | } |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public static function get_total_taxes_percentage() { |
59 | 59 | $total_tax_percent = 0; |
60 | - foreach( self::get_taxes_for_admin() as $tax_price ) { |
|
61 | - $total_tax_percent += $tax_price->get( 'PRC_amount' ); |
|
60 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
61 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
62 | 62 | } |
63 | 63 | return $total_tax_percent; |
64 | 64 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param EE_Ticket $ticket |
70 | 70 | * @return float |
71 | 71 | */ |
72 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
72 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
73 | 73 | $TKT_ID = $ticket->ID(); |
74 | - return isset( self::$_subtotal[ $TKT_ID ] ) ? self::$_subtotal[ $TKT_ID ] : self::_get_subtotal_for_admin( $ticket ); |
|
74 | + return isset(self::$_subtotal[$TKT_ID]) ? self::$_subtotal[$TKT_ID] : self::_get_subtotal_for_admin($ticket); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -81,26 +81,26 @@ discard block |
||
81 | 81 | * @param EE_Ticket $ticket |
82 | 82 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
83 | 83 | */ |
84 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
84 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
85 | 85 | $subtotal = 0; |
86 | 86 | //get all prices |
87 | - $prices = $ticket->get_many_related( 'Price', array( 'default_where_conditions' => 'none', 'order_by' => array( 'PRC_order' => 'ASC' ) ) ); |
|
87 | + $prices = $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))); |
|
88 | 88 | //let's loop through them (base price is always the first item) |
89 | - foreach ( $prices as $price ) { |
|
90 | - if ( $price instanceof EE_Price ) { |
|
91 | - switch ( $price->type_obj()->base_type() ) { |
|
89 | + foreach ($prices as $price) { |
|
90 | + if ($price instanceof EE_Price) { |
|
91 | + switch ($price->type_obj()->base_type()) { |
|
92 | 92 | case 1: // base price |
93 | 93 | case 3: // surcharges |
94 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
94 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
95 | 95 | break; |
96 | 96 | case 2: // discounts |
97 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
97 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
98 | 98 | break; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | $TKT_ID = $ticket->ID(); |
103 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
103 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
104 | 104 | return $subtotal; |
105 | 105 | } |
106 | 106 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return EE_Price[] EE_Price objects that have PRT_ID == 4 |
112 | 112 | */ |
113 | 113 | public static function get_taxes_for_admin() { |
114 | - self::$_default_taxes = ! empty( self::$_default_taxes ) ? self::$_default_taxes : EE_Registry::instance()->load_model( 'Price' )->get_all( array( array( 'Price_Type.PBT_ID' => 4 ) ) ); |
|
114 | + self::$_default_taxes = ! empty(self::$_default_taxes) ? self::$_default_taxes : EE_Registry::instance()->load_model('Price')->get_all(array(array('Price_Type.PBT_ID' => 4))); |
|
115 | 115 | return self::$_default_taxes; |
116 | 116 | } |
117 | 117 |
@@ -36,8 +36,9 @@ |
||
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
40 | - return $tax; |
|
39 | + if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
40 | + return $tax; |
|
41 | + } |
|
41 | 42 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | 43 | $subtotal = self::get_subtotal_for_admin( $ticket ); |
43 | 44 | //get taxes |
@@ -1,5 +1,5 @@ discard block |
||
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 | * Event Espresso |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @param array $props_n_values |
31 | 31 | * @return EE_Term_Relationship |
32 | 32 | */ |
33 | - public static function new_instance( $props_n_values = array() ) { |
|
34 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
35 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
33 | + public static function new_instance($props_n_values = array()) { |
|
34 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
35 | + return $has_object ? $has_object : new self($props_n_values); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @param array $props_n_values |
42 | 42 | * @return EE_Term_Relationship |
43 | 43 | */ |
44 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
45 | - return new self( $props_n_values, TRUE ); |
|
44 | + public static function new_instance_from_db($props_n_values = array()) { |
|
45 | + return new self($props_n_values, TRUE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |