@@ -3,7 +3,7 @@ |
||
3 | 3 | /** @type string $events_requiring_pre_approval_msg */ |
4 | 4 | ?> |
5 | 5 | |
6 | -<h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso');?></span></h4> |
|
6 | +<h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso'); ?></span></h4> |
|
7 | 7 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
8 | 8 | <?php echo $events_requiring_pre_approval_msg; ?> |
9 | 9 | </p> |
@@ -3,9 +3,9 @@ |
||
3 | 3 | /** @type string $sold_out_events_msg */ |
4 | 4 | ?> |
5 | 5 | |
6 | -<h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso');?></b></h4> |
|
6 | +<h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso'); ?></b></h4> |
|
7 | 7 | <ul id="spco-sold-out-events-ul"><?php echo $sold_out_events; ?></ul> |
8 | - <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso');?></h6> |
|
8 | + <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso'); ?></h6> |
|
9 | 9 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
10 | 10 | <?php echo $sold_out_events_msg; ?> |
11 | 11 | </p> |
@@ -3,8 +3,8 @@ |
||
3 | 3 | /** @type string $sold_out_tickets_msg */ |
4 | 4 | ?> |
5 | 5 | |
6 | - <h4 ><b><?php _e('Sold Out', 'event_espresso');?></b></h4> |
|
7 | - <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso');?></h6> |
|
6 | + <h4 ><b><?php _e('Sold Out', 'event_espresso'); ?></b></h4> |
|
7 | + <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso'); ?></h6> |
|
8 | 8 | <p id="tickets-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
9 | 9 | <?php echo $sold_out_tickets_msg; ?> |
10 | 10 | </p> |
@@ -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_Invoice extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Invoice extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function __construct($pm_instance = NULL) { |
38 | 38 | $this->_pretty_name = __("Invoice", 'event_espresso'); |
39 | 39 | $this->_default_description = sprintf( |
40 | - __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.%1$sPlease note that event spaces will not be reserved until payment is received in full, and any remaining tickets could be sold to others in the meantime.%2$s%3$s', 'event_espresso' ), |
|
40 | + __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.%1$sPlease note that event spaces will not be reserved until payment is received in full, and any remaining tickets could be sold to others in the meantime.%2$s%3$s', 'event_espresso'), |
|
41 | 41 | '<br />', |
42 | 42 | '<span class="important-notice">', |
43 | 43 | '</span>' |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param \EE_Transaction $transaction |
54 | 54 | * @return NULL |
55 | 55 | */ |
56 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
56 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
57 | 57 | return NULL; |
58 | 58 | } |
59 | 59 | |
@@ -66,53 +66,53 @@ discard block |
||
66 | 66 | public function generate_new_settings_form() { |
67 | 67 | $pdf_payee_input_name = 'pdf_payee_name'; |
68 | 68 | $confirmation_text_input_name = 'page_confirmation_text'; |
69 | - $form = new EE_Payment_Method_Form(array( |
|
69 | + $form = new EE_Payment_Method_Form(array( |
|
70 | 70 | // 'payment_method_type' => $this, |
71 | 71 | 'extra_meta_inputs'=>array( |
72 | 72 | $pdf_payee_input_name => new EE_Text_Input(array( |
73 | - 'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link()) |
|
73 | + 'html_label_text' => sprintf(__('Payee Name %s', 'event_espresso'), $this->get_help_tab_link()) |
|
74 | 74 | )), |
75 | 75 | 'pdf_payee_email' => new EE_Email_Input(array( |
76 | - 'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
76 | + 'html_label_text' => sprintf(__('Payee Email %s', 'event_espresso'), $this->get_help_tab_link()), |
|
77 | 77 | )), |
78 | 78 | 'pdf_payee_tax_number' => new EE_Text_Input(array( |
79 | - 'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
79 | + 'html_label_text' => sprintf(__('Payee Tax Number %s', 'event_espresso'), $this->get_help_tab_link()), |
|
80 | 80 | )), |
81 | - 'pdf_payee_address' => new EE_Text_Area_Input( array( |
|
82 | - 'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
83 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
81 | + 'pdf_payee_address' => new EE_Text_Area_Input(array( |
|
82 | + 'html_label_text' => sprintf(__('Payee Address %s', 'event_espresso'), $this->get_help_tab_link()), |
|
83 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
84 | 84 | )), |
85 | 85 | 'pdf_instructions'=>new EE_Text_Area_Input(array( |
86 | - 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
86 | + 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
87 | 87 | 'default'=> __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
88 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
88 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
89 | 89 | )), |
90 | 90 | 'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array( |
91 | - 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
91 | + 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
92 | 92 | 'default'=> EE_Config::instance()->organization->logo_url, |
93 | 93 | 'html_help_text'=> __("(Logo for the top left of the invoice)", 'event_espresso'), |
94 | 94 | )), |
95 | 95 | $confirmation_text_input_name =>new EE_Text_Area_Input(array( |
96 | - 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
96 | + 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | 97 | 'default'=> __("Payment must be received within 48 hours of event date. Details about where to send payment is included on the invoice.", 'event_espresso'), |
98 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
98 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
99 | 99 | )), |
100 | 100 | 'page_extra_info'=>new EE_Text_Area_Input(array( |
101 | - 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
102 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
101 | + 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
102 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
103 | 103 | )), |
104 | 104 | ), |
105 | 105 | 'include'=>array( |
106 | - 'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order', |
|
107 | - $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image', |
|
106 | + 'PMD_ID', 'PMD_name', 'PMD_desc', 'PMD_admin_name', 'PMD_admin_desc', 'PMD_type', 'PMD_slug', 'PMD_open_by_default', 'PMD_button_url', 'PMD_scope', 'Currency', 'PMD_order', |
|
107 | + $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions', 'pdf_logo_image', |
|
108 | 108 | $confirmation_text_input_name, 'page_extra_info'), |
109 | 109 | )); |
110 | 110 | $form->add_subsections( |
111 | - array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )), |
|
111 | + array('header1' => new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_display.template.php')), |
|
112 | 112 | $pdf_payee_input_name |
113 | 113 | ); |
114 | 114 | $form->add_subsections( |
115 | - array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )), |
|
115 | + array('header2'=>new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php')), |
|
116 | 116 | $confirmation_text_input_name |
117 | 117 | ); |
118 | 118 | return $form; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @see EE_PMT_Base::help_tabs_config() |
126 | 126 | * @return array |
127 | 127 | */ |
128 | - public function help_tabs_config(){ |
|
128 | + public function help_tabs_config() { |
|
129 | 129 | return array( |
130 | 130 | $this->get_help_tab_name() => array( |
131 | 131 | 'title' => __('Invoice Settings', 'event_espresso'), |
@@ -143,17 +143,17 @@ discard block |
||
143 | 143 | * @param \EE_Payment $payment |
144 | 144 | * @return string |
145 | 145 | */ |
146 | - public function payment_overview_content( EE_Payment $payment ){ |
|
146 | + public function payment_overview_content(EE_Payment $payment) { |
|
147 | 147 | EE_Registry::instance()->load_helper('Template'); |
148 | 148 | return EEH_Template::locate_template( |
149 | - 'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php', |
|
149 | + 'payment_methods'.DS.'Invoice'.DS.'templates'.DS.'invoice_payment_details_content.template.php', |
|
150 | 150 | array_merge( |
151 | 151 | array( |
152 | 152 | 'payment_method' => $this->_pm_instance, |
153 | 153 | 'payment' => $payment, |
154 | 154 | 'page_confirmation_text' => '', |
155 | 155 | 'page_extra_info' => '', |
156 | - 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url( 'html' ) |
|
156 | + 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url('html') |
|
157 | 157 | ), |
158 | 158 | $this->_pm_instance->all_extra_meta_array() |
159 | 159 | ) |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @access protected |
239 | 239 | * @param \EE_Ticket $ticket |
240 | 240 | * @param int $quantity |
241 | - * @return bool |
|
241 | + * @return integer |
|
242 | 242 | * @throws \EE_Error |
243 | 243 | */ |
244 | 244 | protected function _reserve_ticket( EE_Ticket $ticket, $quantity = 1 ) { |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @access protected |
258 | 258 | * @param EE_Ticket $ticket |
259 | 259 | * @param int $quantity |
260 | - * @return bool |
|
260 | + * @return integer |
|
261 | 261 | * @throws \EE_Error |
262 | 262 | */ |
263 | 263 | protected function _release_reserved_ticket( EE_Ticket $ticket, $quantity = 1 ) { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @access protected |
282 | 282 | * @param \EE_Ticket $ticket |
283 | - * @return bool |
|
283 | + * @return boolean|null |
|
284 | 284 | * @throws \EE_Error |
285 | 285 | */ |
286 | 286 | protected function _ticket_sold_out( EE_Ticket $ticket ) { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @access protected |
301 | 301 | * @param \EE_Ticket $ticket |
302 | - * @return bool |
|
302 | + * @return boolean|null |
|
303 | 303 | */ |
304 | 304 | protected function _ticket_quantity_decremented( EE_Ticket $ticket ) { |
305 | 305 | if ( self::debug ) { |
@@ -399,13 +399,13 @@ discard block |
||
399 | 399 | if ( self::debug ) { |
400 | 400 | echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
401 | 401 | } |
402 | - $refresh_msg = ''; |
|
403 | - $none_added_msg = ''; |
|
402 | + $refresh_msg = ''; |
|
403 | + $none_added_msg = ''; |
|
404 | 404 | if (defined('DOING_AJAX') && DOING_AJAX) { |
405 | - $refresh_msg = __('Please refresh the page to view updated ticket quantities.', |
|
406 | - 'event_espresso'); |
|
407 | - $none_added_msg = __('No tickets were added for the event.', 'event_espresso'); |
|
408 | - } |
|
405 | + $refresh_msg = __('Please refresh the page to view updated ticket quantities.', |
|
406 | + 'event_espresso'); |
|
407 | + $none_added_msg = __('No tickets were added for the event.', 'event_espresso'); |
|
408 | + } |
|
409 | 409 | if ( ! empty( $this->sold_out_tickets ) ) { |
410 | 410 | EE_Error::add_attention( |
411 | 411 | sprintf( |
@@ -415,16 +415,16 @@ discard block |
||
415 | 415 | ), |
416 | 416 | '<br />', |
417 | 417 | implode( '<br />', $this->sold_out_tickets ), |
418 | - $none_added_msg, |
|
419 | - $refresh_msg |
|
418 | + $none_added_msg, |
|
419 | + $refresh_msg |
|
420 | 420 | ) |
421 | 421 | ); |
422 | 422 | // alter code flow in the Ticket Selector for better UX |
423 | 423 | add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true' ); |
424 | 424 | add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false' ); |
425 | 425 | $this->sold_out_tickets = array(); |
426 | - // and reset the cart |
|
427 | - EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN); |
|
426 | + // and reset the cart |
|
427 | + EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN); |
|
428 | 428 | } |
429 | 429 | if ( ! empty( $this->decremented_tickets ) ) { |
430 | 430 | EE_Error::add_attention( |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | ), |
436 | 436 | '<br />', |
437 | 437 | implode( '<br />', $this->decremented_tickets ), |
438 | - $none_added_msg, |
|
439 | - $refresh_msg |
|
438 | + $none_added_msg, |
|
439 | + $refresh_msg |
|
440 | 440 | ) |
441 | 441 | ); |
442 | 442 | $this->decremented_tickets = array(); |
@@ -607,11 +607,11 @@ discard block |
||
607 | 607 | } |
608 | 608 | } |
609 | 609 | } |
610 | - if (self::debug) { |
|
611 | - echo "<br /><br /> RESET COMPLETED "; |
|
612 | - } |
|
610 | + if (self::debug) { |
|
611 | + echo "<br /><br /> RESET COMPLETED "; |
|
612 | + } |
|
613 | 613 | |
614 | - } |
|
614 | + } |
|
615 | 615 | |
616 | 616 | |
617 | 617 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * Class EED_Ticket_Sales_Monitor |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | class EED_Ticket_Sales_Monitor extends EED_Module { |
19 | 19 | |
20 | - const debug = false; // true false |
|
20 | + const debug = false; // true false |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * an array of raw ticket data from EED_Ticket_Selector |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public static function set_hooks() { |
61 | 61 | // check ticket reserves AFTER MER does it's check (hence priority 20) |
62 | - add_filter( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', |
|
63 | - array( 'EED_Ticket_Sales_Monitor', 'validate_ticket_sale' ), |
|
62 | + add_filter('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', |
|
63 | + array('EED_Ticket_Sales_Monitor', 'validate_ticket_sale'), |
|
64 | 64 | 20, 3 |
65 | 65 | ); |
66 | 66 | // add notices for sold out tickets |
67 | - add_action( 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', |
|
68 | - array( 'EED_Ticket_Sales_Monitor', 'post_notices' ), |
|
67 | + add_action('AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', |
|
68 | + array('EED_Ticket_Sales_Monitor', 'post_notices'), |
|
69 | 69 | 10 |
70 | 70 | ); |
71 | 71 | // handle ticket quantities adjusted in cart |
@@ -77,40 +77,40 @@ discard block |
||
77 | 77 | // handle tickets deleted from cart |
78 | 78 | add_action( |
79 | 79 | 'FHEE__EED_Multi_Event_Registration__delete_ticket__ticket_removed_from_cart', |
80 | - array( 'EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart' ), |
|
80 | + array('EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart'), |
|
81 | 81 | 10, 2 |
82 | 82 | ); |
83 | 83 | // handle emptied carts |
84 | 84 | add_action( |
85 | 85 | 'AHEE__EE_Session__reset_cart__before_reset', |
86 | - array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ), |
|
86 | + array('EED_Ticket_Sales_Monitor', 'session_cart_reset'), |
|
87 | 87 | 10, 1 |
88 | 88 | ); |
89 | 89 | add_action( |
90 | 90 | 'AHEE__EED_Multi_Event_Registration__empty_event_cart__before_delete_cart', |
91 | - array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ), |
|
91 | + array('EED_Ticket_Sales_Monitor', 'session_cart_reset'), |
|
92 | 92 | 10, 1 |
93 | 93 | ); |
94 | 94 | // handle cancelled registrations |
95 | 95 | add_action( |
96 | 96 | 'AHEE__EE_Session__reset_checkout__before_reset', |
97 | - array( 'EED_Ticket_Sales_Monitor', 'session_checkout_reset' ), |
|
97 | + array('EED_Ticket_Sales_Monitor', 'session_checkout_reset'), |
|
98 | 98 | 10, 1 |
99 | 99 | ); |
100 | 100 | // cron tasks |
101 | 101 | add_action( |
102 | 102 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions__abandoned_transaction', |
103 | - array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ), |
|
103 | + array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'), |
|
104 | 104 | 10, 1 |
105 | 105 | ); |
106 | 106 | add_action( |
107 | 107 | 'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction', |
108 | - array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ), |
|
108 | + array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'), |
|
109 | 109 | 10, 1 |
110 | 110 | ); |
111 | 111 | add_action( |
112 | 112 | 'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction', |
113 | - array( 'EED_Ticket_Sales_Monitor', 'process_failed_transactions' ), |
|
113 | + array('EED_Ticket_Sales_Monitor', 'process_failed_transactions'), |
|
114 | 114 | 10, 1 |
115 | 115 | ); |
116 | 116 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @return EED_Ticket_Sales_Monitor |
135 | 135 | */ |
136 | 136 | public static function instance() { |
137 | - return parent::get_instance( __CLASS__ ); |
|
137 | + return parent::get_instance(__CLASS__); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param WP_Query $WP_Query |
147 | 147 | * @return void |
148 | 148 | */ |
149 | - public function run( $WP_Query ) { |
|
149 | + public function run($WP_Query) { |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | * @param \EE_Ticket $ticket |
165 | 165 | * @return bool |
166 | 166 | */ |
167 | - public static function validate_ticket_sale( $qty = 1, EE_Ticket $ticket ) { |
|
168 | - $qty = absint( $qty ); |
|
169 | - if ( $qty > 0 ) { |
|
170 | - $qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale( $ticket, $qty ); |
|
167 | + public static function validate_ticket_sale($qty = 1, EE_Ticket $ticket) { |
|
168 | + $qty = absint($qty); |
|
169 | + if ($qty > 0) { |
|
170 | + $qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale($ticket, $qty); |
|
171 | 171 | } |
172 | - if ( self::debug ) { |
|
173 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()"; |
|
174 | - echo "<br /><br /><b> RETURNED QTY: " . $qty . '</b>'; |
|
172 | + if (self::debug) { |
|
173 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."()"; |
|
174 | + echo "<br /><br /><b> RETURNED QTY: ".$qty.'</b>'; |
|
175 | 175 | } |
176 | 176 | return $qty; |
177 | 177 | } |
@@ -187,42 +187,42 @@ discard block |
||
187 | 187 | * @param int $qty |
188 | 188 | * @return int |
189 | 189 | */ |
190 | - protected function _validate_ticket_sale( EE_Ticket $ticket, $qty = 1 ) { |
|
191 | - if ( self::debug ) { |
|
192 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
190 | + protected function _validate_ticket_sale(EE_Ticket $ticket, $qty = 1) { |
|
191 | + if (self::debug) { |
|
192 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
193 | 193 | } |
194 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
194 | + if ( ! $ticket instanceof EE_Ticket) { |
|
195 | 195 | return 0; |
196 | 196 | } |
197 | - if ( self::debug ) { |
|
198 | - echo "<br /><b> . ticket->ID: " . $ticket->ID() . '</b>'; |
|
199 | - echo "<br /> . original ticket->reserved: " . $ticket->reserved(); |
|
197 | + if (self::debug) { |
|
198 | + echo "<br /><b> . ticket->ID: ".$ticket->ID().'</b>'; |
|
199 | + echo "<br /> . original ticket->reserved: ".$ticket->reserved(); |
|
200 | 200 | } |
201 | 201 | $ticket->refresh_from_db(); |
202 | 202 | // first let's determine the ticket availability based on sales |
203 | - $available = $ticket->qty( 'saleable' ); |
|
204 | - if ( self::debug ) { |
|
205 | - echo "<br /> . . . ticket->qty: " . $ticket->qty(); |
|
206 | - echo "<br /> . . . ticket->sold: " . $ticket->sold(); |
|
207 | - echo "<br /> . . . ticket->reserved: " . $ticket->reserved(); |
|
208 | - echo "<br /> . . . ticket->qty(saleable): " . $ticket->qty( 'saleable' ); |
|
209 | - echo "<br /> . . . available: " . $available; |
|
210 | - } |
|
211 | - if ( $available < 1 ) { |
|
212 | - $this->_ticket_sold_out( $ticket ); |
|
203 | + $available = $ticket->qty('saleable'); |
|
204 | + if (self::debug) { |
|
205 | + echo "<br /> . . . ticket->qty: ".$ticket->qty(); |
|
206 | + echo "<br /> . . . ticket->sold: ".$ticket->sold(); |
|
207 | + echo "<br /> . . . ticket->reserved: ".$ticket->reserved(); |
|
208 | + echo "<br /> . . . ticket->qty(saleable): ".$ticket->qty('saleable'); |
|
209 | + echo "<br /> . . . available: ".$available; |
|
210 | + } |
|
211 | + if ($available < 1) { |
|
212 | + $this->_ticket_sold_out($ticket); |
|
213 | 213 | return 0; |
214 | 214 | } |
215 | - if ( self::debug ) { |
|
216 | - echo "<br /> . . . qty: " . $qty; |
|
215 | + if (self::debug) { |
|
216 | + echo "<br /> . . . qty: ".$qty; |
|
217 | 217 | } |
218 | - if ( $available < $qty ) { |
|
218 | + if ($available < $qty) { |
|
219 | 219 | $qty = $available; |
220 | - if ( self::debug ) { |
|
221 | - echo "<br /> . . . QTY ADJUSTED: " . $qty; |
|
220 | + if (self::debug) { |
|
221 | + echo "<br /> . . . QTY ADJUSTED: ".$qty; |
|
222 | 222 | } |
223 | - $this->_ticket_quantity_decremented( $ticket ); |
|
223 | + $this->_ticket_quantity_decremented($ticket); |
|
224 | 224 | } |
225 | - $this->_reserve_ticket( $ticket, $qty ); |
|
225 | + $this->_reserve_ticket($ticket, $qty); |
|
226 | 226 | return $qty; |
227 | 227 | } |
228 | 228 | |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | * @return bool |
239 | 239 | * @throws \EE_Error |
240 | 240 | */ |
241 | - protected function _reserve_ticket( EE_Ticket $ticket, $quantity = 1 ) { |
|
242 | - if ( self::debug ) { |
|
243 | - echo "<br /><br /> . . . INCREASE RESERVED: " . $quantity; |
|
241 | + protected function _reserve_ticket(EE_Ticket $ticket, $quantity = 1) { |
|
242 | + if (self::debug) { |
|
243 | + echo "<br /><br /> . . . INCREASE RESERVED: ".$quantity; |
|
244 | 244 | } |
245 | - $ticket->increase_reserved( $quantity ); |
|
245 | + $ticket->increase_reserved($quantity); |
|
246 | 246 | return $ticket->save(); |
247 | 247 | } |
248 | 248 | |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | * @return bool |
258 | 258 | * @throws \EE_Error |
259 | 259 | */ |
260 | - protected function _release_reserved_ticket( EE_Ticket $ticket, $quantity = 1 ) { |
|
261 | - if ( self::debug ) { |
|
262 | - echo "<br /> . . . ticket->ID: " . $ticket->ID(); |
|
263 | - echo "<br /> . . . ticket->reserved: " . $ticket->reserved(); |
|
260 | + protected function _release_reserved_ticket(EE_Ticket $ticket, $quantity = 1) { |
|
261 | + if (self::debug) { |
|
262 | + echo "<br /> . . . ticket->ID: ".$ticket->ID(); |
|
263 | + echo "<br /> . . . ticket->reserved: ".$ticket->reserved(); |
|
264 | 264 | } |
265 | - $ticket->decrease_reserved( $quantity ); |
|
266 | - if ( self::debug ) { |
|
267 | - echo "<br /> . . . ticket->reserved: " . $ticket->reserved(); |
|
265 | + $ticket->decrease_reserved($quantity); |
|
266 | + if (self::debug) { |
|
267 | + echo "<br /> . . . ticket->reserved: ".$ticket->reserved(); |
|
268 | 268 | } |
269 | 269 | return $ticket->save() ? 1 : 0; |
270 | 270 | } |
@@ -280,12 +280,12 @@ discard block |
||
280 | 280 | * @return bool |
281 | 281 | * @throws \EE_Error |
282 | 282 | */ |
283 | - protected function _ticket_sold_out( EE_Ticket $ticket ) { |
|
284 | - if ( self::debug ) { |
|
285 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
286 | - echo "<br /> . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket ); |
|
283 | + protected function _ticket_sold_out(EE_Ticket $ticket) { |
|
284 | + if (self::debug) { |
|
285 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
286 | + echo "<br /> . . ticket->name: ".$this->_get_ticket_and_event_name($ticket); |
|
287 | 287 | } |
288 | - $this->sold_out_tickets[] = $this->_get_ticket_and_event_name( $ticket ); |
|
288 | + $this->sold_out_tickets[] = $this->_get_ticket_and_event_name($ticket); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -298,12 +298,12 @@ discard block |
||
298 | 298 | * @param \EE_Ticket $ticket |
299 | 299 | * @return bool |
300 | 300 | */ |
301 | - protected function _ticket_quantity_decremented( EE_Ticket $ticket ) { |
|
302 | - if ( self::debug ) { |
|
303 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
304 | - echo "<br /> . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket ); |
|
301 | + protected function _ticket_quantity_decremented(EE_Ticket $ticket) { |
|
302 | + if (self::debug) { |
|
303 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
304 | + echo "<br /> . . ticket->name: ".$this->_get_ticket_and_event_name($ticket); |
|
305 | 305 | } |
306 | - $this->decremented_tickets[] = $this->_get_ticket_and_event_name( $ticket ); |
|
306 | + $this->decremented_tickets[] = $this->_get_ticket_and_event_name($ticket); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | * @param \EE_Ticket $ticket |
317 | 317 | * @return string |
318 | 318 | */ |
319 | - protected function _get_ticket_and_event_name( EE_Ticket $ticket ) { |
|
319 | + protected function _get_ticket_and_event_name(EE_Ticket $ticket) { |
|
320 | 320 | $event = $ticket->get_related_event(); |
321 | - if ( $event instanceof EE_Event ) { |
|
321 | + if ($event instanceof EE_Event) { |
|
322 | 322 | $ticket_name = sprintf( |
323 | - _x( '%1$s for %2$s', 'ticket name for event name', 'event_espresso' ), |
|
323 | + _x('%1$s for %2$s', 'ticket name for event name', 'event_espresso'), |
|
324 | 324 | $ticket->name(), |
325 | 325 | $event->name() |
326 | 326 | ); |
@@ -345,13 +345,13 @@ discard block |
||
345 | 345 | * @param int $quantity |
346 | 346 | * @return void |
347 | 347 | */ |
348 | - public static function ticket_quantity_updated( EE_Line_Item $line_item, $quantity = 1 ) { |
|
349 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( absint( $line_item->OBJ_ID() ) ); |
|
350 | - if ( $ticket instanceof EE_Ticket ) { |
|
351 | - if ( $quantity > 0 ) { |
|
352 | - EED_Ticket_Sales_Monitor::instance()->_reserve_ticket( $ticket, $quantity ); |
|
348 | + public static function ticket_quantity_updated(EE_Line_Item $line_item, $quantity = 1) { |
|
349 | + $ticket = EEM_Ticket::instance()->get_one_by_ID(absint($line_item->OBJ_ID())); |
|
350 | + if ($ticket instanceof EE_Ticket) { |
|
351 | + if ($quantity > 0) { |
|
352 | + EED_Ticket_Sales_Monitor::instance()->_reserve_ticket($ticket, $quantity); |
|
353 | 353 | } else { |
354 | - EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity ); |
|
354 | + EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | } |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @param int $quantity |
368 | 368 | * @return void |
369 | 369 | */ |
370 | - public static function ticket_removed_from_cart( EE_Ticket $ticket, $quantity = 1 ) { |
|
371 | - EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity ); |
|
370 | + public static function ticket_removed_from_cart(EE_Ticket $ticket, $quantity = 1) { |
|
371 | + EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | * @return void |
397 | 397 | */ |
398 | 398 | protected function _post_notices() { |
399 | - if ( self::debug ) { |
|
400 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
399 | + if (self::debug) { |
|
400 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
401 | 401 | } |
402 | 402 | $refresh_msg = ''; |
403 | 403 | $none_added_msg = ''; |
@@ -406,35 +406,35 @@ discard block |
||
406 | 406 | 'event_espresso'); |
407 | 407 | $none_added_msg = __('No tickets were added for the event.', 'event_espresso'); |
408 | 408 | } |
409 | - if ( ! empty( $this->sold_out_tickets ) ) { |
|
409 | + if ( ! empty($this->sold_out_tickets)) { |
|
410 | 410 | EE_Error::add_attention( |
411 | 411 | sprintf( |
412 | 412 | apply_filters( |
413 | 413 | 'FHEE__EED_Ticket_Sales_Monitor___post_notices__sold_out_tickets_notice', |
414 | - __( 'We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso' ) |
|
414 | + __('We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso') |
|
415 | 415 | ), |
416 | 416 | '<br />', |
417 | - implode( '<br />', $this->sold_out_tickets ), |
|
417 | + implode('<br />', $this->sold_out_tickets), |
|
418 | 418 | $none_added_msg, |
419 | 419 | $refresh_msg |
420 | 420 | ) |
421 | 421 | ); |
422 | 422 | // alter code flow in the Ticket Selector for better UX |
423 | - add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true' ); |
|
424 | - add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false' ); |
|
423 | + add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true'); |
|
424 | + add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false'); |
|
425 | 425 | $this->sold_out_tickets = array(); |
426 | 426 | // and reset the cart |
427 | 427 | EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN); |
428 | 428 | } |
429 | - if ( ! empty( $this->decremented_tickets ) ) { |
|
429 | + if ( ! empty($this->decremented_tickets)) { |
|
430 | 430 | EE_Error::add_attention( |
431 | 431 | sprintf( |
432 | 432 | apply_filters( |
433 | 433 | 'FHEE__EED_Ticket_Sales_Monitor___ticket_quantity_decremented__notice', |
434 | - __( 'We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso' ) |
|
434 | + __('We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso') |
|
435 | 435 | ), |
436 | 436 | '<br />', |
437 | - implode( '<br />', $this->decremented_tickets ), |
|
437 | + implode('<br />', $this->decremented_tickets), |
|
438 | 438 | $none_added_msg, |
439 | 439 | $refresh_msg |
440 | 440 | ) |
@@ -458,27 +458,27 @@ discard block |
||
458 | 458 | * @param EE_Transaction $transaction |
459 | 459 | * @return int |
460 | 460 | */ |
461 | - protected function _release_all_reserved_tickets_for_transaction( EE_Transaction $transaction ) { |
|
462 | - if ( self::debug ) { |
|
463 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
464 | - echo "<br /> . transaction->ID: " . $transaction->ID(); |
|
461 | + protected function _release_all_reserved_tickets_for_transaction(EE_Transaction $transaction) { |
|
462 | + if (self::debug) { |
|
463 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
464 | + echo "<br /> . transaction->ID: ".$transaction->ID(); |
|
465 | 465 | } |
466 | 466 | /** @type EE_Transaction_Processor $transaction_processor */ |
467 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
467 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
468 | 468 | // check if 'finalize_registration' step has been completed... |
469 | - $finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' ); |
|
470 | - if ( self::debug ) { |
|
469 | + $finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration'); |
|
470 | + if (self::debug) { |
|
471 | 471 | // DEBUG LOG |
472 | 472 | EEH_Debug_Tools::log( |
473 | 473 | __CLASS__, __FUNCTION__, __LINE__, |
474 | - array( 'finalized' => $finalized ), |
|
475 | - false, 'EE_Transaction: ' . $transaction->ID() |
|
474 | + array('finalized' => $finalized), |
|
475 | + false, 'EE_Transaction: '.$transaction->ID() |
|
476 | 476 | ); |
477 | 477 | } |
478 | 478 | // how many tickets were released |
479 | 479 | $count = 0; |
480 | - if ( self::debug ) { |
|
481 | - echo "<br /> . . . finalized: " . $finalized; |
|
480 | + if (self::debug) { |
|
481 | + echo "<br /> . . . finalized: ".$finalized; |
|
482 | 482 | } |
483 | 483 | $release_tickets_with_TXN_status = array( |
484 | 484 | EEM_Transaction::failed_status_code, |
@@ -486,13 +486,13 @@ discard block |
||
486 | 486 | EEM_Transaction::incomplete_status_code, |
487 | 487 | ); |
488 | 488 | // if the session is getting cleared BEFORE the TXN has been finalized |
489 | - if ( ! $finalized || in_array( $transaction->status_ID(), $release_tickets_with_TXN_status ) ) { |
|
489 | + if ( ! $finalized || in_array($transaction->status_ID(), $release_tickets_with_TXN_status)) { |
|
490 | 490 | // let's cancel any reserved tickets |
491 | 491 | $registrations = $transaction->registrations(); |
492 | - if ( ! empty( $registrations ) ) { |
|
493 | - foreach ( $registrations as $registration ) { |
|
494 | - if ( $registration instanceof EE_Registration ) { |
|
495 | - $count += $this->_release_reserved_ticket_for_registration( $registration, $transaction ); |
|
492 | + if ( ! empty($registrations)) { |
|
493 | + foreach ($registrations as $registration) { |
|
494 | + if ($registration instanceof EE_Registration) { |
|
495 | + $count += $this->_release_reserved_ticket_for_registration($registration, $transaction); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | } |
@@ -513,12 +513,12 @@ discard block |
||
513 | 513 | * @return int |
514 | 514 | * @throws \EE_Error |
515 | 515 | */ |
516 | - protected function _release_reserved_ticket_for_registration( EE_Registration $registration, EE_Transaction $transaction ) { |
|
517 | - if ( self::debug ) { |
|
518 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
519 | - echo "<br /> . . registration->ID: " . $registration->ID(); |
|
520 | - echo "<br /> . . registration->status_ID: " . $registration->status_ID(); |
|
521 | - echo "<br /> . . transaction->status_ID(): " . $transaction->status_ID(); |
|
516 | + protected function _release_reserved_ticket_for_registration(EE_Registration $registration, EE_Transaction $transaction) { |
|
517 | + if (self::debug) { |
|
518 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
519 | + echo "<br /> . . registration->ID: ".$registration->ID(); |
|
520 | + echo "<br /> . . registration->status_ID: ".$registration->status_ID(); |
|
521 | + echo "<br /> . . transaction->status_ID(): ".$transaction->status_ID(); |
|
522 | 522 | } |
523 | 523 | if ( |
524 | 524 | // release Tickets for Failed Transactions and Abandoned Transactions |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | ) |
532 | 532 | ) { |
533 | 533 | $ticket = $registration->ticket(); |
534 | - if ( $ticket instanceof EE_Ticket ) { |
|
535 | - return $this->_release_reserved_ticket( $ticket ); |
|
534 | + if ($ticket instanceof EE_Ticket) { |
|
535 | + return $this->_release_reserved_ticket($ticket); |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | return 0; |
@@ -552,20 +552,20 @@ discard block |
||
552 | 552 | * @param EE_Session $session |
553 | 553 | * @return void |
554 | 554 | */ |
555 | - public static function session_cart_reset( EE_Session $session ) { |
|
556 | - if ( self::debug ) { |
|
557 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
555 | + public static function session_cart_reset(EE_Session $session) { |
|
556 | + if (self::debug) { |
|
557 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
558 | 558 | } |
559 | 559 | $cart = $session->cart(); |
560 | - if ( $cart instanceof EE_Cart ) { |
|
561 | - if ( self::debug ) { |
|
560 | + if ($cart instanceof EE_Cart) { |
|
561 | + if (self::debug) { |
|
562 | 562 | echo "<br /><br /> cart instanceof EE_Cart: "; |
563 | 563 | } |
564 | - EED_Ticket_Sales_Monitor::instance()->_session_cart_reset( $cart ); |
|
564 | + EED_Ticket_Sales_Monitor::instance()->_session_cart_reset($cart); |
|
565 | 565 | } else { |
566 | - if ( self::debug ) { |
|
566 | + if (self::debug) { |
|
567 | 567 | echo "<br /><br /> invalid EE_Cart: "; |
568 | - var_dump( $cart ); |
|
568 | + var_dump($cart); |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | } |
@@ -580,30 +580,30 @@ discard block |
||
580 | 580 | * @param EE_Cart $cart |
581 | 581 | * @return void |
582 | 582 | */ |
583 | - protected function _session_cart_reset( EE_Cart $cart ) { |
|
584 | - if ( self::debug ) { |
|
585 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
583 | + protected function _session_cart_reset(EE_Cart $cart) { |
|
584 | + if (self::debug) { |
|
585 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
586 | 586 | } |
587 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
587 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
588 | 588 | $ticket_line_items = $cart->get_tickets(); |
589 | - if ( empty( $ticket_line_items ) ) { |
|
589 | + if (empty($ticket_line_items)) { |
|
590 | 590 | return; |
591 | 591 | } |
592 | - foreach ( $ticket_line_items as $ticket_line_item ) { |
|
593 | - if ( self::debug ) { |
|
594 | - echo "<br /> . ticket_line_item->ID(): " . $ticket_line_item->ID(); |
|
592 | + foreach ($ticket_line_items as $ticket_line_item) { |
|
593 | + if (self::debug) { |
|
594 | + echo "<br /> . ticket_line_item->ID(): ".$ticket_line_item->ID(); |
|
595 | 595 | } |
596 | - if ( $ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket' ) { |
|
597 | - if ( self::debug ) { |
|
598 | - echo "<br /> . . ticket_line_item->OBJ_ID(): " . $ticket_line_item->OBJ_ID(); |
|
596 | + if ($ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket') { |
|
597 | + if (self::debug) { |
|
598 | + echo "<br /> . . ticket_line_item->OBJ_ID(): ".$ticket_line_item->OBJ_ID(); |
|
599 | 599 | } |
600 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( $ticket_line_item->OBJ_ID() ); |
|
601 | - if ( $ticket instanceof EE_Ticket ) { |
|
602 | - if ( self::debug ) { |
|
603 | - echo "<br /> . . ticket->ID(): " . $ticket->ID(); |
|
604 | - echo "<br /> . . ticket_line_item->quantity(): " . $ticket_line_item->quantity(); |
|
600 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($ticket_line_item->OBJ_ID()); |
|
601 | + if ($ticket instanceof EE_Ticket) { |
|
602 | + if (self::debug) { |
|
603 | + echo "<br /> . . ticket->ID(): ".$ticket->ID(); |
|
604 | + echo "<br /> . . ticket_line_item->quantity(): ".$ticket_line_item->quantity(); |
|
605 | 605 | } |
606 | - $this->_release_reserved_ticket( $ticket, $ticket_line_item->quantity() ); |
|
606 | + $this->_release_reserved_ticket($ticket, $ticket_line_item->quantity()); |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | } |
@@ -627,10 +627,10 @@ discard block |
||
627 | 627 | * @param EE_Session $session |
628 | 628 | * @return void |
629 | 629 | */ |
630 | - public static function session_checkout_reset( EE_Session $session ) { |
|
630 | + public static function session_checkout_reset(EE_Session $session) { |
|
631 | 631 | $checkout = $session->checkout(); |
632 | - if ( $checkout instanceof EE_Checkout ) { |
|
633 | - EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset( $checkout ); |
|
632 | + if ($checkout instanceof EE_Checkout) { |
|
633 | + EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset($checkout); |
|
634 | 634 | } |
635 | 635 | } |
636 | 636 | |
@@ -644,15 +644,15 @@ discard block |
||
644 | 644 | * @param EE_Checkout $checkout |
645 | 645 | * @return void |
646 | 646 | */ |
647 | - protected function _session_checkout_reset( EE_Checkout $checkout ) { |
|
648 | - if ( self::debug ) { |
|
649 | - echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() "; |
|
647 | + protected function _session_checkout_reset(EE_Checkout $checkout) { |
|
648 | + if (self::debug) { |
|
649 | + echo "<br /><br /> ".__LINE__.") ".__METHOD__."() "; |
|
650 | 650 | } |
651 | 651 | // we want to release the each registration's reserved tickets if the session was cleared, but not if this is a revisit |
652 | - if ( $checkout->revisit || ! $checkout->transaction instanceof EE_Transaction ) { |
|
652 | + if ($checkout->revisit || ! $checkout->transaction instanceof EE_Transaction) { |
|
653 | 653 | return; |
654 | 654 | } |
655 | - $this->_release_all_reserved_tickets_for_transaction( $checkout->transaction ); |
|
655 | + $this->_release_all_reserved_tickets_for_transaction($checkout->transaction); |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | * @param EE_Session $session |
669 | 669 | * @return void |
670 | 670 | */ |
671 | - public static function session_expired_reset( EE_Session $session ) { |
|
671 | + public static function session_expired_reset(EE_Session $session) { |
|
672 | 672 | |
673 | 673 | } |
674 | 674 | |
@@ -687,30 +687,30 @@ discard block |
||
687 | 687 | * @param EE_Transaction $transaction |
688 | 688 | * @return void |
689 | 689 | */ |
690 | - public static function process_abandoned_transactions( EE_Transaction $transaction ) { |
|
690 | + public static function process_abandoned_transactions(EE_Transaction $transaction) { |
|
691 | 691 | // is this TXN free or has any money been paid towards this TXN? If so, then leave it alone |
692 | - if ( $transaction->is_free() || $transaction->paid() > 0 ) { |
|
693 | - if ( self::debug ) { |
|
692 | + if ($transaction->is_free() || $transaction->paid() > 0) { |
|
693 | + if (self::debug) { |
|
694 | 694 | // DEBUG LOG |
695 | 695 | EEH_Debug_Tools::log( |
696 | 696 | __CLASS__, __FUNCTION__, __LINE__, |
697 | - array( $transaction ), |
|
698 | - false, 'EE_Transaction: ' . $transaction->ID() |
|
697 | + array($transaction), |
|
698 | + false, 'EE_Transaction: '.$transaction->ID() |
|
699 | 699 | ); |
700 | 700 | } |
701 | 701 | return; |
702 | 702 | } |
703 | 703 | // have their been any successful payments made ? |
704 | 704 | $payments = $transaction->payments(); |
705 | - foreach ( $payments as $payment ) { |
|
706 | - if ( $payment instanceof EE_Payment ) { |
|
707 | - if ( $payment->status() === EEM_Payment::status_id_approved ) { |
|
708 | - if ( self::debug ) { |
|
705 | + foreach ($payments as $payment) { |
|
706 | + if ($payment instanceof EE_Payment) { |
|
707 | + if ($payment->status() === EEM_Payment::status_id_approved) { |
|
708 | + if (self::debug) { |
|
709 | 709 | // DEBUG LOG |
710 | 710 | EEH_Debug_Tools::log( |
711 | 711 | __CLASS__, __FUNCTION__, __LINE__, |
712 | - array( $payment ), |
|
713 | - false, 'EE_Transaction: ' . $transaction->ID() |
|
712 | + array($payment), |
|
713 | + false, 'EE_Transaction: '.$transaction->ID() |
|
714 | 714 | ); |
715 | 715 | } |
716 | 716 | return; |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | } |
719 | 719 | } |
720 | 720 | // since you haven't even attempted to pay for your ticket... |
721 | - EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction ); |
|
721 | + EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
@@ -735,9 +735,9 @@ discard block |
||
735 | 735 | * @param EE_Transaction $transaction |
736 | 736 | * @return void |
737 | 737 | */ |
738 | - public static function process_failed_transactions( EE_Transaction $transaction ) { |
|
738 | + public static function process_failed_transactions(EE_Transaction $transaction) { |
|
739 | 739 | // since you haven't even attempted to pay for your ticket... |
740 | - EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction ); |
|
740 | + EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\exceptions\UnexpectedEntityException; |
2 | 2 | |
3 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | /** |
7 | 7 | * Event Espresso |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * date_format and the second value is the time format |
69 | 69 | * @return EE_Ticket |
70 | 70 | */ |
71 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
72 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
73 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
71 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
72 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
73 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * the website will be used. |
82 | 82 | * @return EE_Ticket |
83 | 83 | */ |
84 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
85 | - return new self( $props_n_values, TRUE, $timezone ); |
|
84 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
85 | + return new self($props_n_values, TRUE, $timezone); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return bool |
92 | 92 | */ |
93 | 93 | public function parent() { |
94 | - return $this->get( 'TKT_parent' ); |
|
94 | + return $this->get('TKT_parent'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | * @param int $DTT_ID the primary key for a particular datetime |
102 | 102 | * @return boolean |
103 | 103 | */ |
104 | - public function available( $DTT_ID = 0 ) { |
|
104 | + public function available($DTT_ID = 0) { |
|
105 | 105 | // are we checking availability for a particular datetime ? |
106 | - if ( $DTT_ID ) { |
|
106 | + if ($DTT_ID) { |
|
107 | 107 | // get that datetime object |
108 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
108 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
109 | 109 | // if ticket sales for this datetime have exceeded the reg limit... |
110 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
110 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
111 | 111 | return FALSE; |
112 | 112 | } |
113 | 113 | } |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save further processing |
124 | 124 | * @return mixed status int if the display string isn't requested |
125 | 125 | */ |
126 | - public function ticket_status( $display = FALSE, $remaining = null ) { |
|
127 | - $remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining(); |
|
128 | - if ( ! $remaining ) { |
|
129 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
126 | + public function ticket_status($display = FALSE, $remaining = null) { |
|
127 | + $remaining = is_bool($remaining) ? $remaining : $this->is_remaining(); |
|
128 | + if ( ! $remaining) { |
|
129 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
130 | 130 | } |
131 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
132 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
131 | + if ($this->get('TKT_deleted')) { |
|
132 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
133 | 133 | } |
134 | - if ( $this->is_expired() ) { |
|
135 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
134 | + if ($this->is_expired()) { |
|
135 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
136 | 136 | } |
137 | - if ( $this->is_pending() ) { |
|
138 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
137 | + if ($this->is_pending()) { |
|
138 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
139 | 139 | } |
140 | - if ( $this->is_on_sale() ) { |
|
141 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
140 | + if ($this->is_on_sale()) { |
|
141 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
142 | 142 | } |
143 | 143 | return ''; |
144 | 144 | } |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
153 | 153 | * @return boolean true = tickets remaining, false not. |
154 | 154 | */ |
155 | - public function is_remaining( $DTT_ID = 0 ) { |
|
156 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
157 | - if ( $num_remaining === 0 ) { |
|
155 | + public function is_remaining($DTT_ID = 0) { |
|
156 | + $num_remaining = $this->remaining($DTT_ID); |
|
157 | + if ($num_remaining === 0) { |
|
158 | 158 | return FALSE; |
159 | 159 | } |
160 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
160 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
161 | 161 | return FALSE; |
162 | 162 | } |
163 | 163 | return TRUE; |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * set to 0 for all related datetimes |
173 | 173 | * @return int |
174 | 174 | */ |
175 | - public function remaining( $DTT_ID = 0 ) { |
|
176 | - return $this->real_quantity_on_ticket('saleable', $DTT_ID ); |
|
175 | + public function remaining($DTT_ID = 0) { |
|
176 | + return $this->real_quantity_on_ticket('saleable', $DTT_ID); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return int |
184 | 184 | */ |
185 | 185 | function min() { |
186 | - return $this->get( 'TKT_min' ); |
|
186 | + return $this->get('TKT_min'); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @return boolean |
194 | 194 | */ |
195 | 195 | public function is_expired() { |
196 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
196 | + return ($this->get_raw('TKT_end_date') < time()); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return boolean |
204 | 204 | */ |
205 | 205 | public function is_pending() { |
206 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
206 | + return ($this->get_raw('TKT_start_date') > time()); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @return boolean |
214 | 214 | */ |
215 | 215 | public function is_on_sale() { |
216 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
216 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | * @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 |
225 | 225 | * @return array |
226 | 226 | */ |
227 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
228 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
229 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
227 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
228 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
229 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
230 | 230 | |
231 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
231 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * @return EE_Datetime |
239 | 239 | */ |
240 | 240 | public function first_datetime() { |
241 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
242 | - return reset( $datetimes ); |
|
241 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
242 | + return reset($datetimes); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | * @param array $query_params see EEM_Base::get_all() |
251 | 251 | * @return EE_Datetime[] |
252 | 252 | */ |
253 | - public function datetimes( $query_params = array() ) { |
|
254 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
255 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
253 | + public function datetimes($query_params = array()) { |
|
254 | + if ( ! isset($query_params['order_by'])) { |
|
255 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
256 | 256 | } |
257 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
257 | + return $this->get_many_related('Datetime', $query_params); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | * @return EE_Datetime |
265 | 265 | */ |
266 | 266 | public function last_datetime() { |
267 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
268 | - return end( $datetimes ); |
|
267 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
268 | + return end($datetimes); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -279,22 +279,22 @@ discard block |
||
279 | 279 | * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
280 | 280 | * @return mixed (array|int) how many tickets have sold |
281 | 281 | */ |
282 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
282 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
283 | 283 | $total = 0; |
284 | 284 | $tickets_sold = $this->_all_tickets_sold(); |
285 | - switch ( $what ) { |
|
285 | + switch ($what) { |
|
286 | 286 | case 'ticket' : |
287 | - return $tickets_sold[ 'ticket' ]; |
|
287 | + return $tickets_sold['ticket']; |
|
288 | 288 | break; |
289 | 289 | case 'datetime' : |
290 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
290 | + if (empty($tickets_sold['datetime'])) { |
|
291 | 291 | return $total; |
292 | 292 | } |
293 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
294 | - 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__ ); |
|
293 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
294 | + 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__); |
|
295 | 295 | return $total; |
296 | 296 | } |
297 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
297 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
298 | 298 | break; |
299 | 299 | default: |
300 | 300 | return $total; |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | * @return EE_Ticket[] |
309 | 309 | */ |
310 | 310 | protected function _all_tickets_sold() { |
311 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
311 | + $datetimes = $this->get_many_related('Datetime'); |
|
312 | 312 | $tickets_sold = array(); |
313 | - if ( ! empty( $datetimes ) ) { |
|
314 | - foreach ( $datetimes as $datetime ) { |
|
315 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
313 | + if ( ! empty($datetimes)) { |
|
314 | + foreach ($datetimes as $datetime) { |
|
315 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | //Tickets sold |
319 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
319 | + $tickets_sold['ticket'] = $this->sold(); |
|
320 | 320 | return $tickets_sold; |
321 | 321 | } |
322 | 322 | |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | * @param bool $return_array whether to return as an array indexed by price id or just the object. |
330 | 330 | * @return EE_Price |
331 | 331 | */ |
332 | - public function base_price( $return_array = FALSE ) { |
|
333 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
334 | - return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) ); |
|
332 | + public function base_price($return_array = FALSE) { |
|
333 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
334 | + return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where)); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @return EE_Price[] |
344 | 344 | */ |
345 | 345 | public function price_modifiers() { |
346 | - $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 ) ) ) ); |
|
347 | - return $this->prices( $query_params ); |
|
346 | + $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)))); |
|
347 | + return $this->prices($query_params); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param array $query_params like EEM_Base::get_all |
355 | 355 | * @return EE_Price[] |
356 | 356 | */ |
357 | - public function prices( $query_params = array() ) { |
|
358 | - return $this->get_many_related( 'Price', $query_params ); |
|
357 | + public function prices($query_params = array()) { |
|
358 | + return $this->get_many_related('Price', $query_params); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @param array $query_params see EEM_Base::get_all() |
366 | 366 | * @return EE_Datetime_Ticket |
367 | 367 | */ |
368 | - public function datetime_tickets( $query_params = array() ) { |
|
369 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
368 | + public function datetime_tickets($query_params = array()) { |
|
369 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | * @param boolean $show_deleted |
378 | 378 | * @return EE_Datetime[] |
379 | 379 | */ |
380 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
381 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
380 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
381 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * @return string |
389 | 389 | */ |
390 | 390 | function ID() { |
391 | - return $this->get( 'TKT_ID' ); |
|
391 | + return $this->get('TKT_ID'); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return EE_Ticket_Template |
413 | 413 | */ |
414 | 414 | public function template() { |
415 | - return $this->get_first_related( 'Ticket_Template' ); |
|
415 | + return $this->get_first_related('Ticket_Template'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @return bool |
432 | 432 | */ |
433 | 433 | public function ticket_price() { |
434 | - return $this->get( 'TKT_price' ); |
|
434 | + return $this->get('TKT_price'); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @return mixed |
441 | 441 | */ |
442 | 442 | public function pretty_price() { |
443 | - return $this->get_pretty( 'TKT_price' ); |
|
443 | + return $this->get_pretty('TKT_price'); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | |
@@ -459,17 +459,17 @@ discard block |
||
459 | 459 | * @param bool $no_cache |
460 | 460 | * @return float |
461 | 461 | */ |
462 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
463 | - if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) { |
|
462 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
463 | + if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) { |
|
464 | 464 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
465 | 465 | } |
466 | - return (float)$this->_ticket_total_with_taxes; |
|
466 | + return (float) $this->_ticket_total_with_taxes; |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
470 | 470 | |
471 | 471 | public function ensure_TKT_Price_correct() { |
472 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
472 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
473 | 473 | $this->save(); |
474 | 474 | } |
475 | 475 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @return float |
480 | 480 | */ |
481 | 481 | public function get_ticket_subtotal() { |
482 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
482 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | * @return float |
490 | 490 | */ |
491 | 491 | public function get_ticket_taxes_total_for_admin() { |
492 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
492 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | * @param string $name |
500 | 500 | * @return boolean |
501 | 501 | */ |
502 | - function set_name( $name ) { |
|
503 | - $this->set( 'TKT_name', $name ); |
|
502 | + function set_name($name) { |
|
503 | + $this->set('TKT_name', $name); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | * @return string |
511 | 511 | */ |
512 | 512 | function description() { |
513 | - return $this->get( 'TKT_description' ); |
|
513 | + return $this->get('TKT_description'); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | * @param string $description |
521 | 521 | * @return boolean |
522 | 522 | */ |
523 | - function set_description( $description ) { |
|
524 | - $this->set( 'TKT_description', $description ); |
|
523 | + function set_description($description) { |
|
524 | + $this->set('TKT_description', $description); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | * @param string $tm_frmt |
533 | 533 | * @return string |
534 | 534 | */ |
535 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
536 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
535 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
536 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | * @param string $start_date |
544 | 544 | * @return void |
545 | 545 | */ |
546 | - function set_start_date( $start_date ) { |
|
547 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
546 | + function set_start_date($start_date) { |
|
547 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -555,8 +555,8 @@ discard block |
||
555 | 555 | * @param string $tm_frmt |
556 | 556 | * @return string |
557 | 557 | */ |
558 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
559 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
558 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
559 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | * @param string $end_date |
567 | 567 | * @return void |
568 | 568 | */ |
569 | - function set_end_date( $end_date ) { |
|
570 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
569 | + function set_end_date($end_date) { |
|
570 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | |
@@ -579,8 +579,8 @@ discard block |
||
579 | 579 | * |
580 | 580 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
581 | 581 | */ |
582 | - function set_end_time( $time ) { |
|
583 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
582 | + function set_end_time($time) { |
|
583 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | |
@@ -590,8 +590,8 @@ discard block |
||
590 | 590 | * @param int $min |
591 | 591 | * @return boolean |
592 | 592 | */ |
593 | - function set_min( $min ) { |
|
594 | - $this->set( 'TKT_min', $min ); |
|
593 | + function set_min($min) { |
|
594 | + $this->set('TKT_min', $min); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | * @return int |
602 | 602 | */ |
603 | 603 | function max() { |
604 | - return $this->get( 'TKT_max' ); |
|
604 | + return $this->get('TKT_max'); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | |
@@ -611,8 +611,8 @@ discard block |
||
611 | 611 | * @param int $max |
612 | 612 | * @return boolean |
613 | 613 | */ |
614 | - function set_max( $max ) { |
|
615 | - $this->set( 'TKT_max', $max ); |
|
614 | + function set_max($max) { |
|
615 | + $this->set('TKT_max', $max); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | * @param float $price |
623 | 623 | * @return boolean |
624 | 624 | */ |
625 | - function set_price( $price ) { |
|
626 | - $this->set( 'TKT_price', $price ); |
|
625 | + function set_price($price) { |
|
626 | + $this->set('TKT_price', $price); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | * @return int |
634 | 634 | */ |
635 | 635 | function sold() { |
636 | - return $this->get_raw( 'TKT_sold' ); |
|
636 | + return $this->get_raw('TKT_sold'); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | |
@@ -643,10 +643,10 @@ discard block |
||
643 | 643 | * @param int $sold |
644 | 644 | * @return boolean |
645 | 645 | */ |
646 | - function set_sold( $sold ) { |
|
646 | + function set_sold($sold) { |
|
647 | 647 | // sold can not go below zero |
648 | - $sold = max( 0, $sold ); |
|
649 | - $this->set( 'TKT_sold', $sold ); |
|
648 | + $sold = max(0, $sold); |
|
649 | + $this->set('TKT_sold', $sold); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -656,13 +656,13 @@ discard block |
||
656 | 656 | * @param int $qty |
657 | 657 | * @return boolean |
658 | 658 | */ |
659 | - function increase_sold( $qty = 1 ) { |
|
659 | + function increase_sold($qty = 1) { |
|
660 | 660 | $sold = $this->sold() + $qty; |
661 | 661 | // remove ticket reservation, but don't adjust datetime reservations, because that will happen |
662 | 662 | // via \EE_Datetime::increase_sold() when \EE_Ticket::_increase_sold_for_datetimes() is called |
663 | - $this->decrease_reserved( $qty, false ); |
|
664 | - $this->_increase_sold_for_datetimes( $qty ); |
|
665 | - return $this->set_sold( $sold ); |
|
663 | + $this->decrease_reserved($qty, false); |
|
664 | + $this->_increase_sold_for_datetimes($qty); |
|
665 | + return $this->set_sold($sold); |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | |
@@ -672,12 +672,12 @@ discard block |
||
672 | 672 | * @param int $qty |
673 | 673 | * @return boolean |
674 | 674 | */ |
675 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
675 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
676 | 676 | $datetimes = $this->datetimes(); |
677 | - if ( is_array( $datetimes ) ) { |
|
678 | - foreach ( $datetimes as $datetime ) { |
|
679 | - if ( $datetime instanceof EE_Datetime ) { |
|
680 | - $datetime->increase_sold( $qty ); |
|
677 | + if (is_array($datetimes)) { |
|
678 | + foreach ($datetimes as $datetime) { |
|
679 | + if ($datetime instanceof EE_Datetime) { |
|
680 | + $datetime->increase_sold($qty); |
|
681 | 681 | $datetime->save(); |
682 | 682 | } |
683 | 683 | } |
@@ -691,10 +691,10 @@ discard block |
||
691 | 691 | * @param int $qty |
692 | 692 | * @return boolean |
693 | 693 | */ |
694 | - function decrease_sold( $qty = 1 ) { |
|
694 | + function decrease_sold($qty = 1) { |
|
695 | 695 | $sold = $this->sold() - $qty; |
696 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
697 | - return $this->set_sold( $sold ); |
|
696 | + $this->_decrease_sold_for_datetimes($qty); |
|
697 | + return $this->set_sold($sold); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | |
@@ -705,12 +705,12 @@ discard block |
||
705 | 705 | * @param int $qty |
706 | 706 | * @return boolean |
707 | 707 | */ |
708 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
708 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
709 | 709 | $datetimes = $this->datetimes(); |
710 | - if ( is_array( $datetimes ) ) { |
|
711 | - foreach ( $datetimes as $datetime ) { |
|
712 | - if ( $datetime instanceof EE_Datetime ) { |
|
713 | - $datetime->decrease_sold( $qty ); |
|
710 | + if (is_array($datetimes)) { |
|
711 | + foreach ($datetimes as $datetime) { |
|
712 | + if ($datetime instanceof EE_Datetime) { |
|
713 | + $datetime->decrease_sold($qty); |
|
714 | 714 | $datetime->save(); |
715 | 715 | } |
716 | 716 | } |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | * @return int |
725 | 725 | */ |
726 | 726 | function reserved() { |
727 | - return $this->get_raw( 'TKT_reserved' ); |
|
727 | + return $this->get_raw('TKT_reserved'); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | |
@@ -734,10 +734,10 @@ discard block |
||
734 | 734 | * @param int $reserved |
735 | 735 | * @return boolean |
736 | 736 | */ |
737 | - function set_reserved( $reserved ) { |
|
737 | + function set_reserved($reserved) { |
|
738 | 738 | // reserved can not go below zero |
739 | - $reserved = max( 0, intval( $reserved ) ); |
|
740 | - $this->set( 'TKT_reserved', $reserved ); |
|
739 | + $reserved = max(0, intval($reserved)); |
|
740 | + $this->set('TKT_reserved', $reserved); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | |
@@ -747,11 +747,11 @@ discard block |
||
747 | 747 | * @param int $qty |
748 | 748 | * @return boolean |
749 | 749 | */ |
750 | - function increase_reserved( $qty = 1 ) { |
|
751 | - $qty = absint( $qty ); |
|
750 | + function increase_reserved($qty = 1) { |
|
751 | + $qty = absint($qty); |
|
752 | 752 | $reserved = $this->reserved() + $qty; |
753 | - $this->_increase_reserved_for_datetimes( $qty ); |
|
754 | - return $this->set_reserved( $reserved ); |
|
753 | + $this->_increase_reserved_for_datetimes($qty); |
|
754 | + return $this->set_reserved($reserved); |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | |
@@ -762,12 +762,12 @@ discard block |
||
762 | 762 | * @param int $qty |
763 | 763 | * @return boolean |
764 | 764 | */ |
765 | - protected function _increase_reserved_for_datetimes( $qty = 1 ) { |
|
765 | + protected function _increase_reserved_for_datetimes($qty = 1) { |
|
766 | 766 | $datetimes = $this->datetimes(); |
767 | - if ( is_array( $datetimes ) ) { |
|
768 | - foreach ( $datetimes as $datetime ) { |
|
769 | - if ( $datetime instanceof EE_Datetime ) { |
|
770 | - $datetime->increase_reserved( $qty ); |
|
767 | + if (is_array($datetimes)) { |
|
768 | + foreach ($datetimes as $datetime) { |
|
769 | + if ($datetime instanceof EE_Datetime) { |
|
770 | + $datetime->increase_reserved($qty); |
|
771 | 771 | $datetime->save(); |
772 | 772 | } |
773 | 773 | } |
@@ -783,12 +783,12 @@ discard block |
||
783 | 783 | * @param bool $adjust_datetimes |
784 | 784 | * @return bool |
785 | 785 | */ |
786 | - function decrease_reserved( $qty = 1, $adjust_datetimes = true ) { |
|
787 | - $reserved = $this->reserved() - absint( $qty ); |
|
788 | - if ( $adjust_datetimes ) { |
|
789 | - $this->_decrease_reserved_for_datetimes( $qty ); |
|
786 | + function decrease_reserved($qty = 1, $adjust_datetimes = true) { |
|
787 | + $reserved = $this->reserved() - absint($qty); |
|
788 | + if ($adjust_datetimes) { |
|
789 | + $this->_decrease_reserved_for_datetimes($qty); |
|
790 | 790 | } |
791 | - return $this->set_reserved( $reserved ); |
|
791 | + return $this->set_reserved($reserved); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -799,12 +799,12 @@ discard block |
||
799 | 799 | * @param int $qty |
800 | 800 | * @return boolean |
801 | 801 | */ |
802 | - protected function _decrease_reserved_for_datetimes( $qty = 1 ) { |
|
802 | + protected function _decrease_reserved_for_datetimes($qty = 1) { |
|
803 | 803 | $datetimes = $this->datetimes(); |
804 | - if ( is_array( $datetimes ) ) { |
|
805 | - foreach ( $datetimes as $datetime ) { |
|
806 | - if ( $datetime instanceof EE_Datetime ) { |
|
807 | - $datetime->decrease_reserved( $qty ); |
|
804 | + if (is_array($datetimes)) { |
|
805 | + foreach ($datetimes as $datetime) { |
|
806 | + if ($datetime instanceof EE_Datetime) { |
|
807 | + $datetime->decrease_reserved($qty); |
|
808 | 808 | $datetime->save(); |
809 | 809 | } |
810 | 810 | } |
@@ -825,14 +825,14 @@ discard block |
||
825 | 825 | * |
826 | 826 | * @return int |
827 | 827 | */ |
828 | - function qty( $context = '' ) { |
|
829 | - switch ( $context ) { |
|
828 | + function qty($context = '') { |
|
829 | + switch ($context) { |
|
830 | 830 | case 'reg_limit' : |
831 | 831 | return $this->real_quantity_on_ticket(); |
832 | 832 | case 'saleable' : |
833 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
833 | + return $this->real_quantity_on_ticket('saleable'); |
|
834 | 834 | default: |
835 | - return $this->get_raw( 'TKT_qty' ); |
|
835 | + return $this->get_raw('TKT_qty'); |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | |
@@ -851,15 +851,15 @@ discard block |
||
851 | 851 | * |
852 | 852 | * @return int |
853 | 853 | */ |
854 | - function real_quantity_on_ticket( $context = 'reg_limit', $DTT_ID = 0 ) { |
|
855 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
854 | + function real_quantity_on_ticket($context = 'reg_limit', $DTT_ID = 0) { |
|
855 | + $raw = $this->get_raw('TKT_qty'); |
|
856 | 856 | // return immediately if it's zero |
857 | - if ( $raw === 0 ) { |
|
857 | + if ($raw === 0) { |
|
858 | 858 | return $raw; |
859 | 859 | } |
860 | 860 | //echo "\n\n<br />Ticket: " . $this->name() . '<br />'; |
861 | 861 | // ensure qty doesn't exceed raw value for THIS ticket |
862 | - $qty = min( EE_INF, $raw ); |
|
862 | + $qty = min(EE_INF, $raw); |
|
863 | 863 | //echo "\n . qty: " . $qty . '<br />'; |
864 | 864 | // calculate this ticket's total sales and reservations |
865 | 865 | $sold_and_reserved_for_this_ticket = $this->sold() + $this->reserved(); |
@@ -868,23 +868,23 @@ discard block |
||
868 | 868 | //echo "\n . sold_and_reserved_for_this_ticket: " . $sold_and_reserved_for_this_ticket . '<br />'; |
869 | 869 | // first we need to calculate the maximum number of tickets available for the datetime |
870 | 870 | // do we want data for one datetime or all of them ? |
871 | - $query_params = $DTT_ID ? array( array( 'DTT_ID' => $DTT_ID ) ) : array(); |
|
872 | - $datetimes = $this->datetimes( $query_params ); |
|
873 | - if ( is_array( $datetimes ) && ! empty( $datetimes ) ) { |
|
874 | - foreach ( $datetimes as $datetime ) { |
|
875 | - if ( $datetime instanceof EE_Datetime ) { |
|
871 | + $query_params = $DTT_ID ? array(array('DTT_ID' => $DTT_ID)) : array(); |
|
872 | + $datetimes = $this->datetimes($query_params); |
|
873 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
874 | + foreach ($datetimes as $datetime) { |
|
875 | + if ($datetime instanceof EE_Datetime) { |
|
876 | 876 | $datetime->refresh_from_db(); |
877 | 877 | //echo "\n . . datetime name: " . $datetime->name() . '<br />'; |
878 | 878 | //echo "\n . . datetime ID: " . $datetime->ID() . '<br />'; |
879 | 879 | // initialize with no restrictions for each datetime |
880 | 880 | // but adjust datetime qty based on datetime reg limit |
881 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
881 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
882 | 882 | //echo "\n . . . datetime reg_limit: " . $datetime->reg_limit() . '<br />'; |
883 | 883 | //echo "\n . . . datetime_qty: " . $datetime_qty . '<br />'; |
884 | 884 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
885 | 885 | // and reservations for this datetime, that do NOT include sales and reservations |
886 | 886 | // for this ticket (so we add $this->sold() and $this->reserved() back in) |
887 | - if ( $context == 'saleable' ) { |
|
887 | + if ($context == 'saleable') { |
|
888 | 888 | $datetime_qty = max( |
889 | 889 | $datetime_qty - $datetime->sold_and_reserved() + $sold_and_reserved_for_this_ticket, |
890 | 890 | 0 |
@@ -896,16 +896,16 @@ discard block |
||
896 | 896 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
897 | 897 | //echo "\n . . . datetime_qty: " . $datetime_qty . '<br />'; |
898 | 898 | } |
899 | - $qty = min( $datetime_qty, $qty ); |
|
899 | + $qty = min($datetime_qty, $qty); |
|
900 | 900 | //echo "\n . . qty: " . $qty . '<br />'; |
901 | 901 | } |
902 | 902 | } |
903 | 903 | } |
904 | 904 | // NOW that we know the maximum number of tickets available for the datetime |
905 | 905 | // we can finally factor in the details for this specific ticket |
906 | - if ( $qty > 0 && $context == 'saleable' ) { |
|
906 | + if ($qty > 0 && $context == 'saleable') { |
|
907 | 907 | // and subtract the sales for THIS ticket |
908 | - $qty = max( $qty - $sold_and_reserved_for_this_ticket, 0 ); |
|
908 | + $qty = max($qty - $sold_and_reserved_for_this_ticket, 0); |
|
909 | 909 | //echo "\n . qty: " . $qty . '<br />'; |
910 | 910 | } |
911 | 911 | //echo "\nFINAL QTY: " . $qty . "<br /><br />"; |
@@ -921,14 +921,14 @@ discard block |
||
921 | 921 | * @return bool |
922 | 922 | * @throws \EE_Error |
923 | 923 | */ |
924 | - function set_qty( $qty ) { |
|
924 | + function set_qty($qty) { |
|
925 | 925 | $datetimes = $this->datetimes(); |
926 | - foreach ( $datetimes as $datetime ) { |
|
927 | - if ( $datetime instanceof EE_Datetime ) { |
|
928 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
926 | + foreach ($datetimes as $datetime) { |
|
927 | + if ($datetime instanceof EE_Datetime) { |
|
928 | + $qty = min($qty, $datetime->reg_limit()); |
|
929 | 929 | } |
930 | 930 | } |
931 | - $this->set( 'TKT_qty', $qty ); |
|
931 | + $this->set('TKT_qty', $qty); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | * @return int |
939 | 939 | */ |
940 | 940 | function uses() { |
941 | - return $this->get( 'TKT_uses' ); |
|
941 | + return $this->get('TKT_uses'); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | |
@@ -948,8 +948,8 @@ discard block |
||
948 | 948 | * @param int $uses |
949 | 949 | * @return boolean |
950 | 950 | */ |
951 | - function set_uses( $uses ) { |
|
952 | - $this->set( 'TKT_uses', $uses ); |
|
951 | + function set_uses($uses) { |
|
952 | + $this->set('TKT_uses', $uses); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | * @return boolean |
960 | 960 | */ |
961 | 961 | public function required() { |
962 | - return $this->get( 'TKT_required' ); |
|
962 | + return $this->get('TKT_required'); |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | * @param boolean $required |
970 | 970 | * @return boolean |
971 | 971 | */ |
972 | - public function set_required( $required ) { |
|
973 | - $this->set( 'TKT_required', $required ); |
|
972 | + public function set_required($required) { |
|
973 | + $this->set('TKT_required', $required); |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | * @return boolean |
981 | 981 | */ |
982 | 982 | function taxable() { |
983 | - return $this->get( 'TKT_taxable' ); |
|
983 | + return $this->get('TKT_taxable'); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | |
@@ -990,8 +990,8 @@ discard block |
||
990 | 990 | * @param boolean $taxable |
991 | 991 | * @return boolean |
992 | 992 | */ |
993 | - function set_taxable( $taxable ) { |
|
994 | - $this->set( 'TKT_taxable', $taxable ); |
|
993 | + function set_taxable($taxable) { |
|
994 | + $this->set('TKT_taxable', $taxable); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | * @return boolean |
1002 | 1002 | */ |
1003 | 1003 | function is_default() { |
1004 | - return $this->get( 'TKT_is_default' ); |
|
1004 | + return $this->get('TKT_is_default'); |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | |
@@ -1011,8 +1011,8 @@ discard block |
||
1011 | 1011 | * @param boolean $is_default |
1012 | 1012 | * @return boolean |
1013 | 1013 | */ |
1014 | - function set_is_default( $is_default ) { |
|
1015 | - $this->set( 'TKT_is_default', $is_default ); |
|
1014 | + function set_is_default($is_default) { |
|
1015 | + $this->set('TKT_is_default', $is_default); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | * @return int |
1023 | 1023 | */ |
1024 | 1024 | function order() { |
1025 | - return $this->get( 'TKT_order' ); |
|
1025 | + return $this->get('TKT_order'); |
|
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | |
@@ -1032,8 +1032,8 @@ discard block |
||
1032 | 1032 | * @param int $order |
1033 | 1033 | * @return boolean |
1034 | 1034 | */ |
1035 | - function set_order( $order ) { |
|
1036 | - $this->set( 'TKT_order', $order ); |
|
1035 | + function set_order($order) { |
|
1036 | + $this->set('TKT_order', $order); |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | * @return int |
1044 | 1044 | */ |
1045 | 1045 | function row() { |
1046 | - return $this->get( 'TKT_row' ); |
|
1046 | + return $this->get('TKT_row'); |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | |
@@ -1053,8 +1053,8 @@ discard block |
||
1053 | 1053 | * @param int $row |
1054 | 1054 | * @return boolean |
1055 | 1055 | */ |
1056 | - function set_row( $row ) { |
|
1057 | - $this->set( 'TKT_row', $row ); |
|
1056 | + function set_row($row) { |
|
1057 | + $this->set('TKT_row', $row); |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | * @return boolean |
1065 | 1065 | */ |
1066 | 1066 | function deleted() { |
1067 | - return $this->get( 'TKT_deleted' ); |
|
1067 | + return $this->get('TKT_deleted'); |
|
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | |
@@ -1074,8 +1074,8 @@ discard block |
||
1074 | 1074 | * @param boolean $deleted |
1075 | 1075 | * @return boolean |
1076 | 1076 | */ |
1077 | - function set_deleted( $deleted ) { |
|
1078 | - $this->set( 'TKT_deleted', $deleted ); |
|
1077 | + function set_deleted($deleted) { |
|
1078 | + $this->set('TKT_deleted', $deleted); |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | * @return int |
1086 | 1086 | */ |
1087 | 1087 | function parent_ID() { |
1088 | - return $this->get( 'TKT_parent' ); |
|
1088 | + return $this->get('TKT_parent'); |
|
1089 | 1089 | } |
1090 | 1090 | |
1091 | 1091 | |
@@ -1095,8 +1095,8 @@ discard block |
||
1095 | 1095 | * @param int $parent |
1096 | 1096 | * @return boolean |
1097 | 1097 | */ |
1098 | - function set_parent_ID( $parent ) { |
|
1099 | - $this->set( 'TKT_parent', $parent ); |
|
1098 | + function set_parent_ID($parent) { |
|
1099 | + $this->set('TKT_parent', $parent); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | |
@@ -1107,10 +1107,10 @@ discard block |
||
1107 | 1107 | */ |
1108 | 1108 | function name_and_info() { |
1109 | 1109 | $times = array(); |
1110 | - foreach ( $this->datetimes() as $datetime ) { |
|
1110 | + foreach ($this->datetimes() as $datetime) { |
|
1111 | 1111 | $times[] = $datetime->start_date_and_time(); |
1112 | 1112 | } |
1113 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->pretty_price(); |
|
1113 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->pretty_price(); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | * @return string |
1121 | 1121 | */ |
1122 | 1122 | function name() { |
1123 | - return $this->get( 'TKT_name' ); |
|
1123 | + return $this->get('TKT_name'); |
|
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | * @return float |
1131 | 1131 | */ |
1132 | 1132 | function price() { |
1133 | - return $this->get( 'TKT_price' ); |
|
1133 | + return $this->get('TKT_price'); |
|
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | |
@@ -1140,8 +1140,8 @@ discard block |
||
1140 | 1140 | * @param array $query_params like EEM_Base::get_all's |
1141 | 1141 | * @return EE_Registration[] |
1142 | 1142 | */ |
1143 | - public function registrations( $query_params = array() ) { |
|
1144 | - return $this->get_many_related( 'Registration', $query_params ); |
|
1143 | + public function registrations($query_params = array()) { |
|
1144 | + return $this->get_many_related('Registration', $query_params); |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | |
@@ -1152,8 +1152,8 @@ discard block |
||
1152 | 1152 | * @return int |
1153 | 1153 | */ |
1154 | 1154 | public function update_tickets_sold() { |
1155 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
1156 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
1155 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
1156 | + $this->set_sold($count_regs_for_this_ticket); |
|
1157 | 1157 | $this->save(); |
1158 | 1158 | return $count_regs_for_this_ticket; |
1159 | 1159 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | * @param array $query_params like EEM_Base::get_all's |
1166 | 1166 | * @return int |
1167 | 1167 | */ |
1168 | - public function count_registrations( $query_params = array() ) { |
|
1168 | + public function count_registrations($query_params = array()) { |
|
1169 | 1169 | return $this->count_related('Registration', $query_params); |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1190,23 +1190,23 @@ discard block |
||
1190 | 1190 | public function get_related_event() { |
1191 | 1191 | //get one datetime to use for getting the event |
1192 | 1192 | $datetime = $this->first_datetime(); |
1193 | - if ( ! $datetime instanceof \EE_Datetime ) { |
|
1193 | + if ( ! $datetime instanceof \EE_Datetime) { |
|
1194 | 1194 | throw new UnexpectedEntityException( |
1195 | 1195 | $datetime, |
1196 | 1196 | 'EE_Datetime', |
1197 | 1197 | sprintf( |
1198 | - __( "The ticket (%s) is not associated with any valid datetimes.", "event_espresso" ), |
|
1198 | + __("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"), |
|
1199 | 1199 | $datetime->name() |
1200 | 1200 | ) |
1201 | 1201 | ); |
1202 | 1202 | } |
1203 | 1203 | $event = $datetime->event(); |
1204 | - if ( ! $event instanceof \EE_Event ) { |
|
1204 | + if ( ! $event instanceof \EE_Event) { |
|
1205 | 1205 | throw new UnexpectedEntityException( |
1206 | 1206 | $event, |
1207 | 1207 | 'EE_Event', |
1208 | 1208 | sprintf( |
1209 | - __( "The ticket (%s) is not associated with a valid event.", "event_espresso" ), |
|
1209 | + __("The ticket (%s) is not associated with a valid event.", "event_espresso"), |
|
1210 | 1210 | $this->name() |
1211 | 1211 | ) |
1212 | 1212 | ); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * Using the start date and end date this method calculates whether the ticket is On Sale, Pending, or Expired |
122 | 122 | * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
123 | 123 | * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save further processing |
124 | - * @return mixed status int if the display string isn't requested |
|
124 | + * @return string status int if the display string isn't requested |
|
125 | 125 | */ |
126 | 126 | public function ticket_status( $display = FALSE, $remaining = null ) { |
127 | 127 | $remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining(); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * This returns the chronologically last datetime that this ticket is associated with |
223 | 223 | * @param string $dt_frmt |
224 | 224 | * @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 |
225 | - * @return array |
|
225 | + * @return string |
|
226 | 226 | */ |
227 | 227 | public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
228 | 228 | $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | /** |
364 | 364 | * Gets all the ticket applicabilities (ie, relations between datetimes and tickets) |
365 | 365 | * @param array $query_params see EEM_Base::get_all() |
366 | - * @return EE_Datetime_Ticket |
|
366 | + * @return EE_Base_Class[] |
|
367 | 367 | */ |
368 | 368 | public function datetime_tickets( $query_params = array() ) { |
369 | 369 | return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | /** |
498 | 498 | * Sets name |
499 | 499 | * @param string $name |
500 | - * @return boolean |
|
500 | + * @return boolean|null |
|
501 | 501 | */ |
502 | 502 | function set_name( $name ) { |
503 | 503 | $this->set( 'TKT_name', $name ); |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | /** |
519 | 519 | * Sets description |
520 | 520 | * @param string $description |
521 | - * @return boolean |
|
521 | + * @return boolean|null |
|
522 | 522 | */ |
523 | 523 | function set_description( $description ) { |
524 | 524 | $this->set( 'TKT_description', $description ); |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | /** |
589 | 589 | * Sets min |
590 | 590 | * @param int $min |
591 | - * @return boolean |
|
591 | + * @return boolean|null |
|
592 | 592 | */ |
593 | 593 | function set_min( $min ) { |
594 | 594 | $this->set( 'TKT_min', $min ); |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | /** |
610 | 610 | * Sets max |
611 | 611 | * @param int $max |
612 | - * @return boolean |
|
612 | + * @return boolean|null |
|
613 | 613 | */ |
614 | 614 | function set_max( $max ) { |
615 | 615 | $this->set( 'TKT_max', $max ); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | /** |
621 | 621 | * Sets price |
622 | 622 | * @param float $price |
623 | - * @return boolean |
|
623 | + * @return boolean|null |
|
624 | 624 | */ |
625 | 625 | function set_price( $price ) { |
626 | 626 | $this->set( 'TKT_price', $price ); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | /** |
642 | 642 | * Sets sold |
643 | 643 | * @param int $sold |
644 | - * @return boolean |
|
644 | + * @return boolean|null |
|
645 | 645 | */ |
646 | 646 | function set_sold( $sold ) { |
647 | 647 | // sold can not go below zero |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | /** |
655 | 655 | * increments sold by amount passed by $qty |
656 | 656 | * @param int $qty |
657 | - * @return boolean |
|
657 | + * @return boolean|null |
|
658 | 658 | */ |
659 | 659 | function increase_sold( $qty = 1 ) { |
660 | 660 | $sold = $this->sold() + $qty; |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | /** |
671 | 671 | * Increases sold on related datetimes |
672 | 672 | * @param int $qty |
673 | - * @return boolean |
|
673 | + * @return boolean|null |
|
674 | 674 | */ |
675 | 675 | protected function _increase_sold_for_datetimes( $qty = 1 ) { |
676 | 676 | $datetimes = $this->datetimes(); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | /** |
690 | 690 | * decrements (subtracts) sold by amount passed by $qty |
691 | 691 | * @param int $qty |
692 | - * @return boolean |
|
692 | + * @return boolean|null |
|
693 | 693 | */ |
694 | 694 | function decrease_sold( $qty = 1 ) { |
695 | 695 | $sold = $this->sold() - $qty; |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | * Decreases sold on related datetimes |
704 | 704 | * |
705 | 705 | * @param int $qty |
706 | - * @return boolean |
|
706 | + * @return boolean|null |
|
707 | 707 | */ |
708 | 708 | protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
709 | 709 | $datetimes = $this->datetimes(); |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | /** |
733 | 733 | * Sets reserved |
734 | 734 | * @param int $reserved |
735 | - * @return boolean |
|
735 | + * @return boolean|null |
|
736 | 736 | */ |
737 | 737 | function set_reserved( $reserved ) { |
738 | 738 | // reserved can not go below zero |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | /** |
746 | 746 | * increments reserved by amount passed by $qty |
747 | 747 | * @param int $qty |
748 | - * @return boolean |
|
748 | + * @return boolean|null |
|
749 | 749 | */ |
750 | 750 | function increase_reserved( $qty = 1 ) { |
751 | 751 | $qty = absint( $qty ); |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | * Increases sold on related datetimes |
761 | 761 | * |
762 | 762 | * @param int $qty |
763 | - * @return boolean |
|
763 | + * @return boolean|null |
|
764 | 764 | */ |
765 | 765 | protected function _increase_reserved_for_datetimes( $qty = 1 ) { |
766 | 766 | $datetimes = $this->datetimes(); |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @param int $qty |
783 | 783 | * @param bool $adjust_datetimes |
784 | - * @return bool |
|
784 | + * @return boolean|null |
|
785 | 785 | */ |
786 | 786 | function decrease_reserved( $qty = 1, $adjust_datetimes = true ) { |
787 | 787 | $reserved = $this->reserved() - absint( $qty ); |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | * Increases sold on related datetimes |
798 | 798 | * |
799 | 799 | * @param int $qty |
800 | - * @return boolean |
|
800 | + * @return boolean|null |
|
801 | 801 | */ |
802 | 802 | protected function _decrease_reserved_for_datetimes( $qty = 1 ) { |
803 | 803 | $datetimes = $this->datetimes(); |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | * Sets qty - IMPORTANT!!! Does NOT allow QTY to be set higher than the lowest reg limit of any related datetimes |
919 | 919 | * |
920 | 920 | * @param int $qty |
921 | - * @return bool |
|
921 | + * @return boolean|null |
|
922 | 922 | * @throws \EE_Error |
923 | 923 | */ |
924 | 924 | function set_qty( $qty ) { |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | /** |
947 | 947 | * Sets uses |
948 | 948 | * @param int $uses |
949 | - * @return boolean |
|
949 | + * @return boolean|null |
|
950 | 950 | */ |
951 | 951 | function set_uses( $uses ) { |
952 | 952 | $this->set( 'TKT_uses', $uses ); |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | /** |
968 | 968 | * sets the TKT_required property |
969 | 969 | * @param boolean $required |
970 | - * @return boolean |
|
970 | + * @return boolean|null |
|
971 | 971 | */ |
972 | 972 | public function set_required( $required ) { |
973 | 973 | $this->set( 'TKT_required', $required ); |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | /** |
989 | 989 | * Sets taxable |
990 | 990 | * @param boolean $taxable |
991 | - * @return boolean |
|
991 | + * @return boolean|null |
|
992 | 992 | */ |
993 | 993 | function set_taxable( $taxable ) { |
994 | 994 | $this->set( 'TKT_taxable', $taxable ); |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | /** |
1010 | 1010 | * Sets is_default |
1011 | 1011 | * @param boolean $is_default |
1012 | - * @return boolean |
|
1012 | + * @return boolean|null |
|
1013 | 1013 | */ |
1014 | 1014 | function set_is_default( $is_default ) { |
1015 | 1015 | $this->set( 'TKT_is_default', $is_default ); |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | /** |
1031 | 1031 | * Sets order |
1032 | 1032 | * @param int $order |
1033 | - * @return boolean |
|
1033 | + * @return boolean|null |
|
1034 | 1034 | */ |
1035 | 1035 | function set_order( $order ) { |
1036 | 1036 | $this->set( 'TKT_order', $order ); |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | /** |
1052 | 1052 | * Sets row |
1053 | 1053 | * @param int $row |
1054 | - * @return boolean |
|
1054 | + * @return boolean|null |
|
1055 | 1055 | */ |
1056 | 1056 | function set_row( $row ) { |
1057 | 1057 | $this->set( 'TKT_row', $row ); |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | /** |
1073 | 1073 | * Sets deleted |
1074 | 1074 | * @param boolean $deleted |
1075 | - * @return boolean |
|
1075 | + * @return boolean|null |
|
1076 | 1076 | */ |
1077 | 1077 | function set_deleted( $deleted ) { |
1078 | 1078 | $this->set( 'TKT_deleted', $deleted ); |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | /** |
1094 | 1094 | * Sets parent |
1095 | 1095 | * @param int $parent |
1096 | - * @return boolean |
|
1096 | + * @return boolean|null |
|
1097 | 1097 | */ |
1098 | 1098 | function set_parent_ID( $parent ) { |
1099 | 1099 | $this->set( 'TKT_parent', $parent ); |
@@ -18,52 +18,52 @@ discard block |
||
18 | 18 | |
19 | 19 | |
20 | 20 | /** |
21 | - * name of the file to log exceptions to |
|
22 | - * @access private |
|
23 | - * @var string |
|
24 | - */ |
|
21 | + * name of the file to log exceptions to |
|
22 | + * @access private |
|
23 | + * @var string |
|
24 | + */ |
|
25 | 25 | private static $_exception_log_file = 'espresso_error_log.txt'; |
26 | 26 | |
27 | 27 | /** |
28 | - * the exception |
|
29 | - * @access private |
|
30 | - * @var object |
|
31 | - */ |
|
28 | + * the exception |
|
29 | + * @access private |
|
30 | + * @var object |
|
31 | + */ |
|
32 | 32 | private $_exception; |
33 | 33 | |
34 | 34 | /** |
35 | - * stores details for all exception |
|
36 | - * @access private |
|
37 | - * @var array |
|
38 | - */ |
|
35 | + * stores details for all exception |
|
36 | + * @access private |
|
37 | + * @var array |
|
38 | + */ |
|
39 | 39 | private static $_all_exceptions = array(); |
40 | 40 | |
41 | 41 | /** |
42 | - * tracks number of errors |
|
43 | - * @access private |
|
44 | - * @var int |
|
45 | - */ |
|
42 | + * tracks number of errors |
|
43 | + * @access private |
|
44 | + * @var int |
|
45 | + */ |
|
46 | 46 | private static $_error_count = 0; |
47 | 47 | |
48 | 48 | /** |
49 | - * has JS been loaded ? |
|
50 | - * @access private |
|
51 | - * @var boolean |
|
52 | - */ |
|
49 | + * has JS been loaded ? |
|
50 | + * @access private |
|
51 | + * @var boolean |
|
52 | + */ |
|
53 | 53 | private static $_js_loaded = FALSE; |
54 | 54 | |
55 | 55 | /** |
56 | - * has shutdown action been added ? |
|
57 | - * @access private |
|
58 | - * @var boolean |
|
59 | - */ |
|
56 | + * has shutdown action been added ? |
|
57 | + * @access private |
|
58 | + * @var boolean |
|
59 | + */ |
|
60 | 60 | private static $_action_added = FALSE; |
61 | 61 | |
62 | 62 | /** |
63 | - * has shutdown action been added ? |
|
64 | - * @access private |
|
65 | - * @var boolean |
|
66 | - */ |
|
63 | + * has shutdown action been added ? |
|
64 | + * @access private |
|
65 | + * @var boolean |
|
66 | + */ |
|
67 | 67 | private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
68 | 68 | |
69 | 69 | |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | |
72 | 72 | |
73 | 73 | /** |
74 | - * @override default exception handling |
|
75 | - * @access public |
|
76 | - * @echo string |
|
77 | - */ |
|
74 | + * @override default exception handling |
|
75 | + * @access public |
|
76 | + * @echo string |
|
77 | + */ |
|
78 | 78 | function __construct( $message, $code = 0, Exception $previous = NULL ) { |
79 | 79 | if ( version_compare( phpversion(), '5.3.0', '<' )) { |
80 | 80 | parent::__construct( $message, $code ); |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | /** |
176 | - * fatal_error_handler |
|
177 | - * @access public |
|
178 | - * @return void |
|
179 | - */ |
|
176 | + * fatal_error_handler |
|
177 | + * @access public |
|
178 | + * @return void |
|
179 | + */ |
|
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | 182 | if ( $last_error['type'] === E_ERROR ) { |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | |
222 | 222 | |
223 | 223 | /** |
224 | - * _add_actions |
|
225 | - * @access public |
|
226 | - * @return void |
|
227 | - */ |
|
228 | - public function get_error() { |
|
224 | + * _add_actions |
|
225 | + * @access public |
|
226 | + * @return void |
|
227 | + */ |
|
228 | + public function get_error() { |
|
229 | 229 | |
230 | 230 | if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
231 | 231 | throw $this; |
@@ -254,37 +254,37 @@ discard block |
||
254 | 254 | |
255 | 255 | |
256 | 256 | |
257 | - /** |
|
258 | - * has_error |
|
259 | - * |
|
260 | - * @access public |
|
261 | - * @param bool $check_stored |
|
262 | - * @param string $type_to_check |
|
263 | - * @return bool |
|
264 | - */ |
|
265 | - public static function has_error( $check_stored = false, $type_to_check = 'errors' ){ |
|
266 | - $has_error = isset(self::$_espresso_notices[$type_to_check]) && ! empty(self::$_espresso_notices[$type_to_check]) |
|
267 | - ? true |
|
268 | - : false; |
|
269 | - if ( $check_stored && ! $has_error ) { |
|
270 | - $notices = (array) get_option( 'ee_notices', array() ); |
|
271 | - foreach ( $notices as $type => $notice ) { |
|
272 | - if ( $type === $type_to_check && $notice ) { |
|
273 | - return true; |
|
274 | - } |
|
275 | - } |
|
276 | - } |
|
277 | - return $has_error; |
|
278 | - } |
|
257 | + /** |
|
258 | + * has_error |
|
259 | + * |
|
260 | + * @access public |
|
261 | + * @param bool $check_stored |
|
262 | + * @param string $type_to_check |
|
263 | + * @return bool |
|
264 | + */ |
|
265 | + public static function has_error( $check_stored = false, $type_to_check = 'errors' ){ |
|
266 | + $has_error = isset(self::$_espresso_notices[$type_to_check]) && ! empty(self::$_espresso_notices[$type_to_check]) |
|
267 | + ? true |
|
268 | + : false; |
|
269 | + if ( $check_stored && ! $has_error ) { |
|
270 | + $notices = (array) get_option( 'ee_notices', array() ); |
|
271 | + foreach ( $notices as $type => $notice ) { |
|
272 | + if ( $type === $type_to_check && $notice ) { |
|
273 | + return true; |
|
274 | + } |
|
275 | + } |
|
276 | + } |
|
277 | + return $has_error; |
|
278 | + } |
|
279 | 279 | |
280 | 280 | |
281 | 281 | |
282 | 282 | /** |
283 | - * display_errors |
|
284 | - * @access public |
|
285 | - * @echo string |
|
286 | - */ |
|
287 | - public function display_errors(){ |
|
283 | + * display_errors |
|
284 | + * @access public |
|
285 | + * @echo string |
|
286 | + */ |
|
287 | + public function display_errors(){ |
|
288 | 288 | |
289 | 289 | $trace_details = ''; |
290 | 290 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | // process trace info |
357 | 357 | if ( empty( $ex['trace'] )) { |
358 | 358 | |
359 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
359 | + $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
360 | 360 | |
361 | 361 | } else { |
362 | 362 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $function_dsply = ! empty( $function ) ? $function : ' '; |
409 | 409 | $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
410 | 410 | |
411 | - $trace_details .= ' |
|
411 | + $trace_details .= ' |
|
412 | 412 | <tr> |
413 | 413 | <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
414 | 414 | <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | } |
422 | 422 | |
423 | - $trace_details .= ' |
|
423 | + $trace_details .= ' |
|
424 | 424 | </table> |
425 | 425 | </div>'; |
426 | 426 | |
@@ -500,12 +500,12 @@ discard block |
||
500 | 500 | |
501 | 501 | |
502 | 502 | /** |
503 | - * generate string from exception trace args |
|
504 | - * |
|
505 | - * @access private |
|
506 | - * @ param array $arguments |
|
507 | - * @ return string |
|
508 | - */ |
|
503 | + * generate string from exception trace args |
|
504 | + * |
|
505 | + * @access private |
|
506 | + * @ param array $arguments |
|
507 | + * @ return string |
|
508 | + */ |
|
509 | 509 | private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
510 | 510 | |
511 | 511 | $arg_string = ''; |
@@ -549,15 +549,15 @@ discard block |
||
549 | 549 | |
550 | 550 | |
551 | 551 | /** |
552 | - * add error message |
|
553 | - * |
|
554 | - * @access public |
|
555 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
556 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
557 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
558 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
559 | - * @return void |
|
560 | - */ |
|
552 | + * add error message |
|
553 | + * |
|
554 | + * @access public |
|
555 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
556 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
557 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
558 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
559 | + * @return void |
|
560 | + */ |
|
561 | 561 | public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
562 | 562 | self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
563 | 563 | self::$_error_count++; |
@@ -585,15 +585,15 @@ discard block |
||
585 | 585 | |
586 | 586 | |
587 | 587 | /** |
588 | - * add success message |
|
589 | - * |
|
590 | - * @access public |
|
591 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
592 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
593 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
594 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
595 | - * @return void |
|
596 | - */ |
|
588 | + * add success message |
|
589 | + * |
|
590 | + * @access public |
|
591 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
592 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
593 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
594 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
595 | + * @return void |
|
596 | + */ |
|
597 | 597 | public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
598 | 598 | self::_add_notice ( 'success', $msg, $file, $func, $line ); |
599 | 599 | } |
@@ -603,15 +603,15 @@ discard block |
||
603 | 603 | |
604 | 604 | |
605 | 605 | /** |
606 | - * add attention message |
|
607 | - * |
|
608 | - * @access public |
|
609 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
610 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
611 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
612 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
613 | - * @return void |
|
614 | - */ |
|
606 | + * add attention message |
|
607 | + * |
|
608 | + * @access public |
|
609 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
610 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
611 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
612 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
613 | + * @return void |
|
614 | + */ |
|
615 | 615 | public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
616 | 616 | self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
617 | 617 | } |
@@ -621,16 +621,16 @@ discard block |
||
621 | 621 | |
622 | 622 | |
623 | 623 | /** |
624 | - * add success message |
|
625 | - * |
|
626 | - * @access public |
|
627 | - * @param string $type whether the message is for a success or error notification |
|
628 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
629 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
630 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
631 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
632 | - * @return void |
|
633 | - */ |
|
624 | + * add success message |
|
625 | + * |
|
626 | + * @access public |
|
627 | + * @param string $type whether the message is for a success or error notification |
|
628 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
629 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
630 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
631 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
632 | + * @return void |
|
633 | + */ |
|
634 | 634 | private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
635 | 635 | if ( empty( $msg )) { |
636 | 636 | EE_Error::doing_it_wrong( |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | |
690 | 690 | |
691 | 691 | /** |
692 | - * in some case it may be necessary to overwrite the existing success messages |
|
693 | - * |
|
694 | - * @access public |
|
695 | - * @return void |
|
696 | - */ |
|
692 | + * in some case it may be necessary to overwrite the existing success messages |
|
693 | + * |
|
694 | + * @access public |
|
695 | + * @return void |
|
696 | + */ |
|
697 | 697 | public static function overwrite_success() { |
698 | 698 | self::$_espresso_notices['success'] = FALSE; |
699 | 699 | } |
@@ -703,11 +703,11 @@ discard block |
||
703 | 703 | |
704 | 704 | |
705 | 705 | /** |
706 | - * in some case it may be necessary to overwrite the existing attention messages |
|
707 | - * |
|
708 | - * @access public |
|
709 | - * @return void |
|
710 | - */ |
|
706 | + * in some case it may be necessary to overwrite the existing attention messages |
|
707 | + * |
|
708 | + * @access public |
|
709 | + * @return void |
|
710 | + */ |
|
711 | 711 | public static function overwrite_attention() { |
712 | 712 | self::$_espresso_notices['attention'] = FALSE; |
713 | 713 | } |
@@ -717,11 +717,11 @@ discard block |
||
717 | 717 | |
718 | 718 | |
719 | 719 | /** |
720 | - * in some case it may be necessary to overwrite the existing error messages |
|
721 | - * |
|
722 | - * @access public |
|
723 | - * @return void |
|
724 | - */ |
|
720 | + * in some case it may be necessary to overwrite the existing error messages |
|
721 | + * |
|
722 | + * @access public |
|
723 | + * @return void |
|
724 | + */ |
|
725 | 725 | public static function overwrite_errors() { |
726 | 726 | self::$_espresso_notices['errors'] = FALSE; |
727 | 727 | } |
@@ -729,24 +729,24 @@ discard block |
||
729 | 729 | |
730 | 730 | |
731 | 731 | /** |
732 | - * reset_notices |
|
733 | - * @access private |
|
734 | - * @return void |
|
735 | - */ |
|
732 | + * reset_notices |
|
733 | + * @access private |
|
734 | + * @return void |
|
735 | + */ |
|
736 | 736 | public static function reset_notices(){ |
737 | - self::$_espresso_notices['success'] = FALSE; |
|
738 | - self::$_espresso_notices['attention'] = FALSE; |
|
739 | - self::$_espresso_notices['errors'] = FALSE; |
|
740 | - } |
|
737 | + self::$_espresso_notices['success'] = FALSE; |
|
738 | + self::$_espresso_notices['attention'] = FALSE; |
|
739 | + self::$_espresso_notices['errors'] = FALSE; |
|
740 | + } |
|
741 | 741 | |
742 | 742 | |
743 | 743 | |
744 | 744 | /** |
745 | - * has_errors |
|
746 | - * @access public |
|
747 | - * @return int |
|
748 | - */ |
|
749 | - public static function has_notices(){ |
|
745 | + * has_errors |
|
746 | + * @access public |
|
747 | + * @return int |
|
748 | + */ |
|
749 | + public static function has_notices(){ |
|
750 | 750 | $has_notices = 0; |
751 | 751 | // check for success messages |
752 | 752 | $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
@@ -777,15 +777,15 @@ discard block |
||
777 | 777 | |
778 | 778 | |
779 | 779 | /** |
780 | - * compile all error or success messages into one string |
|
781 | - * @see EE_Error::get_raw_notices if you want the raw notices without any preparations made to them |
|
782 | - * |
|
783 | - * @access public |
|
784 | - * @param boolean $format_output whether or not to format the messages for display in the WP admin |
|
785 | - * @param boolean $save_to_transient whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting |
|
786 | - * @param boolean $remove_empty whether or not to unset empty messages |
|
787 | - * @return array |
|
788 | - */ |
|
780 | + * compile all error or success messages into one string |
|
781 | + * @see EE_Error::get_raw_notices if you want the raw notices without any preparations made to them |
|
782 | + * |
|
783 | + * @access public |
|
784 | + * @param boolean $format_output whether or not to format the messages for display in the WP admin |
|
785 | + * @param boolean $save_to_transient whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting |
|
786 | + * @param boolean $remove_empty whether or not to unset empty messages |
|
787 | + * @return array |
|
788 | + */ |
|
789 | 789 | public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
790 | 790 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
791 | 791 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | |
898 | 898 | |
899 | 899 | /** |
900 | - * add_persistent_admin_notice |
|
901 | - * |
|
902 | - * @access public |
|
903 | - * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
904 | - * @param string $pan_message the message to be stored persistently until dismissed |
|
905 | - * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
|
906 | - * @return void |
|
907 | - */ |
|
900 | + * add_persistent_admin_notice |
|
901 | + * |
|
902 | + * @access public |
|
903 | + * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
904 | + * @param string $pan_message the message to be stored persistently until dismissed |
|
905 | + * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
|
906 | + * @return void |
|
907 | + */ |
|
908 | 908 | public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
909 | 909 | if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
910 | 910 | $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
@@ -1067,11 +1067,11 @@ discard block |
||
1067 | 1067 | |
1068 | 1068 | |
1069 | 1069 | /** |
1070 | - * enqueue_error_scripts |
|
1071 | - * |
|
1072 | - * @access public |
|
1073 | - * @return void |
|
1074 | - */ |
|
1070 | + * enqueue_error_scripts |
|
1071 | + * |
|
1072 | + * @access public |
|
1073 | + * @return void |
|
1074 | + */ |
|
1075 | 1075 | public static function enqueue_error_scripts() { |
1076 | 1076 | self::_print_scripts(); |
1077 | 1077 | } |
@@ -1079,15 +1079,15 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | |
1081 | 1081 | /** |
1082 | - * create error code from filepath, function name, |
|
1083 | - * and line number where exception or error was thrown |
|
1084 | - * |
|
1085 | - * @access public |
|
1086 | - * @param string $file |
|
1087 | - * @param string $func |
|
1088 | - * @param string $line |
|
1089 | - * @return string |
|
1090 | - */ |
|
1082 | + * create error code from filepath, function name, |
|
1083 | + * and line number where exception or error was thrown |
|
1084 | + * |
|
1085 | + * @access public |
|
1086 | + * @param string $file |
|
1087 | + * @param string $func |
|
1088 | + * @param string $line |
|
1089 | + * @return string |
|
1090 | + */ |
|
1091 | 1091 | public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
1092 | 1092 | $file = explode( '.', basename( $file )); |
1093 | 1093 | $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
@@ -1101,13 +1101,13 @@ discard block |
||
1101 | 1101 | |
1102 | 1102 | |
1103 | 1103 | /** |
1104 | - * write exception details to log file |
|
1105 | - * |
|
1106 | - * @access public |
|
1107 | - * @ param timestamp $time |
|
1108 | - * @ param object $ex |
|
1109 | - * @ return void |
|
1110 | - */ |
|
1104 | + * write exception details to log file |
|
1105 | + * |
|
1106 | + * @access public |
|
1107 | + * @ param timestamp $time |
|
1108 | + * @ param object $ex |
|
1109 | + * @ return void |
|
1110 | + */ |
|
1111 | 1111 | public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
1112 | 1112 | |
1113 | 1113 | if ( ! $ex ) { |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | -if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
|
4 | - set_error_handler( array( 'EE_Error', 'error_handler' )); |
|
5 | - register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
|
3 | +if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) { |
|
4 | + set_error_handler(array('EE_Error', 'error_handler')); |
|
5 | + register_shutdown_function(array('EE_Error', 'fatal_error_handler')); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access private |
65 | 65 | * @var boolean |
66 | 66 | */ |
67 | - private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
|
67 | + private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE); |
|
68 | 68 | |
69 | 69 | |
70 | 70 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @echo string |
77 | 77 | */ |
78 | - function __construct( $message, $code = 0, Exception $previous = NULL ) { |
|
79 | - if ( version_compare( phpversion(), '5.3.0', '<' )) { |
|
80 | - parent::__construct( $message, $code ); |
|
78 | + function __construct($message, $code = 0, Exception $previous = NULL) { |
|
79 | + if (version_compare(phpversion(), '5.3.0', '<')) { |
|
80 | + parent::__construct($message, $code); |
|
81 | 81 | } else { |
82 | - parent::__construct( $message, $code, $previous ); |
|
82 | + parent::__construct($message, $code, $previous); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param $line |
95 | 95 | * @return void |
96 | 96 | */ |
97 | - public static function error_handler( $code, $message, $file, $line ) { |
|
98 | - $type = EE_Error::error_type( $code ); |
|
97 | + public static function error_handler($code, $message, $file, $line) { |
|
98 | + $type = EE_Error::error_type($code); |
|
99 | 99 | $site = site_url(); |
100 | - switch ( $site ) { |
|
100 | + switch ($site) { |
|
101 | 101 | case 'http://ee4.eventespresso.com/' : |
102 | 102 | case 'http://ee4decaf.eventespresso.com/' : |
103 | 103 | case 'http://ee4hf.eventespresso.com/' : |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | $to = '[email protected]'; |
111 | 111 | break; |
112 | 112 | default : |
113 | - $to = get_option( 'admin_email' ); |
|
113 | + $to = get_option('admin_email'); |
|
114 | 114 | } |
115 | - $subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url(); |
|
116 | - $msg = EE_Error::_format_error( $type, $message, $file, $line ); |
|
117 | - if ( function_exists( 'wp_mail' )) { |
|
118 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
119 | - wp_mail( $to, $subject, $msg ); |
|
115 | + $subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url(); |
|
116 | + $msg = EE_Error::_format_error($type, $message, $file, $line); |
|
117 | + if (function_exists('wp_mail')) { |
|
118 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
119 | + wp_mail($to, $subject, $msg); |
|
120 | 120 | } |
121 | 121 | echo '<div id="message" class="espresso-notices error"><p>'; |
122 | - echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line; |
|
122 | + echo $type.': '.$message.'<br />'.$file.' line '.$line; |
|
123 | 123 | echo '<br /></p></div>'; |
124 | 124 | } |
125 | 125 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param $code |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public static function error_type( $code ) { |
|
136 | - switch( $code ) { |
|
135 | + public static function error_type($code) { |
|
136 | + switch ($code) { |
|
137 | 137 | case E_ERROR: // 1 // |
138 | 138 | return 'E_ERROR'; |
139 | 139 | case E_WARNING: // 2 // |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | - if ( $last_error['type'] === E_ERROR ) { |
|
183 | - EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] ); |
|
182 | + if ($last_error['type'] === E_ERROR) { |
|
183 | + EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param $line |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - private static function _format_error( $code, $message, $file, $line ) { |
|
198 | + private static function _format_error($code, $message, $file, $line) { |
|
199 | 199 | $html = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>"; |
200 | 200 | $html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>"; |
201 | 201 | $html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param $content_type |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function set_content_type( $content_type ) { |
|
216 | + public static function set_content_type($content_type) { |
|
217 | 217 | return 'text/html'; |
218 | 218 | } |
219 | 219 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_error() { |
229 | 229 | |
230 | - if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
|
230 | + if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) { |
|
231 | 231 | throw $this; |
232 | 232 | } |
233 | 233 | // get separate user and developer messages if they exist |
234 | - $msg = explode( '||', $this->getMessage() ); |
|
234 | + $msg = explode('||', $this->getMessage()); |
|
235 | 235 | $user_msg = $msg[0]; |
236 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
236 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
237 | 237 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
238 | 238 | |
239 | 239 | // add details to _all_exceptions array |
240 | 240 | $x_time = time(); |
241 | - self::$_all_exceptions[ $x_time ]['name'] = get_class( $this ); |
|
242 | - self::$_all_exceptions[ $x_time ]['file'] = $this->getFile(); |
|
243 | - self::$_all_exceptions[ $x_time ]['line'] = $this->getLine(); |
|
244 | - self::$_all_exceptions[ $x_time ]['msg'] = $msg; |
|
245 | - self::$_all_exceptions[ $x_time ]['code'] = $this->getCode(); |
|
246 | - self::$_all_exceptions[ $x_time ]['trace'] = $this->getTrace(); |
|
247 | - self::$_all_exceptions[ $x_time ]['string'] = $this->getTraceAsString(); |
|
241 | + self::$_all_exceptions[$x_time]['name'] = get_class($this); |
|
242 | + self::$_all_exceptions[$x_time]['file'] = $this->getFile(); |
|
243 | + self::$_all_exceptions[$x_time]['line'] = $this->getLine(); |
|
244 | + self::$_all_exceptions[$x_time]['msg'] = $msg; |
|
245 | + self::$_all_exceptions[$x_time]['code'] = $this->getCode(); |
|
246 | + self::$_all_exceptions[$x_time]['trace'] = $this->getTrace(); |
|
247 | + self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString(); |
|
248 | 248 | self::$_error_count++; |
249 | 249 | |
250 | 250 | //add_action( 'shutdown', array( $this, 'display_errors' )); |
@@ -262,14 +262,14 @@ discard block |
||
262 | 262 | * @param string $type_to_check |
263 | 263 | * @return bool |
264 | 264 | */ |
265 | - public static function has_error( $check_stored = false, $type_to_check = 'errors' ){ |
|
265 | + public static function has_error($check_stored = false, $type_to_check = 'errors') { |
|
266 | 266 | $has_error = isset(self::$_espresso_notices[$type_to_check]) && ! empty(self::$_espresso_notices[$type_to_check]) |
267 | 267 | ? true |
268 | 268 | : false; |
269 | - if ( $check_stored && ! $has_error ) { |
|
270 | - $notices = (array) get_option( 'ee_notices', array() ); |
|
271 | - foreach ( $notices as $type => $notice ) { |
|
272 | - if ( $type === $type_to_check && $notice ) { |
|
269 | + if ($check_stored && ! $has_error) { |
|
270 | + $notices = (array) get_option('ee_notices', array()); |
|
271 | + foreach ($notices as $type => $notice) { |
|
272 | + if ($type === $type_to_check && $notice) { |
|
273 | 273 | return true; |
274 | 274 | } |
275 | 275 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @access public |
285 | 285 | * @echo string |
286 | 286 | */ |
287 | - public function display_errors(){ |
|
287 | + public function display_errors() { |
|
288 | 288 | |
289 | 289 | $trace_details = ''; |
290 | 290 | |
@@ -345,18 +345,18 @@ discard block |
||
345 | 345 | </style> |
346 | 346 | <div id="ee-error-message" class="error">'; |
347 | 347 | |
348 | - if ( ! WP_DEBUG ) { |
|
348 | + if ( ! WP_DEBUG) { |
|
349 | 349 | $output .= ' |
350 | 350 | <p>'; |
351 | 351 | } |
352 | 352 | |
353 | 353 | // cycle thru errors |
354 | - foreach ( self::$_all_exceptions as $time => $ex ) { |
|
354 | + foreach (self::$_all_exceptions as $time => $ex) { |
|
355 | 355 | |
356 | 356 | // process trace info |
357 | - if ( empty( $ex['trace'] )) { |
|
357 | + if (empty($ex['trace'])) { |
|
358 | 358 | |
359 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
359 | + $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso'); |
|
360 | 360 | |
361 | 361 | } else { |
362 | 362 | |
@@ -371,50 +371,50 @@ discard block |
||
371 | 371 | <th scope="col" align="left">Method( arguments )</th> |
372 | 372 | </tr>'; |
373 | 373 | |
374 | - $last_on_stack = count( $ex['trace'] ) - 1; |
|
374 | + $last_on_stack = count($ex['trace']) - 1; |
|
375 | 375 | // reverse array so that stack is in proper chronological order |
376 | - $sorted_trace = array_reverse( $ex['trace'] ); |
|
376 | + $sorted_trace = array_reverse($ex['trace']); |
|
377 | 377 | |
378 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
378 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
379 | 379 | |
380 | - $file = isset( $trace['file'] ) ? $trace['file'] : '' ; |
|
381 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
382 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
383 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
384 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
385 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
380 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
381 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
382 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
383 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
384 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
385 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
386 | 386 | $zebra = $nmbr % 2 ? ' odd' : ''; |
387 | 387 | |
388 | - if ( empty( $file ) && ! empty( $class )) { |
|
389 | - $a = new ReflectionClass( $class ); |
|
388 | + if (empty($file) && ! empty($class)) { |
|
389 | + $a = new ReflectionClass($class); |
|
390 | 390 | $file = $a->getFileName(); |
391 | - if ( empty( $line ) && ! empty( $function )) { |
|
392 | - $b = new ReflectionMethod( $class, $function ); |
|
391 | + if (empty($line) && ! empty($function)) { |
|
392 | + $b = new ReflectionMethod($class, $function); |
|
393 | 393 | $line = $b->getStartLine(); |
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
397 | - if ( $nmbr == $last_on_stack ) { |
|
397 | + if ($nmbr == $last_on_stack) { |
|
398 | 398 | $file = $ex['file'] != '' ? $ex['file'] : $file; |
399 | 399 | $line = $ex['line'] != '' ? $ex['line'] : $line; |
400 | - $error_code = self::generate_error_code ( $file, $trace['function'], $line ); |
|
400 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
401 | 401 | } |
402 | 402 | |
403 | - $nmbr_dsply = ! empty( $nmbr ) ? $nmbr : ' '; |
|
404 | - $line_dsply = ! empty( $line ) ? $line : ' '; |
|
405 | - $file_dsply = ! empty( $file ) ? $file : ' '; |
|
406 | - $class_dsply = ! empty( $class ) ? $class : ' '; |
|
407 | - $type_dsply = ! empty( $type ) ? $type : ' '; |
|
408 | - $function_dsply = ! empty( $function ) ? $function : ' '; |
|
409 | - $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
|
403 | + $nmbr_dsply = ! empty($nmbr) ? $nmbr : ' '; |
|
404 | + $line_dsply = ! empty($line) ? $line : ' '; |
|
405 | + $file_dsply = ! empty($file) ? $file : ' '; |
|
406 | + $class_dsply = ! empty($class) ? $class : ' '; |
|
407 | + $type_dsply = ! empty($type) ? $type : ' '; |
|
408 | + $function_dsply = ! empty($function) ? $function : ' '; |
|
409 | + $args_dsply = ! empty($args) ? '( '.$args.' )' : ''; |
|
410 | 410 | |
411 | 411 | $trace_details .= ' |
412 | 412 | <tr> |
413 | - <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
|
414 | - <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
|
415 | - <td align="left" class="' . $zebra . '">' . $file_dsply . '</td> |
|
416 | - <td align="left" class="' . $zebra . '">' . $class_dsply . '</td> |
|
417 | - <td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td> |
|
413 | + <td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td> |
|
414 | + <td align="right" class="' . $zebra.'">'.$line_dsply.'</td> |
|
415 | + <td align="left" class="' . $zebra.'">'.$file_dsply.'</td> |
|
416 | + <td align="left" class="' . $zebra.'">'.$class_dsply.'</td> |
|
417 | + <td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td> |
|
418 | 418 | </tr>'; |
419 | 419 | |
420 | 420 | |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | $ex['code'] = $ex['code'] ? $ex['code'] : $error_code; |
430 | 430 | |
431 | 431 | // add generic non-identifying messages for non-privileged uesrs |
432 | - if ( ! WP_DEBUG ) { |
|
432 | + if ( ! WP_DEBUG) { |
|
433 | 433 | |
434 | - $output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] ) . '</span> <sup>' . $ex['code'] . '</sup><br />'; |
|
434 | + $output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> <sup>'.$ex['code'].'</sup><br />'; |
|
435 | 435 | |
436 | 436 | } else { |
437 | 437 | |
@@ -439,24 +439,24 @@ discard block |
||
439 | 439 | $output .= ' |
440 | 440 | <div class="ee-error-dev-msg-dv"> |
441 | 441 | <p class="ee-error-dev-msg-pg"> |
442 | - <strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong> <span>code: ' . $ex['code'] . '</span><br /> |
|
443 | - <span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/> |
|
444 | - <a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '"> |
|
445 | - ' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . ' |
|
442 | + <strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong> <span>code: '.$ex['code'].'</span><br /> |
|
443 | + <span class="big-text">"' . trim($ex['msg']).'"</span><br/> |
|
444 | + <a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'"> |
|
445 | + ' . __('click to view backtrace and class/method details', 'event_espresso').' |
|
446 | 446 | </a><br /> |
447 | 447 | <span class="small-text lt-grey-text">'.$ex['file'].' ( line no: '.$ex['line'].' )</span> |
448 | 448 | </p> |
449 | - <div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
449 | + <div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;"> |
|
450 | 450 | ' . $trace_details; |
451 | 451 | |
452 | - if ( ! empty( $class )) { |
|
452 | + if ( ! empty($class)) { |
|
453 | 453 | $output .= ' |
454 | 454 | <div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;"> |
455 | 455 | <div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;"> |
456 | 456 | <h3>Class Details</h3>'; |
457 | - $a = new ReflectionClass( $class ); |
|
457 | + $a = new ReflectionClass($class); |
|
458 | 458 | $output .= ' |
459 | - <pre>' . $a . '</pre> |
|
459 | + <pre>' . $a.'</pre> |
|
460 | 460 | </div> |
461 | 461 | </div>'; |
462 | 462 | } |
@@ -468,14 +468,14 @@ discard block |
||
468 | 468 | |
469 | 469 | } |
470 | 470 | |
471 | - $this->write_to_error_log( $time, $ex ); |
|
471 | + $this->write_to_error_log($time, $ex); |
|
472 | 472 | |
473 | 473 | } |
474 | 474 | |
475 | 475 | // remove last linebreak |
476 | - $output = substr( $output, 0, ( count( $output ) - 7 )); |
|
476 | + $output = substr($output, 0, (count($output) - 7)); |
|
477 | 477 | |
478 | - if ( ! WP_DEBUG ) { |
|
478 | + if ( ! WP_DEBUG) { |
|
479 | 479 | $output .= ' |
480 | 480 | </p>'; |
481 | 481 | } |
@@ -483,10 +483,10 @@ discard block |
||
483 | 483 | $output .= ' |
484 | 484 | </div>'; |
485 | 485 | |
486 | - $output .= self::_print_scripts( TRUE ); |
|
486 | + $output .= self::_print_scripts(TRUE); |
|
487 | 487 | |
488 | - if ( defined( 'DOING_AJAX' )) { |
|
489 | - echo wp_json_encode( array( 'error' => $output )); |
|
488 | + if (defined('DOING_AJAX')) { |
|
489 | + echo wp_json_encode(array('error' => $output)); |
|
490 | 490 | exit(); |
491 | 491 | } |
492 | 492 | |
@@ -506,29 +506,29 @@ discard block |
||
506 | 506 | * @ param array $arguments |
507 | 507 | * @ return string |
508 | 508 | */ |
509 | - private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
|
509 | + private function _convert_args_to_string($arguments = array(), $array = FALSE) { |
|
510 | 510 | |
511 | 511 | $arg_string = ''; |
512 | - if ( ! empty( $arguments )) { |
|
512 | + if ( ! empty($arguments)) { |
|
513 | 513 | |
514 | 514 | $args = array(); |
515 | 515 | |
516 | - foreach ( $arguments as $arg ) { |
|
516 | + foreach ($arguments as $arg) { |
|
517 | 517 | |
518 | - if ( ! empty( $arg )) { |
|
518 | + if ( ! empty($arg)) { |
|
519 | 519 | |
520 | - if ( is_string( $arg )) { |
|
521 | - $args[] = " '" . $arg . "'"; |
|
522 | - } elseif ( is_array( $arg )) { |
|
523 | - $args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE ); |
|
524 | - } elseif ( is_null( $arg )) { |
|
520 | + if (is_string($arg)) { |
|
521 | + $args[] = " '".$arg."'"; |
|
522 | + } elseif (is_array($arg)) { |
|
523 | + $args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE); |
|
524 | + } elseif (is_null($arg)) { |
|
525 | 525 | $args[] = ' NULL'; |
526 | - } elseif ( is_bool( $arg )) { |
|
527 | - $args[] = ( $arg ) ? ' TRUE' : ' FALSE'; |
|
528 | - } elseif ( is_object( $arg )) { |
|
529 | - $args[] = ' OBJECT ' . get_class( $arg ); |
|
530 | - } elseif ( is_resource( $arg )) { |
|
531 | - $args[] = get_resource_type( $arg ); |
|
526 | + } elseif (is_bool($arg)) { |
|
527 | + $args[] = ($arg) ? ' TRUE' : ' FALSE'; |
|
528 | + } elseif (is_object($arg)) { |
|
529 | + $args[] = ' OBJECT '.get_class($arg); |
|
530 | + } elseif (is_resource($arg)) { |
|
531 | + $args[] = get_resource_type($arg); |
|
532 | 532 | } else { |
533 | 533 | $args[] = $arg; |
534 | 534 | } |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | } |
537 | 537 | |
538 | 538 | } |
539 | - $arg_string = implode( ', ', $args ); |
|
539 | + $arg_string = implode(', ', $args); |
|
540 | 540 | } |
541 | - if ( $array ) { |
|
541 | + if ($array) { |
|
542 | 542 | $arg_string .= ' )'; |
543 | 543 | } |
544 | 544 | return $arg_string; |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | * @param string $line the line number where the error occurred - just use __LINE__ |
559 | 559 | * @return void |
560 | 560 | */ |
561 | - public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
562 | - self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
|
561 | + public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
562 | + self::_add_notice('errors', $msg, $file, $func, $line); |
|
563 | 563 | self::$_error_count++; |
564 | 564 | } |
565 | 565 | |
@@ -572,11 +572,11 @@ discard block |
||
572 | 572 | * @param string $line |
573 | 573 | * @throws EE_Error |
574 | 574 | */ |
575 | - public static function throw_exception_if_debugging( $msg = null, $file = null, $func = null, $line = null ) { |
|
576 | - if( WP_DEBUG ) { |
|
577 | - throw new EE_Error( $msg ); |
|
578 | - } else { |
|
579 | - EE_Error::add_error( $msg, $file, $func, $line ); |
|
575 | + public static function throw_exception_if_debugging($msg = null, $file = null, $func = null, $line = null) { |
|
576 | + if (WP_DEBUG) { |
|
577 | + throw new EE_Error($msg); |
|
578 | + } else { |
|
579 | + EE_Error::add_error($msg, $file, $func, $line); |
|
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * @param string $line the line number where the error occurred - just use __LINE__ |
595 | 595 | * @return void |
596 | 596 | */ |
597 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
598 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
597 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
598 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | |
@@ -612,8 +612,8 @@ discard block |
||
612 | 612 | * @param string $line the line number where the error occurred - just use __LINE__ |
613 | 613 | * @return void |
614 | 614 | */ |
615 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
616 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
615 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
616 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | |
@@ -631,12 +631,12 @@ discard block |
||
631 | 631 | * @param string $line the line number where the error occurred - just use __LINE__ |
632 | 632 | * @return void |
633 | 633 | */ |
634 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
635 | - if ( empty( $msg )) { |
|
634 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
635 | + if (empty($msg)) { |
|
636 | 636 | EE_Error::doing_it_wrong( |
637 | - 'EE_Error::add_' . $type . '()', |
|
637 | + 'EE_Error::add_'.$type.'()', |
|
638 | 638 | sprintf( |
639 | - __( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ), |
|
639 | + __('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), |
|
640 | 640 | $type, |
641 | 641 | $file, |
642 | 642 | $line |
@@ -644,17 +644,17 @@ discard block |
||
644 | 644 | EVENT_ESPRESSO_VERSION |
645 | 645 | ); |
646 | 646 | } |
647 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
647 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
648 | 648 | EE_Error::doing_it_wrong( |
649 | 649 | 'EE_Error::add_error()', |
650 | - __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ), |
|
650 | + __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), |
|
651 | 651 | EVENT_ESPRESSO_VERSION |
652 | 652 | ); |
653 | 653 | } |
654 | 654 | // get separate user and developer messages if they exist |
655 | - $msg = explode( '||', $msg ); |
|
655 | + $msg = explode('||', $msg); |
|
656 | 656 | $user_msg = $msg[0]; |
657 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
657 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
658 | 658 | /** |
659 | 659 | * Do an action so other code can be triggered when a notice is created |
660 | 660 | * @param string $type can be 'errors', 'attention', or 'success' |
@@ -664,22 +664,22 @@ discard block |
||
664 | 664 | * @param string $func function where error was generated |
665 | 665 | * @param string $line line where error was generated |
666 | 666 | */ |
667 | - do_action( 'AHEE__EE_Error___add_notice', $type, $user_msg, $dev_msg, $file, $func, $line ); |
|
667 | + do_action('AHEE__EE_Error___add_notice', $type, $user_msg, $dev_msg, $file, $func, $line); |
|
668 | 668 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
669 | 669 | // add notice if message exists |
670 | - if ( ! empty( $msg )) { |
|
670 | + if ( ! empty($msg)) { |
|
671 | 671 | // get error code |
672 | - $notice_code = EE_Error::generate_error_code( $file, $func, $line ); |
|
673 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
674 | - $msg .= '<br/><span class="tiny-text">' . $notice_code . '</span>'; |
|
672 | + $notice_code = EE_Error::generate_error_code($file, $func, $line); |
|
673 | + if (WP_DEBUG && $type == 'errors') { |
|
674 | + $msg .= '<br/><span class="tiny-text">'.$notice_code.'</span>'; |
|
675 | 675 | } |
676 | 676 | // add notice. Index by code if it's not blank |
677 | - if( $notice_code ) { |
|
678 | - self::$_espresso_notices[ $type ][ $notice_code ] = $msg; |
|
677 | + if ($notice_code) { |
|
678 | + self::$_espresso_notices[$type][$notice_code] = $msg; |
|
679 | 679 | } else { |
680 | - self::$_espresso_notices[ $type ][] = $msg; |
|
680 | + self::$_espresso_notices[$type][] = $msg; |
|
681 | 681 | } |
682 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
682 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | } |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * @access private |
734 | 734 | * @return void |
735 | 735 | */ |
736 | - public static function reset_notices(){ |
|
736 | + public static function reset_notices() { |
|
737 | 737 | self::$_espresso_notices['success'] = FALSE; |
738 | 738 | self::$_espresso_notices['attention'] = FALSE; |
739 | 739 | self::$_espresso_notices['errors'] = FALSE; |
@@ -746,14 +746,14 @@ discard block |
||
746 | 746 | * @access public |
747 | 747 | * @return int |
748 | 748 | */ |
749 | - public static function has_notices(){ |
|
749 | + public static function has_notices() { |
|
750 | 750 | $has_notices = 0; |
751 | 751 | // check for success messages |
752 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
752 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
753 | 753 | // check for attention messages |
754 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
754 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
755 | 755 | // check for error messages |
756 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
756 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
757 | 757 | return $has_notices; |
758 | 758 | } |
759 | 759 | |
@@ -768,9 +768,9 @@ discard block |
||
768 | 768 | */ |
769 | 769 | public static function get_vanilla_notices() { |
770 | 770 | return array( |
771 | - 'success' => isset( self::$_espresso_notices['success'] ) ? self::$_espresso_notices['success'] : array(), |
|
772 | - 'attention' => isset( self::$_espresso_notices['attention'] ) ? self::$_espresso_notices['attention'] : array(), |
|
773 | - 'errors' => isset( self::$_espresso_notices['errors'] ) ? self::$_espresso_notices['errors'] : array(), |
|
771 | + 'success' => isset(self::$_espresso_notices['success']) ? self::$_espresso_notices['success'] : array(), |
|
772 | + 'attention' => isset(self::$_espresso_notices['attention']) ? self::$_espresso_notices['attention'] : array(), |
|
773 | + 'errors' => isset(self::$_espresso_notices['errors']) ? self::$_espresso_notices['errors'] : array(), |
|
774 | 774 | ); |
775 | 775 | } |
776 | 776 | |
@@ -786,8 +786,8 @@ discard block |
||
786 | 786 | * @param boolean $remove_empty whether or not to unset empty messages |
787 | 787 | * @return array |
788 | 788 | */ |
789 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
790 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
789 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
790 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
791 | 791 | |
792 | 792 | $success_messages = ''; |
793 | 793 | $attention_messages = ''; |
@@ -797,44 +797,44 @@ discard block |
||
797 | 797 | // EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
798 | 798 | |
799 | 799 | // either save notices to the db |
800 | - if ( $save_to_transient ) { |
|
801 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
800 | + if ($save_to_transient) { |
|
801 | + update_option('ee_notices', self::$_espresso_notices); |
|
802 | 802 | return; |
803 | 803 | } |
804 | 804 | // grab any notices that have been previously saved |
805 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
806 | - foreach ( $notices as $type => $notice ) { |
|
807 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
805 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
806 | + foreach ($notices as $type => $notice) { |
|
807 | + if (is_array($notice) && ! empty($notice)) { |
|
808 | 808 | // make sure that existing notice type is an array |
809 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
809 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
810 | 810 | // merge stored notices with any newly created ones |
811 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
811 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
812 | 812 | $print_scripts = TRUE; |
813 | 813 | } |
814 | 814 | } |
815 | 815 | // now clear any stored notices |
816 | - update_option( 'ee_notices', FALSE ); |
|
816 | + update_option('ee_notices', FALSE); |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | // check for success messages |
820 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
820 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
821 | 821 | // combine messages |
822 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
822 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
823 | 823 | $print_scripts = TRUE; |
824 | 824 | } |
825 | 825 | |
826 | 826 | // check for attention messages |
827 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
827 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
828 | 828 | // combine messages |
829 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
829 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
830 | 830 | $print_scripts = TRUE; |
831 | 831 | } |
832 | 832 | |
833 | 833 | // check for error messages |
834 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
835 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
834 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
835 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
836 | 836 | // combine messages |
837 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
837 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
838 | 838 | $print_scripts = TRUE; |
839 | 839 | } |
840 | 840 | |
@@ -848,21 +848,21 @@ discard block |
||
848 | 848 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
849 | 849 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
850 | 850 | //showMessage( $success_messages ); |
851 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
851 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | if ($attention_messages != '') { |
855 | 855 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
856 | 856 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
857 | 857 | //showMessage( $error_messages, TRUE ); |
858 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
858 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | if ($error_messages != '') { |
862 | 862 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
863 | 863 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
864 | 864 | //showMessage( $error_messages, TRUE ); |
865 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
865 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | $notices .= '</div>'; |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | 'errors' => $error_messages |
876 | 876 | ); |
877 | 877 | |
878 | - if ( $remove_empty ) { |
|
878 | + if ($remove_empty) { |
|
879 | 879 | // remove empty notices |
880 | 880 | foreach ($notices as $type => $notice) { |
881 | 881 | if (empty($notice)) { |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | } |
886 | 886 | } |
887 | 887 | |
888 | - if ( $print_scripts ) { |
|
888 | + if ($print_scripts) { |
|
889 | 889 | self::_print_scripts(); |
890 | 890 | } |
891 | 891 | |
@@ -905,17 +905,17 @@ discard block |
||
905 | 905 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
906 | 906 | * @return void |
907 | 907 | */ |
908 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
909 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
910 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
908 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
909 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
910 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
911 | 911 | //maybe initialize persistent_admin_notices |
912 | - if ( empty( $persistent_admin_notices )) { |
|
913 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
912 | + if (empty($persistent_admin_notices)) { |
|
913 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
914 | 914 | } |
915 | - $pan_name = sanitize_key( $pan_name ); |
|
916 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
917 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
918 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
915 | + $pan_name = sanitize_key($pan_name); |
|
916 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
917 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
918 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | } |
@@ -931,34 +931,34 @@ discard block |
||
931 | 931 | * @param bool $return_immediately |
932 | 932 | * @return void |
933 | 933 | */ |
934 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
935 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
936 | - if ( ! empty( $pan_name )) { |
|
937 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
934 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
935 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
936 | + if ( ! empty($pan_name)) { |
|
937 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
938 | 938 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
939 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
939 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
940 | 940 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
941 | - if ( $purge ) { |
|
942 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
941 | + if ($purge) { |
|
942 | + unset($persistent_admin_notices[$pan_name]); |
|
943 | 943 | } else { |
944 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
944 | + $persistent_admin_notices[$pan_name] = NULL; |
|
945 | 945 | } |
946 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
947 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
946 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
947 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | } |
951 | - if ( $return_immediately ) { |
|
951 | + if ($return_immediately) { |
|
952 | 952 | return; |
953 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
953 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
954 | 954 | // grab any notices and concatenate into string |
955 | - echo wp_json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
955 | + echo wp_json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
956 | 956 | exit(); |
957 | 957 | } else { |
958 | 958 | // save errors to a transient to be displayed on next request (after redirect) |
959 | - EE_Error::get_notices( FALSE, TRUE ); |
|
960 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
961 | - wp_safe_redirect( urldecode( $return_url )); |
|
959 | + EE_Error::get_notices(FALSE, TRUE); |
|
960 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
961 | + wp_safe_redirect(urldecode($return_url)); |
|
962 | 962 | } |
963 | 963 | } |
964 | 964 | |
@@ -973,20 +973,20 @@ discard block |
||
973 | 973 | * @param string $return_url URL to go back to after nag notice is dismissed |
974 | 974 | * @return string |
975 | 975 | */ |
976 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
977 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
976 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
977 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
978 | 978 | $args = array( |
979 | 979 | 'nag_notice' => $pan_name, |
980 | - 'return_url' => urlencode( $return_url ), |
|
980 | + 'return_url' => urlencode($return_url), |
|
981 | 981 | 'ajax_url' => WP_AJAX_URL, |
982 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
982 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
983 | 983 | ); |
984 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
984 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
985 | 985 | return ' |
986 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
987 | - <p>' . $pan_message . '</p> |
|
988 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
989 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
986 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
987 | + <p>' . $pan_message.'</p> |
|
988 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
989 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
990 | 990 | </a> |
991 | 991 | <div style="clear:both;"></div> |
992 | 992 | </div>'; |
@@ -1003,24 +1003,24 @@ discard block |
||
1003 | 1003 | * @param string $return_url |
1004 | 1004 | * @return array |
1005 | 1005 | */ |
1006 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
1006 | + public static function get_persistent_admin_notices($return_url = '') { |
|
1007 | 1007 | $notices = ''; |
1008 | 1008 | // check for persistent admin notices |
1009 | 1009 | //filter the list though so plugins can notify the admin in a different way if they want |
1010 | 1010 | $persistent_admin_notices = apply_filters( |
1011 | 1011 | 'FHEE__EE_Error__get_persistent_admin_notices', |
1012 | - get_option( 'ee_pers_admin_notices', FALSE ), |
|
1012 | + get_option('ee_pers_admin_notices', FALSE), |
|
1013 | 1013 | 'ee_pers_admin_notices', |
1014 | 1014 | $return_url |
1015 | 1015 | ); |
1016 | - if ( $persistent_admin_notices ) { |
|
1016 | + if ($persistent_admin_notices) { |
|
1017 | 1017 | // load scripts |
1018 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1019 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1020 | - wp_enqueue_script( 'ee_error_js' ); |
|
1018 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1019 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1020 | + wp_enqueue_script('ee_error_js'); |
|
1021 | 1021 | // and display notices |
1022 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
1023 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
1022 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
1023 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | return $notices; |
@@ -1035,26 +1035,26 @@ discard block |
||
1035 | 1035 | * @param bool $force_print |
1036 | 1036 | * @return void |
1037 | 1037 | */ |
1038 | - private static function _print_scripts( $force_print = FALSE ) { |
|
1039 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
1040 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
1038 | + private static function _print_scripts($force_print = FALSE) { |
|
1039 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
1040 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
1041 | 1041 | return; |
1042 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
1043 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
1044 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
1045 | - wp_enqueue_script( 'ee_error_js' ); |
|
1046 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
1042 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
1043 | + add_filter('FHEE_load_css', '__return_true'); |
|
1044 | + add_filter('FHEE_load_js', '__return_true'); |
|
1045 | + wp_enqueue_script('ee_error_js'); |
|
1046 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
1047 | 1047 | } |
1048 | 1048 | } else { |
1049 | 1049 | return ' |
1050 | 1050 | <script> |
1051 | 1051 | /* <![CDATA[ */ |
1052 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
1052 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
1053 | 1053 | /* ]]> */ |
1054 | 1054 | </script> |
1055 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
1056 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
1057 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
1055 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
1056 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
1057 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
1058 | 1058 | '; |
1059 | 1059 | |
1060 | 1060 | } |
@@ -1088,11 +1088,11 @@ discard block |
||
1088 | 1088 | * @param string $line |
1089 | 1089 | * @return string |
1090 | 1090 | */ |
1091 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
1092 | - $file = explode( '.', basename( $file )); |
|
1093 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
1094 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
1095 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
1091 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
1092 | + $file = explode('.', basename($file)); |
|
1093 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
1094 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
1095 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
1096 | 1096 | return $error_code; |
1097 | 1097 | } |
1098 | 1098 | |
@@ -1108,36 +1108,36 @@ discard block |
||
1108 | 1108 | * @ param object $ex |
1109 | 1109 | * @ return void |
1110 | 1110 | */ |
1111 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
1111 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
1112 | 1112 | |
1113 | - if ( ! $ex ) { |
|
1113 | + if ( ! $ex) { |
|
1114 | 1114 | return; |
1115 | 1115 | } |
1116 | 1116 | |
1117 | - if ( ! $time ) { |
|
1117 | + if ( ! $time) { |
|
1118 | 1118 | $time = time(); |
1119 | 1119 | } |
1120 | 1120 | |
1121 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1122 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
1123 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
1124 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
1125 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
1126 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
1127 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
1128 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
1129 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1121 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1122 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
1123 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
1124 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
1125 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
1126 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
1127 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
1128 | + $exception_log .= $ex['string'].PHP_EOL; |
|
1129 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1130 | 1130 | |
1131 | 1131 | try { |
1132 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
1133 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); |
|
1134 | - if ( ! $clear ) { |
|
1132 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
1133 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); |
|
1134 | + if ( ! $clear) { |
|
1135 | 1135 | //get existing log file and append new log info |
1136 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
1136 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
1137 | 1137 | } |
1138 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
1139 | - } catch( EE_Error $e ){ |
|
1140 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
1138 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
1139 | + } catch (EE_Error $e) { |
|
1140 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
1141 | 1141 | return; |
1142 | 1142 | } |
1143 | 1143 | |
@@ -1173,8 +1173,8 @@ discard block |
||
1173 | 1173 | $applies_when = '', |
1174 | 1174 | $error_type = null |
1175 | 1175 | ) { |
1176 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
1177 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $applies_when, $error_type ); |
|
1176 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1177 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $applies_when, $error_type); |
|
1178 | 1178 | } |
1179 | 1179 | } |
1180 | 1180 | |
@@ -1208,13 +1208,13 @@ discard block |
||
1208 | 1208 | */ |
1209 | 1209 | function espresso_error_enqueue_scripts() { |
1210 | 1210 | // js for error handling |
1211 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1212 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1211 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1212 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1213 | 1213 | } |
1214 | -if ( is_admin() ) { |
|
1215 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1214 | +if (is_admin()) { |
|
1215 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1216 | 1216 | } else { |
1217 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1217 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 |
@@ -63,11 +63,11 @@ |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | do_action( 'AHEE__SPCO__after_registration_steps' ); |
66 | - printf( |
|
67 | - esc_html__('%1$scancel registration%2$s', 'event_espresso'), |
|
68 | - '<a class="small-text float-right" href="' . $cancel_page_url . '">', |
|
69 | - '</a><br class="clear"/><br />' |
|
70 | - ); |
|
66 | + printf( |
|
67 | + esc_html__('%1$scancel registration%2$s', 'event_espresso'), |
|
68 | + '<a class="small-text float-right" href="' . $cancel_page_url . '">', |
|
69 | + '</a><br class="clear"/><br />' |
|
70 | + ); |
|
71 | 71 | |
72 | 72 | } else { |
73 | 73 | ?> |
@@ -1,39 +1,39 @@ discard block |
||
1 | 1 | <div id="ee-single-page-checkout-dv" class=""> |
2 | 2 | <?php |
3 | -if ( ! $empty_cart ) { |
|
4 | - if ( apply_filters( 'FHEE__registration_page_wrapper_template__display_time_limit', false ) ) { ?> |
|
3 | +if ( ! $empty_cart) { |
|
4 | + if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?> |
|
5 | 5 | <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice" style="display: none;"> |
6 | 6 | <?php echo sprintf( |
7 | 7 | apply_filters( |
8 | 8 | 'FHEE__registration_page_wrapper_template___time_limit', |
9 | - __( 'You have %1$s to complete your registration.', 'event_espresso' ) |
|
9 | + __('You have %1$s to complete your registration.', 'event_espresso') |
|
10 | 10 | ), |
11 | - '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' . $registration_time_limit . '</span>' |
|
11 | + '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">'.$registration_time_limit.'</span>' |
|
12 | 12 | ); |
13 | 13 | ?> |
14 | 14 | <span id="spco-registration-expiration-spn" class="" style="display:none;"></span> |
15 | 15 | </p> |
16 | 16 | <?php } |
17 | - if ( ! $revisit && apply_filters( 'FHEE__registration_page_wrapper_template__steps_display', TRUE )) { |
|
17 | + if ( ! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', TRUE)) { |
|
18 | 18 | ?> |
19 | 19 | <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr"><?php _e(' Steps', 'event_espresso'); ?></h2> |
20 | 20 | |
21 | 21 | <div id="spco-steps-display-dv"> |
22 | 22 | <?php |
23 | 23 | $step_nmbr = 1; |
24 | - $total_steps = count( $reg_steps ) - 1; |
|
25 | - foreach ( $reg_steps as $reg_step ) { |
|
26 | - if ( $reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration' ) { |
|
24 | + $total_steps = count($reg_steps) - 1; |
|
25 | + foreach ($reg_steps as $reg_step) { |
|
26 | + if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
27 | 27 | $slug = $reg_step->slug(); |
28 | 28 | $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step'; |
29 | 29 | ?> |
30 | 30 | <div id="spco-step-<?php echo $slug; ?>-display-dv" class="spco-step-display-dv <?php echo $step_display_dv_class; ?> steps-<?php echo $total_steps; ?>"> |
31 | 31 | <h4 id="spco-step-<?php echo $slug; ?>-display-hdr" class="spco-steps-display-hdr"> |
32 | - <span class="spco-step-big-nmbr"><?php echo $step_nmbr; ?></span> <span class="spco-step-name"><?php echo str_replace( ' ', '<br/> ', $reg_step->name() ); ?></span> |
|
32 | + <span class="spco-step-big-nmbr"><?php echo $step_nmbr; ?></span> <span class="spco-step-name"><?php echo str_replace(' ', '<br/> ', $reg_step->name()); ?></span> |
|
33 | 33 | </h4> |
34 | 34 | </div> |
35 | 35 | |
36 | - <?php if ( $step_nmbr < $total_steps ) { ?> |
|
36 | + <?php if ($step_nmbr < $total_steps) { ?> |
|
37 | 37 | <div class="spco-step-arrow-dv">»</div> |
38 | 38 | <?php |
39 | 39 | } |
@@ -47,25 +47,25 @@ discard block |
||
47 | 47 | <?php |
48 | 48 | } |
49 | 49 | |
50 | - do_action( 'AHEE__SPCO__before_registration_steps' ); |
|
50 | + do_action('AHEE__SPCO__before_registration_steps'); |
|
51 | 51 | $step_nmbr = 1; |
52 | - foreach ( $reg_steps as $reg_step ) { |
|
53 | - if ( $reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration' ) { |
|
52 | + foreach ($reg_steps as $reg_step) { |
|
53 | + if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') { |
|
54 | 54 | $slug = $reg_step->slug(); |
55 | - do_action( 'AHEE__' . $slug . '__reg_step_start', $reg_step ); |
|
55 | + do_action('AHEE__'.$slug.'__reg_step_start', $reg_step); |
|
56 | 56 | // todo: deprecate hook AHEE__registration_page_attendee_information__start |
57 | 57 | ?> |
58 | 58 | <div id="spco-<?php echo $slug; ?>-dv" class="spco-step-dv <?php echo $reg_step->div_class(); ?>"> |
59 | 59 | <?php echo $reg_step->display_reg_form(); ?> |
60 | - <?php do_action( 'AHEE__SPCO_after_reg_step_form', $slug, $next_step ); ?> |
|
60 | + <?php do_action('AHEE__SPCO_after_reg_step_form', $slug, $next_step); ?> |
|
61 | 61 | </div> |
62 | 62 | <?php $step_nmbr++; |
63 | 63 | } |
64 | 64 | } |
65 | - do_action( 'AHEE__SPCO__after_registration_steps' ); |
|
65 | + do_action('AHEE__SPCO__after_registration_steps'); |
|
66 | 66 | printf( |
67 | 67 | esc_html__('%1$scancel registration%2$s', 'event_espresso'), |
68 | - '<a class="small-text float-right" href="' . $cancel_page_url . '">', |
|
68 | + '<a class="small-text float-right" href="'.$cancel_page_url.'">', |
|
69 | 69 | '</a><br class="clear"/><br />' |
70 | 70 | ); |
71 | 71 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | <?php echo $cookies_not_set_msg; ?> |
77 | 77 | <?php |
78 | 78 | } |
79 | -do_action( 'AHEE__SPCO__reg_form_footer' ); |
|
79 | +do_action('AHEE__SPCO__reg_form_footer'); |
|
80 | 80 | ?> |
81 | 81 | |
82 | 82 | </div> |
@@ -8,34 +8,34 @@ |
||
8 | 8 | ?> |
9 | 9 | |
10 | 10 | <h4 id="reg-page-totals-hdr" class=""> |
11 | - <span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count;?> |
|
11 | + <span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count; ?> |
|
12 | 12 | </h4> |
13 | 13 | |
14 | 14 | <div class="spco-payment-info-dv"> |
15 | 15 | <table id="spco-payment-info-table"> |
16 | 16 | <thead> |
17 | 17 | <tr> |
18 | - <th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th> |
|
19 | - <th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th> |
|
20 | - <th scope="col" width="5%" class="jst-cntr"><?php _e( 'Qty', 'event_espresso' ); ?></th> |
|
21 | - <th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th> |
|
22 | - <?php do_action( 'AHEE__registration_page_payment_options__payment_info_table_thead_row_end' ); ?> |
|
18 | + <th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th> |
|
19 | + <th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th> |
|
20 | + <th scope="col" width="5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th> |
|
21 | + <th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th> |
|
22 | + <?php do_action('AHEE__registration_page_payment_options__payment_info_table_thead_row_end'); ?> |
|
23 | 23 | </tr> |
24 | 24 | </thead> |
25 | 25 | <tbody> |
26 | - <?php echo $transaction_details;?> |
|
27 | - <?php do_action( 'AHEE__registration_page_payment_options__payment_info_table_tbody_end' ); ?> |
|
26 | + <?php echo $transaction_details; ?> |
|
27 | + <?php do_action('AHEE__registration_page_payment_options__payment_info_table_tbody_end'); ?> |
|
28 | 28 | </tbody> |
29 | 29 | </table> |
30 | 30 | </div> |
31 | 31 | <div class="clear-float"> </div> |
32 | 32 | |
33 | - <?php echo $before_payment_options; ?> |
|
33 | + <?php echo $before_payment_options; ?> |
|
34 | 34 | |
35 | 35 | <div id="methods-of-payment"> |
36 | 36 | <?php echo $payment_options; ?> |
37 | 37 | </div> |
38 | 38 | <!-- end #methods-of-payment --> |
39 | 39 | |
40 | - <?php echo $after_payment_options; ?> |
|
40 | + <?php echo $after_payment_options; ?> |
|
41 | 41 |