@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Aim extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
38 | 38 | $this->_gateway = new EEG_AIM(); |
39 | 39 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
40 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
40 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
41 | 41 | $this->_requires_https = true; |
42 | 42 | parent::__construct($pm_instance); |
43 | 43 | } |
@@ -47,60 +47,60 @@ discard block |
||
47 | 47 | * @param \EE_Transaction $transaction |
48 | 48 | * @return EE_Billing_Info_Form |
49 | 49 | */ |
50 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
50 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
51 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
52 | 52 | 'name'=>'AIM_Form', |
53 | 53 | 'subsections'=>array( |
54 | 54 | 'credit_card'=>new EE_Credit_Card_Input(array( |
55 | 55 | 'required'=>true, |
56 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
56 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
57 | 57 | )), |
58 | 58 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
59 | 59 | 'required'=>true, |
60 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
60 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
61 | 61 | )), |
62 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
62 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
63 | 63 | 'required'=>true, |
64 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
64 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
65 | 65 | )), |
66 | - 'cvv'=>new EE_CVV_Input( array( |
|
66 | + 'cvv'=>new EE_CVV_Input(array( |
|
67 | 67 | 'required'=>true, |
68 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
68 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
69 | 69 | ) |
70 | 70 | )); |
71 | - $billing_form->add_subsections( array( |
|
72 | - 'company' => new EE_Text_Input( array( |
|
71 | + $billing_form->add_subsections(array( |
|
72 | + 'company' => new EE_Text_Input(array( |
|
73 | 73 | 'html_label_text' => __('Company', 'event_espresso') |
74 | 74 | )) |
75 | - ), 'email', false ); |
|
75 | + ), 'email', false); |
|
76 | 76 | $billing_form->add_subsections( |
77 | 77 | array( |
78 | - 'fax' => new EE_Text_Input( array( |
|
78 | + 'fax' => new EE_Text_Input(array( |
|
79 | 79 | 'html_label_text' => __('Fax', 'event_espresso') |
80 | 80 | )) |
81 | 81 | ), |
82 | 82 | 'phone', |
83 | 83 | false ); |
84 | 84 | $settings_form = $this->settings_form(); |
85 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
86 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
85 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
86 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
87 | 87 | } |
88 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
88 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
89 | 89 | $required_inputs = array_merge( |
90 | 90 | array( |
91 | 91 | 'credit_card', |
92 | 92 | 'exp_month', |
93 | 93 | 'exp_year' ), |
94 | - $settings_form->get_input( 'required_billing_inputs' )->normalized_value() ); |
|
95 | - foreach( $billing_form->inputs() as $input_name => $input ) { |
|
96 | - if( in_array( $input_name, $required_inputs ) ) { |
|
97 | - $input->set_required( true ); |
|
94 | + $settings_form->get_input('required_billing_inputs')->normalized_value() ); |
|
95 | + foreach ($billing_form->inputs() as $input_name => $input) { |
|
96 | + if (in_array($input_name, $required_inputs)) { |
|
97 | + $input->set_required(true); |
|
98 | 98 | } else { |
99 | - $input->set_required( false ); |
|
99 | + $input->set_required(false); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
103 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -112,19 +112,19 @@ discard block |
||
112 | 112 | * @param \EE_Billing_Info_Form $billing_form |
113 | 113 | * @return \EE_Billing_Info_Form |
114 | 114 | */ |
115 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
116 | - if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) { |
|
117 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
118 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
119 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
120 | - $billing_form->get_input( 'cvv' )->set_default(( '123' )); |
|
115 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
116 | + if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) { |
|
117 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
118 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
119 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
120 | + $billing_form->get_input('cvv')->set_default(('123')); |
|
121 | 121 | } |
122 | 122 | $billing_form->add_subsections( |
123 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
123 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
124 | 124 | 'credit_card' |
125 | 125 | ); |
126 | 126 | $billing_form->add_subsections( |
127 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )), |
|
127 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')), |
|
128 | 128 | 'first_name' |
129 | 129 | ); |
130 | 130 | } |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | 'extra_meta_inputs'=>array( |
145 | 145 | 'login_id'=>new EE_Text_Input( |
146 | 146 | array( |
147 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
147 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
148 | 148 | 'required' => true ) |
149 | 149 | ), |
150 | 150 | 'transaction_key'=>new EE_Text_Input( |
151 | 151 | array( |
152 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
152 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
153 | 153 | 'required' => true ) |
154 | 154 | ), |
155 | 155 | 'test_transactions'=>new EE_Yes_No_Input( |
156 | 156 | array( |
157 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
157 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
158 | 158 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
159 | 159 | 'default' => false, |
160 | 160 | 'required' => true |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
164 | 164 | $billing_input_names, |
165 | 165 | array( |
166 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
166 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
167 | 167 | 'default' => array( |
168 | 168 | 'company', |
169 | 169 | 'fax', |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
173 | 173 | $billing_input_names, |
174 | 174 | array( |
175 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
175 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
176 | 176 | 'default' => array_diff( |
177 | - array_keys( $billing_input_names ), |
|
178 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
177 | + array_keys($billing_input_names), |
|
178 | + array('address2', 'phone', 'company', 'fax') |
|
179 | 179 | ), |
180 | 180 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
181 | 181 | )), |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function billing_input_names() { |
193 | 193 | return array( |
194 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
194 | + 'first_name' => __('First Name', 'event_espresso'), |
|
195 | 195 | 'last_name' => __('Last Name', 'event_espresso'), |
196 | - 'email' => __( 'Email', 'event_espresso' ), |
|
197 | - 'company' => __( 'Company', 'event_espresso' ), |
|
196 | + 'email' => __('Email', 'event_espresso'), |
|
197 | + 'company' => __('Company', 'event_espresso'), |
|
198 | 198 | 'address' => __('Address', 'event_espresso'), |
199 | 199 | 'address2' => __('Address2', 'event_espresso'), |
200 | 200 | 'city' => __('City', 'event_espresso'), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'country' => __('Country', 'event_espresso'), |
203 | 203 | 'zip' => __('Zip', 'event_espresso'), |
204 | 204 | 'phone' => __('Phone', 'event_espresso'), |
205 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
205 | + 'fax' => __('Fax', 'event_espresso'), |
|
206 | 206 | 'cvv' => __('CVV', 'event_espresso') |
207 | 207 | ); |
208 | 208 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | * @param type $billing_form |
214 | 214 | * @return array |
215 | 215 | */ |
216 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
216 | + protected function _get_billing_values_from_form($billing_form) { |
|
217 | 217 | $all_billing_values_empty = array(); |
218 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
219 | - $all_billing_values_empty[ $input_name ] = ''; |
|
218 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
219 | + $all_billing_values_empty[$input_name] = ''; |
|
220 | 220 | } |
221 | 221 | return array_merge( |
222 | 222 | $all_billing_values_empty, |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @see EE_PMT_Base::help_tabs_config() |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function help_tabs_config(){ |
|
234 | + public function help_tabs_config() { |
|
235 | 235 | return array( |
236 | 236 | $this->get_help_tab_name() => array( |
237 | 237 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EE_Payment_Processor |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public static function instance() { |
29 | 29 | // check if class object is instantiated |
30 | - if ( ! self::$_instance instanceof EE_Payment_Processor ) { |
|
30 | + if ( ! self::$_instance instanceof EE_Payment_Processor) { |
|
31 | 31 | self::$_instance = new self(); |
32 | 32 | } |
33 | 33 | return self::$_instance; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | *@return EE_Payment_Processor |
43 | 43 | */ |
44 | 44 | private function __construct() { |
45 | - do_action( 'AHEE__EE_Payment_Processor__construct' ); |
|
45 | + do_action('AHEE__EE_Payment_Processor__construct'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -64,42 +64,42 @@ discard block |
||
64 | 64 | * @param string $cancel_url URL to return to if off-site payments are cancelled |
65 | 65 | * @return EE_Payment |
66 | 66 | */ |
67 | - public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '' ) { |
|
68 | - if( $amount < 0 ) { |
|
67 | + public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '') { |
|
68 | + if ($amount < 0) { |
|
69 | 69 | throw new EE_Error( |
70 | 70 | sprintf( |
71 | - __( 'Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso' ), |
|
71 | + __('Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso'), |
|
72 | 72 | $amount, |
73 | 73 | $transaction->ID() ) ); |
74 | 74 | } |
75 | 75 | // verify payment method |
76 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE ); |
|
76 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE); |
|
77 | 77 | // verify transaction |
78 | - EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
79 | - $transaction->set_payment_method_ID( $payment_method->ID() ); |
|
78 | + EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
79 | + $transaction->set_payment_method_ID($payment_method->ID()); |
|
80 | 80 | // verify payment method type |
81 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ){ |
|
81 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
82 | 82 | $payment = $payment_method->type_obj()->process_payment( |
83 | 83 | $transaction, |
84 | - min( $amount, $transaction->remaining() ),//make sure we don't overcharge |
|
84 | + min($amount, $transaction->remaining()), //make sure we don't overcharge |
|
85 | 85 | $billing_form, |
86 | 86 | $return_url, |
87 | - add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
87 | + add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
88 | 88 | $method, |
89 | 89 | $by_admin |
90 | 90 | ); |
91 | 91 | // check if payment method uses an off-site gateway |
92 | - if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) { |
|
92 | + if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) { |
|
93 | 93 | // don't process payments for off-site gateways yet because no payment has occurred yet |
94 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
94 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
95 | 95 | } |
96 | 96 | return $payment; |
97 | 97 | } else { |
98 | 98 | EE_Error::add_error( |
99 | 99 | sprintf( |
100 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
100 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
101 | 101 | '<br/>', |
102 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
102 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
103 | 103 | ), __FILE__, __FUNCTION__, __LINE__ |
104 | 104 | ); |
105 | 105 | return NULL; |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | * @throws EE_Error |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - public function get_ipn_url_for_payment_method( $transaction, $payment_method ){ |
|
118 | + public function get_ipn_url_for_payment_method($transaction, $payment_method) { |
|
119 | 119 | /** @type EE_Transaction $transaction */ |
120 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
120 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
121 | 121 | $primary_reg = $transaction->primary_registration(); |
122 | - if( ! $primary_reg instanceof EE_Registration ){ |
|
123 | - throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID())); |
|
122 | + if ( ! $primary_reg instanceof EE_Registration) { |
|
123 | + throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID())); |
|
124 | 124 | } |
125 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true); |
|
125 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true); |
|
126 | 126 | $url = add_query_arg( |
127 | 127 | array( |
128 | 128 | 'e_reg_url_link'=>$primary_reg->reg_url_link(), |
@@ -149,81 +149,81 @@ discard block |
||
149 | 149 | * @throws Exception |
150 | 150 | * @return EE_Payment |
151 | 151 | */ |
152 | - public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){ |
|
153 | - $_req_data = $this->_remove_unusable_characters( $_req_data ); |
|
154 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
155 | - EE_Processor_Base::set_IPN( $separate_IPN_request ); |
|
156 | - if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){ |
|
157 | - $obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) ); |
|
158 | - }elseif( $payment_method instanceof EE_Payment ){ |
|
152 | + public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) { |
|
153 | + $_req_data = $this->_remove_unusable_characters($_req_data); |
|
154 | + EE_Registry::instance()->load_model('Change_Log'); |
|
155 | + EE_Processor_Base::set_IPN($separate_IPN_request); |
|
156 | + if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) { |
|
157 | + $obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc'))); |
|
158 | + }elseif ($payment_method instanceof EE_Payment) { |
|
159 | 159 | $obj_for_log = $payment_method; |
160 | - }elseif( $transaction instanceof EE_Transaction ){ |
|
160 | + }elseif ($transaction instanceof EE_Transaction) { |
|
161 | 161 | $obj_for_log = $transaction; |
162 | - }else{ |
|
162 | + } else { |
|
163 | 163 | $obj_for_log = null; |
164 | 164 | } |
165 | 165 | $log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log); |
166 | - try{ |
|
166 | + try { |
|
167 | 167 | /** |
168 | 168 | * @var EE_Payment $payment |
169 | 169 | */ |
170 | 170 | $payment = NULL; |
171 | - if($transaction && $payment_method){ |
|
171 | + if ($transaction && $payment_method) { |
|
172 | 172 | /** @type EE_Transaction $transaction */ |
173 | 173 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
174 | 174 | /** @type EE_Payment_Method $payment_method */ |
175 | 175 | $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method); |
176 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
177 | - $payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction ); |
|
176 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
177 | + $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction); |
|
178 | 178 | $log->set_object($payment); |
179 | 179 | } else { |
180 | 180 | // not a payment |
181 | 181 | EE_Error::add_error( |
182 | 182 | sprintf( |
183 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ), |
|
183 | + __('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'), |
|
184 | 184 | '<br/>', |
185 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
185 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
186 | 186 | ), |
187 | 187 | __FILE__, __FUNCTION__, __LINE__ |
188 | 188 | ); |
189 | 189 | } |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | //that's actually pretty ok. The IPN just wasn't able |
192 | 192 | //to identify which transaction or payment method this was for |
193 | 193 | // give all active payment methods a chance to claim it |
194 | 194 | $active_pms = EEM_Payment_Method::instance()->get_all_active(); |
195 | - foreach( $active_pms as $payment_method ){ |
|
196 | - try{ |
|
197 | - $payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data ); |
|
195 | + foreach ($active_pms as $payment_method) { |
|
196 | + try { |
|
197 | + $payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data); |
|
198 | 198 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment); |
199 | 199 | break; |
200 | - } catch( EE_Error $e ) { |
|
200 | + } catch (EE_Error $e) { |
|
201 | 201 | //that's fine- it apparently couldn't handle the IPN |
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | } |
206 | 206 | // EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method); |
207 | - if( $payment instanceof EE_Payment){ |
|
207 | + if ($payment instanceof EE_Payment) { |
|
208 | 208 | $payment->save(); |
209 | 209 | // update the TXN |
210 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
|
211 | - }else{ |
|
210 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request); |
|
211 | + } else { |
|
212 | 212 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
213 | - if($payment_method){ |
|
213 | + if ($payment_method) { |
|
214 | 214 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
215 | - }elseif($transaction){ |
|
215 | + }elseif ($transaction) { |
|
216 | 216 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
217 | 217 | } |
218 | 218 | } |
219 | 219 | return $payment; |
220 | 220 | |
221 | - } catch( EE_Error $e ) { |
|
221 | + } catch (EE_Error $e) { |
|
222 | 222 | do_action( |
223 | 223 | 'AHEE__log', __FILE__, __FUNCTION__, sprintf( |
224 | - __( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ), |
|
225 | - print_r( $transaction, TRUE ), |
|
226 | - print_r( $_req_data, TRUE ), |
|
224 | + __('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'), |
|
225 | + print_r($transaction, TRUE), |
|
226 | + print_r($_req_data, TRUE), |
|
227 | 227 | $e->getMessage() |
228 | 228 | ) |
229 | 229 | ); |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | * @param array $request_data |
238 | 238 | * @return array|string |
239 | 239 | */ |
240 | - protected function _remove_unusable_characters( $request_data ) { |
|
241 | - if( is_array( $request_data ) ) { |
|
240 | + protected function _remove_unusable_characters($request_data) { |
|
241 | + if (is_array($request_data)) { |
|
242 | 242 | $return_data = array(); |
243 | - foreach( $request_data as $key => $value ) { |
|
244 | - $return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value ); |
|
243 | + foreach ($request_data as $key => $value) { |
|
244 | + $return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value); |
|
245 | 245 | } |
246 | - }else{ |
|
247 | - $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
|
246 | + } else { |
|
247 | + $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
|
248 | 248 | } |
249 | 249 | return $return_data; |
250 | 250 | } |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | * @return EE_Payment |
267 | 267 | * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs |
268 | 268 | */ |
269 | - public function finalize_payment_for( $transaction, $update_txn = TRUE ){ |
|
269 | + public function finalize_payment_for($transaction, $update_txn = TRUE) { |
|
270 | 270 | /** @var $transaction EE_Transaction */ |
271 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
271 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
272 | 272 | $last_payment_method = $transaction->payment_method(); |
273 | - if ( $last_payment_method instanceof EE_Payment_Method ) { |
|
274 | - $payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction ); |
|
275 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
273 | + if ($last_payment_method instanceof EE_Payment_Method) { |
|
274 | + $payment = $last_payment_method->type_obj()->finalize_payment_for($transaction); |
|
275 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
276 | 276 | return $payment; |
277 | 277 | } else { |
278 | 278 | return NULL; |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * @internal param float $amount |
290 | 290 | * @return EE_Payment |
291 | 291 | */ |
292 | - public function process_refund( EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array() ){ |
|
293 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) { |
|
294 | - $payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info ); |
|
295 | - $this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund ); |
|
292 | + public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) { |
|
293 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) { |
|
294 | + $payment_method->type_obj()->process_refund($payment_to_refund, $refund_info); |
|
295 | + $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); |
|
296 | 296 | } |
297 | 297 | return $payment_to_refund; |
298 | 298 | } |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | * TXN is locked before updating |
335 | 335 | * @throws \EE_Error |
336 | 336 | */ |
337 | - public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){ |
|
337 | + public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) { |
|
338 | 338 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful'; |
339 | 339 | /** @type EE_Transaction $transaction */ |
340 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
340 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
341 | 341 | // can we freely update the TXN at this moment? |
342 | - if ( $IPN && $transaction->is_locked() ) { |
|
342 | + if ($IPN && $transaction->is_locked()) { |
|
343 | 343 | // don't update the transaction at this exact moment |
344 | 344 | // because the TXN is active in another request |
345 | 345 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
@@ -349,40 +349,40 @@ discard block |
||
349 | 349 | ); |
350 | 350 | } else { |
351 | 351 | // verify payment and that it has been saved |
352 | - if ( $payment instanceof EE_Payment && $payment->ID() ) { |
|
353 | - if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){ |
|
354 | - $payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment ); |
|
352 | + if ($payment instanceof EE_Payment && $payment->ID()) { |
|
353 | + if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) { |
|
354 | + $payment->payment_method()->type_obj()->update_txn_based_on_payment($payment); |
|
355 | 355 | // update TXN registrations with payment info |
356 | - $this->process_registration_payments( $transaction, $payment ); |
|
356 | + $this->process_registration_payments($transaction, $payment); |
|
357 | 357 | } |
358 | 358 | $do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action; |
359 | 359 | } else { |
360 | 360 | // send out notifications |
361 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
361 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
362 | 362 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made'; |
363 | 363 | } |
364 | 364 | // if this is an IPN, then we want to know the initial TXN status prior to updating the TXN |
365 | 365 | // so that we know whether the status has changed and notifications should be triggered |
366 | - if ( $IPN ) { |
|
366 | + if ($IPN) { |
|
367 | 367 | /** @type EE_Transaction_Processor $transaction_processor */ |
368 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
369 | - $transaction_processor->set_old_txn_status( $transaction->status_ID() ); |
|
368 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
369 | + $transaction_processor->set_old_txn_status($transaction->status_ID()); |
|
370 | 370 | } |
371 | - if ( $payment->status() !== EEM_Payment::status_id_failed ) { |
|
371 | + if ($payment->status() !== EEM_Payment::status_id_failed) { |
|
372 | 372 | /** @type EE_Transaction_Payments $transaction_payments */ |
373 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
373 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
374 | 374 | // set new value for total paid |
375 | - $transaction_payments->calculate_total_payments_and_update_status( $transaction ); |
|
375 | + $transaction_payments->calculate_total_payments_and_update_status($transaction); |
|
376 | 376 | // call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ??? |
377 | - if ( $update_txn ) { |
|
378 | - $this->_post_payment_processing( $transaction, $payment, $IPN ); |
|
377 | + if ($update_txn) { |
|
378 | + $this->_post_payment_processing($transaction, $payment, $IPN); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | // granular hook for others to use. |
382 | - do_action( $do_action, $transaction, $payment ); |
|
383 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' ); |
|
382 | + do_action($do_action, $transaction, $payment); |
|
383 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action'); |
|
384 | 384 | //global hook for others to use. |
385 | - do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment ); |
|
385 | + do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment); |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
@@ -396,25 +396,25 @@ discard block |
||
396 | 396 | * @param EE_Registration[] $registrations |
397 | 397 | * @throws \EE_Error |
398 | 398 | */ |
399 | - public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) { |
|
399 | + public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) { |
|
400 | 400 | // only process if payment was successful |
401 | - if ( $payment->status() !== EEM_Payment::status_id_approved ) { |
|
401 | + if ($payment->status() !== EEM_Payment::status_id_approved) { |
|
402 | 402 | return; |
403 | 403 | } |
404 | 404 | //EEM_Registration::instance()->show_next_x_db_queries(); |
405 | - if ( empty( $registrations )) { |
|
405 | + if (empty($registrations)) { |
|
406 | 406 | // find registrations with monies owing that can receive a payment |
407 | - $registrations = $transaction->registrations( array( |
|
407 | + $registrations = $transaction->registrations(array( |
|
408 | 408 | array( |
409 | 409 | // only these reg statuses can receive payments |
410 | - 'STS_ID' => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ), |
|
411 | - 'REG_final_price' => array( '!=', 0 ), |
|
412 | - 'REG_final_price*' => array( '!=', 'REG_paid', true ), |
|
410 | + 'STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), |
|
411 | + 'REG_final_price' => array('!=', 0), |
|
412 | + 'REG_final_price*' => array('!=', 'REG_paid', true), |
|
413 | 413 | ) |
414 | - ) ); |
|
414 | + )); |
|
415 | 415 | } |
416 | 416 | // still nothing ??!?? |
417 | - if ( empty( $registrations )) { |
|
417 | + if (empty($registrations)) { |
|
418 | 418 | return; |
419 | 419 | } |
420 | 420 | // todo: break out the following logic into a separate strategy class |
@@ -426,28 +426,28 @@ discard block |
||
426 | 426 | |
427 | 427 | $refund = $payment->is_a_refund(); |
428 | 428 | // how much is available to apply to registrations? |
429 | - $available_payment_amount = abs( $payment->amount() ); |
|
430 | - foreach ( $registrations as $registration ) { |
|
431 | - if ( $registration instanceof EE_Registration ) { |
|
429 | + $available_payment_amount = abs($payment->amount()); |
|
430 | + foreach ($registrations as $registration) { |
|
431 | + if ($registration instanceof EE_Registration) { |
|
432 | 432 | // nothing left? |
433 | - if ( $available_payment_amount <= 0 ) { |
|
433 | + if ($available_payment_amount <= 0) { |
|
434 | 434 | break; |
435 | 435 | } |
436 | - if ( $refund ) { |
|
437 | - $available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount ); |
|
436 | + if ($refund) { |
|
437 | + $available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount); |
|
438 | 438 | } else { |
439 | - $available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount ); |
|
439 | + $available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount); |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | } |
443 | - if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) { |
|
443 | + if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) { |
|
444 | 444 | EE_Error::add_attention( |
445 | 445 | sprintf( |
446 | - __( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ), |
|
447 | - EEH_Template::format_currency( $available_payment_amount ), |
|
448 | - implode( ', ', array_keys( $registrations ) ), |
|
446 | + __('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), |
|
447 | + EEH_Template::format_currency($available_payment_amount), |
|
448 | + implode(', ', array_keys($registrations)), |
|
449 | 449 | '<br/>', |
450 | - EEH_Template::format_currency( $payment->amount() ) |
|
450 | + EEH_Template::format_currency($payment->amount()) |
|
451 | 451 | ), |
452 | 452 | __FILE__, __FUNCTION__, __LINE__ |
453 | 453 | ); |
@@ -464,17 +464,17 @@ discard block |
||
464 | 464 | * @param float $available_payment_amount |
465 | 465 | * @return float |
466 | 466 | */ |
467 | - public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) { |
|
467 | + public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) { |
|
468 | 468 | $owing = $registration->final_price() - $registration->paid(); |
469 | - if ( $owing > 0 ) { |
|
469 | + if ($owing > 0) { |
|
470 | 470 | // don't allow payment amount to exceed the available payment amount, OR the amount owing |
471 | - $payment_amount = min( $available_payment_amount, $owing ); |
|
471 | + $payment_amount = min($available_payment_amount, $owing); |
|
472 | 472 | // update $available_payment_amount |
473 | 473 | $available_payment_amount = $available_payment_amount - $payment_amount; |
474 | 474 | //calculate and set new REG_paid |
475 | - $registration->set_paid( $registration->paid() + $payment_amount ); |
|
475 | + $registration->set_paid($registration->paid() + $payment_amount); |
|
476 | 476 | // now save it |
477 | - $this->_apply_registration_payment( $registration, $payment, $payment_amount ); |
|
477 | + $this->_apply_registration_payment($registration, $payment, $payment_amount); |
|
478 | 478 | } |
479 | 479 | return $available_payment_amount; |
480 | 480 | } |
@@ -489,19 +489,19 @@ discard block |
||
489 | 489 | * @param float $payment_amount |
490 | 490 | * @return float |
491 | 491 | */ |
492 | - protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) { |
|
492 | + protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) { |
|
493 | 493 | // find any existing reg payment records for this registration and payment |
494 | 494 | $existing_reg_payment = EEM_Registration_Payment::instance()->get_one( |
495 | - array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) ) |
|
495 | + array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID())) |
|
496 | 496 | ); |
497 | 497 | // if existing registration payment exists |
498 | - if ( $existing_reg_payment instanceof EE_Registration_Payment ) { |
|
498 | + if ($existing_reg_payment instanceof EE_Registration_Payment) { |
|
499 | 499 | // then update that record |
500 | - $existing_reg_payment->set_amount( $payment_amount ); |
|
500 | + $existing_reg_payment->set_amount($payment_amount); |
|
501 | 501 | $existing_reg_payment->save(); |
502 | 502 | } else { |
503 | 503 | // or add new relation between registration and payment and set amount |
504 | - $registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) ); |
|
504 | + $registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount)); |
|
505 | 505 | // make it stick |
506 | 506 | $registration->save(); |
507 | 507 | } |
@@ -517,21 +517,21 @@ discard block |
||
517 | 517 | * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER |
518 | 518 | * @return float |
519 | 519 | */ |
520 | - public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) { |
|
520 | + public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) { |
|
521 | 521 | //EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ ); |
522 | - if ( $registration->paid() > 0 ) { |
|
522 | + if ($registration->paid() > 0) { |
|
523 | 523 | // ensure $available_refund_amount is NOT negative |
524 | - $available_refund_amount = abs( $available_refund_amount ); |
|
524 | + $available_refund_amount = abs($available_refund_amount); |
|
525 | 525 | // don't allow refund amount to exceed the available payment amount, OR the amount paid |
526 | - $refund_amount = min( $available_refund_amount, $registration->paid() ); |
|
526 | + $refund_amount = min($available_refund_amount, $registration->paid()); |
|
527 | 527 | // update $available_payment_amount |
528 | 528 | $available_refund_amount = $available_refund_amount - $refund_amount; |
529 | 529 | //calculate and set new REG_paid |
530 | - $registration->set_paid( $registration->paid() - $refund_amount ); |
|
530 | + $registration->set_paid($registration->paid() - $refund_amount); |
|
531 | 531 | // convert payment amount back to a negative value for storage in the db |
532 | - $refund_amount = abs( $refund_amount ) * -1; |
|
532 | + $refund_amount = abs($refund_amount) * -1; |
|
533 | 533 | // now save it |
534 | - $this->_apply_registration_payment( $registration, $payment, $refund_amount ); |
|
534 | + $this->_apply_registration_payment($registration, $payment, $refund_amount); |
|
535 | 535 | } |
536 | 536 | return $available_refund_amount; |
537 | 537 | } |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | * @param EE_Payment $payment |
550 | 550 | * @param bool $IPN |
551 | 551 | */ |
552 | - protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) { |
|
552 | + protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) { |
|
553 | 553 | |
554 | 554 | /** @type EE_Transaction_Processor $transaction_processor */ |
555 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
555 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
556 | 556 | // is the Payment Options Reg Step completed ? |
557 | - $payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' ); |
|
557 | + $payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options'); |
|
558 | 558 | // DEBUG LOG |
559 | 559 | //$this->log( |
560 | 560 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -567,14 +567,14 @@ discard block |
||
567 | 567 | // if the Payment Options Reg Step is completed... |
568 | 568 | $revisit = $payment_options_step_completed === true ? true : false; |
569 | 569 | // then this is kinda sorta a revisit with regards to payments at least |
570 | - $transaction_processor->set_revisit( $revisit ); |
|
570 | + $transaction_processor->set_revisit($revisit); |
|
571 | 571 | // if this is an IPN, let's consider the Payment Options Reg Step completed if not already |
572 | 572 | if ( |
573 | 573 | $IPN && |
574 | 574 | $payment_options_step_completed !== true && |
575 | - ( $payment->is_approved() || $payment->is_pending() ) |
|
575 | + ($payment->is_approved() || $payment->is_pending()) |
|
576 | 576 | ) { |
577 | - $payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' ); |
|
577 | + $payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options'); |
|
578 | 578 | } |
579 | 579 | // DEBUG LOG |
580 | 580 | //$this->log( |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | // ) |
587 | 587 | //); |
588 | 588 | /** @type EE_Transaction_Payments $transaction_payments */ |
589 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
589 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
590 | 590 | // maybe update status, but don't save transaction just yet |
591 | - $transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false ); |
|
591 | + $transaction_payments->update_transaction_status_based_on_total_paid($transaction, false); |
|
592 | 592 | // check if 'finalize_registration' step has been completed... |
593 | - $finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' ); |
|
593 | + $finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration'); |
|
594 | 594 | // DEBUG LOG |
595 | 595 | //$this->log( |
596 | 596 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | // ) |
602 | 602 | //); |
603 | 603 | // if this is an IPN and the final step has not been initiated |
604 | - if ( $IPN && $payment_options_step_completed && $finalized === false ) { |
|
604 | + if ($IPN && $payment_options_step_completed && $finalized === false) { |
|
605 | 605 | // and if it hasn't already been set as being started... |
606 | - $finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' ); |
|
606 | + $finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration'); |
|
607 | 607 | // DEBUG LOG |
608 | 608 | //$this->log( |
609 | 609 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -616,13 +616,13 @@ discard block |
||
616 | 616 | } |
617 | 617 | $transaction->save(); |
618 | 618 | // because the above will return false if the final step was not fully completed, we need to check again... |
619 | - if ( $IPN && $finalized !== false ) { |
|
619 | + if ($IPN && $finalized !== false) { |
|
620 | 620 | // and if we are all good to go, then send out notifications |
621 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
621 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
622 | 622 | // DEBUG LOG |
623 | 623 | //$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction ); |
624 | 624 | //ok, now process the transaction according to the payment |
625 | - $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment ); |
|
625 | + $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment); |
|
626 | 626 | } |
627 | 627 | // DEBUG LOG |
628 | 628 | //$this->log( |
@@ -24,14 +24,14 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | static $initialized = false; |
27 | - if ( ! $initialized ) { |
|
27 | + if ( ! $initialized) { |
|
28 | 28 | // instantiate PSR4 autoloader |
29 | - espresso_load_required( 'Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php' ); |
|
29 | + espresso_load_required('Psr4Autoloader', EE_CORE.'Psr4Autoloader.php'); |
|
30 | 30 | EE_Psr4AutoloaderInit::$psr4_loader = new \EventEspresso\Core\Psr4Autoloader(); |
31 | 31 | // register the autoloader |
32 | 32 | EE_Psr4AutoloaderInit::$psr4_loader->register(); |
33 | 33 | // register the base directories for the namespace prefix |
34 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace( 'EventEspresso', EE_PLUGIN_DIR_PATH ); |
|
34 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
|
35 | 35 | $initialized = true; |
36 | 36 | } |
37 | 37 | } |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Event Espresso |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EE_System |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage core/ |
|
20 | - * @author Brent Christensen, Michael Nelson |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Event Espresso |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EE_System |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage core/ |
|
20 | + * @author Brent Christensen, Michael Nelson |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | final class EE_System { |
25 | 25 | |
26 | 26 | |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | |
204 | 204 | |
205 | 205 | /** |
206 | - * detect_if_activation_or_upgrade |
|
207 | - * |
|
208 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
209 | - * and either setting up the DB or setting up maintenance mode etc. |
|
210 | - * |
|
211 | - * @access public |
|
212 | - * @return void |
|
213 | - */ |
|
206 | + * detect_if_activation_or_upgrade |
|
207 | + * |
|
208 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
209 | + * and either setting up the DB or setting up maintenance mode etc. |
|
210 | + * |
|
211 | + * @access public |
|
212 | + * @return void |
|
213 | + */ |
|
214 | 214 | public function detect_if_activation_or_upgrade() { |
215 | 215 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
216 | 216 | |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | $query_params = array( 'page' => 'espresso_about' ); |
515 | 515 | |
516 | 516 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
517 | - $query_params['new_activation'] = TRUE; |
|
517 | + $query_params['new_activation'] = TRUE; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
521 | - $query_params['reactivation'] = TRUE; |
|
521 | + $query_params['reactivation'] = TRUE; |
|
522 | 522 | } |
523 | 523 | $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
524 | 524 | wp_safe_redirect( $url ); |
@@ -621,11 +621,11 @@ discard block |
||
621 | 621 | |
622 | 622 | |
623 | 623 | /** |
624 | - * _incompatible_addon_error |
|
625 | - * |
|
626 | - * @access public |
|
627 | - * @return void |
|
628 | - */ |
|
624 | + * _incompatible_addon_error |
|
625 | + * |
|
626 | + * @access public |
|
627 | + * @return void |
|
628 | + */ |
|
629 | 629 | private function _incompatible_addon_error() { |
630 | 630 | // get array of classes hooking into here |
631 | 631 | $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
@@ -747,14 +747,14 @@ discard block |
||
747 | 747 | |
748 | 748 | |
749 | 749 | /** |
750 | - * load_controllers |
|
751 | - * |
|
752 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
753 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
754 | - * |
|
755 | - * @access public |
|
756 | - * @return void |
|
757 | - */ |
|
750 | + * load_controllers |
|
751 | + * |
|
752 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
753 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
754 | + * |
|
755 | + * @access public |
|
756 | + * @return void |
|
757 | + */ |
|
758 | 758 | public function load_controllers() { |
759 | 759 | do_action( 'AHEE__EE_System__load_controllers__start' ); |
760 | 760 | // let's get it started |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | |
772 | 772 | |
773 | 773 | /** |
774 | - * core_loaded_and_ready |
|
775 | - * |
|
776 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
777 | - * |
|
778 | - * @access public |
|
779 | - * @return void |
|
780 | - */ |
|
774 | + * core_loaded_and_ready |
|
775 | + * |
|
776 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
777 | + * |
|
778 | + * @access public |
|
779 | + * @return void |
|
780 | + */ |
|
781 | 781 | public function core_loaded_and_ready() { |
782 | 782 | do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
783 | 783 | do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
@@ -788,13 +788,13 @@ discard block |
||
788 | 788 | |
789 | 789 | |
790 | 790 | /** |
791 | - * initialize |
|
792 | - * |
|
793 | - * this is the best place to begin initializing client code |
|
794 | - * |
|
795 | - * @access public |
|
796 | - * @return void |
|
797 | - */ |
|
791 | + * initialize |
|
792 | + * |
|
793 | + * this is the best place to begin initializing client code |
|
794 | + * |
|
795 | + * @access public |
|
796 | + * @return void |
|
797 | + */ |
|
798 | 798 | public function initialize() { |
799 | 799 | do_action( 'AHEE__EE_System__initialize' ); |
800 | 800 | } |
@@ -802,13 +802,13 @@ discard block |
||
802 | 802 | |
803 | 803 | |
804 | 804 | /** |
805 | - * initialize_last |
|
806 | - * |
|
807 | - * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
808 | - * |
|
809 | - * @access public |
|
810 | - * @return void |
|
811 | - */ |
|
805 | + * initialize_last |
|
806 | + * |
|
807 | + * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
808 | + * |
|
809 | + * @access public |
|
810 | + * @return void |
|
811 | + */ |
|
812 | 812 | public function initialize_last() { |
813 | 813 | do_action( 'AHEE__EE_System__initialize_last' ); |
814 | 814 | } |
@@ -817,14 +817,14 @@ discard block |
||
817 | 817 | |
818 | 818 | |
819 | 819 | /** |
820 | - * set_hooks_for_shortcodes_modules_and_addons |
|
821 | - * |
|
822 | - * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
823 | - * this happens at the very beginning of the wp_loaded hookpoint |
|
824 | - * |
|
825 | - * @access public |
|
826 | - * @return void |
|
827 | - */ |
|
820 | + * set_hooks_for_shortcodes_modules_and_addons |
|
821 | + * |
|
822 | + * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
823 | + * this happens at the very beginning of the wp_loaded hookpoint |
|
824 | + * |
|
825 | + * @access public |
|
826 | + * @return void |
|
827 | + */ |
|
828 | 828 | public function set_hooks_for_shortcodes_modules_and_addons() { |
829 | 829 | // do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
830 | 830 | } |
@@ -833,13 +833,13 @@ discard block |
||
833 | 833 | |
834 | 834 | |
835 | 835 | /** |
836 | - * do_not_cache |
|
837 | - * |
|
838 | - * sets no cache headers and defines no cache constants for WP plugins |
|
839 | - * |
|
840 | - * @access public |
|
841 | - * @return void |
|
842 | - */ |
|
836 | + * do_not_cache |
|
837 | + * |
|
838 | + * sets no cache headers and defines no cache constants for WP plugins |
|
839 | + * |
|
840 | + * @access public |
|
841 | + * @return void |
|
842 | + */ |
|
843 | 843 | public static function do_not_cache() { |
844 | 844 | // set no cache constants |
845 | 845 | if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | //Current post |
959 | 959 | global $post; |
960 | 960 | |
961 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
961 | + if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
962 | 962 | //Events Edit Current Event |
963 | 963 | $admin_bar->add_menu(array( |
964 | 964 | 'id' => 'espresso-toolbar-events-edit', |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function instance() { |
104 | 104 | // check if class object is instantiated |
105 | - if ( ! self::$_instance instanceof EE_System ) { |
|
105 | + if ( ! self::$_instance instanceof EE_System) { |
|
106 | 106 | self::$_instance = new self(); |
107 | 107 | } |
108 | 108 | return self::$_instance; |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * resets the instance and returns it |
114 | 114 | * @return EE_System |
115 | 115 | */ |
116 | - public static function reset(){ |
|
116 | + public static function reset() { |
|
117 | 117 | self::$_instance->_req_type = NULL; |
118 | 118 | //we need to reset the migration manager in order for it to detect DMSs properly |
119 | 119 | EE_Data_Migration_Manager::reset(); |
120 | 120 | //make sure none of the old hooks are left hanging around |
121 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
121 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
122 | 122 | self::instance()->detect_activations_or_upgrades(); |
123 | 123 | self::instance()->perform_activations_upgrades_and_migrations(); |
124 | 124 | return self::instance(); |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | * @access private |
135 | 135 | */ |
136 | 136 | private function __construct() { |
137 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
137 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
138 | 138 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
139 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
139 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
140 | 140 | // when an ee addon is activated, we want to call the core hook(s) again |
141 | 141 | // because the newly-activated addon didn't get a chance to run at all |
142 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
142 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
143 | 143 | // detect whether install or upgrade |
144 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
144 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
145 | 145 | // load EE_Config, EE_Textdomain, etc |
146 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
146 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
147 | 147 | // load EE_Config, EE_Textdomain, etc |
148 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
148 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
149 | 149 | // you wanna get going? I wanna get going... let's get going! |
150 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
150 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
151 | 151 | //other housekeeping |
152 | 152 | //exclude EE critical pages from wp_list_pages |
153 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
153 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
154 | 154 | // ALL EE Addons should use the following hook point to attach their initial setup too |
155 | 155 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
156 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
156 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | public function load_espresso_addons() { |
174 | 174 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
175 | 175 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
176 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
176 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
177 | 177 | //load and setup EE_Capabilities |
178 | - EE_Registry::instance()->load_core( 'Capabilities' ); |
|
179 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
178 | + EE_Registry::instance()->load_core('Capabilities'); |
|
179 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * @access public |
192 | 192 | * @return void |
193 | 193 | */ |
194 | - public function detect_activations_or_upgrades(){ |
|
194 | + public function detect_activations_or_upgrades() { |
|
195 | 195 | //first off: let's make sure to handle core |
196 | 196 | $this->detect_if_activation_or_upgrade(); |
197 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
197 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
198 | 198 | //detect teh request type for that addon |
199 | 199 | $addon->detect_activation_or_upgrade(); |
200 | 200 | } |
@@ -215,44 +215,44 @@ discard block |
||
215 | 215 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
216 | 216 | |
217 | 217 | // load M-Mode class |
218 | - EE_Registry::instance()->load_core( 'Maintenance_Mode' ); |
|
218 | + EE_Registry::instance()->load_core('Maintenance_Mode'); |
|
219 | 219 | // check if db has been updated, or if its a brand-new installation |
220 | 220 | |
221 | 221 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
222 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
222 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
223 | 223 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
224 | - if( $request_type != EE_System::req_type_normal){ |
|
224 | + if ($request_type != EE_System::req_type_normal) { |
|
225 | 225 | EE_Registry::instance()->load_helper('Activation'); |
226 | 226 | } |
227 | 227 | |
228 | - switch($request_type){ |
|
228 | + switch ($request_type) { |
|
229 | 229 | case EE_System::req_type_new_activation: |
230 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
231 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
230 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
231 | + $this->_handle_core_version_change($espresso_db_update); |
|
232 | 232 | break; |
233 | 233 | case EE_System::req_type_reactivation: |
234 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
235 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
234 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
235 | + $this->_handle_core_version_change($espresso_db_update); |
|
236 | 236 | break; |
237 | 237 | case EE_System::req_type_upgrade: |
238 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
238 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
239 | 239 | //migrations may be required now that we've upgraded |
240 | 240 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
241 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
241 | + $this->_handle_core_version_change($espresso_db_update); |
|
242 | 242 | // echo "done upgrade";die; |
243 | 243 | break; |
244 | 244 | case EE_System::req_type_downgrade: |
245 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
245 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
246 | 246 | //its possible migrations are no longer required |
247 | 247 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
248 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
248 | + $this->_handle_core_version_change($espresso_db_update); |
|
249 | 249 | break; |
250 | 250 | case EE_System::req_type_normal: |
251 | 251 | default: |
252 | 252 | // $this->_maybe_redirect_to_ee_about(); |
253 | 253 | break; |
254 | 254 | } |
255 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
255 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | * initializing the database later during the request |
261 | 261 | * @param array $espresso_db_update |
262 | 262 | */ |
263 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
264 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
263 | + protected function _handle_core_version_change($espresso_db_update) { |
|
264 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
265 | 265 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
266 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
266 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,44 +278,44 @@ discard block |
||
278 | 278 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
279 | 279 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
280 | 280 | */ |
281 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
282 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
283 | - if( ! $espresso_db_update){ |
|
284 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
281 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
282 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
283 | + if ( ! $espresso_db_update) { |
|
284 | + $espresso_db_update = get_option('espresso_db_update'); |
|
285 | 285 | } |
286 | 286 | // check that option is an array |
287 | - if( ! is_array( $espresso_db_update )) { |
|
287 | + if ( ! is_array($espresso_db_update)) { |
|
288 | 288 | // if option is FALSE, then it never existed |
289 | - if ( $espresso_db_update === FALSE ) { |
|
289 | + if ($espresso_db_update === FALSE) { |
|
290 | 290 | // make $espresso_db_update an array and save option with autoload OFF |
291 | - $espresso_db_update = array(); |
|
292 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
291 | + $espresso_db_update = array(); |
|
292 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
293 | 293 | } else { |
294 | 294 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
295 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
296 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
295 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
296 | + update_option('espresso_db_update', $espresso_db_update); |
|
297 | 297 | } |
298 | - }else{ |
|
298 | + } else { |
|
299 | 299 | $corrected_db_update = array(); |
300 | 300 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
301 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
302 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
301 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
302 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
303 | 303 | //the key is an int, and the value IS NOT an array |
304 | 304 | //so it must be numerically-indexed, where values are versions installed... |
305 | 305 | //fix it! |
306 | 306 | $version_string = $should_be_array; |
307 | 307 | $corrected_db_update[$version_string] = array('unknown-date'); |
308 | - }else{ |
|
308 | + } else { |
|
309 | 309 | //ok it checks out |
310 | 310 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | $espresso_db_update = $corrected_db_update; |
314 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
314 | + update_option('espresso_db_update', $espresso_db_update); |
|
315 | 315 | |
316 | 316 | } |
317 | 317 | |
318 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
318 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
319 | 319 | return $espresso_db_update; |
320 | 320 | } |
321 | 321 | |
@@ -334,33 +334,33 @@ discard block |
||
334 | 334 | * so we prefer to only do it when necessary |
335 | 335 | * @return void |
336 | 336 | */ |
337 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
337 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
338 | 338 | $request_type = $this->detect_req_type(); |
339 | 339 | //only initialize system if we're not in maintenance mode. |
340 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
341 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
340 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
341 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
342 | 342 | EEH_Activation::system_initialization(); |
343 | - if( $verify_schema ) { |
|
343 | + if ($verify_schema) { |
|
344 | 344 | EEH_Activation::initialize_db_and_folders(); |
345 | 345 | } |
346 | 346 | EEH_Activation::initialize_db_content(); |
347 | - if( $initialize_addons_too ) { |
|
347 | + if ($initialize_addons_too) { |
|
348 | 348 | $this->initialize_addons(); |
349 | 349 | } |
350 | - }else{ |
|
351 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
350 | + } else { |
|
351 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
352 | 352 | } |
353 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
354 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
353 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
354 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Initializes the db for all registered addons |
360 | 360 | */ |
361 | - public function initialize_addons(){ |
|
361 | + public function initialize_addons() { |
|
362 | 362 | //foreach registered addon, make sure its db is up-to-date too |
363 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
363 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
364 | 364 | $addon->initialize_db_if_no_migrations_required(); |
365 | 365 | } |
366 | 366 | } |
@@ -372,16 +372,16 @@ discard block |
||
372 | 372 | * @param string $current_version_to_add version to be added to the version history |
373 | 373 | * @return boolean success as to whether or not this option was changed |
374 | 374 | */ |
375 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
376 | - if( ! $version_history ) { |
|
375 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
376 | + if ( ! $version_history) { |
|
377 | 377 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
378 | 378 | } |
379 | - if( $current_version_to_add == NULL){ |
|
379 | + if ($current_version_to_add == NULL) { |
|
380 | 380 | $current_version_to_add = espresso_version(); |
381 | 381 | } |
382 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
382 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
383 | 383 | // re-save |
384 | - return update_option( 'espresso_db_update', $version_history ); |
|
384 | + return update_option('espresso_db_update', $version_history); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -398,10 +398,10 @@ discard block |
||
398 | 398 | * but still know if this is a new install or not |
399 | 399 | * @return int one of the constants on EE_System::req_type_ |
400 | 400 | */ |
401 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
402 | - if ( $this->_req_type === NULL ){ |
|
403 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
404 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
401 | + public function detect_req_type($espresso_db_update = NULL) { |
|
402 | + if ($this->_req_type === NULL) { |
|
403 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
404 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
405 | 405 | } |
406 | 406 | return $this->_req_type; |
407 | 407 | } |
@@ -417,39 +417,39 @@ discard block |
||
417 | 417 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
418 | 418 | * @return int one of the constants on EE_System::req_type_* |
419 | 419 | */ |
420 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
421 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
422 | - if( $activation_history_for_addon ){ |
|
420 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
421 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
422 | + if ($activation_history_for_addon) { |
|
423 | 423 | //it exists, so this isn't a completely new install |
424 | 424 | //check if this version already in that list of previously installed versions |
425 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
425 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
426 | 426 | //it a version we haven't seen before |
427 | - if( $version_is_higher === 1 ){ |
|
427 | + if ($version_is_higher === 1) { |
|
428 | 428 | $req_type = EE_System::req_type_upgrade; |
429 | - }else{ |
|
429 | + } else { |
|
430 | 430 | $req_type = EE_System::req_type_downgrade; |
431 | 431 | } |
432 | - delete_option( $activation_indicator_option_name ); |
|
432 | + delete_option($activation_indicator_option_name); |
|
433 | 433 | } else { |
434 | 434 | // its not an update. maybe a reactivation? |
435 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
436 | - if ( $version_is_higher === -1 ){ |
|
435 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
436 | + if ($version_is_higher === -1) { |
|
437 | 437 | $req_type = EE_System::req_type_downgrade; |
438 | - }elseif( $version_is_higher === 0 ){ |
|
438 | + }elseif ($version_is_higher === 0) { |
|
439 | 439 | //we've seen this version before, but it's an activation. must be a reactivation |
440 | 440 | $req_type = EE_System::req_type_reactivation; |
441 | - }else{//$version_is_higher === 1 |
|
441 | + } else {//$version_is_higher === 1 |
|
442 | 442 | $req_type = EE_System::req_type_upgrade; |
443 | 443 | } |
444 | - delete_option( $activation_indicator_option_name ); |
|
444 | + delete_option($activation_indicator_option_name); |
|
445 | 445 | } else { |
446 | 446 | //we've seen this version before and the activation indicate doesn't show it was just activated |
447 | - if ( $version_is_higher === -1 ){ |
|
447 | + if ($version_is_higher === -1) { |
|
448 | 448 | $req_type = EE_System::req_type_downgrade; |
449 | - }elseif( $version_is_higher === 0 ){ |
|
449 | + }elseif ($version_is_higher === 0) { |
|
450 | 450 | //we've seen this version before and it's not an activation. its normal request |
451 | 451 | $req_type = EE_System::req_type_normal; |
452 | - }else{//$version_is_higher === 1 |
|
452 | + } else {//$version_is_higher === 1 |
|
453 | 453 | $req_type = EE_System::req_type_upgrade; |
454 | 454 | } |
455 | 455 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | } else { |
458 | 458 | //brand new install |
459 | 459 | $req_type = EE_System::req_type_new_activation; |
460 | - delete_option( $activation_indicator_option_name ); |
|
460 | + delete_option($activation_indicator_option_name); |
|
461 | 461 | } |
462 | 462 | return $req_type; |
463 | 463 | } |
@@ -475,30 +475,30 @@ discard block |
||
475 | 475 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
476 | 476 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
477 | 477 | */ |
478 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
478 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
479 | 479 | //find the most recently-activated version |
480 | 480 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
481 | 481 | $most_recently_active_version = '0.0.0.dev.000'; |
482 | - if( is_array( $activation_history_for_addon ) ){ |
|
483 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
482 | + if (is_array($activation_history_for_addon)) { |
|
483 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
484 | 484 | //check there is a record of when this version was activated. Otherwise, |
485 | 485 | //mark it as unknown |
486 | - if( ! $times_activated ){ |
|
487 | - $times_activated = array( 'unknown-date'); |
|
486 | + if ( ! $times_activated) { |
|
487 | + $times_activated = array('unknown-date'); |
|
488 | 488 | } |
489 | - if( is_string( $times_activated ) ){ |
|
490 | - $times_activated = array( $times_activated ); |
|
489 | + if (is_string($times_activated)) { |
|
490 | + $times_activated = array($times_activated); |
|
491 | 491 | } |
492 | - foreach( $times_activated as $an_activation ){ |
|
493 | - if( $an_activation != 'unknown-date' && |
|
494 | - $an_activation > $most_recently_active_version_activation ){ |
|
492 | + foreach ($times_activated as $an_activation) { |
|
493 | + if ($an_activation != 'unknown-date' && |
|
494 | + $an_activation > $most_recently_active_version_activation) { |
|
495 | 495 | $most_recently_active_version = $version; |
496 | 496 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
500 | 500 | } |
501 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
501 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -508,20 +508,20 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | public function redirect_to_about_ee() { |
511 | - $notices = EE_Error::get_notices( FALSE ); |
|
511 | + $notices = EE_Error::get_notices(FALSE); |
|
512 | 512 | //if current user is an admin and it's not an ajax request |
513 | - if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) && ! isset( $notices[ 'errors' ] ) ){ |
|
514 | - $query_params = array( 'page' => 'espresso_about' ); |
|
513 | + if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) { |
|
514 | + $query_params = array('page' => 'espresso_about'); |
|
515 | 515 | |
516 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
516 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
517 | 517 | $query_params['new_activation'] = TRUE; |
518 | 518 | } |
519 | 519 | |
520 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
520 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
521 | 521 | $query_params['reactivation'] = TRUE; |
522 | 522 | } |
523 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
524 | - wp_safe_redirect( $url ); |
|
523 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
524 | + wp_safe_redirect($url); |
|
525 | 525 | exit(); |
526 | 526 | } |
527 | 527 | } |
@@ -535,31 +535,31 @@ discard block |
||
535 | 535 | * |
536 | 536 | * @return void |
537 | 537 | */ |
538 | - public function load_core_configuration(){ |
|
539 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
540 | - EE_Registry::instance()->load_core( 'EE_Load_Textdomain' ); |
|
538 | + public function load_core_configuration() { |
|
539 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
540 | + EE_Registry::instance()->load_core('EE_Load_Textdomain'); |
|
541 | 541 | //load textdomain |
542 | 542 | EE_Load_Textdomain::load_textdomain(); |
543 | 543 | // load and setup EE_Config and EE_Network_Config |
544 | - EE_Registry::instance()->load_core( 'Config' ); |
|
545 | - EE_Registry::instance()->load_core( 'Network_Config' ); |
|
544 | + EE_Registry::instance()->load_core('Config'); |
|
545 | + EE_Registry::instance()->load_core('Network_Config'); |
|
546 | 546 | // setup autoloaders |
547 | 547 | // enable logging? |
548 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
549 | - EE_Registry::instance()->load_core( 'Log' ); |
|
548 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
549 | + EE_Registry::instance()->load_core('Log'); |
|
550 | 550 | } |
551 | 551 | // check for activation errors |
552 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
553 | - if ( $activation_errors ) { |
|
554 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
555 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
552 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
553 | + if ($activation_errors) { |
|
554 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
555 | + update_option('ee_plugin_activation_errors', FALSE); |
|
556 | 556 | } |
557 | 557 | // get model names |
558 | 558 | $this->_parse_model_names(); |
559 | 559 | |
560 | 560 | //load caf stuff a chance to play during the activation process too. |
561 | 561 | $this->_maybe_brew_regular(); |
562 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
562 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
@@ -568,23 +568,23 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @return void |
570 | 570 | */ |
571 | - private function _parse_model_names(){ |
|
571 | + private function _parse_model_names() { |
|
572 | 572 | //get all the files in the EE_MODELS folder that end in .model.php |
573 | - $models = glob( EE_MODELS.'*.model.php'); |
|
573 | + $models = glob(EE_MODELS.'*.model.php'); |
|
574 | 574 | $model_names = array(); |
575 | 575 | $non_abstract_db_models = array(); |
576 | - foreach( $models as $model ){ |
|
576 | + foreach ($models as $model) { |
|
577 | 577 | // get model classname |
578 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
579 | - $shortname = str_replace( 'EEM_', '', $classname ); |
|
578 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
579 | + $shortname = str_replace('EEM_', '', $classname); |
|
580 | 580 | $reflectionClass = new ReflectionClass($classname); |
581 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
581 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
582 | 582 | $non_abstract_db_models[$shortname] = $classname; |
583 | 583 | } |
584 | - $model_names[ $shortname ] = $classname; |
|
584 | + $model_names[$shortname] = $classname; |
|
585 | 585 | } |
586 | - EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
587 | - EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
586 | + EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
587 | + EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * @return void |
595 | 595 | */ |
596 | 596 | private function _maybe_brew_regular() { |
597 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
598 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
597 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
598 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | * @return void |
613 | 613 | */ |
614 | 614 | public function register_shortcodes_modules_and_widgets() { |
615 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
615 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
616 | 616 | // check for addons using old hookpoint |
617 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
617 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
618 | 618 | $this->_incompatible_addon_error(); |
619 | 619 | } |
620 | 620 | } |
@@ -628,19 +628,19 @@ discard block |
||
628 | 628 | */ |
629 | 629 | private function _incompatible_addon_error() { |
630 | 630 | // get array of classes hooking into here |
631 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
632 | - if ( ! empty( $class_names )) { |
|
633 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
631 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
632 | + if ( ! empty($class_names)) { |
|
633 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
634 | 634 | $msg .= '<ul>'; |
635 | - foreach ( $class_names as $class_name ) { |
|
636 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
635 | + foreach ($class_names as $class_name) { |
|
636 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
637 | 637 | } |
638 | 638 | $msg .= '</ul>'; |
639 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
639 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
640 | 640 | // save list of incompatible addons to wp-options for later use |
641 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
642 | - if ( is_admin() ) { |
|
643 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
641 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
642 | + if (is_admin()) { |
|
643 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | } |
@@ -657,25 +657,25 @@ discard block |
||
657 | 657 | * |
658 | 658 | * @return void |
659 | 659 | */ |
660 | - public function brew_espresso(){ |
|
661 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
660 | + public function brew_espresso() { |
|
661 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
662 | 662 | // load some final core systems |
663 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
664 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
665 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
666 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
667 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
668 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
669 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
670 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
671 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
672 | - |
|
673 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
663 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
664 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
665 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
666 | + add_action('init', array($this, 'load_controllers'), 7); |
|
667 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
668 | + add_action('init', array($this, 'initialize'), 10); |
|
669 | + add_action('init', array($this, 'initialize_last'), 100); |
|
670 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
671 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
672 | + |
|
673 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
674 | 674 | // pew pew pew |
675 | - EE_Registry::instance()->load_core( 'PUE' ); |
|
676 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
675 | + EE_Registry::instance()->load_core('PUE'); |
|
676 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
677 | 677 | } |
678 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
678 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | */ |
690 | 690 | public function set_hooks_for_core() { |
691 | 691 | $this->_deactivate_incompatible_addons(); |
692 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
692 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | |
@@ -698,15 +698,15 @@ discard block |
||
698 | 698 | * Using the information gathered in EE_System::_incompatible_addon_error, |
699 | 699 | * deactivates any addons considered incompatible with the current version of EE |
700 | 700 | */ |
701 | - private function _deactivate_incompatible_addons(){ |
|
702 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
703 | - if ( ! empty( $incompatible_addons )) { |
|
704 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
705 | - foreach ( $active_plugins as $active_plugin ) { |
|
706 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
707 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
708 | - unset( $_GET['activate'] ); |
|
709 | - espresso_deactivate_plugin( $active_plugin ); |
|
701 | + private function _deactivate_incompatible_addons() { |
|
702 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
703 | + if ( ! empty($incompatible_addons)) { |
|
704 | + $active_plugins = get_option('active_plugins', array()); |
|
705 | + foreach ($active_plugins as $active_plugin) { |
|
706 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
707 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
708 | + unset($_GET['activate']); |
|
709 | + espresso_deactivate_plugin($active_plugin); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | } |
@@ -723,10 +723,10 @@ discard block |
||
723 | 723 | */ |
724 | 724 | public function perform_activations_upgrades_and_migrations() { |
725 | 725 | //first check if we had previously attempted to setup EE's directories but failed |
726 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
726 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
727 | 727 | EEH_Activation::create_upload_directories(); |
728 | 728 | } |
729 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
729 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | |
@@ -738,10 +738,10 @@ discard block |
||
738 | 738 | * @return void |
739 | 739 | */ |
740 | 740 | public function load_CPTs_and_session() { |
741 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
741 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
742 | 742 | // register Custom Post Types |
743 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
744 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
743 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
744 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -756,16 +756,16 @@ discard block |
||
756 | 756 | * @return void |
757 | 757 | */ |
758 | 758 | public function load_controllers() { |
759 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
759 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
760 | 760 | // let's get it started |
761 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
762 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
763 | - EE_Registry::instance()->load_core( 'Front_Controller' ); |
|
764 | - } else if ( ! EE_FRONT_AJAX ) { |
|
765 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
766 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
761 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
762 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
763 | + EE_Registry::instance()->load_core('Front_Controller'); |
|
764 | + } else if ( ! EE_FRONT_AJAX) { |
|
765 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
766 | + EE_Registry::instance()->load_core('Admin'); |
|
767 | 767 | } |
768 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
768 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -779,10 +779,10 @@ discard block |
||
779 | 779 | * @return void |
780 | 780 | */ |
781 | 781 | public function core_loaded_and_ready() { |
782 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
783 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
782 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
783 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
784 | 784 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
785 | - EE_Registry::instance()->load_core( 'Session' ); |
|
785 | + EE_Registry::instance()->load_core('Session'); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @return void |
797 | 797 | */ |
798 | 798 | public function initialize() { |
799 | - do_action( 'AHEE__EE_System__initialize' ); |
|
799 | + do_action('AHEE__EE_System__initialize'); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | * @return void |
811 | 811 | */ |
812 | 812 | public function initialize_last() { |
813 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
813 | + do_action('AHEE__EE_System__initialize_last'); |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | |
@@ -842,21 +842,21 @@ discard block |
||
842 | 842 | */ |
843 | 843 | public static function do_not_cache() { |
844 | 844 | // set no cache constants |
845 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
846 | - define( 'DONOTCACHEPAGE', true ); |
|
845 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
846 | + define('DONOTCACHEPAGE', true); |
|
847 | 847 | } |
848 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
849 | - define( 'DONOTCACHCEOBJECT', true ); |
|
848 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
849 | + define('DONOTCACHCEOBJECT', true); |
|
850 | 850 | } |
851 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
852 | - define( 'DONOTCACHEDB', true ); |
|
851 | + if ( ! defined('DONOTCACHEDB')) { |
|
852 | + define('DONOTCACHEDB', true); |
|
853 | 853 | } |
854 | 854 | // add no cache headers |
855 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
855 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
856 | 856 | // plus a little extra for nginx |
857 | - add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 ); |
|
857 | + add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1); |
|
858 | 858 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
859 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
859 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | * @param $headers |
869 | 869 | * @return array |
870 | 870 | */ |
871 | - public static function nocache_headers_nginx ( $headers ) { |
|
871 | + public static function nocache_headers_nginx($headers) { |
|
872 | 872 | $headers['X-Accel-Expires'] = 0; |
873 | 873 | return $headers; |
874 | 874 | } |
@@ -894,15 +894,15 @@ discard block |
||
894 | 894 | * @param $admin_bar |
895 | 895 | * @return void |
896 | 896 | */ |
897 | - public function espresso_toolbar_items( $admin_bar ) { |
|
897 | + public function espresso_toolbar_items($admin_bar) { |
|
898 | 898 | |
899 | 899 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
900 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
900 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
901 | 901 | return; |
902 | 902 | } |
903 | 903 | |
904 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
905 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
904 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
905 | + EE_Registry::instance()->load_helper('URL'); |
|
906 | 906 | $menu_class = 'espresso_menu_item_class'; |
907 | 907 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
908 | 908 | //because they're only defined in each of their respective constructors |
@@ -914,20 +914,20 @@ discard block |
||
914 | 914 | //Top Level |
915 | 915 | $admin_bar->add_menu(array( |
916 | 916 | 'id' => 'espresso-toolbar', |
917 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
917 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
918 | 918 | 'href' => $events_admin_url, |
919 | 919 | 'meta' => array( |
920 | 920 | 'title' => __('Event Espresso', 'event_espresso'), |
921 | - 'class' => $menu_class . 'first' |
|
921 | + 'class' => $menu_class.'first' |
|
922 | 922 | ), |
923 | 923 | )); |
924 | 924 | |
925 | 925 | //Events |
926 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
926 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
927 | 927 | $admin_bar->add_menu(array( |
928 | 928 | 'id' => 'espresso-toolbar-events', |
929 | 929 | 'parent' => 'espresso-toolbar', |
930 | - 'title' => __( 'Events', 'event_espresso' ), |
|
930 | + 'title' => __('Events', 'event_espresso'), |
|
931 | 931 | 'href' => $events_admin_url, |
932 | 932 | 'meta' => array( |
933 | 933 | 'title' => __('Events', 'event_espresso'), |
@@ -938,13 +938,13 @@ discard block |
||
938 | 938 | } |
939 | 939 | |
940 | 940 | |
941 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
941 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
942 | 942 | //Events Add New |
943 | 943 | $admin_bar->add_menu(array( |
944 | 944 | 'id' => 'espresso-toolbar-events-new', |
945 | 945 | 'parent' => 'espresso-toolbar-events', |
946 | 946 | 'title' => __('Add New', 'event_espresso'), |
947 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
947 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
948 | 948 | 'meta' => array( |
949 | 949 | 'title' => __('Add New', 'event_espresso'), |
950 | 950 | 'target' => '', |
@@ -953,18 +953,18 @@ discard block |
||
953 | 953 | )); |
954 | 954 | } |
955 | 955 | |
956 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
956 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
957 | 957 | |
958 | 958 | //Current post |
959 | 959 | global $post; |
960 | 960 | |
961 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
961 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
962 | 962 | //Events Edit Current Event |
963 | 963 | $admin_bar->add_menu(array( |
964 | 964 | 'id' => 'espresso-toolbar-events-edit', |
965 | 965 | 'parent' => 'espresso-toolbar-events', |
966 | 966 | 'title' => __('Edit Event', 'event_espresso'), |
967 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
967 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
968 | 968 | 'meta' => array( |
969 | 969 | 'title' => __('Edit Event', 'event_espresso'), |
970 | 970 | 'target' => '', |
@@ -976,11 +976,11 @@ discard block |
||
976 | 976 | } |
977 | 977 | |
978 | 978 | //Events View |
979 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
979 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
980 | 980 | $admin_bar->add_menu(array( |
981 | 981 | 'id' => 'espresso-toolbar-events-view', |
982 | 982 | 'parent' => 'espresso-toolbar-events', |
983 | - 'title' => __( 'View', 'event_espresso' ), |
|
983 | + 'title' => __('View', 'event_espresso'), |
|
984 | 984 | 'href' => $events_admin_url, |
985 | 985 | 'meta' => array( |
986 | 986 | 'title' => __('View', 'event_espresso'), |
@@ -990,12 +990,12 @@ discard block |
||
990 | 990 | )); |
991 | 991 | } |
992 | 992 | |
993 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
993 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
994 | 994 | //Events View All |
995 | 995 | $admin_bar->add_menu(array( |
996 | 996 | 'id' => 'espresso-toolbar-events-all', |
997 | 997 | 'parent' => 'espresso-toolbar-events-view', |
998 | - 'title' => __( 'All', 'event_espresso' ), |
|
998 | + 'title' => __('All', 'event_espresso'), |
|
999 | 999 | 'href' => $events_admin_url, |
1000 | 1000 | 'meta' => array( |
1001 | 1001 | 'title' => __('All', 'event_espresso'), |
@@ -1006,13 +1006,13 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | |
1009 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1009 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1010 | 1010 | //Events View Today |
1011 | 1011 | $admin_bar->add_menu(array( |
1012 | 1012 | 'id' => 'espresso-toolbar-events-today', |
1013 | 1013 | 'parent' => 'espresso-toolbar-events-view', |
1014 | 1014 | 'title' => __('Today', 'event_espresso'), |
1015 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1015 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1016 | 1016 | 'meta' => array( |
1017 | 1017 | 'title' => __('Today', 'event_espresso'), |
1018 | 1018 | 'target' => '', |
@@ -1022,13 +1022,13 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | |
1025 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1025 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1026 | 1026 | //Events View This Month |
1027 | 1027 | $admin_bar->add_menu(array( |
1028 | 1028 | 'id' => 'espresso-toolbar-events-month', |
1029 | 1029 | 'parent' => 'espresso-toolbar-events-view', |
1030 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1031 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1030 | + 'title' => __('This Month', 'event_espresso'), |
|
1031 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1032 | 1032 | 'meta' => array( |
1033 | 1033 | 'title' => __('This Month', 'event_espresso'), |
1034 | 1034 | 'target' => '', |
@@ -1038,11 +1038,11 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | //Registration Overview |
1041 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1041 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1042 | 1042 | $admin_bar->add_menu(array( |
1043 | 1043 | 'id' => 'espresso-toolbar-registrations', |
1044 | 1044 | 'parent' => 'espresso-toolbar', |
1045 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1045 | + 'title' => __('Registrations', 'event_espresso'), |
|
1046 | 1046 | 'href' => $reg_admin_url, |
1047 | 1047 | 'meta' => array( |
1048 | 1048 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1053,12 +1053,12 @@ discard block |
||
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | //Registration Overview Today |
1056 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1056 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1057 | 1057 | $admin_bar->add_menu(array( |
1058 | 1058 | 'id' => 'espresso-toolbar-registrations-today', |
1059 | 1059 | 'parent' => 'espresso-toolbar-registrations', |
1060 | - 'title' => __( 'Today', 'event_espresso'), |
|
1061 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1060 | + 'title' => __('Today', 'event_espresso'), |
|
1061 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1062 | 1062 | 'meta' => array( |
1063 | 1063 | 'title' => __('Today', 'event_espresso'), |
1064 | 1064 | 'target' => '', |
@@ -1068,14 +1068,14 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | //Registration Overview Today Completed |
1071 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1071 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1072 | 1072 | $admin_bar->add_menu(array( |
1073 | 1073 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1074 | 1074 | 'parent' => 'espresso-toolbar-registrations-today', |
1075 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1076 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1075 | + 'title' => __('Approved', 'event_espresso'), |
|
1076 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1077 | 1077 | 'meta' => array( |
1078 | - 'title' => __('Approved', 'event_espresso' ), |
|
1078 | + 'title' => __('Approved', 'event_espresso'), |
|
1079 | 1079 | 'target' => '', |
1080 | 1080 | 'class' => $menu_class |
1081 | 1081 | ), |
@@ -1083,14 +1083,14 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | //Registration Overview Today Pending\ |
1086 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1086 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1087 | 1087 | $admin_bar->add_menu(array( |
1088 | 1088 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1089 | 1089 | 'parent' => 'espresso-toolbar-registrations-today', |
1090 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1091 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1090 | + 'title' => __('Pending', 'event_espresso'), |
|
1091 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1092 | 1092 | 'meta' => array( |
1093 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1093 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1094 | 1094 | 'target' => '', |
1095 | 1095 | 'class' => $menu_class |
1096 | 1096 | ), |
@@ -1098,14 +1098,14 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | //Registration Overview Today Incomplete |
1101 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1101 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1102 | 1102 | $admin_bar->add_menu(array( |
1103 | 1103 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1104 | 1104 | 'parent' => 'espresso-toolbar-registrations-today', |
1105 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1106 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1105 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1106 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1107 | 1107 | 'meta' => array( |
1108 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1108 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1109 | 1109 | 'target' => '', |
1110 | 1110 | 'class' => $menu_class |
1111 | 1111 | ), |
@@ -1113,12 +1113,12 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | //Registration Overview Today Incomplete |
1116 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1116 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1117 | 1117 | $admin_bar->add_menu(array( |
1118 | 1118 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1119 | 1119 | 'parent' => 'espresso-toolbar-registrations-today', |
1120 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1121 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1120 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1121 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1122 | 1122 | 'meta' => array( |
1123 | 1123 | 'title' => __('Cancelled', 'event_espresso'), |
1124 | 1124 | 'target' => '', |
@@ -1128,12 +1128,12 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | //Registration Overview This Month |
1131 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1131 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1132 | 1132 | $admin_bar->add_menu(array( |
1133 | 1133 | 'id' => 'espresso-toolbar-registrations-month', |
1134 | 1134 | 'parent' => 'espresso-toolbar-registrations', |
1135 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1136 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1135 | + 'title' => __('This Month', 'event_espresso'), |
|
1136 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1137 | 1137 | 'meta' => array( |
1138 | 1138 | 'title' => __('This Month', 'event_espresso'), |
1139 | 1139 | 'target' => '', |
@@ -1143,12 +1143,12 @@ discard block |
||
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | //Registration Overview This Month Approved |
1146 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1146 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1147 | 1147 | $admin_bar->add_menu(array( |
1148 | 1148 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1149 | 1149 | 'parent' => 'espresso-toolbar-registrations-month', |
1150 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1151 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1150 | + 'title' => __('Approved', 'event_espresso'), |
|
1151 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1152 | 1152 | 'meta' => array( |
1153 | 1153 | 'title' => __('Approved', 'event_espresso'), |
1154 | 1154 | 'target' => '', |
@@ -1158,12 +1158,12 @@ discard block |
||
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | //Registration Overview This Month Pending |
1161 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1161 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1162 | 1162 | $admin_bar->add_menu(array( |
1163 | 1163 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1164 | 1164 | 'parent' => 'espresso-toolbar-registrations-month', |
1165 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1166 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1165 | + 'title' => __('Pending', 'event_espresso'), |
|
1166 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1167 | 1167 | 'meta' => array( |
1168 | 1168 | 'title' => __('Pending', 'event_espresso'), |
1169 | 1169 | 'target' => '', |
@@ -1173,14 +1173,14 @@ discard block |
||
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | //Registration Overview This Month Not Approved |
1176 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1176 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1177 | 1177 | $admin_bar->add_menu(array( |
1178 | 1178 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1179 | 1179 | 'parent' => 'espresso-toolbar-registrations-month', |
1180 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1181 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1180 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1181 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1182 | 1182 | 'meta' => array( |
1183 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1183 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1184 | 1184 | 'target' => '', |
1185 | 1185 | 'class' => $menu_class |
1186 | 1186 | ), |
@@ -1189,12 +1189,12 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | |
1191 | 1191 | //Registration Overview This Month Cancelled |
1192 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1192 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1193 | 1193 | $admin_bar->add_menu(array( |
1194 | 1194 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1195 | 1195 | 'parent' => 'espresso-toolbar-registrations-month', |
1196 | 1196 | 'title' => __('Cancelled', 'event_espresso'), |
1197 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1197 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1198 | 1198 | 'meta' => array( |
1199 | 1199 | 'title' => __('Cancelled', 'event_espresso'), |
1200 | 1200 | 'target' => '', |
@@ -1204,11 +1204,11 @@ discard block |
||
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | //Extensions & Services |
1207 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1207 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1208 | 1208 | $admin_bar->add_menu(array( |
1209 | 1209 | 'id' => 'espresso-toolbar-extensions-and-services', |
1210 | 1210 | 'parent' => 'espresso-toolbar', |
1211 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1211 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1212 | 1212 | 'href' => $extensions_admin_url, |
1213 | 1213 | 'meta' => array( |
1214 | 1214 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1230,8 +1230,8 @@ discard block |
||
1230 | 1230 | * @param array $exclude_array any existing pages being excluded are in this array. |
1231 | 1231 | * @return array |
1232 | 1232 | */ |
1233 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1234 | - return array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() ); |
|
1233 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1234 | + return array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array()); |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | |
@@ -1251,11 +1251,11 @@ discard block |
||
1251 | 1251 | */ |
1252 | 1252 | public function wp_enqueue_scripts() { |
1253 | 1253 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1254 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1254 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1255 | 1255 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1256 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1256 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1257 | 1257 | // register jQuery Validate |
1258 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE ); |
|
1258 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | } |
@@ -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 |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * date_format and the second value is the time format |
75 | 75 | * @return EE_Datetime |
76 | 76 | */ |
77 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
78 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
79 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
77 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
78 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
79 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * the website will be used. |
88 | 88 | * @return EE_Datetime |
89 | 89 | */ |
90 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
91 | - return new self( $props_n_values, TRUE, $timezone ); |
|
90 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
91 | + return new self($props_n_values, TRUE, $timezone); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * @param $name |
98 | 98 | */ |
99 | - public function set_name( $name ) { |
|
100 | - $this->set( 'DTT_name', $name ); |
|
99 | + public function set_name($name) { |
|
100 | + $this->set('DTT_name', $name); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | /** |
106 | 106 | * @param $description |
107 | 107 | */ |
108 | - public function set_description( $description ) { |
|
109 | - $this->set( 'DTT_description', $description ); |
|
108 | + public function set_description($description) { |
|
109 | + $this->set('DTT_description', $description); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @access public |
120 | 120 | * @param string $date a string representation of the event's date ex: Dec. 25, 2025 or 12-25-2025 |
121 | 121 | */ |
122 | - public function set_start_date( $date ) { |
|
123 | - $this->_set_date_for( $date, 'DTT_EVT_start' ); |
|
122 | + public function set_start_date($date) { |
|
123 | + $this->_set_date_for($date, 'DTT_EVT_start'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @access public |
134 | 134 | * @param string $time a string representation of the event time ex: 9am or 7:30 PM |
135 | 135 | */ |
136 | - public function set_start_time( $time ) { |
|
137 | - $this->_set_time_for( $time, 'DTT_EVT_start' ); |
|
136 | + public function set_start_time($time) { |
|
137 | + $this->_set_time_for($time, 'DTT_EVT_start'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @access public |
148 | 148 | * @param string $date a string representation of the event's date ex: Dec. 25, 2025 or 12-25-2025 |
149 | 149 | */ |
150 | - public function set_end_date( $date ) { |
|
151 | - $this->_set_date_for( $date, 'DTT_EVT_end' ); |
|
150 | + public function set_end_date($date) { |
|
151 | + $this->_set_date_for($date, 'DTT_EVT_end'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * @access public |
162 | 162 | * @param string $time a string representation of the event time ex: 9am or 7:30 PM |
163 | 163 | */ |
164 | - public function set_end_time( $time ) { |
|
165 | - $this->_set_time_for( $time, 'DTT_EVT_end' ); |
|
164 | + public function set_end_time($time) { |
|
165 | + $this->_set_time_for($time, 'DTT_EVT_end'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | * @access public |
176 | 176 | * @param int $reg_limit |
177 | 177 | */ |
178 | - public function set_reg_limit( $reg_limit ) { |
|
179 | - $this->set( 'DTT_reg_limit', $reg_limit ); |
|
178 | + public function set_reg_limit($reg_limit) { |
|
179 | + $this->set('DTT_reg_limit', $reg_limit); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | * @access public |
188 | 188 | * @param int $sold |
189 | 189 | */ |
190 | - public function set_sold( $sold ) { |
|
190 | + public function set_sold($sold) { |
|
191 | 191 | // sold can not go below zero |
192 | - $sold = max( 0, $sold ); |
|
193 | - $this->set( 'DTT_sold', $sold ); |
|
192 | + $sold = max(0, $sold); |
|
193 | + $this->set('DTT_sold', $sold); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | * increments sold by amount passed by $qty |
200 | 200 | * @param int $qty |
201 | 201 | */ |
202 | - function increase_sold( $qty = 1 ) { |
|
202 | + function increase_sold($qty = 1) { |
|
203 | 203 | $sold = $this->sold() + $qty; |
204 | - $this->set_sold( $sold ); |
|
204 | + $this->set_sold($sold); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | * decrements (subtracts) sold amount passed by $qty |
211 | 211 | * @param int $qty |
212 | 212 | */ |
213 | - function decrease_sold( $qty = 1 ) { |
|
213 | + function decrease_sold($qty = 1) { |
|
214 | 214 | $sold = $this->sold() - $qty; |
215 | - $this->set_sold( $sold ); |
|
215 | + $this->set_sold($sold); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @return string |
223 | 223 | */ |
224 | 224 | public function name() { |
225 | - return $this->get( 'DTT_name' ); |
|
225 | + return $this->get('DTT_name'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return string |
233 | 233 | */ |
234 | 234 | public function description() { |
235 | - return $this->get( 'DTT_description' ); |
|
235 | + return $this->get('DTT_description'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @return boolean TRUE if is primary, FALSE if not. |
243 | 243 | */ |
244 | 244 | public function is_primary() { |
245 | - return $this->get( 'DTT_is_primary' ); |
|
245 | + return $this->get('DTT_is_primary'); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @return int The order of the datetime for this event. |
253 | 253 | */ |
254 | 254 | public function order() { |
255 | - return $this->get( 'DTT_order' ); |
|
255 | + return $this->get('DTT_order'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return int |
263 | 263 | */ |
264 | 264 | public function parent() { |
265 | - return $this->get( 'DTT_parent' ); |
|
265 | + return $this->get('DTT_parent'); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | * @param bool $echo - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats) |
279 | 279 | * @return string|bool|void string on success, FALSE on fail |
280 | 280 | */ |
281 | - private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) { |
|
281 | + private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) { |
|
282 | 282 | $field_name = "DTT_EVT_{$start_or_end}"; |
283 | - $dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo ); |
|
284 | - if ( ! $echo ) { |
|
283 | + $dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo); |
|
284 | + if ( ! $echo) { |
|
285 | 285 | return $dtt; |
286 | 286 | } |
287 | 287 | return ''; |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @param null $dt_frmt - string representation of date format defaults to 'F j, Y' |
298 | 298 | * @return mixed string on success, FALSE on fail |
299 | 299 | */ |
300 | - public function start_date( $dt_frmt = NULL ) { |
|
301 | - return $this->_show_datetime( 'D', 'start', $dt_frmt ); |
|
300 | + public function start_date($dt_frmt = NULL) { |
|
301 | + return $this->_show_datetime('D', 'start', $dt_frmt); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | * Echoes start_date() |
308 | 308 | * @param string $dt_frmt |
309 | 309 | */ |
310 | - public function e_start_date( $dt_frmt = NULL ) { |
|
311 | - $this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE ); |
|
310 | + public function e_start_date($dt_frmt = NULL) { |
|
311 | + $this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | * @param null $dt_frmt - string representation of date format defaults to 'F j, Y' |
322 | 322 | * @return mixed string on success, FALSE on fail |
323 | 323 | */ |
324 | - public function end_date( $dt_frmt = NULL ) { |
|
325 | - return $this->_show_datetime( 'D', 'end', $dt_frmt ); |
|
324 | + public function end_date($dt_frmt = NULL) { |
|
325 | + return $this->_show_datetime('D', 'end', $dt_frmt); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | * Echoes the end date. See end_date() |
332 | 332 | * @param string $dt_frmt |
333 | 333 | */ |
334 | - public function e_end_date( $dt_frmt = NULL ) { |
|
335 | - $this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE ); |
|
334 | + public function e_end_date($dt_frmt = NULL) { |
|
335 | + $this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
346 | 346 | * @return mixed string on success, FALSE on fail |
347 | 347 | */ |
348 | - public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) { |
|
349 | - $dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt; |
|
350 | - $start = str_replace( ' ', ' ', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) ); |
|
351 | - $end = str_replace( ' ', ' ', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) ); |
|
352 | - return $start != $end ? $start . $conjunction . $end : $start; |
|
348 | + public function date_range($dt_frmt = NULL, $conjunction = ' - ') { |
|
349 | + $dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt; |
|
350 | + $start = str_replace(' ', ' ', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt)); |
|
351 | + $end = str_replace(' ', ' ', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt)); |
|
352 | + return $start != $end ? $start.$conjunction.$end : $start; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | * @param null $dt_frmt |
359 | 359 | * @param string $conjunction |
360 | 360 | */ |
361 | - public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) { |
|
362 | - echo $this->date_range( $dt_frmt, $conjunction ); |
|
361 | + public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') { |
|
362 | + echo $this->date_range($dt_frmt, $conjunction); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @param string $tm_format - string representation of time format defaults to 'g:i a' |
372 | 372 | * @return mixed string on success, FALSE on fail |
373 | 373 | */ |
374 | - public function start_time( $tm_format = NULL ) { |
|
375 | - return $this->_show_datetime( 'T', 'start', NULL, $tm_format ); |
|
374 | + public function start_time($tm_format = NULL) { |
|
375 | + return $this->_show_datetime('T', 'start', NULL, $tm_format); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * @param null $tm_format |
382 | 382 | */ |
383 | - public function e_start_time( $tm_format = NULL ) { |
|
384 | - $this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE ); |
|
383 | + public function e_start_time($tm_format = NULL) { |
|
384 | + $this->_show_datetime('T', 'start', NULL, $tm_format, TRUE); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | * @param string $tm_format - string representation of time format defaults to 'g:i a' |
394 | 394 | * @return mixed string on success, FALSE on fail |
395 | 395 | */ |
396 | - public function end_time( $tm_format = NULL ) { |
|
397 | - return $this->_show_datetime( 'T', 'end', NULL, $tm_format ); |
|
396 | + public function end_time($tm_format = NULL) { |
|
397 | + return $this->_show_datetime('T', 'end', NULL, $tm_format); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | /** |
403 | 403 | * @param null $tm_format |
404 | 404 | */ |
405 | - public function e_end_time( $tm_format = NULL ) { |
|
406 | - $this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE ); |
|
405 | + public function e_end_time($tm_format = NULL) { |
|
406 | + $this->_show_datetime('T', 'end', NULL, $tm_format, TRUE); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
417 | 417 | * @return mixed string on success, FALSE on fail |
418 | 418 | */ |
419 | - public function time_range( $tm_format = NULL, $conjunction = ' - ' ) { |
|
420 | - $tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt; |
|
419 | + public function time_range($tm_format = NULL, $conjunction = ' - ') { |
|
420 | + $tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt; |
|
421 | 421 | |
422 | - $start = str_replace( ' ', ' ', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) ); |
|
423 | - $end = str_replace( ' ', ' ', $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format ) ); |
|
424 | - return $start != $end ? $start . $conjunction . $end : $start; |
|
422 | + $start = str_replace(' ', ' ', $this->get_i18n_datetime('DTT_EVT_start', $tm_format)); |
|
423 | + $end = str_replace(' ', ' ', $this->get_i18n_datetime('DTT_EVT_end', $tm_format)); |
|
424 | + return $start != $end ? $start.$conjunction.$end : $start; |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | * @param null $tm_format |
431 | 431 | * @param string $conjunction |
432 | 432 | */ |
433 | - public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) { |
|
434 | - echo $this->time_range( $tm_format, $conjunction ); |
|
433 | + public function e_time_range($tm_format = NULL, $conjunction = ' - ') { |
|
434 | + echo $this->time_range($tm_format, $conjunction); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | * @param string $tm_format - string representation of time format defaults to 'g:i a' |
445 | 445 | * @return mixed string on success, FALSE on fail |
446 | 446 | */ |
447 | - public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) { |
|
448 | - return $this->_show_datetime( '', 'start', $dt_format, $tm_format ); |
|
447 | + public function start_date_and_time($dt_format = NULL, $tm_format = NULL) { |
|
448 | + return $this->_show_datetime('', 'start', $dt_format, $tm_format); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | * @param null $dt_frmt |
455 | 455 | * @param null $tm_format |
456 | 456 | */ |
457 | - public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) { |
|
458 | - $this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE ); |
|
457 | + public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) { |
|
458 | + $this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param bool $round_up |
470 | 470 | * @return float|int|mixed |
471 | 471 | */ |
472 | - public function length( $units = 'seconds', $round_up = FALSE ) { |
|
473 | - $start = $this->get_raw( 'DTT_EVT_start' ); |
|
474 | - $end = $this->get_raw( 'DTT_EVT_end' ); |
|
472 | + public function length($units = 'seconds', $round_up = FALSE) { |
|
473 | + $start = $this->get_raw('DTT_EVT_start'); |
|
474 | + $end = $this->get_raw('DTT_EVT_end'); |
|
475 | 475 | $length_in_units = $end - $start; |
476 | - switch ( $units ) { |
|
476 | + switch ($units) { |
|
477 | 477 | //NOTE: We purposefully don't use "break;" in order to chain the divisions |
478 | 478 | /** @noinspection PhpMissingBreakStatementInspection */ |
479 | 479 | case 'days': |
@@ -486,10 +486,10 @@ discard block |
||
486 | 486 | $length_in_units /= 60; |
487 | 487 | case 'seconds': |
488 | 488 | default: |
489 | - $length_in_units = ceil( $length_in_units ); |
|
489 | + $length_in_units = ceil($length_in_units); |
|
490 | 490 | } |
491 | - if ( $round_up ) { |
|
492 | - $length_in_units = max( $length_in_units, 1 ); |
|
491 | + if ($round_up) { |
|
492 | + $length_in_units = max($length_in_units, 1); |
|
493 | 493 | } |
494 | 494 | return $length_in_units; |
495 | 495 | } |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | * @param bool | string $tm_format - string representation of time format defaults to 'g:i a' |
505 | 505 | * @return mixed string on success, FALSE on fail |
506 | 506 | */ |
507 | - public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) { |
|
508 | - return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format ); |
|
507 | + public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) { |
|
508 | + return $this->_show_datetime('', 'end', $dt_frmt, $tm_format); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | * @param bool $dt_frmt |
515 | 515 | * @param bool $tm_format |
516 | 516 | */ |
517 | - public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) { |
|
518 | - $this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE ); |
|
517 | + public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) { |
|
518 | + $this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return int |
528 | 528 | */ |
529 | 529 | public function start() { |
530 | - return $this->get_raw( 'DTT_EVT_start' ); |
|
530 | + return $this->get_raw('DTT_EVT_start'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @return int |
540 | 540 | */ |
541 | 541 | public function end() { |
542 | - return $this->get_raw( 'DTT_EVT_end' ); |
|
542 | + return $this->get_raw('DTT_EVT_end'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | * @return mixed int on success, FALSE on fail |
552 | 552 | */ |
553 | 553 | public function reg_limit() { |
554 | - return $this->get_raw( 'DTT_reg_limit' ); |
|
554 | + return $this->get_raw('DTT_reg_limit'); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * @return mixed int on success, FALSE on fail |
564 | 564 | */ |
565 | 565 | public function sold() { |
566 | - return $this->get_raw( 'DTT_sold' ); |
|
566 | + return $this->get_raw('DTT_sold'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | |
@@ -592,15 +592,15 @@ discard block |
||
592 | 592 | * the spaces remaining for this particular datetime, hence the flag. |
593 | 593 | * @return int |
594 | 594 | */ |
595 | - public function spaces_remaining( $consider_tickets = FALSE ) { |
|
595 | + public function spaces_remaining($consider_tickets = FALSE) { |
|
596 | 596 | // tickets remaining available for purchase |
597 | 597 | //no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF |
598 | 598 | $dtt_remaining = $this->reg_limit() - $this->sold(); |
599 | - if ( ! $consider_tickets ) { |
|
599 | + if ( ! $consider_tickets) { |
|
600 | 600 | return $dtt_remaining; |
601 | 601 | } |
602 | 602 | $tickets_remaining = $this->tickets_remaining(); |
603 | - return min( $dtt_remaining, $tickets_remaining ); |
|
603 | + return min($dtt_remaining, $tickets_remaining); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | |
@@ -611,19 +611,19 @@ discard block |
||
611 | 611 | * @param array $query_params like EEM_Base::get_all's |
612 | 612 | * @return int |
613 | 613 | */ |
614 | - public function tickets_remaining( $query_params = array() ) { |
|
614 | + public function tickets_remaining($query_params = array()) { |
|
615 | 615 | $sum = 0; |
616 | - $tickets = $this->tickets( $query_params ); |
|
617 | - if ( ! empty( $tickets ) ) { |
|
618 | - foreach ( $tickets as $ticket ) { |
|
619 | - if ( $ticket instanceof EE_Ticket ) { |
|
616 | + $tickets = $this->tickets($query_params); |
|
617 | + if ( ! empty($tickets)) { |
|
618 | + foreach ($tickets as $ticket) { |
|
619 | + if ($ticket instanceof EE_Ticket) { |
|
620 | 620 | // get the actual amount of tickets that can be sold |
621 | - $qty = $ticket->qty( 'saleable' ); |
|
622 | - if ( $qty === EE_INF ) { |
|
621 | + $qty = $ticket->qty('saleable'); |
|
622 | + if ($qty === EE_INF) { |
|
623 | 623 | return EE_INF; |
624 | 624 | } |
625 | 625 | // no negative ticket quantities plz |
626 | - if ( $qty > 0 ) { |
|
626 | + if ($qty > 0) { |
|
627 | 627 | $sum += $qty; |
628 | 628 | } |
629 | 629 | } |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | * @param array $query_params like EEM_Base::get_all's |
641 | 641 | * @return int |
642 | 642 | */ |
643 | - public function sum_tickets_initially_available( $query_params = array() ) { |
|
644 | - return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' ); |
|
643 | + public function sum_tickets_initially_available($query_params = array()) { |
|
644 | + return $this->sum_related('Ticket', $query_params, 'TKT_qty'); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * @return int |
654 | 654 | */ |
655 | 655 | public function total_tickets_available_at_this_datetime() { |
656 | - return $this->spaces_remaining( true ); |
|
656 | + return $this->spaces_remaining(true); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | * @return boolean |
665 | 665 | */ |
666 | 666 | public function is_upcoming() { |
667 | - return ( $this->get_raw( 'DTT_EVT_start' ) > time() ); |
|
667 | + return ($this->get_raw('DTT_EVT_start') > time()); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @return boolean |
675 | 675 | */ |
676 | 676 | public function is_active() { |
677 | - return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() ); |
|
677 | + return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time()); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * @return boolean |
685 | 685 | */ |
686 | 686 | public function is_expired() { |
687 | - return ( $this->get_raw( 'DTT_EVT_end' ) < time() ); |
|
687 | + return ($this->get_raw('DTT_EVT_end') < time()); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | |
@@ -695,16 +695,16 @@ discard block |
||
695 | 695 | */ |
696 | 696 | public function get_active_status() { |
697 | 697 | $total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime(); |
698 | - if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) { |
|
698 | + if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) { |
|
699 | 699 | return EE_Datetime::sold_out; |
700 | 700 | } |
701 | - if ( $this->is_expired() ) { |
|
701 | + if ($this->is_expired()) { |
|
702 | 702 | return EE_Datetime::expired; |
703 | 703 | } |
704 | - if ( $this->is_upcoming() ) { |
|
704 | + if ($this->is_upcoming()) { |
|
705 | 705 | return EE_Datetime::upcoming; |
706 | 706 | } |
707 | - if ( $this->is_active() ) { |
|
707 | + if ($this->is_active()) { |
|
708 | 708 | return EE_Datetime::active; |
709 | 709 | } |
710 | 710 | return NULL; |
@@ -718,24 +718,24 @@ discard block |
||
718 | 718 | * @param boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty. |
719 | 719 | * @return string |
720 | 720 | */ |
721 | - public function get_dtt_display_name( $use_dtt_name = FALSE ) { |
|
722 | - if ( $use_dtt_name ) { |
|
721 | + public function get_dtt_display_name($use_dtt_name = FALSE) { |
|
722 | + if ($use_dtt_name) { |
|
723 | 723 | $dtt_name = $this->name(); |
724 | - if ( !empty( $dtt_name ) ) { |
|
724 | + if ( ! empty($dtt_name)) { |
|
725 | 725 | return $dtt_name; |
726 | 726 | } |
727 | 727 | } |
728 | 728 | //first condition is to see if the months are different |
729 | - if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) { |
|
730 | - $display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' ); |
|
729 | + if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) { |
|
730 | + $display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a'); |
|
731 | 731 | //next condition is if its the same month but different day |
732 | 732 | } |
733 | 733 | else { |
734 | - if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) { |
|
735 | - $display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' ); |
|
734 | + if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) { |
|
735 | + $display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y'); |
|
736 | 736 | } |
737 | 737 | else { |
738 | - $display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' ); |
|
738 | + $display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a'); |
|
739 | 739 | } |
740 | 740 | } |
741 | 741 | return $display_date; |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | *@param array $query_params see EEM_Base::get_all() |
750 | 750 | * @return EE_Ticket[] |
751 | 751 | */ |
752 | - public function tickets( $query_params = array() ) { |
|
753 | - return $this->get_many_related( 'Ticket', $query_params ); |
|
752 | + public function tickets($query_params = array()) { |
|
753 | + return $this->get_many_related('Ticket', $query_params); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | |
@@ -760,21 +760,21 @@ discard block |
||
760 | 760 | * @param array $query_params like EEM_Base::get_all's |
761 | 761 | * @return EE_Ticket[] |
762 | 762 | */ |
763 | - public function ticket_types_available_for_purchase( $query_params = array() ) { |
|
763 | + public function ticket_types_available_for_purchase($query_params = array()) { |
|
764 | 764 | // first check if datetime is valid |
765 | - if ( !( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) { |
|
765 | + if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) { |
|
766 | 766 | return array(); |
767 | 767 | } |
768 | - if ( empty( $query_params ) ) { |
|
768 | + if (empty($query_params)) { |
|
769 | 769 | $query_params = array( |
770 | 770 | array( |
771 | - 'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ), |
|
772 | - 'TKT_end_date' => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ), |
|
771 | + 'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')), |
|
772 | + 'TKT_end_date' => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')), |
|
773 | 773 | 'TKT_deleted' => false |
774 | 774 | ) |
775 | 775 | ); |
776 | 776 | } |
777 | - return $this->tickets( $query_params ); |
|
777 | + return $this->tickets($query_params); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | * @return EE_Event |
785 | 785 | */ |
786 | 786 | public function event() { |
787 | - return $this->get_first_related( 'Event' ); |
|
787 | + return $this->get_first_related('Event'); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | |
@@ -796,13 +796,13 @@ discard block |
||
796 | 796 | */ |
797 | 797 | public function update_sold() { |
798 | 798 | $count_regs_for_this_datetime = EEM_Registration::instance()->count( |
799 | - array( array( |
|
799 | + array(array( |
|
800 | 800 | 'STS_ID' => EEM_Registration::status_id_approved, |
801 | 801 | 'REG_deleted' => 0, |
802 | 802 | 'Ticket.Datetime.DTT_ID' => $this->ID(), |
803 | - ) ) |
|
803 | + )) |
|
804 | 804 | ); |
805 | - $this->set( 'DTT_sold', $count_regs_for_this_datetime ); |
|
805 | + $this->set('DTT_sold', $count_regs_for_this_datetime); |
|
806 | 806 | $this->save(); |
807 | 807 | return $count_regs_for_this_datetime; |
808 | 808 | } |
@@ -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 |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * date_format and the second value is the time format |
67 | 67 | * @return EE_Ticket |
68 | 68 | */ |
69 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
70 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
71 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
69 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
70 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
71 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * the website will be used. |
80 | 80 | * @return EE_Ticket |
81 | 81 | */ |
82 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
83 | - return new self( $props_n_values, TRUE, $timezone ); |
|
82 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
83 | + return new self($props_n_values, TRUE, $timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return bool |
90 | 90 | */ |
91 | 91 | public function parent() { |
92 | - return $this->get( 'TKT_parent' ); |
|
92 | + return $this->get('TKT_parent'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @param int $DTT_ID the primary key for a particular datetime |
100 | 100 | * @return boolean |
101 | 101 | */ |
102 | - public function available( $DTT_ID = 0 ) { |
|
102 | + public function available($DTT_ID = 0) { |
|
103 | 103 | // are we checking availability for a particular datetime ? |
104 | - if ( $DTT_ID ) { |
|
104 | + if ($DTT_ID) { |
|
105 | 105 | // get that datetime object |
106 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
106 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
107 | 107 | // if ticket sales for this datetime have exceeded the reg limit... |
108 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
108 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
109 | 109 | return FALSE; |
110 | 110 | } |
111 | 111 | } |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
121 | 121 | * @return mixed(int|string) status int if the display string isn't requested |
122 | 122 | */ |
123 | - public function ticket_status( $display = FALSE ) { |
|
124 | - if ( ! $this->is_remaining() ) { |
|
125 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
123 | + public function ticket_status($display = FALSE) { |
|
124 | + if ( ! $this->is_remaining()) { |
|
125 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
126 | 126 | } |
127 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
128 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
127 | + if ($this->get('TKT_deleted')) { |
|
128 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
129 | 129 | } |
130 | - if ( $this->is_expired() ) { |
|
131 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
130 | + if ($this->is_expired()) { |
|
131 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
132 | 132 | } |
133 | - if ( $this->is_pending() ) { |
|
134 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
133 | + if ($this->is_pending()) { |
|
134 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
135 | 135 | } |
136 | - if ( $this->is_on_sale() ) { |
|
137 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
136 | + if ($this->is_on_sale()) { |
|
137 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
138 | 138 | } |
139 | 139 | return ''; |
140 | 140 | } |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
149 | 149 | * @return boolean true = tickets remaining, false not. |
150 | 150 | */ |
151 | - public function is_remaining( $DTT_ID = 0 ) { |
|
152 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
153 | - if ( $num_remaining === 0 ) { |
|
151 | + public function is_remaining($DTT_ID = 0) { |
|
152 | + $num_remaining = $this->remaining($DTT_ID); |
|
153 | + if ($num_remaining === 0) { |
|
154 | 154 | return FALSE; |
155 | 155 | } |
156 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
156 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
157 | 157 | return FALSE; |
158 | 158 | } |
159 | 159 | return TRUE; |
@@ -167,25 +167,25 @@ discard block |
||
167 | 167 | * all related datetimes |
168 | 168 | * @return int |
169 | 169 | */ |
170 | - public function remaining( $DTT_ID = 0 ) { |
|
170 | + public function remaining($DTT_ID = 0) { |
|
171 | 171 | // are we checking availability for a particular datetime ? |
172 | - if ( $DTT_ID ) { |
|
172 | + if ($DTT_ID) { |
|
173 | 173 | // get array with the one requested datetime |
174 | - $datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
174 | + $datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
175 | 175 | } else { |
176 | 176 | // we need to check availability of ALL datetimes |
177 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
177 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
178 | 178 | } |
179 | 179 | // d( $datetimes ); |
180 | 180 | // if datetime reg limit is not unlimited |
181 | - if ( ! empty( $datetimes ) ) { |
|
181 | + if ( ! empty($datetimes)) { |
|
182 | 182 | // although TKT_qty and $datetime->spaces_remaining() could both be EE_INF |
183 | 183 | // we only need to check for EE_INF explicitly if we want to optimize. |
184 | 184 | // because EE_INF - x = EE_INF; and min(x,EE_INF) = x; |
185 | 185 | $tickets_remaining = $this->qty() - $this->sold(); |
186 | - foreach ( $datetimes as $datetime ) { |
|
187 | - if ( $datetime instanceof EE_Datetime ) { |
|
188 | - $tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() ); |
|
186 | + foreach ($datetimes as $datetime) { |
|
187 | + if ($datetime instanceof EE_Datetime) { |
|
188 | + $tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining()); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | return $tickets_remaining; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @return int |
201 | 201 | */ |
202 | 202 | function min() { |
203 | - return $this->get( 'TKT_min' ); |
|
203 | + return $this->get('TKT_min'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return boolean |
211 | 211 | */ |
212 | 212 | public function is_expired() { |
213 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
213 | + return ($this->get_raw('TKT_end_date') < time()); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return boolean |
221 | 221 | */ |
222 | 222 | public function is_pending() { |
223 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
223 | + return ($this->get_raw('TKT_start_date') > time()); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return boolean |
231 | 231 | */ |
232 | 232 | public function is_on_sale() { |
233 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
233 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
242 | 242 | * @return array |
243 | 243 | */ |
244 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
245 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
246 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
244 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
245 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
246 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
247 | 247 | |
248 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
248 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | * @return EE_Datetime |
256 | 256 | */ |
257 | 257 | public function first_datetime() { |
258 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
259 | - return reset( $datetimes ); |
|
258 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
259 | + return reset($datetimes); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * @param array $query_params see EEM_Base::get_all() |
268 | 268 | * @return EE_Datetime[] |
269 | 269 | */ |
270 | - public function datetimes( $query_params = array() ) { |
|
271 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
272 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
270 | + public function datetimes($query_params = array()) { |
|
271 | + if ( ! isset($query_params['order_by'])) { |
|
272 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
273 | 273 | } |
274 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
274 | + return $this->get_many_related('Datetime', $query_params); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @return EE_Datetime |
282 | 282 | */ |
283 | 283 | public function last_datetime() { |
284 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
285 | - return end( $datetimes ); |
|
284 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
285 | + return end($datetimes); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -296,22 +296,22 @@ discard block |
||
296 | 296 | * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
297 | 297 | * @return mixed (array|int) how many tickets have sold |
298 | 298 | */ |
299 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
299 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
300 | 300 | $total = 0; |
301 | 301 | $tickets_sold = $this->_all_tickets_sold(); |
302 | - switch ( $what ) { |
|
302 | + switch ($what) { |
|
303 | 303 | case 'ticket' : |
304 | - return $tickets_sold[ 'ticket' ]; |
|
304 | + return $tickets_sold['ticket']; |
|
305 | 305 | break; |
306 | 306 | case 'datetime' : |
307 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
307 | + if (empty($tickets_sold['datetime'])) { |
|
308 | 308 | return $total; |
309 | 309 | } |
310 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
311 | - EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
310 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
311 | + EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
312 | 312 | return $total; |
313 | 313 | } |
314 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
314 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
315 | 315 | break; |
316 | 316 | default: |
317 | 317 | return $total; |
@@ -325,15 +325,15 @@ discard block |
||
325 | 325 | * @return EE_Ticket[] |
326 | 326 | */ |
327 | 327 | protected function _all_tickets_sold() { |
328 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
328 | + $datetimes = $this->get_many_related('Datetime'); |
|
329 | 329 | $tickets_sold = array(); |
330 | - if ( ! empty( $datetimes ) ) { |
|
331 | - foreach ( $datetimes as $datetime ) { |
|
332 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
330 | + if ( ! empty($datetimes)) { |
|
331 | + foreach ($datetimes as $datetime) { |
|
332 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | //Tickets sold |
336 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
336 | + $tickets_sold['ticket'] = $this->sold(); |
|
337 | 337 | return $tickets_sold; |
338 | 338 | } |
339 | 339 | |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | * @param bool $return_array whether to return as an array indexed by price id or just the object. |
347 | 347 | * @return EE_Price |
348 | 348 | */ |
349 | - public function base_price( $return_array = FALSE ) { |
|
350 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
351 | - return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) ); |
|
349 | + public function base_price($return_array = FALSE) { |
|
350 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
351 | + return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where)); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @return EE_Price[] |
361 | 361 | */ |
362 | 362 | public function price_modifiers() { |
363 | - $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
|
364 | - return $this->prices( $query_params ); |
|
363 | + $query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax)))); |
|
364 | + return $this->prices($query_params); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @param array $query_params like EEM_Base::get_all |
372 | 372 | * @return EE_Price[] |
373 | 373 | */ |
374 | - public function prices( $query_params = array() ) { |
|
375 | - return $this->get_many_related( 'Price', $query_params ); |
|
374 | + public function prices($query_params = array()) { |
|
375 | + return $this->get_many_related('Price', $query_params); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @param array $query_params see EEM_Base::get_all() |
383 | 383 | * @return EE_Datetime_Ticket |
384 | 384 | */ |
385 | - public function datetime_tickets( $query_params = array() ) { |
|
386 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
385 | + public function datetime_tickets($query_params = array()) { |
|
386 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | * @param boolean $show_deleted |
395 | 395 | * @return EE_Datetime[] |
396 | 396 | */ |
397 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
398 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
397 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
398 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return string |
406 | 406 | */ |
407 | 407 | function ID() { |
408 | - return $this->get( 'TKT_ID' ); |
|
408 | + return $this->get('TKT_ID'); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return EE_Ticket_Template |
430 | 430 | */ |
431 | 431 | public function template() { |
432 | - return $this->get_first_related( 'Ticket_Template' ); |
|
432 | + return $this->get_first_related('Ticket_Template'); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @return bool |
449 | 449 | */ |
450 | 450 | public function ticket_price() { |
451 | - return $this->get( 'TKT_price' ); |
|
451 | + return $this->get('TKT_price'); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @return mixed |
458 | 458 | */ |
459 | 459 | public function pretty_price() { |
460 | - return $this->get_pretty( 'TKT_price' ); |
|
460 | + return $this->get_pretty('TKT_price'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -476,17 +476,17 @@ discard block |
||
476 | 476 | * @param bool $no_cache |
477 | 477 | * @return float |
478 | 478 | */ |
479 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
480 | - if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) { |
|
479 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
480 | + if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) { |
|
481 | 481 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
482 | 482 | } |
483 | - return (float)$this->_ticket_total_with_taxes; |
|
483 | + return (float) $this->_ticket_total_with_taxes; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
487 | 487 | |
488 | 488 | public function ensure_TKT_Price_correct() { |
489 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
489 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
490 | 490 | $this->save(); |
491 | 491 | } |
492 | 492 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return float |
497 | 497 | */ |
498 | 498 | public function get_ticket_subtotal() { |
499 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
499 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @return float |
507 | 507 | */ |
508 | 508 | public function get_ticket_taxes_total_for_admin() { |
509 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
509 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @param string $name |
517 | 517 | * @return boolean |
518 | 518 | */ |
519 | - function set_name( $name ) { |
|
520 | - $this->set( 'TKT_name', $name ); |
|
519 | + function set_name($name) { |
|
520 | + $this->set('TKT_name', $name); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return string |
528 | 528 | */ |
529 | 529 | function description() { |
530 | - return $this->get( 'TKT_description' ); |
|
530 | + return $this->get('TKT_description'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | * @param string $description |
538 | 538 | * @return boolean |
539 | 539 | */ |
540 | - function set_description( $description ) { |
|
541 | - $this->set( 'TKT_description', $description ); |
|
540 | + function set_description($description) { |
|
541 | + $this->set('TKT_description', $description); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | * @param string $tm_frmt |
550 | 550 | * @return string |
551 | 551 | */ |
552 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
553 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
552 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
553 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | * @param string $start_date |
561 | 561 | * @return void |
562 | 562 | */ |
563 | - function set_start_date( $start_date ) { |
|
564 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
563 | + function set_start_date($start_date) { |
|
564 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | * @param string $tm_frmt |
573 | 573 | * @return string |
574 | 574 | */ |
575 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
576 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
575 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
576 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -583,8 +583,8 @@ discard block |
||
583 | 583 | * @param string $end_date |
584 | 584 | * @return void |
585 | 585 | */ |
586 | - function set_end_date( $end_date ) { |
|
587 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
586 | + function set_end_date($end_date) { |
|
587 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
598 | 598 | */ |
599 | - function set_end_time( $time ) { |
|
600 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
599 | + function set_end_time($time) { |
|
600 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | * @param int $min |
608 | 608 | * @return boolean |
609 | 609 | */ |
610 | - function set_min( $min ) { |
|
611 | - $this->set( 'TKT_min', $min ); |
|
610 | + function set_min($min) { |
|
611 | + $this->set('TKT_min', $min); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * @return int |
619 | 619 | */ |
620 | 620 | function max() { |
621 | - return $this->get( 'TKT_max' ); |
|
621 | + return $this->get('TKT_max'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,8 +628,8 @@ discard block |
||
628 | 628 | * @param int $max |
629 | 629 | * @return boolean |
630 | 630 | */ |
631 | - function set_max( $max ) { |
|
632 | - $this->set( 'TKT_max', $max ); |
|
631 | + function set_max($max) { |
|
632 | + $this->set('TKT_max', $max); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @param float $price |
640 | 640 | * @return boolean |
641 | 641 | */ |
642 | - function set_price( $price ) { |
|
643 | - $this->set( 'TKT_price', $price ); |
|
642 | + function set_price($price) { |
|
643 | + $this->set('TKT_price', $price); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @return int |
651 | 651 | */ |
652 | 652 | function sold() { |
653 | - return $this->get_raw( 'TKT_sold' ); |
|
653 | + return $this->get_raw('TKT_sold'); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | |
@@ -660,10 +660,10 @@ discard block |
||
660 | 660 | * @param int $qty |
661 | 661 | * @return boolean |
662 | 662 | */ |
663 | - function increase_sold( $qty = 1 ) { |
|
663 | + function increase_sold($qty = 1) { |
|
664 | 664 | $sold = $this->sold() + $qty; |
665 | - $this->_increase_sold_for_datetimes( $qty ); |
|
666 | - return $this->set_sold( $sold ); |
|
665 | + $this->_increase_sold_for_datetimes($qty); |
|
666 | + return $this->set_sold($sold); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -673,12 +673,12 @@ discard block |
||
673 | 673 | * @param int $qty |
674 | 674 | * @return boolean |
675 | 675 | */ |
676 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
676 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
677 | 677 | $datetimes = $this->datetimes(); |
678 | - if ( is_array( $datetimes ) ) { |
|
679 | - foreach ( $datetimes as $datetime ) { |
|
680 | - if ( $datetime instanceof EE_Datetime ) { |
|
681 | - $datetime->increase_sold( $qty ); |
|
678 | + if (is_array($datetimes)) { |
|
679 | + foreach ($datetimes as $datetime) { |
|
680 | + if ($datetime instanceof EE_Datetime) { |
|
681 | + $datetime->increase_sold($qty); |
|
682 | 682 | $datetime->save(); |
683 | 683 | } |
684 | 684 | } |
@@ -692,10 +692,10 @@ discard block |
||
692 | 692 | * @param int $sold |
693 | 693 | * @return boolean |
694 | 694 | */ |
695 | - function set_sold( $sold ) { |
|
695 | + function set_sold($sold) { |
|
696 | 696 | // sold can not go below zero |
697 | - $sold = max( 0, $sold ); |
|
698 | - $this->set( 'TKT_sold', $sold ); |
|
697 | + $sold = max(0, $sold); |
|
698 | + $this->set('TKT_sold', $sold); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
@@ -705,10 +705,10 @@ discard block |
||
705 | 705 | * @param int $qty |
706 | 706 | * @return boolean |
707 | 707 | */ |
708 | - function decrease_sold( $qty = 1 ) { |
|
708 | + function decrease_sold($qty = 1) { |
|
709 | 709 | $sold = $this->sold() - $qty; |
710 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
711 | - return $this->set_sold( $sold ); |
|
710 | + $this->_decrease_sold_for_datetimes($qty); |
|
711 | + return $this->set_sold($sold); |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | |
@@ -719,12 +719,12 @@ discard block |
||
719 | 719 | * @param int $qty |
720 | 720 | * @return boolean |
721 | 721 | */ |
722 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
722 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
723 | 723 | $datetimes = $this->datetimes(); |
724 | - if ( is_array( $datetimes ) ) { |
|
725 | - foreach ( $datetimes as $datetime ) { |
|
726 | - if ( $datetime instanceof EE_Datetime ) { |
|
727 | - $datetime->decrease_sold( $qty ); |
|
724 | + if (is_array($datetimes)) { |
|
725 | + foreach ($datetimes as $datetime) { |
|
726 | + if ($datetime instanceof EE_Datetime) { |
|
727 | + $datetime->decrease_sold($qty); |
|
728 | 728 | $datetime->save(); |
729 | 729 | } |
730 | 730 | } |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | * |
746 | 746 | * @return int |
747 | 747 | */ |
748 | - function qty( $context = '' ) { |
|
749 | - switch ( $context ) { |
|
748 | + function qty($context = '') { |
|
749 | + switch ($context) { |
|
750 | 750 | case 'reg_limit' : |
751 | 751 | return $this->real_quantity_on_ticket(); |
752 | 752 | case 'saleable' : |
753 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
753 | + return $this->real_quantity_on_ticket('saleable'); |
|
754 | 754 | default: |
755 | - return $this->get_raw( 'TKT_qty' ); |
|
755 | + return $this->get_raw('TKT_qty'); |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | |
@@ -769,38 +769,38 @@ discard block |
||
769 | 769 | * |
770 | 770 | * @return int |
771 | 771 | */ |
772 | - function real_quantity_on_ticket( $context = 'reg_limit' ) { |
|
772 | + function real_quantity_on_ticket($context = 'reg_limit') { |
|
773 | 773 | // start with the original db value for ticket quantity |
774 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
774 | + $raw = $this->get_raw('TKT_qty'); |
|
775 | 775 | // return immediately if it's zero |
776 | - if ( $raw === 0 ) { |
|
776 | + if ($raw === 0) { |
|
777 | 777 | return $raw; |
778 | 778 | } |
779 | 779 | // ensure qty doesn't exceed raw value for THIS ticket |
780 | - $qty = min( EE_INF, $raw ); |
|
780 | + $qty = min(EE_INF, $raw); |
|
781 | 781 | // NOW that we know the maximum number of tickets available for the ticket |
782 | 782 | // we need to calculate the maximum number of tickets available for the datetime |
783 | 783 | // without really factoring this ticket into the calculations |
784 | 784 | $datetimes = $this->datetimes(); |
785 | - foreach ( $datetimes as $datetime ) { |
|
786 | - if ( $datetime instanceof EE_Datetime ) { |
|
785 | + foreach ($datetimes as $datetime) { |
|
786 | + if ($datetime instanceof EE_Datetime) { |
|
787 | 787 | // initialize with no restrictions for each datetime |
788 | 788 | // but adjust datetime qty based on datetime reg limit |
789 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
789 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
790 | 790 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
791 | 791 | // for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in) |
792 | - if ( $context == 'saleable' ) { |
|
793 | - $datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 ); |
|
792 | + if ($context == 'saleable') { |
|
793 | + $datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0); |
|
794 | 794 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
795 | 795 | } |
796 | - $qty = min( $datetime_qty, $qty ); |
|
796 | + $qty = min($datetime_qty, $qty); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | } |
800 | 800 | // we need to factor in the details for this specific ticket |
801 | - if ( $qty > 0 && $context == 'saleable' ) { |
|
801 | + if ($qty > 0 && $context == 'saleable') { |
|
802 | 802 | // and subtract the sales for THIS ticket |
803 | - $qty = max( $qty - $this->sold(), 0 ); |
|
803 | + $qty = max($qty - $this->sold(), 0); |
|
804 | 804 | //echo ' $qty: ' . $qty . "<br />"; |
805 | 805 | } |
806 | 806 | //echo '$qty: ' . $qty . "<br />"; |
@@ -816,14 +816,14 @@ discard block |
||
816 | 816 | * @return bool |
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | - function set_qty( $qty ) { |
|
819 | + function set_qty($qty) { |
|
820 | 820 | $datetimes = $this->datetimes(); |
821 | - foreach ( $datetimes as $datetime ) { |
|
822 | - if ( $datetime instanceof EE_Datetime ) { |
|
823 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
821 | + foreach ($datetimes as $datetime) { |
|
822 | + if ($datetime instanceof EE_Datetime) { |
|
823 | + $qty = min($qty, $datetime->reg_limit()); |
|
824 | 824 | } |
825 | 825 | } |
826 | - $this->set( 'TKT_qty', $qty ); |
|
826 | + $this->set('TKT_qty', $qty); |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | * @return int |
834 | 834 | */ |
835 | 835 | function uses() { |
836 | - return $this->get( 'TKT_uses' ); |
|
836 | + return $this->get('TKT_uses'); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | * @param int $uses |
844 | 844 | * @return boolean |
845 | 845 | */ |
846 | - function set_uses( $uses ) { |
|
847 | - $this->set( 'TKT_uses', $uses ); |
|
846 | + function set_uses($uses) { |
|
847 | + $this->set('TKT_uses', $uses); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | * @return boolean |
855 | 855 | */ |
856 | 856 | public function required() { |
857 | - return $this->get( 'TKT_required' ); |
|
857 | + return $this->get('TKT_required'); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | |
@@ -864,8 +864,8 @@ discard block |
||
864 | 864 | * @param boolean $required |
865 | 865 | * @return boolean |
866 | 866 | */ |
867 | - public function set_required( $required ) { |
|
868 | - $this->set( 'TKT_required', $required ); |
|
867 | + public function set_required($required) { |
|
868 | + $this->set('TKT_required', $required); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | * @return boolean |
876 | 876 | */ |
877 | 877 | function taxable() { |
878 | - return $this->get( 'TKT_taxable' ); |
|
878 | + return $this->get('TKT_taxable'); |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -885,8 +885,8 @@ discard block |
||
885 | 885 | * @param boolean $taxable |
886 | 886 | * @return boolean |
887 | 887 | */ |
888 | - function set_taxable( $taxable ) { |
|
889 | - $this->set( 'TKT_taxable', $taxable ); |
|
888 | + function set_taxable($taxable) { |
|
889 | + $this->set('TKT_taxable', $taxable); |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * @return boolean |
897 | 897 | */ |
898 | 898 | function is_default() { |
899 | - return $this->get( 'TKT_is_default' ); |
|
899 | + return $this->get('TKT_is_default'); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | |
@@ -906,8 +906,8 @@ discard block |
||
906 | 906 | * @param boolean $is_default |
907 | 907 | * @return boolean |
908 | 908 | */ |
909 | - function set_is_default( $is_default ) { |
|
910 | - $this->set( 'TKT_is_default', $is_default ); |
|
909 | + function set_is_default($is_default) { |
|
910 | + $this->set('TKT_is_default', $is_default); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | * @return int |
918 | 918 | */ |
919 | 919 | function order() { |
920 | - return $this->get( 'TKT_order' ); |
|
920 | + return $this->get('TKT_order'); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | * @param int $order |
928 | 928 | * @return boolean |
929 | 929 | */ |
930 | - function set_order( $order ) { |
|
931 | - $this->set( 'TKT_order', $order ); |
|
930 | + function set_order($order) { |
|
931 | + $this->set('TKT_order', $order); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | * @return int |
939 | 939 | */ |
940 | 940 | function row() { |
941 | - return $this->get( 'TKT_row' ); |
|
941 | + return $this->get('TKT_row'); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | |
@@ -948,8 +948,8 @@ discard block |
||
948 | 948 | * @param int $row |
949 | 949 | * @return boolean |
950 | 950 | */ |
951 | - function set_row( $row ) { |
|
952 | - $this->set( 'TKT_row', $row ); |
|
951 | + function set_row($row) { |
|
952 | + $this->set('TKT_row', $row); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | * @return boolean |
960 | 960 | */ |
961 | 961 | function deleted() { |
962 | - return $this->get( 'TKT_deleted' ); |
|
962 | + return $this->get('TKT_deleted'); |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | * @param boolean $deleted |
970 | 970 | * @return boolean |
971 | 971 | */ |
972 | - function set_deleted( $deleted ) { |
|
973 | - $this->set( 'TKT_deleted', $deleted ); |
|
972 | + function set_deleted($deleted) { |
|
973 | + $this->set('TKT_deleted', $deleted); |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | * @return int |
981 | 981 | */ |
982 | 982 | function parent_ID() { |
983 | - return $this->get( 'TKT_parent' ); |
|
983 | + return $this->get('TKT_parent'); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | |
@@ -990,8 +990,8 @@ discard block |
||
990 | 990 | * @param int $parent |
991 | 991 | * @return boolean |
992 | 992 | */ |
993 | - function set_parent_ID( $parent ) { |
|
994 | - $this->set( 'TKT_parent', $parent ); |
|
993 | + function set_parent_ID($parent) { |
|
994 | + $this->set('TKT_parent', $parent); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | |
@@ -1002,10 +1002,10 @@ discard block |
||
1002 | 1002 | */ |
1003 | 1003 | function name_and_info() { |
1004 | 1004 | $times = array(); |
1005 | - foreach ( $this->datetimes() as $datetime ) { |
|
1005 | + foreach ($this->datetimes() as $datetime) { |
|
1006 | 1006 | $times[] = $datetime->start_date_and_time(); |
1007 | 1007 | } |
1008 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price(); |
|
1008 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->price(); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | * @return string |
1016 | 1016 | */ |
1017 | 1017 | function name() { |
1018 | - return $this->get( 'TKT_name' ); |
|
1018 | + return $this->get('TKT_name'); |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | * @return float |
1026 | 1026 | */ |
1027 | 1027 | function price() { |
1028 | - return $this->get( 'TKT_price' ); |
|
1028 | + return $this->get('TKT_price'); |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | * @param array $query_params like EEM_Base::get_all's |
1036 | 1036 | * @return EE_Registration[] |
1037 | 1037 | */ |
1038 | - public function registrations( $query_params = array() ) { |
|
1039 | - return $this->get_many_related( 'Registration', $query_params ); |
|
1038 | + public function registrations($query_params = array()) { |
|
1039 | + return $this->get_many_related('Registration', $query_params); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | |
@@ -1047,8 +1047,8 @@ discard block |
||
1047 | 1047 | * @return int |
1048 | 1048 | */ |
1049 | 1049 | public function update_tickets_sold() { |
1050 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
1051 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
1050 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
1051 | + $this->set_sold($count_regs_for_this_ticket); |
|
1052 | 1052 | $this->save(); |
1053 | 1053 | return $count_regs_for_this_ticket; |
1054 | 1054 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @param array $query_params like EEM_Base::get_all's |
1061 | 1061 | * @return int |
1062 | 1062 | */ |
1063 | - public function count_registrations( $query_params = array() ) { |
|
1063 | + public function count_registrations($query_params = array()) { |
|
1064 | 1064 | return $this->count_related('Registration', $query_params); |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | public function get_related_event() { |
1086 | 1086 | //get one datetime to use for getting the event |
1087 | 1087 | $datetime = $this->first_datetime(); |
1088 | - if ( $datetime instanceof EE_Datetime ) { |
|
1088 | + if ($datetime instanceof EE_Datetime) { |
|
1089 | 1089 | return $datetime->event(); |
1090 | 1090 | } |
1091 | 1091 | return null; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Ticket','event_espresso'); |
|
40 | - $this->plural_item = __('Tickets','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Ticket', 'event_espresso'); |
|
40 | + $this->plural_item = __('Tickets', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Ticket'=>array( |
47 | - 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')), |
|
48 | - 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'), |
|
47 | + 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), |
|
48 | + 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), |
|
49 | 49 | 'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), |
50 | - 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ), |
|
51 | - 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
52 | - 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
53 | - 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ), |
|
54 | - 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ), |
|
50 | + 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), |
|
51 | + 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), |
|
54 | + 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF), |
|
55 | 55 | 'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), |
56 | 56 | 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), |
57 | - 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF), |
|
58 | - 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ), |
|
59 | - 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ), |
|
60 | - 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false), |
|
61 | - 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ), |
|
57 | + 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF), |
|
58 | + 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF), |
|
59 | + 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), |
|
60 | + 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), |
|
61 | + 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), |
|
62 | 62 | 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), |
63 | - 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ), |
|
63 | + 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), |
|
64 | 64 | 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), |
65 | - 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ), |
|
66 | - 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 ) |
|
65 | + 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE), |
|
66 | + 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0) |
|
67 | 67 | )); |
68 | 68 | $this->_model_relations = array( |
69 | 69 | 'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | //this model is generally available for reading |
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
78 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
79 | 79 | //account for default tickets in the caps |
80 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
81 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
82 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
83 | - parent::__construct( $timezone ); |
|
80 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
81 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
82 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
83 | + parent::__construct($timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get_all_default_tickets() { |
93 | 93 | /** @type EE_Ticket[] $tickets */ |
94 | - $tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')) ); |
|
94 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC'))); |
|
95 | 95 | //we need to set the start date and end date to today's date and the start of the default dtt |
96 | - return $this->_set_default_dates( $tickets ); |
|
96 | + return $this->_set_default_dates($tickets); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @param EE_Ticket[] $tickets |
104 | 104 | * @return EE_Ticket[] |
105 | 105 | */ |
106 | - private function _set_default_dates( $tickets ) { |
|
107 | - foreach ( $tickets as $ticket ) { |
|
108 | - $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) ); |
|
109 | - $ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) ); |
|
110 | - $ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) ); |
|
106 | + private function _set_default_dates($tickets) { |
|
107 | + foreach ($tickets as $ticket) { |
|
108 | + $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true)); |
|
109 | + $ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30)); |
|
110 | + $ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $tickets; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param array $query_params |
123 | 123 | * @return int |
124 | 124 | */ |
125 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){ |
|
126 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params ); |
|
125 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
126 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param EE_Ticket[] $tickets |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function update_tickets_sold($tickets){ |
|
137 | - foreach($tickets as $ticket){ |
|
136 | + public function update_tickets_sold($tickets) { |
|
137 | + foreach ($tickets as $ticket) { |
|
138 | 138 | /* @var $ticket EE_Ticket */ |
139 | 139 | $ticket->update_tickets_sold(); |
140 | 140 | } |
@@ -8,32 +8,32 @@ discard block |
||
8 | 8 | |
9 | 9 | $row = 1; |
10 | 10 | $max = 1; |
11 | -$ticket_count = count( $tickets ); |
|
11 | +$ticket_count = count($tickets); |
|
12 | 12 | |
13 | -if ( ! $ticket_count ) { |
|
13 | +if ( ! $ticket_count) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | $required_ticket_sold_out = FALSE; |
18 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config(); |
|
18 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config(); |
|
19 | 19 | ob_start(); |
20 | 20 | |
21 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
22 | - if ( $ticket instanceof EE_Ticket ) { |
|
21 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
22 | + if ($ticket instanceof EE_Ticket) { |
|
23 | 23 | // d( $ticket ); |
24 | - $max =$ticket->max(); |
|
24 | + $max = $ticket->max(); |
|
25 | 25 | $min = 0; |
26 | 26 | $remaining = $ticket->remaining(); |
27 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
27 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
28 | 28 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
29 | - $max = min( $remaining, $max_atndz ); |
|
29 | + $max = min($remaining, $max_atndz); |
|
30 | 30 | // but... we also want to restrict the number of tickets by the ticket max setting, |
31 | 31 | // however, the max still can't be higher than what was just set above |
32 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
32 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
33 | 33 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
34 | 34 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
35 | 35 | // and if the ticket is required, then make sure that min qty is at least 1 |
36 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
36 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
37 | 37 | } else { |
38 | 38 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
39 | 39 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -42,40 +42,40 @@ discard block |
||
42 | 42 | $ticket_price = $ticket->get_ticket_total_with_taxes(); |
43 | 43 | $ticket_bundle = FALSE; |
44 | 44 | // for ticket bundles, set min and max qty the same |
45 | - if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) { |
|
45 | + if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) { |
|
46 | 46 | $ticket_price = $ticket_price * $ticket->min(); |
47 | 47 | $ticket_bundle = TRUE; |
48 | 48 | } |
49 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
49 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
50 | 50 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
51 | 51 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
52 | 52 | $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(); |
53 | 53 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
54 | 54 | // check ticket status |
55 | - switch ( $tkt_status ) { |
|
55 | + switch ($tkt_status) { |
|
56 | 56 | // sold_out |
57 | 57 | case EE_Ticket::sold_out : |
58 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
58 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>'; |
|
59 | 59 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
60 | 60 | break; |
61 | 61 | // expired |
62 | 62 | case EE_Ticket::expired : |
63 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
63 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>'; |
|
64 | 64 | $status_class = 'ticket-sales-expired lt-grey-text'; |
65 | 65 | break; |
66 | 66 | // archived |
67 | 67 | case EE_Ticket::archived : |
68 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
68 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>'; |
|
69 | 69 | $status_class = 'archived-ticket hidden'; |
70 | 70 | break; |
71 | 71 | // pending |
72 | 72 | case EE_Ticket::pending : |
73 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
73 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>'; |
|
74 | 74 | $status_class = 'ticket-pending'; |
75 | 75 | break; |
76 | 76 | // onsale |
77 | 77 | case EE_Ticket::onsale : |
78 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
78 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>'; |
|
79 | 79 | $status_class = 'ticket-on-sale'; |
80 | 80 | break; |
81 | 81 | } |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @var string|bool |
92 | 92 | */ |
93 | - if ( false !== ( $new_row_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
93 | + if (false !== ($new_row_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
94 | 94 | echo $new_row_content; |
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | ?> |
98 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
98 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
99 | 99 | <?php |
100 | 100 | /** |
101 | 101 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -107,24 +107,24 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @var string|bool |
109 | 109 | */ |
110 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
110 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
111 | 111 | echo $new_row_cells_content; |
112 | 112 | echo '</tr>'; |
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | ?> |
116 | 116 | <td class="tckt-slctr-tbl-td-name"> |
117 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
118 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
119 | - <a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
120 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
117 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
118 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
119 | + <a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
120 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
121 | 121 | </a> |
122 | - <a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
123 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
122 | + <a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
123 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
124 | 124 | </a> |
125 | 125 | <?php endif; //end show details check ?> |
126 | - <?php if ( $ticket->required() ) { ?> |
|
127 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
126 | + <?php if ($ticket->required()) { ?> |
|
127 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
128 | 128 | <?php } ?> |
129 | 129 | <?php |
130 | 130 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -138,63 +138,63 @@ discard block |
||
138 | 138 | // echo '<br/><b> $ticket->required() : ' . $ticket->uses() . '</b>'; |
139 | 139 | ?> |
140 | 140 | </td> |
141 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
142 | - <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?> <span class="smaller-text no-bold"><?php |
|
143 | - if ( $ticket_bundle ) { |
|
144 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
141 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
142 | + <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?> <span class="smaller-text no-bold"><?php |
|
143 | + if ($ticket_bundle) { |
|
144 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
145 | 145 | } else { |
146 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
146 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
147 | 147 | }?></span> </td> |
148 | 148 | <?php } ?> |
149 | 149 | <td class="tckt-slctr-tbl-td-qty cntr"> |
150 | 150 | <?php |
151 | 151 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
152 | 152 | // sold out or other status ? |
153 | - if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) { |
|
153 | + if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) { |
|
154 | 154 | ?> |
155 | - <span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold Out', 'event_espresso' ));?></span> |
|
155 | + <span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold Out', 'event_espresso')); ?></span> |
|
156 | 156 | <?php |
157 | - } else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) { |
|
157 | + } else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) { |
|
158 | 158 | echo $ticket_status; |
159 | - } else if ( $tkt_status == EE_Ticket::pending ) { |
|
159 | + } else if ($tkt_status == EE_Ticket::pending) { |
|
160 | 160 | ?> |
161 | 161 | <div class="ticket-pending-pg"> |
162 | - <span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes On Sale', 'event_espresso' )); ?></span><br/> |
|
163 | - <span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span> |
|
162 | + <span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes On Sale', 'event_espresso')); ?></span><br/> |
|
163 | + <span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span> |
|
164 | 164 | </div> |
165 | 165 | <?php |
166 | 166 | // min qty purchasable is less than tickets available |
167 | - } else if ( $ticket->min() > $remaining ) { |
|
167 | + } else if ($ticket->min() > $remaining) { |
|
168 | 168 | ?> |
169 | 169 | <div class="archived-ticket-pg"> |
170 | - <span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/> |
|
170 | + <span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/> |
|
171 | 171 | </div> |
172 | 172 | <?php |
173 | 173 | // if only one attendee is allowed to register at a time |
174 | - } else if ( $max_atndz == 1 ) { |
|
174 | + } else if ($max_atndz == 1) { |
|
175 | 175 | // display submit button since we have tickets available |
176 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
176 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
177 | 177 | ?> |
178 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
178 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
179 | 179 | <?php |
180 | 180 | $hidden_input_qty = FALSE; |
181 | 181 | |
182 | - } else if ( $max_atndz == 0 ) { |
|
183 | - echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>'; |
|
184 | - } elseif ( $max > 0 ) { |
|
182 | + } else if ($max_atndz == 0) { |
|
183 | + echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>'; |
|
184 | + } elseif ($max > 0) { |
|
185 | 185 | // display submit button since we have tickets available |
186 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
186 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
187 | 187 | |
188 | 188 | ?> |
189 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
189 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
190 | 190 | <?php |
191 | 191 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
192 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
192 | + if ( ! $ticket->required() && $min !== 0) { |
|
193 | 193 | ?> |
194 | 194 | <option value="0"> 0 </option> |
195 | 195 | <?php } |
196 | 196 | // offer ticket quantities from the min to the max |
197 | - for ( $i = $min; $i <= $max; $i++) { |
|
197 | + for ($i = $min; $i <= $max; $i++) { |
|
198 | 198 | ?> |
199 | 199 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
200 | 200 | <?php } ?> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | } |
206 | 206 | // depending on group reg we need to change the format for qty |
207 | - if ( $hidden_input_qty ) { |
|
207 | + if ($hidden_input_qty) { |
|
208 | 208 | ?> |
209 | 209 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
210 | 210 | <?php |
@@ -214,33 +214,33 @@ discard block |
||
214 | 214 | |
215 | 215 | </td> |
216 | 216 | </tr> |
217 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
218 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
217 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
218 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
219 | 219 | <td class="tckt-slctr-tkt-details-td" colspan="3" > |
220 | - <div id="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
|
220 | + <div id="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
|
221 | 221 | |
222 | 222 | <section class="tckt-slctr-tkt-details-sctn"> |
223 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
223 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
224 | 224 | <p><?php echo $ticket->description(); ?></p> |
225 | 225 | |
226 | - <?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
226 | + <?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
227 | 227 | <section class="tckt-slctr-tkt-price-sctn"> |
228 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
228 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
229 | 229 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
230 | 230 | <table class="tckt-slctr-tkt-details-tbl"> |
231 | 231 | <thead> |
232 | 232 | <tr> |
233 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
234 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
235 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
233 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
234 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
235 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
236 | 236 | </tr> |
237 | 237 | </thead> |
238 | 238 | <tbody> |
239 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
239 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
240 | 240 | <tr> |
241 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
242 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
243 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
241 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
242 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
243 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
244 | 244 | </tr> |
245 | 245 | <?php |
246 | 246 | $running_total = $ticket->base_price()->amount(); |
@@ -248,44 +248,44 @@ discard block |
||
248 | 248 | $running_total = 0; |
249 | 249 | } |
250 | 250 | // now add price modifiers |
251 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
251 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
252 | 252 | <tr> |
253 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
254 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
255 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
253 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
254 | + <?php if ($price_mod->is_percent()) { ?> |
|
255 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
256 | 256 | <?php |
257 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
257 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
258 | 258 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
259 | 259 | ?> |
260 | 260 | <?php } else { ?> |
261 | 261 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
262 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
262 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
263 | 263 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
264 | 264 | <?php } ?> |
265 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
265 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
266 | 266 | <?php $running_total += $new_sub_total; ?> |
267 | 267 | </tr> |
268 | 268 | <?php } ?> |
269 | - <?php if ( $ticket->taxable() ) { ?> |
|
269 | + <?php if ($ticket->taxable()) { ?> |
|
270 | 270 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
271 | 271 | <tr> |
272 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
273 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
272 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
273 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
274 | 274 | </tr> |
275 | 275 | |
276 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
276 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
277 | 277 | <tr> |
278 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
279 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
280 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
281 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
278 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
279 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
280 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
281 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
282 | 282 | <?php $running_total += $tax_amount; ?> |
283 | 283 | </tr> |
284 | 284 | <?php } ?> |
285 | 285 | <?php } ?> |
286 | 286 | <tr> |
287 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
288 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
287 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
288 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
289 | 289 | </tr> |
290 | 290 | </tbody> |
291 | 291 | </table> |
@@ -295,106 +295,106 @@ discard block |
||
295 | 295 | <?php } ?> |
296 | 296 | |
297 | 297 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
298 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
299 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
300 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
301 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
298 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
299 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
300 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
301 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
302 | 302 | </section> |
303 | 303 | <br/> |
304 | 304 | |
305 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
305 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
306 | 306 | |
307 | - <?php if ( $ticket->min() &&$ticket->max() ) { ?> |
|
307 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
308 | 308 | <section class="tckt-slctr-tkt-quantities-sctn"> |
309 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
310 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
311 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
312 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
309 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
310 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
311 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
312 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
313 | 313 | <?php //$max = min( $max, $max_atndz );?> |
314 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
314 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
315 | 315 | </section> |
316 | 316 | <br/> |
317 | 317 | <?php } ?> |
318 | 318 | |
319 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
319 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
320 | 320 | <section class="tckt-slctr-tkt-uses-sctn"> |
321 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
321 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
322 | 322 | <span class="drk-grey-text small-text no-bold"> - <?php |
323 | 323 | echo apply_filters( |
324 | 324 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
325 | 325 | sprintf( |
326 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
326 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
327 | 327 | '<br/>', |
328 | 328 | '<strong>', |
329 | 329 | '</strong>' |
330 | 330 | ) |
331 | 331 | ); |
332 | 332 | ?></span><br/> |
333 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
333 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
334 | 334 | </section> |
335 | 335 | <?php } ?> |
336 | 336 | |
337 | 337 | <?php |
338 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
338 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
339 | 339 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
340 | - if ( ! empty( $datetimes )) { ?> |
|
340 | + if ( ! empty($datetimes)) { ?> |
|
341 | 341 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
342 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
343 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
342 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
343 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
344 | 344 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
345 | 345 | <table class="tckt-slctr-tkt-details-tbl"> |
346 | 346 | <thead> |
347 | 347 | <tr> |
348 | 348 | <th class="tckt-slctr-tkt-details-date-th"> |
349 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
349 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
350 | 350 | </th> |
351 | 351 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
352 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
352 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
353 | 353 | </th> |
354 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
354 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
355 | 355 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
356 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
356 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
357 | 357 | </th> |
358 | 358 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
359 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
359 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
360 | 360 | </th> |
361 | 361 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
362 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
362 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
363 | 363 | </th> |
364 | 364 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
365 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
365 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
366 | 366 | </th> |
367 | 367 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
368 | 368 | </tr> |
369 | 369 | </thead> |
370 | 370 | <tbody> |
371 | 371 | <?php |
372 | - foreach ( $datetimes as $datetime ) { |
|
373 | - if ( $datetime instanceof EE_Datetime ) { |
|
372 | + foreach ($datetimes as $datetime) { |
|
373 | + if ($datetime instanceof EE_Datetime) { |
|
374 | 374 | ?> |
375 | 375 | |
376 | 376 | <tr> |
377 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
377 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
378 | 378 | <?php $datetime_name = $datetime->name(); ?> |
379 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
380 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
379 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
380 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
381 | 381 | </td> |
382 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
383 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
382 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
383 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
384 | 384 | </td> |
385 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
386 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
385 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
386 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
387 | 387 | <?php echo $ticket->sold(); ?> |
388 | 388 | </td> |
389 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
390 | - <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
389 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
390 | + <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
391 | 391 | </td> |
392 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
392 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
393 | 393 | <?php echo $datetime->sold(); ?> |
394 | 394 | </td> |
395 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
396 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
397 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
395 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
396 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
397 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
398 | 398 | </td> |
399 | 399 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
400 | 400 | </tr> |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | </div> |
413 | 413 | </td> |
414 | 414 | </tr> |
415 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
415 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
416 | 416 | <?php |
417 | 417 | $row++; |
418 | 418 | } |
@@ -421,32 +421,32 @@ discard block |
||
421 | 421 | $ticket_row_html = ob_get_clean(); |
422 | 422 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
423 | 423 | $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false; |
424 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
424 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
425 | 425 | //EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
426 | 426 | //EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ ); |
427 | 427 | //EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ ); |
428 | 428 | //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ ); |
429 | 429 | remove_filter( |
430 | 430 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
431 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
431 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
432 | 432 | ); |
433 | 433 | remove_filter( |
434 | 434 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
435 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
435 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
436 | 436 | ); |
437 | -if ( ! $hide_ticket_selector ) { |
|
437 | +if ( ! $hide_ticket_selector) { |
|
438 | 438 | ?> |
439 | 439 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
440 | 440 | |
441 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
441 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
442 | 442 | |
443 | 443 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
444 | 444 | <thead> |
445 | 445 | <tr> |
446 | 446 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
447 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
447 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
448 | 448 | </th> |
449 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
449 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
450 | 450 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
451 | 451 | <?php |
452 | 452 | /** |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @param string 'Price' The translatable text to display in the table header for price |
458 | 458 | * @param int $EVT_ID The Event ID |
459 | 459 | */ |
460 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
460 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
461 | 461 | ?> |
462 | 462 | </th> |
463 | 463 | <?php } ?> |
@@ -471,24 +471,24 @@ discard block |
||
471 | 471 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
472 | 472 | * @param int $EVT_ID The Event ID |
473 | 473 | */ |
474 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
474 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
475 | 475 | ?> |
476 | 476 | </th> |
477 | 477 | </tr> |
478 | 478 | </thead> |
479 | 479 | <tbody> |
480 | - <?php echo $ticket_row_html;?> |
|
480 | + <?php echo $ticket_row_html; ?> |
|
481 | 481 | </tbody> |
482 | 482 | </table> |
483 | 483 | |
484 | 484 | <input type="hidden" name="noheader" value="true" /> |
485 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" /> |
|
485 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" /> |
|
486 | 486 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
487 | 487 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
488 | 488 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
489 | 489 | |
490 | 490 | <?php |
491 | -if ( $max_atndz > 0 && ! $hide_ticket_selector ) { |
|
491 | +if ($max_atndz > 0 && ! $hide_ticket_selector) { |
|
492 | 492 | echo apply_filters( |
493 | 493 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
494 | 494 | '' |
@@ -496,10 +496,10 @@ discard block |
||
496 | 496 | } |
497 | 497 | ?> |
498 | 498 | |
499 | - <?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?> |
|
499 | + <?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?> |
|
500 | 500 | |
501 | 501 | </div> |
502 | -<?php } else if ( isset( $TKT_ID ) ) { ?> |
|
502 | +<?php } else if (isset($TKT_ID)) { ?> |
|
503 | 503 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
504 | 504 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
505 | 505 | <input type="hidden" name="noheader" value="true"/> |
@@ -508,27 +508,27 @@ discard block |
||
508 | 508 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
509 | 509 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
510 | 510 | <?php |
511 | - if ( $ticket instanceof EE_Ticket ) { |
|
512 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
511 | + if ($ticket instanceof EE_Ticket) { |
|
512 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
513 | 513 | $ticket_description = $ticket->description(); |
514 | 514 | ?> |
515 | 515 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
516 | 516 | <div class="no-tkt-slctr-ticket-content-dv"> |
517 | 517 | <h5><?php echo $ticket->name(); ?></h5> |
518 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
518 | + <?php if ( ! empty($ticket_description)) { ?> |
|
519 | 519 | <p><?php echo $ticket_description; ?></p> |
520 | 520 | <?php } ?> |
521 | 521 | </div> |
522 | 522 | <?php |
523 | 523 | add_filter( |
524 | 524 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
525 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
525 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
526 | 526 | ); |
527 | 527 | add_filter( |
528 | 528 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
529 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
529 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
530 | 530 | ); |
531 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
531 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | ?> |