@@ -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 | * 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 | |
@@ -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 |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | * @param string $timezone |
| 36 | 36 | * @return EE_Ticket_Template|mixed |
| 37 | 37 | */ |
| 38 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
| 39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
| 40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
| 38 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
| 39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
| 40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | * @param string $timezone |
| 48 | 48 | * @return EE_Ticket_Template |
| 49 | 49 | */ |
| 50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
| 51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
| 51 | + return new self($props_n_values, TRUE, $timezone); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -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_WP_User class |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | * @param array $props_n_values |
| 23 | 23 | * @return EE_WP_User|mixed |
| 24 | 24 | */ |
| 25 | - public static function new_instance( $props_n_values = array() ) { |
|
| 26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
| 27 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
| 25 | + public static function new_instance($props_n_values = array()) { |
|
| 26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 27 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | * @param array $props_n_values |
| 34 | 34 | * @return EE_WP_User |
| 35 | 35 | */ |
| 36 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
| 37 | - return new self( $props_n_values, TRUE ); |
|
| 36 | + public static function new_instance_from_db($props_n_values = array()) { |
|
| 37 | + return new self($props_n_values, TRUE); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @return WP_User |
| 43 | 43 | */ |
| 44 | 44 | public function wp_user_obj() { |
| 45 | - if( ! $this->_wp_user_obj ) { |
|
| 46 | - $this->_wp_user_obj = get_user_by('ID', $this->ID() ); |
|
| 45 | + if ( ! $this->_wp_user_obj) { |
|
| 46 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
| 47 | 47 | } |
| 48 | 48 | return $this->_wp_user_obj; |
| 49 | 49 | } |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | - * retrieve a single attendee from db via their ID |
|
| 109 | - * |
|
| 110 | - * @access public |
|
| 111 | - * @param $ATT_ID |
|
| 112 | - * @return mixed array on success, FALSE on fail |
|
| 108 | + * retrieve a single attendee from db via their ID |
|
| 109 | + * |
|
| 110 | + * @access public |
|
| 111 | + * @param $ATT_ID |
|
| 112 | + * @return mixed array on success, FALSE on fail |
|
| 113 | 113 | * @deprecated |
| 114 | - */ |
|
| 114 | + */ |
|
| 115 | 115 | public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
| 116 | 116 | // retrieve a particular EE_Attendee |
| 117 | 117 | return $this->get_one_by_ID( $ATT_ID ); |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | - * retrieve a single attendee from db via their ID |
|
| 125 | - * |
|
| 126 | - * @access public |
|
| 127 | - * @param array $where_cols_n_values |
|
| 128 | - * @return mixed array on success, FALSE on fail |
|
| 129 | - */ |
|
| 124 | + * retrieve a single attendee from db via their ID |
|
| 125 | + * |
|
| 126 | + * @access public |
|
| 127 | + * @param array $where_cols_n_values |
|
| 128 | + * @return mixed array on success, FALSE on fail |
|
| 129 | + */ |
|
| 130 | 130 | public function get_attendee( $where_cols_n_values = array() ) { |
| 131 | 131 | |
| 132 | 132 | if ( empty( $where_cols_n_values )) { |
@@ -174,20 +174,20 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | - * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate |
|
| 178 | - * EE_Attendee objects. |
|
| 179 | - * |
|
| 180 | - * @since 4.3.0 |
|
| 181 | - * @param array $ids array of EE_Registration ids |
|
| 182 | - * @return EE_Attendee[] |
|
| 183 | - */ |
|
| 184 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
| 185 | - $ids = (array) $ids; |
|
| 186 | - $_where = array( |
|
| 187 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
| 188 | - ); |
|
| 189 | - return $this->get_all( array( $_where ) ); |
|
| 190 | - } |
|
| 177 | + * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate |
|
| 178 | + * EE_Attendee objects. |
|
| 179 | + * |
|
| 180 | + * @since 4.3.0 |
|
| 181 | + * @param array $ids array of EE_Registration ids |
|
| 182 | + * @return EE_Attendee[] |
|
| 183 | + */ |
|
| 184 | + public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
| 185 | + $ids = (array) $ids; |
|
| 186 | + $_where = array( |
|
| 187 | + 'Registration.REG_ID' => array( 'in', $ids ) |
|
| 188 | + ); |
|
| 189 | + return $this->get_all( array( $_where ) ); |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | } |
@@ -256,7 +256,7 @@ |
||
| 256 | 256 | * @param int $TXN_ID |
| 257 | 257 | * @param int $ATT_ID |
| 258 | 258 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
| 259 | - * @return mixed array on success, FALSE on fail |
|
| 259 | + * @return EE_Soft_Delete_Base_Class|null array on success, FALSE on fail |
|
| 260 | 260 | */ |
| 261 | 261 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
| 262 | 262 | return $this->get_one(array( |
@@ -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,5 +1,5 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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') |
@@ -135,36 +135,36 @@ discard block |
||
| 135 | 135 | 'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, time()), |
| 136 | 136 | 'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")), |
| 137 | 137 | 'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, time()), |
| 138 | - 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ), |
|
| 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 | 163 | ); |
| 164 | 164 | require_once('strategies/EE_CPT_Where_Conditions.strategy.php'); |
| 165 | 165 | $this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_attendees', 'ATTM_ID'); |
| 166 | 166 | $this->_caps_slug = 'contacts'; |
| 167 | - parent::__construct( $timezone ); |
|
| 167 | + parent::__construct($timezone); |
|
| 168 | 168 | |
| 169 | 169 | } |
| 170 | 170 | |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | * @param string $system_question_string |
| 175 | 175 | * @return string|null if not found |
| 176 | 176 | */ |
| 177 | - public function get_attendee_field_for_system_question( $system_question_string ) { |
|
| 178 | - return isset( $this->_system_question_to_attendee_field_name[ $system_question_string ] ) ? $this->_system_question_to_attendee_field_name[ $system_question_string ] : null; |
|
| 177 | + public function get_attendee_field_for_system_question($system_question_string) { |
|
| 178 | + return isset($this->_system_question_to_attendee_field_name[$system_question_string]) ? $this->_system_question_to_attendee_field_name[$system_question_string] : null; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID |
| 187 | 187 | * @return EE_Attendee[] |
| 188 | 188 | */ |
| 189 | - public function get_attendees_for_transaction( $transaction_id_or_obj ){ |
|
| 190 | - return $this->get_all( array( array( |
|
| 189 | + public function get_attendees_for_transaction($transaction_id_or_obj) { |
|
| 190 | + return $this->get_all(array(array( |
|
| 191 | 191 | 'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj |
| 192 | 192 | ))); |
| 193 | 193 | } |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | * @return mixed array on success, FALSE on fail |
| 203 | 203 | * @deprecated |
| 204 | 204 | */ |
| 205 | - public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
|
| 205 | + public function get_attendee_by_ID($ATT_ID = FALSE) { |
|
| 206 | 206 | // retrieve a particular EE_Attendee |
| 207 | - return $this->get_one_by_ID( $ATT_ID ); |
|
| 207 | + return $this->get_one_by_ID($ATT_ID); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -217,14 +217,14 @@ discard block |
||
| 217 | 217 | * @param array $where_cols_n_values |
| 218 | 218 | * @return mixed array on success, FALSE on fail |
| 219 | 219 | */ |
| 220 | - public function get_attendee( $where_cols_n_values = array() ) { |
|
| 220 | + public function get_attendee($where_cols_n_values = array()) { |
|
| 221 | 221 | |
| 222 | - if ( empty( $where_cols_n_values )) { |
|
| 222 | + if (empty($where_cols_n_values)) { |
|
| 223 | 223 | return FALSE; |
| 224 | 224 | } |
| 225 | - $attendee = $this->get_all( array($where_cols_n_values )); |
|
| 226 | - if ( ! empty( $attendee )) { |
|
| 227 | - return array_shift( $attendee ); |
|
| 225 | + $attendee = $this->get_all(array($where_cols_n_values)); |
|
| 226 | + if ( ! empty($attendee)) { |
|
| 227 | + return array_shift($attendee); |
|
| 228 | 228 | } else { |
| 229 | 229 | return FALSE; |
| 230 | 230 | } |
@@ -240,20 +240,20 @@ discard block |
||
| 240 | 240 | * @param array $where_cols_n_values |
| 241 | 241 | * @return bool|mixed |
| 242 | 242 | */ |
| 243 | - public function find_existing_attendee( $where_cols_n_values = NULL ) { |
|
| 243 | + public function find_existing_attendee($where_cols_n_values = NULL) { |
|
| 244 | 244 | // search by combo of first and last names plus the email address |
| 245 | - $attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email ); |
|
| 245 | + $attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email); |
|
| 246 | 246 | // no search params means attendee object already exists. |
| 247 | - $where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys; |
|
| 247 | + $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys; |
|
| 248 | 248 | $valid_data = TRUE; |
| 249 | 249 | // check for required values |
| 250 | - $valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE; |
|
| 251 | - $valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE; |
|
| 252 | - $valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE; |
|
| 250 | + $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE; |
|
| 251 | + $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE; |
|
| 252 | + $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE; |
|
| 253 | 253 | |
| 254 | - if ( $valid_data ) { |
|
| 255 | - $attendee = $this->get_attendee( $where_cols_n_values ); |
|
| 256 | - if ( $attendee instanceof EE_Attendee ) { |
|
| 254 | + if ($valid_data) { |
|
| 255 | + $attendee = $this->get_attendee($where_cols_n_values); |
|
| 256 | + if ($attendee instanceof EE_Attendee) { |
|
| 257 | 257 | return $attendee; |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -271,12 +271,12 @@ discard block |
||
| 271 | 271 | * @param array $ids array of EE_Registration ids |
| 272 | 272 | * @return EE_Attendee[] |
| 273 | 273 | */ |
| 274 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
| 274 | + public function get_array_of_contacts_from_reg_ids($ids) { |
|
| 275 | 275 | $ids = (array) $ids; |
| 276 | 276 | $_where = array( |
| 277 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
| 277 | + 'Registration.REG_ID' => array('in', $ids) |
|
| 278 | 278 | ); |
| 279 | - return $this->get_all( array( $_where ) ); |
|
| 279 | + return $this->get_all(array($_where)); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |