@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <h3><?php _e('Transaction Details', 'event_espresso'); ?></h3> |
2 | -<?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_heading' ); ?> |
|
2 | +<?php do_action('AHEE__thank_you_page_transaction_details_template__after_heading'); ?> |
|
3 | 3 | |
4 | 4 | <div id="espresso-thank-you-page-transaction-details-dv"> |
5 | 5 | <table class='ee-table'> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <label><?php _e('Total Cost: ', 'event_espresso'); ?></label> |
10 | 10 | </td> |
11 | 11 | <td> |
12 | - <?php echo EEH_Template::format_currency( $transaction->total() ); ?> |
|
12 | + <?php echo EEH_Template::format_currency($transaction->total()); ?> |
|
13 | 13 | </td> |
14 | 14 | </tr> |
15 | 15 | <tr> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <label><?php _e('Amount Owing: ', 'event_espresso'); ?></label> |
18 | 18 | </td> |
19 | 19 | <td class="<?php echo ($transaction->paid() == $transaction->total()) ? 'ee-transaction-paid' : 'ee-transaction-unpaid' ?>"> |
20 | - <?php echo EEH_Template::format_currency( $transaction->remaining() ); ?> |
|
20 | + <?php echo EEH_Template::format_currency($transaction->remaining()); ?> |
|
21 | 21 | </td> |
22 | 22 | </tr> |
23 | 23 | <tr> |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | <label><?php _e('Transaction Status: ', 'event_espresso'); ?></label> |
26 | 26 | </td> |
27 | 27 | <td> |
28 | - <?php $transaction->e_pretty_status( TRUE ); |
|
29 | - if ( $show_try_pay_again_link && ! $transaction->is_completed() ) { ?> |
|
28 | + <?php $transaction->e_pretty_status(TRUE); |
|
29 | + if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
30 | 30 | <span class="small-text"><a href='<?php echo $SPCO_payment_options_url?>'><?php _e('View Payment Options', 'event_espresso'); ?></a></span> |
31 | 31 | <?php } ?> |
32 | 32 | </td> |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | <?php echo $primary_registrant_name; ?> |
40 | 40 | </td> |
41 | 41 | </tr> |
42 | - <?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', $transaction ); ?> |
|
42 | + <?php do_action('AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', $transaction); ?> |
|
43 | 43 | </tbody> |
44 | 44 | </table> |
45 | 45 | |
46 | -<?php if ( $show_try_pay_again_link && ! $transaction->is_completed() ) { ?> |
|
46 | +<?php if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
47 | 47 | <p class="small-text jst-rght"> |
48 | 48 | <a href='<?php echo $SPCO_payment_options_url?>'><?php _e("Click here to view Payment Options", 'event_espresso'); ?></a> |
49 | 49 | </p> |
@@ -52,6 +52,6 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php }?> |
54 | 54 | |
55 | - <?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_transaction_details' ); ?> |
|
55 | + <?php do_action('AHEE__thank_you_page_transaction_details_template__after_transaction_details'); ?> |
|
56 | 56 | |
57 | 57 | </div> |
@@ -5,81 +5,81 @@ discard block |
||
5 | 5 | /** @type string $SPCO_attendee_information_url */ |
6 | 6 | ?> |
7 | 7 | <h3 class="ee-registration-details-h3"><?php _e('Registration Details', 'event_espresso'); ?></h3> |
8 | -<?php do_action( 'AHEE__thank_you_page_registration_details_template__after_heading' ); ?> |
|
8 | +<?php do_action('AHEE__thank_you_page_registration_details_template__after_heading'); ?> |
|
9 | 9 | |
10 | 10 | <div class="ee-registration-details-dv"> |
11 | 11 | <?php |
12 | 12 | $registrations = $transaction->registrations(); |
13 | -$registrations = is_array( $registrations ) ? $registrations : array(); |
|
14 | -$reg_count = count( $registrations ); |
|
13 | +$registrations = is_array($registrations) ? $registrations : array(); |
|
14 | +$reg_count = count($registrations); |
|
15 | 15 | $reg_cntr = 0; |
16 | 16 | $event_name = ''; |
17 | 17 | $wait_list = false; |
18 | -foreach ( $registrations as $registration ) { |
|
19 | - if ( $registration instanceof EE_Registration ) { |
|
20 | - if ( $event_name != $registration->event_name() && ! empty( $event_name )) { ?> |
|
18 | +foreach ($registrations as $registration) { |
|
19 | + if ($registration instanceof EE_Registration) { |
|
20 | + if ($event_name != $registration->event_name() && ! empty($event_name)) { ?> |
|
21 | 21 | </tbody> |
22 | 22 | </table> |
23 | 23 | <?php |
24 | 24 | } |
25 | 25 | $reg_cntr++; |
26 | - if ( $event_name != $registration->event_name() ) { |
|
26 | + if ($event_name != $registration->event_name()) { |
|
27 | 27 | ?> |
28 | 28 | <h5> |
29 | - <span class="smaller-text grey-text"><?php _e('for','event_espresso');?>: </span> <?php echo htmlentities( $registration->event_name(), ENT_QUOTES, 'UTF-8' );?> |
|
29 | + <span class="smaller-text grey-text"><?php _e('for', 'event_espresso'); ?>: </span> <?php echo htmlentities($registration->event_name(), ENT_QUOTES, 'UTF-8'); ?> |
|
30 | 30 | </h5> |
31 | 31 | <table class='ee-table ee-registrations-list'> |
32 | 32 | <thead> |
33 | 33 | <tr> |
34 | 34 | <th width="40%"> |
35 | - <?php _e("Registrant Name",'event_espresso')?> |
|
35 | + <?php _e("Registrant Name", 'event_espresso')?> |
|
36 | 36 | </th> |
37 | 37 | <th width="25%" class="jst-left"> |
38 | - <?php _e("REG Code",'event_espresso');?> |
|
38 | + <?php _e("REG Code", 'event_espresso'); ?> |
|
39 | 39 | </th> |
40 | 40 | <th width="35%" class="jst-left"> |
41 | - <?php _e("REG Status",'event_espresso');?> |
|
41 | + <?php _e("REG Status", 'event_espresso'); ?> |
|
42 | 42 | </th> |
43 | 43 | </tr> |
44 | 44 | </thead> |
45 | 45 | <tbody> |
46 | 46 | <?php |
47 | 47 | } |
48 | - if ( $is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link() )) { ?> |
|
48 | + if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?> |
|
49 | 49 | <tr> |
50 | 50 | <td width="40%"> |
51 | 51 | <?php |
52 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
53 | - echo $registration->attendee()->full_name( TRUE ); |
|
52 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
53 | + echo $registration->attendee()->full_name(TRUE); |
|
54 | 54 | } |
55 | 55 | ?> |
56 | 56 | <p class="tiny-text" style="margin: .75em 0 0;"> |
57 | 57 | <?php |
58 | - if ( $registration->count_question_groups() ) { |
|
58 | + if ($registration->count_question_groups()) { |
|
59 | 59 | ?> |
60 | - <a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url();?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso');?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso');?></a> |
|
60 | + <a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url(); ?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso'); ?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso'); ?></a> |
|
61 | 61 | <?php } ?> |
62 | - <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg( array( 'token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true' ), EE_Registry::instance()->CFG->core->thank_you_page_url() );?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso');?>" rel="<?php echo $registration->reg_url_link();?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso');?></a> |
|
62 | + <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg(array('token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true'), EE_Registry::instance()->CFG->core->thank_you_page_url()); ?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso'); ?>" rel="<?php echo $registration->reg_url_link(); ?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso'); ?></a> |
|
63 | 63 | </p> |
64 | 64 | </td> |
65 | 65 | <td width="25%" class="jst-left"> |
66 | 66 | <?php $registration->e('REG_code') ?> |
67 | 67 | </td> |
68 | 68 | <td width="35%" class="jst-left"> |
69 | - <?php $registration->e_pretty_status( TRUE )?> |
|
69 | + <?php $registration->e_pretty_status(TRUE)?> |
|
70 | 70 | <?php |
71 | - if ( $registration->status_ID() === EEM_Registration::status_id_wait_list ) { |
|
71 | + if ($registration->status_ID() === EEM_Registration::status_id_wait_list) { |
|
72 | 72 | $wait_list = true; |
73 | 73 | } |
74 | 74 | ?> |
75 | 75 | </td> |
76 | 76 | </tr> |
77 | - <?php do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration ); ?> |
|
77 | + <?php do_action('AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration); ?> |
|
78 | 78 | <?php |
79 | 79 | $event_name = $registration->event_name(); |
80 | 80 | |
81 | 81 | } |
82 | - if ( $reg_cntr >= $reg_count ) { |
|
82 | + if ($reg_cntr >= $reg_count) { |
|
83 | 83 | ?> |
84 | 84 | </tbody> |
85 | 85 | </table> |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | ?> |
91 | -<?php if ( $is_primary && $SPCO_attendee_information_url ) { ?> |
|
91 | +<?php if ($is_primary && $SPCO_attendee_information_url) { ?> |
|
92 | 92 | <p class="small-text jst-rght"> |
93 | 93 | <a href='<?php echo $SPCO_attendee_information_url?>'><?php _e("Click here to edit All Attendee Information", 'event_espresso'); ?></a> |
94 | 94 | </p> |
95 | 95 | <?php } ?> |
96 | - <?php if ( $wait_list ) { ?> |
|
96 | + <?php if ($wait_list) { ?> |
|
97 | 97 | |
98 | 98 | <?php |
99 | 99 | echo apply_filters( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | <?php } ?> |
114 | 114 | |
115 | 115 | |
116 | - <?php do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_details' ); ?> |
|
116 | + <?php do_action('AHEE__thank_you_page_registration_details_template__after_registration_details'); ?> |
|
117 | 117 | |
118 | 118 | </div> |
119 | 119 | <!-- end of .registration-details --> |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public static function set_definitions() |
143 | 143 | { |
144 | - define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
145 | - define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
144 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
145 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | { |
334 | 334 | wp_register_script( |
335 | 335 | 'thank_you_page', |
336 | - THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
336 | + THANK_YOU_ASSETS_URL.'thank_you_page.js', |
|
337 | 337 | array('espresso_core', 'heartbeat'), |
338 | 338 | EVENT_ESPRESSO_VERSION, |
339 | 339 | true |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $this->_get_reg_url_link(); |
355 | 355 | if ( ! $this->get_txn()) { |
356 | 356 | echo EEH_HTML::div( |
357 | - EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') . |
|
357 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', ''). |
|
358 | 358 | sprintf( |
359 | 359 | __( |
360 | 360 | 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
470 | 470 | } |
471 | 471 | return EEH_Template::locate_template( |
472 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
472 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', |
|
473 | 473 | $template_args, |
474 | 474 | true, |
475 | 475 | true |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | '$SPCO_attendee_information_url' |
637 | 637 | ); |
638 | 638 | echo EEH_Template::locate_template( |
639 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
639 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', |
|
640 | 640 | $template_args, |
641 | 641 | true, |
642 | 642 | true |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | '$SPCO_payment_options_url' |
845 | 845 | ); |
846 | 846 | return EEH_Template::locate_template( |
847 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
847 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', |
|
848 | 848 | $template_args, |
849 | 849 | true, |
850 | 850 | true |
@@ -875,25 +875,25 @@ discard block |
||
875 | 875 | $payment->set_status(EEM_Payment::status_id_pending); |
876 | 876 | } |
877 | 877 | $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
878 | - ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' |
|
878 | + ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>' |
|
879 | 879 | : ''; |
880 | 880 | $html .= ' |
881 | 881 | <tr> |
882 | 882 | <td> |
883 | - ' . $payment->timestamp() . ' |
|
883 | + ' . $payment->timestamp().' |
|
884 | 884 | </td> |
885 | 885 | <td> |
886 | 886 | ' . ( |
887 | 887 | $payment->payment_method() instanceof EE_Payment_Method |
888 | 888 | ? $payment->payment_method()->name() |
889 | 889 | : __('Unknown', 'event_espresso') |
890 | - ) . ' |
|
890 | + ).' |
|
891 | 891 | </td> |
892 | 892 | <td class="jst-rght"> |
893 | - ' . EEH_Template::format_currency($payment->amount()) . ' |
|
893 | + ' . EEH_Template::format_currency($payment->amount()).' |
|
894 | 894 | </td> |
895 | 895 | <td class="jst-rght" style="line-height:1;"> |
896 | - ' . $payment->pretty_status(true) . $payment_declined_msg . ' |
|
896 | + ' . $payment->pretty_status(true).$payment_declined_msg.' |
|
897 | 897 | </td> |
898 | 898 | </tr>'; |
899 | 899 | do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | '$SPCO_payment_options_url' |
953 | 953 | ); |
954 | 954 | return EEH_Template::locate_template( |
955 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
955 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', |
|
956 | 956 | $template_args, |
957 | 957 | true, |
958 | 958 | true |
@@ -14,757 +14,757 @@ discard block |
||
14 | 14 | class EED_Thank_You_Page extends EED_Module |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes ) |
|
19 | - */ |
|
20 | - const IPN_wait_time = 1200; |
|
21 | - |
|
22 | - /** |
|
23 | - * The transaction specified by the reg_url_link passed from the Request, or from the Session |
|
24 | - * |
|
25 | - * @var EE_Transaction $_current_txn |
|
26 | - */ |
|
27 | - private $_current_txn; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var EE_Registration $_primary_registrant |
|
31 | - */ |
|
32 | - private $_primary_registrant; |
|
33 | - |
|
34 | - /** |
|
35 | - * The reg_url_link passed from the Request, or from the Session |
|
36 | - * |
|
37 | - * @var string $_reg_url_link |
|
38 | - */ |
|
39 | - private $_reg_url_link; |
|
40 | - |
|
41 | - /** |
|
42 | - * whether the incoming reg_url_link is for the primary registrant or not |
|
43 | - * |
|
44 | - * @var boolean $_is_primary |
|
45 | - */ |
|
46 | - private $_is_primary; |
|
47 | - |
|
48 | - /** |
|
49 | - * The URL for revisiting the SPCO attendee information step |
|
50 | - * |
|
51 | - * @var string $_SPCO_attendee_information_url |
|
52 | - */ |
|
53 | - private $_SPCO_attendee_information_url; |
|
54 | - |
|
55 | - /** |
|
56 | - * The URL for revisiting the SPCO payment options step |
|
57 | - * |
|
58 | - * @var string $_SPCO_payment_options_url |
|
59 | - */ |
|
60 | - private $_SPCO_payment_options_url; |
|
61 | - |
|
62 | - /** |
|
63 | - * whether to display the Payment Options link |
|
64 | - * |
|
65 | - * @var boolean $_show_try_pay_again_link |
|
66 | - */ |
|
67 | - private $_show_try_pay_again_link = false; |
|
68 | - |
|
69 | - /** |
|
70 | - * whether payments are allowed at this time |
|
71 | - * |
|
72 | - * @var boolean $_payments_closed |
|
73 | - */ |
|
74 | - private $_payments_closed = false; |
|
75 | - |
|
76 | - /** |
|
77 | - * whether the selected payment method is Bank, Check , Invoice, etc |
|
78 | - * |
|
79 | - * @var boolean $_is_offline_payment_method |
|
80 | - */ |
|
81 | - private $_is_offline_payment_method = true; |
|
82 | - |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * @return EED_Module|EED_Thank_You_Page |
|
87 | - */ |
|
88 | - public static function instance() |
|
89 | - { |
|
90 | - return parent::get_instance(__CLASS__); |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * set_hooks - for hooking into EE Core, modules, etc |
|
96 | - * |
|
97 | - * @return void |
|
98 | - */ |
|
99 | - public static function set_hooks() |
|
100 | - { |
|
101 | - add_action('wp_loaded', array('EED_Thank_You_Page', 'set_definitions'), 2); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * set_hooks_admin - for hooking into EE Admin Core, modules, etc |
|
108 | - * |
|
109 | - * @return void |
|
110 | - */ |
|
111 | - public static function set_hooks_admin() |
|
112 | - { |
|
113 | - // AJAX for IPN monitoring |
|
114 | - add_filter('heartbeat_received', array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), 10, 3); |
|
115 | - add_filter( |
|
116 | - 'heartbeat_nopriv_received', |
|
117 | - array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), |
|
118 | - 10, |
|
119 | - 3 |
|
120 | - ); |
|
121 | - add_action( |
|
122 | - 'wp_ajax_espresso_resend_reg_confirmation_email', |
|
123 | - array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
124 | - 10, |
|
125 | - 2 |
|
126 | - ); |
|
127 | - add_action( |
|
128 | - 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', |
|
129 | - array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
130 | - 10, |
|
131 | - 2 |
|
132 | - ); |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * set_definitions |
|
139 | - * |
|
140 | - * @return void |
|
141 | - */ |
|
142 | - public static function set_definitions() |
|
143 | - { |
|
144 | - define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
145 | - define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * get_txn |
|
152 | - * |
|
153 | - * @return EE_Transaction |
|
154 | - */ |
|
155 | - public function get_txn() |
|
156 | - { |
|
157 | - if ($this->_current_txn instanceof EE_Transaction) { |
|
158 | - return $this->_current_txn; |
|
159 | - } |
|
160 | - $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
161 | - if ( ! $TXN_model instanceof EEM_Transaction) { |
|
162 | - EE_Error::add_error( |
|
163 | - __('The transaction model could not be established.', 'event_espresso'), |
|
164 | - __FILE__, |
|
165 | - __FUNCTION__, |
|
166 | - __LINE__ |
|
167 | - ); |
|
168 | - return null; |
|
169 | - } |
|
170 | - //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
|
171 | - $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
172 | - // verify TXN |
|
173 | - if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
174 | - EE_Error::add_error( |
|
175 | - __( |
|
176 | - 'No transaction information could be retrieved or the transaction data is not of the correct type.', |
|
177 | - 'event_espresso' |
|
178 | - ), |
|
179 | - __FILE__, |
|
180 | - __FUNCTION__, |
|
181 | - __LINE__ |
|
182 | - ); |
|
183 | - return null; |
|
184 | - } |
|
185 | - return $this->_current_txn; |
|
186 | - } |
|
187 | - |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * get_txn_payments |
|
192 | - * |
|
193 | - * @param int $since |
|
194 | - * @return mixed array of EE_Payment || FALSE |
|
195 | - * @throws \EE_Error |
|
196 | - */ |
|
197 | - public function get_txn_payments($since = 0) |
|
198 | - { |
|
199 | - if ( ! $this->get_txn()) { |
|
200 | - return false; |
|
201 | - } |
|
202 | - $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
203 | - if ($since > 0) { |
|
204 | - $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
205 | - } |
|
206 | - // get array of payments with most recent first |
|
207 | - return $this->_current_txn->payments($args); |
|
208 | - } |
|
209 | - |
|
210 | - |
|
211 | - |
|
212 | - /** |
|
213 | - * get_reg_url_link |
|
214 | - * |
|
215 | - * @return void |
|
216 | - */ |
|
217 | - private function _get_reg_url_link() |
|
218 | - { |
|
219 | - if ( ! empty($this->_reg_url_link)) { |
|
220 | - return; |
|
221 | - } |
|
222 | - // only do thank you page stuff if we have a REG_url_link in the url |
|
223 | - if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
224 | - EE_Error::add_error( |
|
225 | - __( |
|
226 | - 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
|
227 | - 'event_espresso' |
|
228 | - ), |
|
229 | - __FILE__, |
|
230 | - __FUNCTION__, |
|
231 | - __LINE__ |
|
232 | - ); |
|
233 | - return; |
|
234 | - } |
|
235 | - // check for reg_url_link |
|
236 | - $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - |
|
241 | - /** |
|
242 | - * set_reg_url_link |
|
243 | - * |
|
244 | - * @param string $reg_url_link |
|
245 | - */ |
|
246 | - public function set_reg_url_link($reg_url_link = null) |
|
247 | - { |
|
248 | - $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - |
|
253 | - /** |
|
254 | - * run - initial module setup |
|
255 | - * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
256 | - * |
|
257 | - * @param WP $WP |
|
258 | - * @return void |
|
259 | - * @throws \EE_Error |
|
260 | - */ |
|
261 | - public function run($WP) |
|
262 | - { |
|
263 | - |
|
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - |
|
268 | - /** |
|
269 | - * load_resources |
|
270 | - * |
|
271 | - * @return void |
|
272 | - * @throws \EE_Error |
|
273 | - */ |
|
274 | - public function load_resources() { |
|
275 | - $this->_get_reg_url_link(); |
|
276 | - // resend_reg_confirmation_email ? |
|
277 | - if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
278 | - EED_Thank_You_Page::resend_reg_confirmation_email(); |
|
279 | - } |
|
280 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
281 | - $this->_translate_strings(); |
|
282 | - // load assets |
|
283 | - add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
284 | - } |
|
285 | - |
|
286 | - |
|
287 | - |
|
288 | - /** |
|
289 | - * load_js |
|
290 | - * |
|
291 | - * @return void |
|
292 | - */ |
|
293 | - protected function _translate_strings() |
|
294 | - { |
|
295 | - EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
296 | - EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
297 | - EE_Registry::$i18n_js_strings['IPN_wait_time'] = EED_Thank_You_Page::IPN_wait_time; |
|
298 | - EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
299 | - EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
300 | - EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __( |
|
301 | - 'checking for new payments...', |
|
302 | - 'event_espresso' |
|
303 | - ); |
|
304 | - EE_Registry::$i18n_js_strings['loading_payment_info'] = __( |
|
305 | - 'loading payment information...', |
|
306 | - 'event_espresso' |
|
307 | - ); |
|
308 | - EE_Registry::$i18n_js_strings['server_error'] = __( |
|
309 | - 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', |
|
310 | - 'event_espresso' |
|
311 | - ); |
|
312 | - EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
313 | - 'EED_Thank_You_Page__load_js__slow_IPN', |
|
314 | - sprintf( |
|
315 | - __( |
|
316 | - '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', |
|
317 | - 'event_espresso' |
|
318 | - ), |
|
319 | - '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
|
320 | - '</div>' |
|
321 | - ) |
|
322 | - ); |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * load_js |
|
329 | - * |
|
330 | - * @return void |
|
331 | - */ |
|
332 | - public function load_js() |
|
333 | - { |
|
334 | - wp_register_script( |
|
335 | - 'thank_you_page', |
|
336 | - THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
337 | - array('espresso_core', 'heartbeat'), |
|
338 | - EVENT_ESPRESSO_VERSION, |
|
339 | - true |
|
340 | - ); |
|
341 | - wp_enqueue_script('thank_you_page'); |
|
342 | - wp_enqueue_style('espresso_default'); |
|
343 | - } |
|
344 | - |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * init |
|
349 | - * |
|
350 | - * @return void |
|
351 | - * @throws \EE_Error |
|
352 | - */ |
|
353 | - public function init() |
|
354 | - { |
|
355 | - $this->_get_reg_url_link(); |
|
356 | - if ( ! $this->get_txn()) { |
|
357 | - echo EEH_HTML::div( |
|
358 | - EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') . |
|
359 | - sprintf( |
|
360 | - __( |
|
361 | - 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', |
|
362 | - 'event_espresso' |
|
363 | - ), |
|
364 | - '<br/>' |
|
365 | - ), |
|
366 | - '', |
|
367 | - 'ee-attention' |
|
368 | - ); |
|
369 | - return null; |
|
370 | - } |
|
371 | - // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
|
372 | - if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) { |
|
373 | - $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
374 | - $this->_current_txn->save(); |
|
375 | - } |
|
376 | - $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration |
|
377 | - ? $this->_current_txn->primary_registration() |
|
378 | - : null; |
|
379 | - $this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link ? true : false; |
|
380 | - $show_try_pay_again_link_default = apply_filters( |
|
381 | - 'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default', |
|
382 | - true |
|
383 | - ); |
|
384 | - $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
385 | - // txn status ? |
|
386 | - if ($this->_current_txn->is_completed()) { |
|
387 | - $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
388 | - } else if ( |
|
389 | - $this->_current_txn->is_incomplete() |
|
390 | - && ($this->_primary_registrant->is_approved() |
|
391 | - || $this->_primary_registrant->is_pending_payment()) |
|
392 | - ) { |
|
393 | - $this->_show_try_pay_again_link = true; |
|
394 | - } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
395 | - // its pending |
|
396 | - $this->_show_try_pay_again_link = isset( |
|
397 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
398 | - ) |
|
399 | - && EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
400 | - ? true |
|
401 | - : $show_try_pay_again_link_default; |
|
402 | - } |
|
403 | - $this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
404 | - ? true |
|
405 | - : false; |
|
406 | - $this->_is_offline_payment_method = false; |
|
407 | - if ( |
|
408 | - // if payment method is unknown |
|
409 | - ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
410 | - || ( |
|
411 | - // or is an offline payment method |
|
412 | - $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
413 | - && $this->_current_txn->payment_method()->is_off_line() |
|
414 | - ) |
|
415 | - ) { |
|
416 | - $this->_is_offline_payment_method = true; |
|
417 | - } |
|
418 | - // link to SPCO |
|
419 | - $revisit_spco_url = add_query_arg( |
|
420 | - array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link), |
|
421 | - EE_Registry::instance()->CFG->core->reg_page_url() |
|
422 | - ); |
|
423 | - // link to SPCO payment_options |
|
424 | - $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration |
|
425 | - ? $this->_primary_registrant->payment_overview_url() |
|
426 | - : add_query_arg( |
|
427 | - array('step' => 'payment_options'), |
|
428 | - $revisit_spco_url |
|
429 | - ); |
|
430 | - // link to SPCO attendee_information |
|
431 | - $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration |
|
432 | - ? $this->_primary_registrant->edit_attendee_information_url() |
|
433 | - : false; |
|
434 | - do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn); |
|
435 | - // set no cache headers and constants |
|
436 | - EE_System::do_not_cache(); |
|
437 | - } |
|
438 | - |
|
439 | - |
|
440 | - |
|
441 | - /** |
|
442 | - * display_thank_you_page_results |
|
443 | - * |
|
444 | - * @return string |
|
445 | - * @throws \EE_Error |
|
446 | - */ |
|
447 | - public function thank_you_page_results() |
|
448 | - { |
|
449 | - $this->init(); |
|
450 | - if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
451 | - return EE_Error::get_notices(); |
|
452 | - } |
|
453 | - // link to receipt |
|
454 | - $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
455 | - if ( ! empty($template_args['TXN_receipt_url'])) { |
|
456 | - $template_args['order_conf_desc'] = __( |
|
457 | - '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', |
|
458 | - 'event_espresso' |
|
459 | - ); |
|
460 | - } else { |
|
461 | - $template_args['order_conf_desc'] = __( |
|
462 | - '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', |
|
463 | - 'event_espresso' |
|
464 | - ); |
|
465 | - } |
|
466 | - $template_args['transaction'] = $this->_current_txn; |
|
467 | - $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false); |
|
468 | - add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
469 | - if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
470 | - add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
471 | - } |
|
472 | - return EEH_Template::locate_template( |
|
473 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
474 | - $template_args, |
|
475 | - true, |
|
476 | - true |
|
477 | - ); |
|
478 | - } |
|
479 | - |
|
480 | - |
|
481 | - |
|
482 | - /** |
|
483 | - * thank_you_page_IPN_monitor |
|
484 | - * this basically just pulls the TXN based on the reg_url_link sent from the server, |
|
485 | - * then checks that the TXN status is not failed, and that no other errors have been generated. |
|
486 | - * it also calculates the IPN wait time since the Thank You page was first loaded |
|
487 | - * |
|
488 | - * @param array $response |
|
489 | - * @param array $data |
|
490 | - * @return array |
|
491 | - * @throws \EE_Error |
|
492 | - */ |
|
493 | - public static function thank_you_page_IPN_monitor($response = array(), $data = array()) |
|
494 | - { |
|
495 | - // does this heartbeat contain our data ? |
|
496 | - if ( ! isset($data['espresso_thank_you_page'])) { |
|
497 | - return $response; |
|
498 | - } |
|
499 | - // check for reg_url_link in the incoming heartbeat data |
|
500 | - if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
501 | - $response['espresso_thank_you_page'] = array( |
|
502 | - 'errors' => ! empty($notices['errors']) |
|
503 | - ? $notices['errors'] |
|
504 | - : __( |
|
505 | - 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
|
506 | - 'event_espresso' |
|
507 | - ) |
|
508 | - ); |
|
509 | - return $response; |
|
510 | - } |
|
511 | - // kk heartbeat has our data |
|
512 | - $response['espresso_thank_you_page'] = array(); |
|
513 | - // set_definitions, instantiate the thank you page class, and get the ball rolling |
|
514 | - EED_Thank_You_Page::set_definitions(); |
|
515 | - /** @var $espresso_thank_you_page EED_Thank_You_Page */ |
|
516 | - $espresso_thank_you_page = EED_Thank_You_Page::instance(); |
|
517 | - $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
518 | - $espresso_thank_you_page->init(); |
|
519 | - //get TXN |
|
520 | - $TXN = $espresso_thank_you_page->get_txn(); |
|
521 | - // no TXN? then get out |
|
522 | - if ( ! $TXN instanceof EE_Transaction) { |
|
523 | - $notices = EE_Error::get_notices(); |
|
524 | - $response['espresso_thank_you_page'] = array( |
|
525 | - 'errors' => ! empty($notices['errors']) |
|
526 | - ? $notices['errors'] |
|
527 | - : sprintf( |
|
528 | - __( |
|
529 | - 'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', |
|
530 | - 'event_espresso' |
|
531 | - ), |
|
532 | - __LINE__ |
|
533 | - ) |
|
534 | - ); |
|
535 | - return $response; |
|
536 | - } |
|
537 | - // grab transient of TXN's status |
|
538 | - $txn_status = isset($data['espresso_thank_you_page']['txn_status']) |
|
539 | - ? $data['espresso_thank_you_page']['txn_status'] |
|
540 | - : null; |
|
541 | - // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
|
542 | - if ($txn_status !== $TXN->status_ID()) { |
|
543 | - // switch between two possible basic outcomes |
|
544 | - switch ($TXN->status_ID()) { |
|
545 | - // TXN has been updated in some way |
|
546 | - case EEM_Transaction::overpaid_status_code: |
|
547 | - case EEM_Transaction::complete_status_code: |
|
548 | - case EEM_Transaction::incomplete_status_code: |
|
549 | - // send updated TXN results back to client, |
|
550 | - $response['espresso_thank_you_page'] = array( |
|
551 | - 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
|
552 | - 'txn_status' => $TXN->status_ID() |
|
553 | - ); |
|
554 | - break; |
|
555 | - // or we have a bad TXN, or really slow IPN, so calculate the wait time and send that back... |
|
556 | - case EEM_Transaction::failed_status_code: |
|
557 | - default: |
|
558 | - // keep on waiting... |
|
559 | - return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
560 | - } |
|
561 | - // or is the TXN still failed (never been updated) ??? |
|
562 | - } else if ($TXN->failed()) { |
|
563 | - // keep on waiting... |
|
564 | - return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
565 | - } |
|
566 | - // TXN is happening so let's get the payments now |
|
567 | - // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
|
568 | - $since = isset($data['espresso_thank_you_page']['get_payments_since']) |
|
569 | - ? $data['espresso_thank_you_page']['get_payments_since'] |
|
570 | - : 0; |
|
571 | - // then check for payments |
|
572 | - $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
573 | - // has a payment been processed ? |
|
574 | - if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
575 | - if ($since) { |
|
576 | - $response['espresso_thank_you_page'] = array( |
|
577 | - 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
578 | - 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
|
579 | - 'txn_status' => $TXN->status_ID() |
|
580 | - ); |
|
581 | - } else { |
|
582 | - $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details( |
|
583 | - $payments |
|
584 | - ); |
|
585 | - } |
|
586 | - // reset time to check for payments |
|
587 | - $response['espresso_thank_you_page']['get_payments_since'] = time(); |
|
588 | - } else { |
|
589 | - $response['espresso_thank_you_page']['get_payments_since'] = $since; |
|
590 | - } |
|
591 | - return $response; |
|
592 | - } |
|
593 | - |
|
594 | - |
|
595 | - |
|
596 | - /** |
|
597 | - * _update_server_wait_time |
|
598 | - * |
|
599 | - * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
|
600 | - * @return array |
|
601 | - * @throws \EE_Error |
|
602 | - */ |
|
603 | - private function _update_server_wait_time($thank_you_page_data = array()) |
|
604 | - { |
|
605 | - $response['espresso_thank_you_page'] = array( |
|
606 | - 'still_waiting' => isset($thank_you_page_data['initial_access']) |
|
607 | - ? time() - $thank_you_page_data['initial_access'] |
|
608 | - : 0, |
|
609 | - 'txn_status' => $this->_current_txn->status_ID() |
|
610 | - ); |
|
611 | - return $response; |
|
612 | - } |
|
613 | - |
|
614 | - |
|
615 | - |
|
616 | - /** |
|
617 | - * get_registration_details |
|
618 | - * |
|
619 | - * @throws \EE_Error |
|
620 | - */ |
|
621 | - public function get_registration_details() |
|
622 | - { |
|
623 | - //prepare variables for displaying |
|
624 | - $template_args = array(); |
|
625 | - $template_args['transaction'] = $this->_current_txn; |
|
626 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
627 | - $template_args['is_primary'] = $this->_is_primary; |
|
628 | - $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
|
629 | - $template_args['resend_reg_confirmation_url'] = add_query_arg( |
|
630 | - array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
631 | - EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
632 | - ); |
|
633 | - // verify template arguments |
|
634 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
635 | - EEH_Template_Validator::verify_isnt_null( |
|
636 | - $template_args['SPCO_attendee_information_url'], |
|
637 | - '$SPCO_attendee_information_url' |
|
638 | - ); |
|
639 | - echo EEH_Template::locate_template( |
|
640 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
641 | - $template_args, |
|
642 | - true, |
|
643 | - true |
|
644 | - ); |
|
645 | - } |
|
646 | - |
|
647 | - |
|
648 | - |
|
649 | - /** |
|
650 | - * resend_reg_confirmation_email |
|
651 | - * |
|
652 | - * @throws \EE_Error |
|
653 | - */ |
|
654 | - public static function resend_reg_confirmation_email() |
|
655 | - { |
|
656 | - EE_Registry::instance()->load_core('Request_Handler'); |
|
657 | - $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
658 | - // was a REG_ID passed ? |
|
659 | - if ($reg_url_link) { |
|
660 | - $registration = EE_Registry::instance()->load_model('Registration')->get_one( |
|
661 | - array(array('REG_url_link' => $reg_url_link)) |
|
662 | - ); |
|
663 | - if ($registration instanceof EE_Registration) { |
|
664 | - // resend email |
|
665 | - EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
666 | - } else { |
|
667 | - EE_Error::add_error( |
|
668 | - __( |
|
669 | - 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', |
|
670 | - 'event_espresso' |
|
671 | - ), |
|
672 | - __FILE__, |
|
673 | - __FUNCTION__, |
|
674 | - __LINE__ |
|
675 | - ); |
|
676 | - } |
|
677 | - } else { |
|
678 | - EE_Error::add_error( |
|
679 | - __( |
|
680 | - 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', |
|
681 | - 'event_espresso' |
|
682 | - ), |
|
683 | - __FILE__, |
|
684 | - __FUNCTION__, |
|
685 | - __LINE__ |
|
686 | - ); |
|
687 | - } |
|
688 | - // request sent via AJAX ? |
|
689 | - if (EE_FRONT_AJAX) { |
|
690 | - echo wp_json_encode(EE_Error::get_notices(false)); |
|
691 | - die(); |
|
692 | - // or was JS disabled ? |
|
693 | - } else { |
|
694 | - // save errors so that they get picked up on the next request |
|
695 | - EE_Error::get_notices(true, true); |
|
696 | - wp_safe_redirect( |
|
697 | - add_query_arg( |
|
698 | - array('e_reg_url_link' => $reg_url_link), |
|
699 | - EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
700 | - ) |
|
701 | - ); |
|
702 | - } |
|
703 | - } |
|
704 | - |
|
705 | - |
|
706 | - |
|
707 | - /** |
|
708 | - * get_ajax_content |
|
709 | - * |
|
710 | - * @return void |
|
711 | - * @throws \EE_Error |
|
712 | - */ |
|
713 | - public function get_ajax_content() |
|
714 | - { |
|
715 | - if ( ! $this->get_txn()) { |
|
716 | - return; |
|
717 | - } |
|
718 | - // first determine which event(s) require pre-approval or not |
|
719 | - $events = array(); |
|
720 | - $events_requiring_pre_approval = array(); |
|
721 | - foreach ($this->_current_txn->registrations() as $registration) { |
|
722 | - if ($registration instanceof EE_Registration) { |
|
723 | - $event = $registration->event(); |
|
724 | - if ($event instanceof EE_Event) { |
|
725 | - if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
726 | - $events_requiring_pre_approval[$event->ID()] = $event; |
|
727 | - } else { |
|
728 | - $events[$event->ID()] = $event; |
|
729 | - } |
|
730 | - } |
|
731 | - } |
|
732 | - } |
|
733 | - $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
734 | - $this->display_details_for_events($events); |
|
735 | - } |
|
736 | - |
|
737 | - |
|
738 | - |
|
739 | - /** |
|
740 | - * display_details_for_events |
|
741 | - * |
|
742 | - * @param EE_Event[] $events |
|
743 | - * @return void |
|
744 | - */ |
|
745 | - public function display_details_for_events($events = array()) |
|
746 | - { |
|
747 | - if ( ! empty($events)) { |
|
748 | - ?> |
|
17 | + /** |
|
18 | + * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes ) |
|
19 | + */ |
|
20 | + const IPN_wait_time = 1200; |
|
21 | + |
|
22 | + /** |
|
23 | + * The transaction specified by the reg_url_link passed from the Request, or from the Session |
|
24 | + * |
|
25 | + * @var EE_Transaction $_current_txn |
|
26 | + */ |
|
27 | + private $_current_txn; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var EE_Registration $_primary_registrant |
|
31 | + */ |
|
32 | + private $_primary_registrant; |
|
33 | + |
|
34 | + /** |
|
35 | + * The reg_url_link passed from the Request, or from the Session |
|
36 | + * |
|
37 | + * @var string $_reg_url_link |
|
38 | + */ |
|
39 | + private $_reg_url_link; |
|
40 | + |
|
41 | + /** |
|
42 | + * whether the incoming reg_url_link is for the primary registrant or not |
|
43 | + * |
|
44 | + * @var boolean $_is_primary |
|
45 | + */ |
|
46 | + private $_is_primary; |
|
47 | + |
|
48 | + /** |
|
49 | + * The URL for revisiting the SPCO attendee information step |
|
50 | + * |
|
51 | + * @var string $_SPCO_attendee_information_url |
|
52 | + */ |
|
53 | + private $_SPCO_attendee_information_url; |
|
54 | + |
|
55 | + /** |
|
56 | + * The URL for revisiting the SPCO payment options step |
|
57 | + * |
|
58 | + * @var string $_SPCO_payment_options_url |
|
59 | + */ |
|
60 | + private $_SPCO_payment_options_url; |
|
61 | + |
|
62 | + /** |
|
63 | + * whether to display the Payment Options link |
|
64 | + * |
|
65 | + * @var boolean $_show_try_pay_again_link |
|
66 | + */ |
|
67 | + private $_show_try_pay_again_link = false; |
|
68 | + |
|
69 | + /** |
|
70 | + * whether payments are allowed at this time |
|
71 | + * |
|
72 | + * @var boolean $_payments_closed |
|
73 | + */ |
|
74 | + private $_payments_closed = false; |
|
75 | + |
|
76 | + /** |
|
77 | + * whether the selected payment method is Bank, Check , Invoice, etc |
|
78 | + * |
|
79 | + * @var boolean $_is_offline_payment_method |
|
80 | + */ |
|
81 | + private $_is_offline_payment_method = true; |
|
82 | + |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * @return EED_Module|EED_Thank_You_Page |
|
87 | + */ |
|
88 | + public static function instance() |
|
89 | + { |
|
90 | + return parent::get_instance(__CLASS__); |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * set_hooks - for hooking into EE Core, modules, etc |
|
96 | + * |
|
97 | + * @return void |
|
98 | + */ |
|
99 | + public static function set_hooks() |
|
100 | + { |
|
101 | + add_action('wp_loaded', array('EED_Thank_You_Page', 'set_definitions'), 2); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * set_hooks_admin - for hooking into EE Admin Core, modules, etc |
|
108 | + * |
|
109 | + * @return void |
|
110 | + */ |
|
111 | + public static function set_hooks_admin() |
|
112 | + { |
|
113 | + // AJAX for IPN monitoring |
|
114 | + add_filter('heartbeat_received', array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), 10, 3); |
|
115 | + add_filter( |
|
116 | + 'heartbeat_nopriv_received', |
|
117 | + array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), |
|
118 | + 10, |
|
119 | + 3 |
|
120 | + ); |
|
121 | + add_action( |
|
122 | + 'wp_ajax_espresso_resend_reg_confirmation_email', |
|
123 | + array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
124 | + 10, |
|
125 | + 2 |
|
126 | + ); |
|
127 | + add_action( |
|
128 | + 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', |
|
129 | + array('EED_Thank_You_Page', 'resend_reg_confirmation_email'), |
|
130 | + 10, |
|
131 | + 2 |
|
132 | + ); |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * set_definitions |
|
139 | + * |
|
140 | + * @return void |
|
141 | + */ |
|
142 | + public static function set_definitions() |
|
143 | + { |
|
144 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
145 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * get_txn |
|
152 | + * |
|
153 | + * @return EE_Transaction |
|
154 | + */ |
|
155 | + public function get_txn() |
|
156 | + { |
|
157 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
158 | + return $this->_current_txn; |
|
159 | + } |
|
160 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
161 | + if ( ! $TXN_model instanceof EEM_Transaction) { |
|
162 | + EE_Error::add_error( |
|
163 | + __('The transaction model could not be established.', 'event_espresso'), |
|
164 | + __FILE__, |
|
165 | + __FUNCTION__, |
|
166 | + __LINE__ |
|
167 | + ); |
|
168 | + return null; |
|
169 | + } |
|
170 | + //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
|
171 | + $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
172 | + // verify TXN |
|
173 | + if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
174 | + EE_Error::add_error( |
|
175 | + __( |
|
176 | + 'No transaction information could be retrieved or the transaction data is not of the correct type.', |
|
177 | + 'event_espresso' |
|
178 | + ), |
|
179 | + __FILE__, |
|
180 | + __FUNCTION__, |
|
181 | + __LINE__ |
|
182 | + ); |
|
183 | + return null; |
|
184 | + } |
|
185 | + return $this->_current_txn; |
|
186 | + } |
|
187 | + |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * get_txn_payments |
|
192 | + * |
|
193 | + * @param int $since |
|
194 | + * @return mixed array of EE_Payment || FALSE |
|
195 | + * @throws \EE_Error |
|
196 | + */ |
|
197 | + public function get_txn_payments($since = 0) |
|
198 | + { |
|
199 | + if ( ! $this->get_txn()) { |
|
200 | + return false; |
|
201 | + } |
|
202 | + $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
203 | + if ($since > 0) { |
|
204 | + $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
205 | + } |
|
206 | + // get array of payments with most recent first |
|
207 | + return $this->_current_txn->payments($args); |
|
208 | + } |
|
209 | + |
|
210 | + |
|
211 | + |
|
212 | + /** |
|
213 | + * get_reg_url_link |
|
214 | + * |
|
215 | + * @return void |
|
216 | + */ |
|
217 | + private function _get_reg_url_link() |
|
218 | + { |
|
219 | + if ( ! empty($this->_reg_url_link)) { |
|
220 | + return; |
|
221 | + } |
|
222 | + // only do thank you page stuff if we have a REG_url_link in the url |
|
223 | + if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
224 | + EE_Error::add_error( |
|
225 | + __( |
|
226 | + 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
|
227 | + 'event_espresso' |
|
228 | + ), |
|
229 | + __FILE__, |
|
230 | + __FUNCTION__, |
|
231 | + __LINE__ |
|
232 | + ); |
|
233 | + return; |
|
234 | + } |
|
235 | + // check for reg_url_link |
|
236 | + $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + |
|
241 | + /** |
|
242 | + * set_reg_url_link |
|
243 | + * |
|
244 | + * @param string $reg_url_link |
|
245 | + */ |
|
246 | + public function set_reg_url_link($reg_url_link = null) |
|
247 | + { |
|
248 | + $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + |
|
253 | + /** |
|
254 | + * run - initial module setup |
|
255 | + * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
256 | + * |
|
257 | + * @param WP $WP |
|
258 | + * @return void |
|
259 | + * @throws \EE_Error |
|
260 | + */ |
|
261 | + public function run($WP) |
|
262 | + { |
|
263 | + |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + |
|
268 | + /** |
|
269 | + * load_resources |
|
270 | + * |
|
271 | + * @return void |
|
272 | + * @throws \EE_Error |
|
273 | + */ |
|
274 | + public function load_resources() { |
|
275 | + $this->_get_reg_url_link(); |
|
276 | + // resend_reg_confirmation_email ? |
|
277 | + if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
278 | + EED_Thank_You_Page::resend_reg_confirmation_email(); |
|
279 | + } |
|
280 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
281 | + $this->_translate_strings(); |
|
282 | + // load assets |
|
283 | + add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
284 | + } |
|
285 | + |
|
286 | + |
|
287 | + |
|
288 | + /** |
|
289 | + * load_js |
|
290 | + * |
|
291 | + * @return void |
|
292 | + */ |
|
293 | + protected function _translate_strings() |
|
294 | + { |
|
295 | + EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
296 | + EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
297 | + EE_Registry::$i18n_js_strings['IPN_wait_time'] = EED_Thank_You_Page::IPN_wait_time; |
|
298 | + EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
299 | + EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
300 | + EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __( |
|
301 | + 'checking for new payments...', |
|
302 | + 'event_espresso' |
|
303 | + ); |
|
304 | + EE_Registry::$i18n_js_strings['loading_payment_info'] = __( |
|
305 | + 'loading payment information...', |
|
306 | + 'event_espresso' |
|
307 | + ); |
|
308 | + EE_Registry::$i18n_js_strings['server_error'] = __( |
|
309 | + 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', |
|
310 | + 'event_espresso' |
|
311 | + ); |
|
312 | + EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
313 | + 'EED_Thank_You_Page__load_js__slow_IPN', |
|
314 | + sprintf( |
|
315 | + __( |
|
316 | + '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', |
|
317 | + 'event_espresso' |
|
318 | + ), |
|
319 | + '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
|
320 | + '</div>' |
|
321 | + ) |
|
322 | + ); |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * load_js |
|
329 | + * |
|
330 | + * @return void |
|
331 | + */ |
|
332 | + public function load_js() |
|
333 | + { |
|
334 | + wp_register_script( |
|
335 | + 'thank_you_page', |
|
336 | + THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
337 | + array('espresso_core', 'heartbeat'), |
|
338 | + EVENT_ESPRESSO_VERSION, |
|
339 | + true |
|
340 | + ); |
|
341 | + wp_enqueue_script('thank_you_page'); |
|
342 | + wp_enqueue_style('espresso_default'); |
|
343 | + } |
|
344 | + |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * init |
|
349 | + * |
|
350 | + * @return void |
|
351 | + * @throws \EE_Error |
|
352 | + */ |
|
353 | + public function init() |
|
354 | + { |
|
355 | + $this->_get_reg_url_link(); |
|
356 | + if ( ! $this->get_txn()) { |
|
357 | + echo EEH_HTML::div( |
|
358 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') . |
|
359 | + sprintf( |
|
360 | + __( |
|
361 | + 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', |
|
362 | + 'event_espresso' |
|
363 | + ), |
|
364 | + '<br/>' |
|
365 | + ), |
|
366 | + '', |
|
367 | + 'ee-attention' |
|
368 | + ); |
|
369 | + return null; |
|
370 | + } |
|
371 | + // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
|
372 | + if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) { |
|
373 | + $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
374 | + $this->_current_txn->save(); |
|
375 | + } |
|
376 | + $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration |
|
377 | + ? $this->_current_txn->primary_registration() |
|
378 | + : null; |
|
379 | + $this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link ? true : false; |
|
380 | + $show_try_pay_again_link_default = apply_filters( |
|
381 | + 'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default', |
|
382 | + true |
|
383 | + ); |
|
384 | + $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
385 | + // txn status ? |
|
386 | + if ($this->_current_txn->is_completed()) { |
|
387 | + $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
|
388 | + } else if ( |
|
389 | + $this->_current_txn->is_incomplete() |
|
390 | + && ($this->_primary_registrant->is_approved() |
|
391 | + || $this->_primary_registrant->is_pending_payment()) |
|
392 | + ) { |
|
393 | + $this->_show_try_pay_again_link = true; |
|
394 | + } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
395 | + // its pending |
|
396 | + $this->_show_try_pay_again_link = isset( |
|
397 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
398 | + ) |
|
399 | + && EE_Registry::instance()->CFG->registration->show_pending_payment_options |
|
400 | + ? true |
|
401 | + : $show_try_pay_again_link_default; |
|
402 | + } |
|
403 | + $this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
404 | + ? true |
|
405 | + : false; |
|
406 | + $this->_is_offline_payment_method = false; |
|
407 | + if ( |
|
408 | + // if payment method is unknown |
|
409 | + ! $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
410 | + || ( |
|
411 | + // or is an offline payment method |
|
412 | + $this->_current_txn->payment_method() instanceof EE_Payment_Method |
|
413 | + && $this->_current_txn->payment_method()->is_off_line() |
|
414 | + ) |
|
415 | + ) { |
|
416 | + $this->_is_offline_payment_method = true; |
|
417 | + } |
|
418 | + // link to SPCO |
|
419 | + $revisit_spco_url = add_query_arg( |
|
420 | + array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link), |
|
421 | + EE_Registry::instance()->CFG->core->reg_page_url() |
|
422 | + ); |
|
423 | + // link to SPCO payment_options |
|
424 | + $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration |
|
425 | + ? $this->_primary_registrant->payment_overview_url() |
|
426 | + : add_query_arg( |
|
427 | + array('step' => 'payment_options'), |
|
428 | + $revisit_spco_url |
|
429 | + ); |
|
430 | + // link to SPCO attendee_information |
|
431 | + $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration |
|
432 | + ? $this->_primary_registrant->edit_attendee_information_url() |
|
433 | + : false; |
|
434 | + do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn); |
|
435 | + // set no cache headers and constants |
|
436 | + EE_System::do_not_cache(); |
|
437 | + } |
|
438 | + |
|
439 | + |
|
440 | + |
|
441 | + /** |
|
442 | + * display_thank_you_page_results |
|
443 | + * |
|
444 | + * @return string |
|
445 | + * @throws \EE_Error |
|
446 | + */ |
|
447 | + public function thank_you_page_results() |
|
448 | + { |
|
449 | + $this->init(); |
|
450 | + if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
451 | + return EE_Error::get_notices(); |
|
452 | + } |
|
453 | + // link to receipt |
|
454 | + $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
455 | + if ( ! empty($template_args['TXN_receipt_url'])) { |
|
456 | + $template_args['order_conf_desc'] = __( |
|
457 | + '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', |
|
458 | + 'event_espresso' |
|
459 | + ); |
|
460 | + } else { |
|
461 | + $template_args['order_conf_desc'] = __( |
|
462 | + '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', |
|
463 | + 'event_espresso' |
|
464 | + ); |
|
465 | + } |
|
466 | + $template_args['transaction'] = $this->_current_txn; |
|
467 | + $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false); |
|
468 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
469 | + if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
470 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
471 | + } |
|
472 | + return EEH_Template::locate_template( |
|
473 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
474 | + $template_args, |
|
475 | + true, |
|
476 | + true |
|
477 | + ); |
|
478 | + } |
|
479 | + |
|
480 | + |
|
481 | + |
|
482 | + /** |
|
483 | + * thank_you_page_IPN_monitor |
|
484 | + * this basically just pulls the TXN based on the reg_url_link sent from the server, |
|
485 | + * then checks that the TXN status is not failed, and that no other errors have been generated. |
|
486 | + * it also calculates the IPN wait time since the Thank You page was first loaded |
|
487 | + * |
|
488 | + * @param array $response |
|
489 | + * @param array $data |
|
490 | + * @return array |
|
491 | + * @throws \EE_Error |
|
492 | + */ |
|
493 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) |
|
494 | + { |
|
495 | + // does this heartbeat contain our data ? |
|
496 | + if ( ! isset($data['espresso_thank_you_page'])) { |
|
497 | + return $response; |
|
498 | + } |
|
499 | + // check for reg_url_link in the incoming heartbeat data |
|
500 | + if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
501 | + $response['espresso_thank_you_page'] = array( |
|
502 | + 'errors' => ! empty($notices['errors']) |
|
503 | + ? $notices['errors'] |
|
504 | + : __( |
|
505 | + 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
|
506 | + 'event_espresso' |
|
507 | + ) |
|
508 | + ); |
|
509 | + return $response; |
|
510 | + } |
|
511 | + // kk heartbeat has our data |
|
512 | + $response['espresso_thank_you_page'] = array(); |
|
513 | + // set_definitions, instantiate the thank you page class, and get the ball rolling |
|
514 | + EED_Thank_You_Page::set_definitions(); |
|
515 | + /** @var $espresso_thank_you_page EED_Thank_You_Page */ |
|
516 | + $espresso_thank_you_page = EED_Thank_You_Page::instance(); |
|
517 | + $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
518 | + $espresso_thank_you_page->init(); |
|
519 | + //get TXN |
|
520 | + $TXN = $espresso_thank_you_page->get_txn(); |
|
521 | + // no TXN? then get out |
|
522 | + if ( ! $TXN instanceof EE_Transaction) { |
|
523 | + $notices = EE_Error::get_notices(); |
|
524 | + $response['espresso_thank_you_page'] = array( |
|
525 | + 'errors' => ! empty($notices['errors']) |
|
526 | + ? $notices['errors'] |
|
527 | + : sprintf( |
|
528 | + __( |
|
529 | + 'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', |
|
530 | + 'event_espresso' |
|
531 | + ), |
|
532 | + __LINE__ |
|
533 | + ) |
|
534 | + ); |
|
535 | + return $response; |
|
536 | + } |
|
537 | + // grab transient of TXN's status |
|
538 | + $txn_status = isset($data['espresso_thank_you_page']['txn_status']) |
|
539 | + ? $data['espresso_thank_you_page']['txn_status'] |
|
540 | + : null; |
|
541 | + // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
|
542 | + if ($txn_status !== $TXN->status_ID()) { |
|
543 | + // switch between two possible basic outcomes |
|
544 | + switch ($TXN->status_ID()) { |
|
545 | + // TXN has been updated in some way |
|
546 | + case EEM_Transaction::overpaid_status_code: |
|
547 | + case EEM_Transaction::complete_status_code: |
|
548 | + case EEM_Transaction::incomplete_status_code: |
|
549 | + // send updated TXN results back to client, |
|
550 | + $response['espresso_thank_you_page'] = array( |
|
551 | + 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
|
552 | + 'txn_status' => $TXN->status_ID() |
|
553 | + ); |
|
554 | + break; |
|
555 | + // or we have a bad TXN, or really slow IPN, so calculate the wait time and send that back... |
|
556 | + case EEM_Transaction::failed_status_code: |
|
557 | + default: |
|
558 | + // keep on waiting... |
|
559 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
560 | + } |
|
561 | + // or is the TXN still failed (never been updated) ??? |
|
562 | + } else if ($TXN->failed()) { |
|
563 | + // keep on waiting... |
|
564 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
565 | + } |
|
566 | + // TXN is happening so let's get the payments now |
|
567 | + // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
|
568 | + $since = isset($data['espresso_thank_you_page']['get_payments_since']) |
|
569 | + ? $data['espresso_thank_you_page']['get_payments_since'] |
|
570 | + : 0; |
|
571 | + // then check for payments |
|
572 | + $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
573 | + // has a payment been processed ? |
|
574 | + if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
575 | + if ($since) { |
|
576 | + $response['espresso_thank_you_page'] = array( |
|
577 | + 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
578 | + 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
|
579 | + 'txn_status' => $TXN->status_ID() |
|
580 | + ); |
|
581 | + } else { |
|
582 | + $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details( |
|
583 | + $payments |
|
584 | + ); |
|
585 | + } |
|
586 | + // reset time to check for payments |
|
587 | + $response['espresso_thank_you_page']['get_payments_since'] = time(); |
|
588 | + } else { |
|
589 | + $response['espresso_thank_you_page']['get_payments_since'] = $since; |
|
590 | + } |
|
591 | + return $response; |
|
592 | + } |
|
593 | + |
|
594 | + |
|
595 | + |
|
596 | + /** |
|
597 | + * _update_server_wait_time |
|
598 | + * |
|
599 | + * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
|
600 | + * @return array |
|
601 | + * @throws \EE_Error |
|
602 | + */ |
|
603 | + private function _update_server_wait_time($thank_you_page_data = array()) |
|
604 | + { |
|
605 | + $response['espresso_thank_you_page'] = array( |
|
606 | + 'still_waiting' => isset($thank_you_page_data['initial_access']) |
|
607 | + ? time() - $thank_you_page_data['initial_access'] |
|
608 | + : 0, |
|
609 | + 'txn_status' => $this->_current_txn->status_ID() |
|
610 | + ); |
|
611 | + return $response; |
|
612 | + } |
|
613 | + |
|
614 | + |
|
615 | + |
|
616 | + /** |
|
617 | + * get_registration_details |
|
618 | + * |
|
619 | + * @throws \EE_Error |
|
620 | + */ |
|
621 | + public function get_registration_details() |
|
622 | + { |
|
623 | + //prepare variables for displaying |
|
624 | + $template_args = array(); |
|
625 | + $template_args['transaction'] = $this->_current_txn; |
|
626 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
627 | + $template_args['is_primary'] = $this->_is_primary; |
|
628 | + $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
|
629 | + $template_args['resend_reg_confirmation_url'] = add_query_arg( |
|
630 | + array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
631 | + EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
632 | + ); |
|
633 | + // verify template arguments |
|
634 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
635 | + EEH_Template_Validator::verify_isnt_null( |
|
636 | + $template_args['SPCO_attendee_information_url'], |
|
637 | + '$SPCO_attendee_information_url' |
|
638 | + ); |
|
639 | + echo EEH_Template::locate_template( |
|
640 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
641 | + $template_args, |
|
642 | + true, |
|
643 | + true |
|
644 | + ); |
|
645 | + } |
|
646 | + |
|
647 | + |
|
648 | + |
|
649 | + /** |
|
650 | + * resend_reg_confirmation_email |
|
651 | + * |
|
652 | + * @throws \EE_Error |
|
653 | + */ |
|
654 | + public static function resend_reg_confirmation_email() |
|
655 | + { |
|
656 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
657 | + $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
658 | + // was a REG_ID passed ? |
|
659 | + if ($reg_url_link) { |
|
660 | + $registration = EE_Registry::instance()->load_model('Registration')->get_one( |
|
661 | + array(array('REG_url_link' => $reg_url_link)) |
|
662 | + ); |
|
663 | + if ($registration instanceof EE_Registration) { |
|
664 | + // resend email |
|
665 | + EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
666 | + } else { |
|
667 | + EE_Error::add_error( |
|
668 | + __( |
|
669 | + 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', |
|
670 | + 'event_espresso' |
|
671 | + ), |
|
672 | + __FILE__, |
|
673 | + __FUNCTION__, |
|
674 | + __LINE__ |
|
675 | + ); |
|
676 | + } |
|
677 | + } else { |
|
678 | + EE_Error::add_error( |
|
679 | + __( |
|
680 | + 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', |
|
681 | + 'event_espresso' |
|
682 | + ), |
|
683 | + __FILE__, |
|
684 | + __FUNCTION__, |
|
685 | + __LINE__ |
|
686 | + ); |
|
687 | + } |
|
688 | + // request sent via AJAX ? |
|
689 | + if (EE_FRONT_AJAX) { |
|
690 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
691 | + die(); |
|
692 | + // or was JS disabled ? |
|
693 | + } else { |
|
694 | + // save errors so that they get picked up on the next request |
|
695 | + EE_Error::get_notices(true, true); |
|
696 | + wp_safe_redirect( |
|
697 | + add_query_arg( |
|
698 | + array('e_reg_url_link' => $reg_url_link), |
|
699 | + EE_Registry::instance()->CFG->core->thank_you_page_url() |
|
700 | + ) |
|
701 | + ); |
|
702 | + } |
|
703 | + } |
|
704 | + |
|
705 | + |
|
706 | + |
|
707 | + /** |
|
708 | + * get_ajax_content |
|
709 | + * |
|
710 | + * @return void |
|
711 | + * @throws \EE_Error |
|
712 | + */ |
|
713 | + public function get_ajax_content() |
|
714 | + { |
|
715 | + if ( ! $this->get_txn()) { |
|
716 | + return; |
|
717 | + } |
|
718 | + // first determine which event(s) require pre-approval or not |
|
719 | + $events = array(); |
|
720 | + $events_requiring_pre_approval = array(); |
|
721 | + foreach ($this->_current_txn->registrations() as $registration) { |
|
722 | + if ($registration instanceof EE_Registration) { |
|
723 | + $event = $registration->event(); |
|
724 | + if ($event instanceof EE_Event) { |
|
725 | + if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
726 | + $events_requiring_pre_approval[$event->ID()] = $event; |
|
727 | + } else { |
|
728 | + $events[$event->ID()] = $event; |
|
729 | + } |
|
730 | + } |
|
731 | + } |
|
732 | + } |
|
733 | + $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
734 | + $this->display_details_for_events($events); |
|
735 | + } |
|
736 | + |
|
737 | + |
|
738 | + |
|
739 | + /** |
|
740 | + * display_details_for_events |
|
741 | + * |
|
742 | + * @param EE_Event[] $events |
|
743 | + * @return void |
|
744 | + */ |
|
745 | + public function display_details_for_events($events = array()) |
|
746 | + { |
|
747 | + if ( ! empty($events)) { |
|
748 | + ?> |
|
749 | 749 | <div id="espresso-thank-you-page-ajax-content-dv"> |
750 | 750 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
751 | 751 | <div id="espresso-thank-you-page-ajax-payment-dv"></div> |
752 | 752 | <div id="espresso-thank-you-page-ajax-loading-dv"> |
753 | 753 | <div id="ee-ajax-loading-dv" class="float-left lt-blue-text"> |
754 | 754 | <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e( |
755 | - 'loading transaction and payment information...', |
|
756 | - 'event_espresso' |
|
757 | - ); ?></span> |
|
755 | + 'loading transaction and payment information...', |
|
756 | + 'event_espresso' |
|
757 | + ); ?></span> |
|
758 | 758 | </div> |
759 | 759 | <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
760 | 760 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
761 | 761 | <?php echo apply_filters( |
762 | - 'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg', |
|
763 | - __( |
|
764 | - 'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', |
|
765 | - 'event_espresso' |
|
766 | - ) |
|
767 | - ); ?> |
|
762 | + 'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg', |
|
763 | + __( |
|
764 | + 'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', |
|
765 | + 'event_espresso' |
|
766 | + ) |
|
767 | + ); ?> |
|
768 | 768 | <br/> |
769 | 769 | <span class="jst-rght ee-block small-text lt-grey-text"> |
770 | 770 | <?php _e('current wait time ', 'event_espresso'); ?> |
@@ -775,120 +775,120 @@ discard block |
||
775 | 775 | <div class="clear"></div> |
776 | 776 | </div> |
777 | 777 | <?php |
778 | - } |
|
779 | - } |
|
778 | + } |
|
779 | + } |
|
780 | 780 | |
781 | 781 | |
782 | 782 | |
783 | - /** |
|
784 | - * display_details_for_events_requiring_pre_approval |
|
785 | - * |
|
786 | - * @param EE_Event[] $events |
|
787 | - * @return void |
|
788 | - */ |
|
789 | - public function display_details_for_events_requiring_pre_approval($events = array()) |
|
790 | - { |
|
791 | - if ( ! empty($events)) { |
|
792 | - ?> |
|
783 | + /** |
|
784 | + * display_details_for_events_requiring_pre_approval |
|
785 | + * |
|
786 | + * @param EE_Event[] $events |
|
787 | + * @return void |
|
788 | + */ |
|
789 | + public function display_details_for_events_requiring_pre_approval($events = array()) |
|
790 | + { |
|
791 | + if ( ! empty($events)) { |
|
792 | + ?> |
|
793 | 793 | <div id="espresso-thank-you-page-not-approved-message-dv"> |
794 | 794 | <h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4> |
795 | 795 | <p id="events-requiring-pre-approval-pg" class="small-text"> |
796 | 796 | <?php echo apply_filters( |
797 | - 'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message', |
|
798 | - __( |
|
799 | - 'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', |
|
800 | - 'event_espresso' |
|
801 | - ) |
|
802 | - ); ?> |
|
797 | + 'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message', |
|
798 | + __( |
|
799 | + 'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', |
|
800 | + 'event_espresso' |
|
801 | + ) |
|
802 | + ); ?> |
|
803 | 803 | </p> |
804 | 804 | <ul class="events-requiring-pre-approval-ul"> |
805 | 805 | <?php foreach ($events as $event) { |
806 | - if ($event instanceof EE_Event) { |
|
807 | - echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', |
|
808 | - $event->name(), |
|
809 | - '</li>'; |
|
810 | - } |
|
811 | - } ?> |
|
806 | + if ($event instanceof EE_Event) { |
|
807 | + echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', |
|
808 | + $event->name(), |
|
809 | + '</li>'; |
|
810 | + } |
|
811 | + } ?> |
|
812 | 812 | </ul> |
813 | 813 | <div class="clear"></div> |
814 | 814 | </div> |
815 | 815 | <?php |
816 | - } |
|
817 | - } |
|
818 | - |
|
819 | - |
|
820 | - |
|
821 | - /** |
|
822 | - * get_transaction_details |
|
823 | - * |
|
824 | - * @return string |
|
825 | - * @throws \EE_Error |
|
826 | - */ |
|
827 | - public function get_transaction_details() |
|
828 | - { |
|
829 | - //prepare variables for displaying |
|
830 | - $template_args = array(); |
|
831 | - $template_args['transaction'] = $this->_current_txn; |
|
832 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
833 | - $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true); |
|
834 | - // link to SPCO payment_options |
|
835 | - $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
836 | - $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
837 | - // verify template arguments |
|
838 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
839 | - EEH_Template_Validator::verify_isnt_null( |
|
840 | - $template_args['show_try_pay_again_link'], |
|
841 | - '$show_try_pay_again_link' |
|
842 | - ); |
|
843 | - EEH_Template_Validator::verify_isnt_null( |
|
844 | - $template_args['SPCO_payment_options_url'], |
|
845 | - '$SPCO_payment_options_url' |
|
846 | - ); |
|
847 | - return EEH_Template::locate_template( |
|
848 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
849 | - $template_args, |
|
850 | - true, |
|
851 | - true |
|
852 | - ); |
|
853 | - } |
|
854 | - |
|
855 | - |
|
856 | - |
|
857 | - /** |
|
858 | - * get_payment_row_html |
|
859 | - * |
|
860 | - * @param EE_Payment $payment |
|
861 | - * @return string |
|
862 | - * @throws \EE_Error |
|
863 | - */ |
|
864 | - public function get_payment_row_html($payment = null) |
|
865 | - { |
|
866 | - $html = ''; |
|
867 | - if ($payment instanceof EE_Payment) { |
|
868 | - if ( |
|
869 | - $payment->payment_method() instanceof EE_Payment_Method |
|
870 | - && $payment->status() === EEM_Payment::status_id_failed |
|
871 | - && $payment->payment_method()->is_off_site() |
|
872 | - ) { |
|
873 | - // considering the registrant has made it to the Thank You page, |
|
874 | - // any failed payments may actually be pending and the IPN is just slow |
|
875 | - // so let's |
|
876 | - $payment->set_status(EEM_Payment::status_id_pending); |
|
877 | - } |
|
878 | - $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
|
879 | - ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' |
|
880 | - : ''; |
|
881 | - $html .= ' |
|
816 | + } |
|
817 | + } |
|
818 | + |
|
819 | + |
|
820 | + |
|
821 | + /** |
|
822 | + * get_transaction_details |
|
823 | + * |
|
824 | + * @return string |
|
825 | + * @throws \EE_Error |
|
826 | + */ |
|
827 | + public function get_transaction_details() |
|
828 | + { |
|
829 | + //prepare variables for displaying |
|
830 | + $template_args = array(); |
|
831 | + $template_args['transaction'] = $this->_current_txn; |
|
832 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
833 | + $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true); |
|
834 | + // link to SPCO payment_options |
|
835 | + $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
836 | + $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
837 | + // verify template arguments |
|
838 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
839 | + EEH_Template_Validator::verify_isnt_null( |
|
840 | + $template_args['show_try_pay_again_link'], |
|
841 | + '$show_try_pay_again_link' |
|
842 | + ); |
|
843 | + EEH_Template_Validator::verify_isnt_null( |
|
844 | + $template_args['SPCO_payment_options_url'], |
|
845 | + '$SPCO_payment_options_url' |
|
846 | + ); |
|
847 | + return EEH_Template::locate_template( |
|
848 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
849 | + $template_args, |
|
850 | + true, |
|
851 | + true |
|
852 | + ); |
|
853 | + } |
|
854 | + |
|
855 | + |
|
856 | + |
|
857 | + /** |
|
858 | + * get_payment_row_html |
|
859 | + * |
|
860 | + * @param EE_Payment $payment |
|
861 | + * @return string |
|
862 | + * @throws \EE_Error |
|
863 | + */ |
|
864 | + public function get_payment_row_html($payment = null) |
|
865 | + { |
|
866 | + $html = ''; |
|
867 | + if ($payment instanceof EE_Payment) { |
|
868 | + if ( |
|
869 | + $payment->payment_method() instanceof EE_Payment_Method |
|
870 | + && $payment->status() === EEM_Payment::status_id_failed |
|
871 | + && $payment->payment_method()->is_off_site() |
|
872 | + ) { |
|
873 | + // considering the registrant has made it to the Thank You page, |
|
874 | + // any failed payments may actually be pending and the IPN is just slow |
|
875 | + // so let's |
|
876 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
877 | + } |
|
878 | + $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
|
879 | + ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' |
|
880 | + : ''; |
|
881 | + $html .= ' |
|
882 | 882 | <tr> |
883 | 883 | <td> |
884 | 884 | ' . $payment->timestamp() . ' |
885 | 885 | </td> |
886 | 886 | <td> |
887 | 887 | ' . ( |
888 | - $payment->payment_method() instanceof EE_Payment_Method |
|
889 | - ? $payment->payment_method()->name() |
|
890 | - : __('Unknown', 'event_espresso') |
|
891 | - ) . ' |
|
888 | + $payment->payment_method() instanceof EE_Payment_Method |
|
889 | + ? $payment->payment_method()->name() |
|
890 | + : __('Unknown', 'event_espresso') |
|
891 | + ) . ' |
|
892 | 892 | </td> |
893 | 893 | <td class="jst-rght"> |
894 | 894 | ' . EEH_Template::format_currency($payment->amount()) . ' |
@@ -897,87 +897,87 @@ discard block |
||
897 | 897 | ' . $payment->pretty_status(true) . $payment_declined_msg . ' |
898 | 898 | </td> |
899 | 899 | </tr>'; |
900 | - do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
901 | - } |
|
902 | - return $html; |
|
903 | - } |
|
904 | - |
|
905 | - |
|
906 | - |
|
907 | - /** |
|
908 | - * get_payment_details |
|
909 | - * |
|
910 | - * @param array $payments |
|
911 | - * @return string |
|
912 | - * @throws \EE_Error |
|
913 | - */ |
|
914 | - public function get_payment_details($payments = array()) |
|
915 | - { |
|
916 | - //prepare variables for displaying |
|
917 | - $template_args = array(); |
|
918 | - $template_args['transaction'] = $this->_current_txn; |
|
919 | - $template_args['reg_url_link'] = $this->_reg_url_link; |
|
920 | - $template_args['payments'] = array(); |
|
921 | - foreach ($payments as $payment) { |
|
922 | - $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
923 | - } |
|
924 | - //create a hacky payment object, but dont save it |
|
925 | - $payment = EE_Payment::new_instance( |
|
926 | - array( |
|
927 | - 'TXN_ID' => $this->_current_txn->ID(), |
|
928 | - 'STS_ID' => EEM_Payment::status_id_pending, |
|
929 | - 'PAY_timestamp' => time(), |
|
930 | - 'PAY_amount' => $this->_current_txn->total(), |
|
931 | - 'PMD_ID' => $this->_current_txn->payment_method_ID() |
|
932 | - ) |
|
933 | - ); |
|
934 | - $payment_method = $this->_current_txn->payment_method(); |
|
935 | - if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
936 | - $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
937 | - } else { |
|
938 | - $template_args['gateway_content'] = ''; |
|
939 | - } |
|
940 | - // link to SPCO payment_options |
|
941 | - $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
942 | - $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
943 | - // verify template arguments |
|
944 | - EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
945 | - EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
946 | - EEH_Template_Validator::verify_isnt_null( |
|
947 | - $template_args['show_try_pay_again_link'], |
|
948 | - '$show_try_pay_again_link' |
|
949 | - ); |
|
950 | - EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
951 | - EEH_Template_Validator::verify_isnt_null( |
|
952 | - $template_args['SPCO_payment_options_url'], |
|
953 | - '$SPCO_payment_options_url' |
|
954 | - ); |
|
955 | - return EEH_Template::locate_template( |
|
956 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
957 | - $template_args, |
|
958 | - true, |
|
959 | - true |
|
960 | - ); |
|
961 | - } |
|
962 | - |
|
963 | - |
|
964 | - |
|
965 | - /** |
|
966 | - * get_payment_details |
|
967 | - * |
|
968 | - * @param array $payments |
|
969 | - * @return string |
|
970 | - * @throws \EE_Error |
|
971 | - */ |
|
972 | - public function get_new_payments($payments = array()) |
|
973 | - { |
|
974 | - $payments_html = ''; |
|
975 | - //prepare variables for displaying |
|
976 | - foreach ($payments as $payment) { |
|
977 | - $payments_html .= $this->get_payment_row_html($payment); |
|
978 | - } |
|
979 | - return $payments_html; |
|
980 | - } |
|
900 | + do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
901 | + } |
|
902 | + return $html; |
|
903 | + } |
|
904 | + |
|
905 | + |
|
906 | + |
|
907 | + /** |
|
908 | + * get_payment_details |
|
909 | + * |
|
910 | + * @param array $payments |
|
911 | + * @return string |
|
912 | + * @throws \EE_Error |
|
913 | + */ |
|
914 | + public function get_payment_details($payments = array()) |
|
915 | + { |
|
916 | + //prepare variables for displaying |
|
917 | + $template_args = array(); |
|
918 | + $template_args['transaction'] = $this->_current_txn; |
|
919 | + $template_args['reg_url_link'] = $this->_reg_url_link; |
|
920 | + $template_args['payments'] = array(); |
|
921 | + foreach ($payments as $payment) { |
|
922 | + $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
923 | + } |
|
924 | + //create a hacky payment object, but dont save it |
|
925 | + $payment = EE_Payment::new_instance( |
|
926 | + array( |
|
927 | + 'TXN_ID' => $this->_current_txn->ID(), |
|
928 | + 'STS_ID' => EEM_Payment::status_id_pending, |
|
929 | + 'PAY_timestamp' => time(), |
|
930 | + 'PAY_amount' => $this->_current_txn->total(), |
|
931 | + 'PMD_ID' => $this->_current_txn->payment_method_ID() |
|
932 | + ) |
|
933 | + ); |
|
934 | + $payment_method = $this->_current_txn->payment_method(); |
|
935 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
936 | + $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
937 | + } else { |
|
938 | + $template_args['gateway_content'] = ''; |
|
939 | + } |
|
940 | + // link to SPCO payment_options |
|
941 | + $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
|
942 | + $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
|
943 | + // verify template arguments |
|
944 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
945 | + EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
946 | + EEH_Template_Validator::verify_isnt_null( |
|
947 | + $template_args['show_try_pay_again_link'], |
|
948 | + '$show_try_pay_again_link' |
|
949 | + ); |
|
950 | + EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
951 | + EEH_Template_Validator::verify_isnt_null( |
|
952 | + $template_args['SPCO_payment_options_url'], |
|
953 | + '$SPCO_payment_options_url' |
|
954 | + ); |
|
955 | + return EEH_Template::locate_template( |
|
956 | + THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
957 | + $template_args, |
|
958 | + true, |
|
959 | + true |
|
960 | + ); |
|
961 | + } |
|
962 | + |
|
963 | + |
|
964 | + |
|
965 | + /** |
|
966 | + * get_payment_details |
|
967 | + * |
|
968 | + * @param array $payments |
|
969 | + * @return string |
|
970 | + * @throws \EE_Error |
|
971 | + */ |
|
972 | + public function get_new_payments($payments = array()) |
|
973 | + { |
|
974 | + $payments_html = ''; |
|
975 | + //prepare variables for displaying |
|
976 | + foreach ($payments as $payment) { |
|
977 | + $payments_html .= $this->get_payment_row_html($payment); |
|
978 | + } |
|
979 | + return $payments_html; |
|
980 | + } |
|
981 | 981 | |
982 | 982 | |
983 | 983 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | return; |
53 | 53 | } |
54 | 54 | $post = reset($wp_query->posts); |
55 | - if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
55 | + if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | $this->is_thank_you_page = true; |
@@ -20,75 +20,75 @@ |
||
20 | 20 | class EspressoThankYou extends EspressoShortcode |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var boolean $is_thank_you_page |
|
25 | - */ |
|
26 | - private $is_thank_you_page = false; |
|
27 | - |
|
28 | - /** |
|
29 | - * the actual shortcode tag that gets registered with WordPress |
|
30 | - * |
|
31 | - * @return string |
|
32 | - */ |
|
33 | - public function getTag() |
|
34 | - { |
|
35 | - return 'ESPRESSO_THANK_YOU'; |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * the time in seconds to cache the results of the processShortcode() method |
|
42 | - * 0 means the processShortcode() results will NOT be cached at all |
|
43 | - * |
|
44 | - * @return int |
|
45 | - */ |
|
46 | - public function cacheExpiration() |
|
47 | - { |
|
48 | - return 0; |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * a place for adding any initialization code that needs to run prior to wp_header(). |
|
54 | - * this may be required for shortcodes that utilize a corresponding module, |
|
55 | - * and need to enqueue assets for that module |
|
56 | - * |
|
57 | - * @return void |
|
58 | - * @throws \EE_Error |
|
59 | - */ |
|
60 | - public function initializeShortcode() |
|
61 | - { |
|
62 | - global $wp_query; |
|
63 | - if (empty($wp_query->posts) || count($wp_query->posts) > 1) { |
|
64 | - return; |
|
65 | - } |
|
66 | - $post = reset($wp_query->posts); |
|
67 | - if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
68 | - return; |
|
69 | - } |
|
70 | - $this->is_thank_you_page = true; |
|
71 | - \EED_Thank_You_Page::instance()->load_resources(); |
|
72 | - $this->shortcodeHasBeenInitialized(); |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * callback that runs when the shortcode is encountered in post content. |
|
79 | - * IMPORTANT !!! |
|
80 | - * remember that shortcode content should be RETURNED and NOT echoed out |
|
81 | - * |
|
82 | - * @param array $attributes |
|
83 | - * @return string |
|
84 | - * @throws \EE_Error |
|
85 | - */ |
|
86 | - public function processShortcode($attributes = array()) |
|
87 | - { |
|
88 | - return $this->is_thank_you_page |
|
89 | - ? \EED_Thank_You_Page::instance()->thank_you_page_results() |
|
90 | - : ''; |
|
91 | - } |
|
23 | + /** |
|
24 | + * @var boolean $is_thank_you_page |
|
25 | + */ |
|
26 | + private $is_thank_you_page = false; |
|
27 | + |
|
28 | + /** |
|
29 | + * the actual shortcode tag that gets registered with WordPress |
|
30 | + * |
|
31 | + * @return string |
|
32 | + */ |
|
33 | + public function getTag() |
|
34 | + { |
|
35 | + return 'ESPRESSO_THANK_YOU'; |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * the time in seconds to cache the results of the processShortcode() method |
|
42 | + * 0 means the processShortcode() results will NOT be cached at all |
|
43 | + * |
|
44 | + * @return int |
|
45 | + */ |
|
46 | + public function cacheExpiration() |
|
47 | + { |
|
48 | + return 0; |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * a place for adding any initialization code that needs to run prior to wp_header(). |
|
54 | + * this may be required for shortcodes that utilize a corresponding module, |
|
55 | + * and need to enqueue assets for that module |
|
56 | + * |
|
57 | + * @return void |
|
58 | + * @throws \EE_Error |
|
59 | + */ |
|
60 | + public function initializeShortcode() |
|
61 | + { |
|
62 | + global $wp_query; |
|
63 | + if (empty($wp_query->posts) || count($wp_query->posts) > 1) { |
|
64 | + return; |
|
65 | + } |
|
66 | + $post = reset($wp_query->posts); |
|
67 | + if ( ! $post instanceof WP_Post || $post->ID !== EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
68 | + return; |
|
69 | + } |
|
70 | + $this->is_thank_you_page = true; |
|
71 | + \EED_Thank_You_Page::instance()->load_resources(); |
|
72 | + $this->shortcodeHasBeenInitialized(); |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * callback that runs when the shortcode is encountered in post content. |
|
79 | + * IMPORTANT !!! |
|
80 | + * remember that shortcode content should be RETURNED and NOT echoed out |
|
81 | + * |
|
82 | + * @param array $attributes |
|
83 | + * @return string |
|
84 | + * @throws \EE_Error |
|
85 | + */ |
|
86 | + public function processShortcode($attributes = array()) |
|
87 | + { |
|
88 | + return $this->is_thank_you_page |
|
89 | + ? \EED_Thank_You_Page::instance()->thank_you_page_results() |
|
90 | + : ''; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | |
94 | 94 |
@@ -128,7 +128,8 @@ |
||
128 | 128 | * |
129 | 129 | * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
130 | 130 | * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save further processing |
131 | - * @return mixed status int if the display string isn't requested |
|
131 | + * @param boolean $remaining |
|
132 | + * @return string status int if the display string isn't requested |
|
132 | 133 | * @throws \EE_Error |
133 | 134 | */ |
134 | 135 | public function ticket_status( $display = FALSE, $remaining = null ) { |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | */ |
54 | 54 | const onsale = 'TKO'; |
55 | 55 | |
56 | - /** |
|
57 | - * extra meta key for tracking ticket reservations |
|
58 | - * |
|
59 | - * @type string |
|
60 | - */ |
|
61 | - const META_KEY_TICKET_RESERVATIONS = 'ticket_reservations'; |
|
62 | - |
|
63 | - /** |
|
56 | + /** |
|
57 | + * extra meta key for tracking ticket reservations |
|
58 | + * |
|
59 | + * @type string |
|
60 | + */ |
|
61 | + const META_KEY_TICKET_RESERVATIONS = 'ticket_reservations'; |
|
62 | + |
|
63 | + /** |
|
64 | 64 | * cached result from method of the same name |
65 | 65 | * @var float $_ticket_total_with_taxes |
66 | 66 | */ |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * @param array $props_n_values incoming values |
|
73 | - * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
74 | - * used.) |
|
75 | - * @param array $date_formats incoming date_formats in an array where the first value is the |
|
76 | - * date_format and the second value is the time format |
|
77 | - * @return EE_Ticket |
|
78 | - * @throws \EE_Error |
|
79 | - */ |
|
71 | + /** |
|
72 | + * @param array $props_n_values incoming values |
|
73 | + * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
74 | + * used.) |
|
75 | + * @param array $date_formats incoming date_formats in an array where the first value is the |
|
76 | + * date_format and the second value is the time format |
|
77 | + * @return EE_Ticket |
|
78 | + * @throws \EE_Error |
|
79 | + */ |
|
80 | 80 | public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
81 | 81 | $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
82 | 82 | return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
@@ -84,36 +84,36 @@ discard block |
||
84 | 84 | |
85 | 85 | |
86 | 86 | |
87 | - /** |
|
88 | - * @param array $props_n_values incoming values from the database |
|
89 | - * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
90 | - * the website will be used. |
|
91 | - * @return EE_Ticket |
|
92 | - * @throws \EE_Error |
|
93 | - */ |
|
87 | + /** |
|
88 | + * @param array $props_n_values incoming values from the database |
|
89 | + * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
90 | + * the website will be used. |
|
91 | + * @return EE_Ticket |
|
92 | + * @throws \EE_Error |
|
93 | + */ |
|
94 | 94 | public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
95 | 95 | return new self( $props_n_values, TRUE, $timezone ); |
96 | 96 | } |
97 | 97 | |
98 | 98 | |
99 | 99 | |
100 | - /** |
|
101 | - * @return bool |
|
102 | - * @throws \EE_Error |
|
103 | - */ |
|
100 | + /** |
|
101 | + * @return bool |
|
102 | + * @throws \EE_Error |
|
103 | + */ |
|
104 | 104 | public function parent() { |
105 | 105 | return $this->get( 'TKT_parent' ); |
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | |
110 | - /** |
|
111 | - * return if a ticket has quantities available for purchase |
|
112 | - * |
|
113 | - * @param int $DTT_ID the primary key for a particular datetime |
|
114 | - * @return boolean |
|
115 | - * @throws \EE_Error |
|
116 | - */ |
|
110 | + /** |
|
111 | + * return if a ticket has quantities available for purchase |
|
112 | + * |
|
113 | + * @param int $DTT_ID the primary key for a particular datetime |
|
114 | + * @return boolean |
|
115 | + * @throws \EE_Error |
|
116 | + */ |
|
117 | 117 | public function available( $DTT_ID = 0 ) { |
118 | 118 | // are we checking availability for a particular datetime ? |
119 | 119 | if ( $DTT_ID ) { |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | |
133 | - /** |
|
134 | - * Using the start date and end date this method calculates whether the ticket is On Sale, Pending, or Expired |
|
135 | - * |
|
136 | - * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
|
137 | - * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save further processing |
|
138 | - * @return mixed status int if the display string isn't requested |
|
139 | - * @throws \EE_Error |
|
140 | - */ |
|
133 | + /** |
|
134 | + * Using the start date and end date this method calculates whether the ticket is On Sale, Pending, or Expired |
|
135 | + * |
|
136 | + * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
|
137 | + * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save further processing |
|
138 | + * @return mixed status int if the display string isn't requested |
|
139 | + * @throws \EE_Error |
|
140 | + */ |
|
141 | 141 | public function ticket_status( $display = FALSE, $remaining = null ) { |
142 | 142 | $remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining(); |
143 | 143 | if ( ! $remaining ) { |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | |
161 | 161 | |
162 | 162 | |
163 | - /** |
|
164 | - * The purpose of this method is to simply return a boolean for whether there are any tickets remaining for sale considering ALL the factors used for figuring that out. |
|
165 | - * |
|
166 | - * @access public |
|
167 | - * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
|
168 | - * @return boolean true = tickets remaining, false not. |
|
169 | - * @throws \EE_Error |
|
170 | - */ |
|
163 | + /** |
|
164 | + * The purpose of this method is to simply return a boolean for whether there are any tickets remaining for sale considering ALL the factors used for figuring that out. |
|
165 | + * |
|
166 | + * @access public |
|
167 | + * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
|
168 | + * @return boolean true = tickets remaining, false not. |
|
169 | + * @throws \EE_Error |
|
170 | + */ |
|
171 | 171 | public function is_remaining( $DTT_ID = 0 ) { |
172 | 172 | $num_remaining = $this->remaining( $DTT_ID ); |
173 | 173 | if ( $num_remaining === 0 ) { |
@@ -181,76 +181,76 @@ discard block |
||
181 | 181 | |
182 | 182 | |
183 | 183 | |
184 | - /** |
|
185 | - * return the total number of tickets available for purchase |
|
186 | - * |
|
187 | - * @param int $DTT_ID the primary key for a particular datetime. |
|
188 | - * set to 0 for all related datetimes |
|
189 | - * @return int |
|
190 | - * @throws \EE_Error |
|
191 | - */ |
|
184 | + /** |
|
185 | + * return the total number of tickets available for purchase |
|
186 | + * |
|
187 | + * @param int $DTT_ID the primary key for a particular datetime. |
|
188 | + * set to 0 for all related datetimes |
|
189 | + * @return int |
|
190 | + * @throws \EE_Error |
|
191 | + */ |
|
192 | 192 | public function remaining( $DTT_ID = 0 ) { |
193 | 193 | return $this->real_quantity_on_ticket('saleable', $DTT_ID ); |
194 | 194 | } |
195 | 195 | |
196 | 196 | |
197 | 197 | |
198 | - /** |
|
199 | - * Gets min |
|
200 | - * |
|
201 | - * @return int |
|
202 | - * @throws \EE_Error |
|
203 | - */ |
|
198 | + /** |
|
199 | + * Gets min |
|
200 | + * |
|
201 | + * @return int |
|
202 | + * @throws \EE_Error |
|
203 | + */ |
|
204 | 204 | public function min() { |
205 | 205 | return $this->get( 'TKT_min' ); |
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | 209 | |
210 | - /** |
|
211 | - * return if a ticket is no longer available cause its available dates have expired. |
|
212 | - * |
|
213 | - * @return boolean |
|
214 | - * @throws \EE_Error |
|
215 | - */ |
|
210 | + /** |
|
211 | + * return if a ticket is no longer available cause its available dates have expired. |
|
212 | + * |
|
213 | + * @return boolean |
|
214 | + * @throws \EE_Error |
|
215 | + */ |
|
216 | 216 | public function is_expired() { |
217 | 217 | return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
218 | 218 | } |
219 | 219 | |
220 | 220 | |
221 | 221 | |
222 | - /** |
|
223 | - * Return if a ticket is yet to go on sale or not |
|
224 | - * |
|
225 | - * @return boolean |
|
226 | - * @throws \EE_Error |
|
227 | - */ |
|
222 | + /** |
|
223 | + * Return if a ticket is yet to go on sale or not |
|
224 | + * |
|
225 | + * @return boolean |
|
226 | + * @throws \EE_Error |
|
227 | + */ |
|
228 | 228 | public function is_pending() { |
229 | 229 | return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
230 | 230 | } |
231 | 231 | |
232 | 232 | |
233 | 233 | |
234 | - /** |
|
235 | - * Return if a ticket is on sale or not |
|
236 | - * |
|
237 | - * @return boolean |
|
238 | - * @throws \EE_Error |
|
239 | - */ |
|
234 | + /** |
|
235 | + * Return if a ticket is on sale or not |
|
236 | + * |
|
237 | + * @return boolean |
|
238 | + * @throws \EE_Error |
|
239 | + */ |
|
240 | 240 | public function is_on_sale() { |
241 | 241 | return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
242 | 242 | } |
243 | 243 | |
244 | 244 | |
245 | 245 | |
246 | - /** |
|
247 | - * This returns the chronologically last datetime that this ticket is associated with |
|
248 | - * |
|
249 | - * @param string $dt_frmt |
|
250 | - * @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 |
|
251 | - * @return string |
|
252 | - * @throws \EE_Error |
|
253 | - */ |
|
246 | + /** |
|
247 | + * This returns the chronologically last datetime that this ticket is associated with |
|
248 | + * |
|
249 | + * @param string $dt_frmt |
|
250 | + * @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 |
|
251 | + * @return string |
|
252 | + * @throws \EE_Error |
|
253 | + */ |
|
254 | 254 | public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
255 | 255 | $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
256 | 256 | $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | |
261 | 261 | |
262 | 262 | |
263 | - /** |
|
264 | - * This returns the chronologically first datetime that this ticket is associated with |
|
265 | - * |
|
266 | - * @return EE_Datetime |
|
267 | - * @throws \EE_Error |
|
268 | - */ |
|
263 | + /** |
|
264 | + * This returns the chronologically first datetime that this ticket is associated with |
|
265 | + * |
|
266 | + * @return EE_Datetime |
|
267 | + * @throws \EE_Error |
|
268 | + */ |
|
269 | 269 | public function first_datetime() { |
270 | 270 | $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
271 | 271 | return reset( $datetimes ); |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | |
274 | 274 | |
275 | 275 | |
276 | - /** |
|
277 | - * Gets all the datetimes this ticket can be used for attending. |
|
278 | - * Unless otherwise specified, orders datetimes by start date. |
|
279 | - * |
|
280 | - * @param array $query_params see EEM_Base::get_all() |
|
281 | - * @return EE_Datetime[]|EE_Base_Class[] |
|
282 | - * @throws \EE_Error |
|
283 | - */ |
|
276 | + /** |
|
277 | + * Gets all the datetimes this ticket can be used for attending. |
|
278 | + * Unless otherwise specified, orders datetimes by start date. |
|
279 | + * |
|
280 | + * @param array $query_params see EEM_Base::get_all() |
|
281 | + * @return EE_Datetime[]|EE_Base_Class[] |
|
282 | + * @throws \EE_Error |
|
283 | + */ |
|
284 | 284 | public function datetimes( $query_params = array() ) { |
285 | 285 | if ( ! isset( $query_params[ 'order_by' ] ) ) { |
286 | 286 | $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | |
291 | 291 | |
292 | 292 | |
293 | - /** |
|
294 | - * This returns the chronologically last datetime that this ticket is associated with |
|
295 | - * |
|
296 | - * @return EE_Datetime |
|
297 | - * @throws \EE_Error |
|
298 | - */ |
|
293 | + /** |
|
294 | + * This returns the chronologically last datetime that this ticket is associated with |
|
295 | + * |
|
296 | + * @return EE_Datetime |
|
297 | + * @throws \EE_Error |
|
298 | + */ |
|
299 | 299 | public function last_datetime() { |
300 | 300 | $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
301 | 301 | return end( $datetimes ); |
@@ -303,19 +303,19 @@ discard block |
||
303 | 303 | |
304 | 304 | |
305 | 305 | |
306 | - /** |
|
307 | - * This returns the total tickets sold depending on the given parameters. |
|
308 | - * |
|
309 | - * @param string $what Can be one of two options: 'ticket', 'datetime'. |
|
310 | - * 'ticket' = total ticket sales for all datetimes this ticket is related to |
|
311 | - * 'datetime' = total ticket sales for a specified datetime (required $dtt_id) |
|
312 | - * 'datetime' = total ticket sales in the datetime_ticket table. |
|
313 | - * If $dtt_id is not given then we return an array of sales indexed by datetime. |
|
314 | - * If $dtt_id IS given then we return the tickets sold for that given datetime. |
|
315 | - * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
|
316 | - * @return mixed (array|int) how many tickets have sold |
|
317 | - * @throws \EE_Error |
|
318 | - */ |
|
306 | + /** |
|
307 | + * This returns the total tickets sold depending on the given parameters. |
|
308 | + * |
|
309 | + * @param string $what Can be one of two options: 'ticket', 'datetime'. |
|
310 | + * 'ticket' = total ticket sales for all datetimes this ticket is related to |
|
311 | + * 'datetime' = total ticket sales for a specified datetime (required $dtt_id) |
|
312 | + * 'datetime' = total ticket sales in the datetime_ticket table. |
|
313 | + * If $dtt_id is not given then we return an array of sales indexed by datetime. |
|
314 | + * If $dtt_id IS given then we return the tickets sold for that given datetime. |
|
315 | + * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
|
316 | + * @return mixed (array|int) how many tickets have sold |
|
317 | + * @throws \EE_Error |
|
318 | + */ |
|
319 | 319 | public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
320 | 320 | $total = 0; |
321 | 321 | $tickets_sold = $this->_all_tickets_sold(); |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | |
341 | 341 | |
342 | 342 | |
343 | - /** |
|
344 | - * This returns an array indexed by datetime_id for tickets sold with this ticket. |
|
345 | - * |
|
346 | - * @return EE_Ticket[] |
|
347 | - * @throws \EE_Error |
|
348 | - */ |
|
343 | + /** |
|
344 | + * This returns an array indexed by datetime_id for tickets sold with this ticket. |
|
345 | + * |
|
346 | + * @return EE_Ticket[] |
|
347 | + * @throws \EE_Error |
|
348 | + */ |
|
349 | 349 | protected function _all_tickets_sold() { |
350 | 350 | $datetimes = $this->get_many_related( 'Datetime' ); |
351 | 351 | $tickets_sold = array(); |
@@ -361,29 +361,29 @@ discard block |
||
361 | 361 | |
362 | 362 | |
363 | 363 | |
364 | - /** |
|
365 | - * This returns the base price object for the ticket. |
|
366 | - * |
|
367 | - * @param bool $return_array whether to return as an array indexed by price id or just the object. |
|
368 | - * @return EE_Price|EE_Base_Class|EE_Price[]|EE_Base_Class[] |
|
369 | - * @throws \EE_Error |
|
370 | - */ |
|
364 | + /** |
|
365 | + * This returns the base price object for the ticket. |
|
366 | + * |
|
367 | + * @param bool $return_array whether to return as an array indexed by price id or just the object. |
|
368 | + * @return EE_Price|EE_Base_Class|EE_Price[]|EE_Base_Class[] |
|
369 | + * @throws \EE_Error |
|
370 | + */ |
|
371 | 371 | public function base_price( $return_array = FALSE ) { |
372 | 372 | $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
373 | 373 | return $return_array |
374 | - ? $this->get_many_related( 'Price', array( $_where ) ) |
|
375 | - : $this->get_first_related( 'Price', array( $_where ) ); |
|
374 | + ? $this->get_many_related( 'Price', array( $_where ) ) |
|
375 | + : $this->get_first_related( 'Price', array( $_where ) ); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
379 | 379 | |
380 | - /** |
|
381 | - * This returns ONLY the price modifiers for the ticket (i.e. no taxes or base price) |
|
382 | - * |
|
383 | - * @access public |
|
384 | - * @return EE_Price[] |
|
385 | - * @throws \EE_Error |
|
386 | - */ |
|
380 | + /** |
|
381 | + * This returns ONLY the price modifiers for the ticket (i.e. no taxes or base price) |
|
382 | + * |
|
383 | + * @access public |
|
384 | + * @return EE_Price[] |
|
385 | + * @throws \EE_Error |
|
386 | + */ |
|
387 | 387 | public function price_modifiers() { |
388 | 388 | $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 ) ) ) ); |
389 | 389 | return $this->prices( $query_params ); |
@@ -391,132 +391,132 @@ discard block |
||
391 | 391 | |
392 | 392 | |
393 | 393 | |
394 | - /** |
|
395 | - * Gets all the prices that combine to form the final price of this ticket |
|
396 | - * |
|
397 | - * @param array $query_params like EEM_Base::get_all |
|
398 | - * @return EE_Price[]|EE_Base_Class[] |
|
399 | - * @throws \EE_Error |
|
400 | - */ |
|
394 | + /** |
|
395 | + * Gets all the prices that combine to form the final price of this ticket |
|
396 | + * |
|
397 | + * @param array $query_params like EEM_Base::get_all |
|
398 | + * @return EE_Price[]|EE_Base_Class[] |
|
399 | + * @throws \EE_Error |
|
400 | + */ |
|
401 | 401 | public function prices( $query_params = array() ) { |
402 | 402 | return $this->get_many_related( 'Price', $query_params ); |
403 | 403 | } |
404 | 404 | |
405 | 405 | |
406 | 406 | |
407 | - /** |
|
408 | - * Gets all the ticket applicabilities (ie, relations between datetimes and tickets) |
|
409 | - * |
|
410 | - * @param array $query_params see EEM_Base::get_all() |
|
411 | - * @return EE_Datetime_Ticket|EE_Base_Class[] |
|
412 | - * @throws \EE_Error |
|
413 | - */ |
|
407 | + /** |
|
408 | + * Gets all the ticket applicabilities (ie, relations between datetimes and tickets) |
|
409 | + * |
|
410 | + * @param array $query_params see EEM_Base::get_all() |
|
411 | + * @return EE_Datetime_Ticket|EE_Base_Class[] |
|
412 | + * @throws \EE_Error |
|
413 | + */ |
|
414 | 414 | public function datetime_tickets( $query_params = array() ) { |
415 | 415 | return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
416 | 416 | } |
417 | 417 | |
418 | 418 | |
419 | 419 | |
420 | - /** |
|
421 | - * Gets all the datetimes from the db ordered by DTT_order |
|
422 | - * |
|
423 | - * @param boolean $show_expired |
|
424 | - * @param boolean $show_deleted |
|
425 | - * @return EE_Datetime[] |
|
426 | - * @throws \EE_Error |
|
427 | - */ |
|
420 | + /** |
|
421 | + * Gets all the datetimes from the db ordered by DTT_order |
|
422 | + * |
|
423 | + * @param boolean $show_expired |
|
424 | + * @param boolean $show_deleted |
|
425 | + * @return EE_Datetime[] |
|
426 | + * @throws \EE_Error |
|
427 | + */ |
|
428 | 428 | public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
429 | 429 | return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
430 | 430 | } |
431 | 431 | |
432 | 432 | |
433 | 433 | |
434 | - /** |
|
435 | - * Gets ID |
|
436 | - * |
|
437 | - * @return string |
|
438 | - * @throws \EE_Error |
|
439 | - */ |
|
434 | + /** |
|
435 | + * Gets ID |
|
436 | + * |
|
437 | + * @return string |
|
438 | + * @throws \EE_Error |
|
439 | + */ |
|
440 | 440 | public function ID() { |
441 | 441 | return $this->get( 'TKT_ID' ); |
442 | 442 | } |
443 | 443 | |
444 | 444 | |
445 | 445 | |
446 | - /** |
|
447 | - * get the author of the ticket. |
|
448 | - * |
|
449 | - * @since 4.5.0 |
|
450 | - * @return int |
|
451 | - * @throws \EE_Error |
|
452 | - */ |
|
446 | + /** |
|
447 | + * get the author of the ticket. |
|
448 | + * |
|
449 | + * @since 4.5.0 |
|
450 | + * @return int |
|
451 | + * @throws \EE_Error |
|
452 | + */ |
|
453 | 453 | public function wp_user() { |
454 | 454 | return $this->get('TKT_wp_user'); |
455 | 455 | } |
456 | 456 | |
457 | 457 | |
458 | 458 | |
459 | - /** |
|
460 | - * Gets the template for the ticket |
|
461 | - * |
|
462 | - * @return EE_Ticket_Template|EE_Base_Class |
|
463 | - * @throws \EE_Error |
|
464 | - */ |
|
459 | + /** |
|
460 | + * Gets the template for the ticket |
|
461 | + * |
|
462 | + * @return EE_Ticket_Template|EE_Base_Class |
|
463 | + * @throws \EE_Error |
|
464 | + */ |
|
465 | 465 | public function template() { |
466 | 466 | return $this->get_first_related( 'Ticket_Template' ); |
467 | 467 | } |
468 | 468 | |
469 | 469 | |
470 | 470 | |
471 | - /** |
|
472 | - * Simply returns an array of EE_Price objects that are taxes. |
|
473 | - * |
|
474 | - * @return EE_Price[] |
|
475 | - * @throws \EE_Error |
|
476 | - */ |
|
471 | + /** |
|
472 | + * Simply returns an array of EE_Price objects that are taxes. |
|
473 | + * |
|
474 | + * @return EE_Price[] |
|
475 | + * @throws \EE_Error |
|
476 | + */ |
|
477 | 477 | public function get_ticket_taxes_for_admin() { |
478 | 478 | return EE_Taxes::get_taxes_for_admin(); |
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | |
483 | - /** |
|
484 | - * @return float |
|
485 | - * @throws \EE_Error |
|
486 | - */ |
|
483 | + /** |
|
484 | + * @return float |
|
485 | + * @throws \EE_Error |
|
486 | + */ |
|
487 | 487 | public function ticket_price() { |
488 | 488 | return $this->get( 'TKT_price' ); |
489 | 489 | } |
490 | 490 | |
491 | 491 | |
492 | 492 | |
493 | - /** |
|
494 | - * @return mixed |
|
495 | - * @throws \EE_Error |
|
496 | - */ |
|
493 | + /** |
|
494 | + * @return mixed |
|
495 | + * @throws \EE_Error |
|
496 | + */ |
|
497 | 497 | public function pretty_price() { |
498 | 498 | return $this->get_pretty( 'TKT_price' ); |
499 | 499 | } |
500 | 500 | |
501 | 501 | |
502 | 502 | |
503 | - /** |
|
504 | - * @return bool |
|
505 | - * @throws \EE_Error |
|
506 | - */ |
|
503 | + /** |
|
504 | + * @return bool |
|
505 | + * @throws \EE_Error |
|
506 | + */ |
|
507 | 507 | public function is_free() { |
508 | 508 | return $this->get_ticket_total_with_taxes() === (float) 0; |
509 | 509 | } |
510 | 510 | |
511 | 511 | |
512 | 512 | |
513 | - /** |
|
514 | - * get_ticket_total_with_taxes |
|
515 | - * |
|
516 | - * @param bool $no_cache |
|
517 | - * @return float |
|
518 | - * @throws \EE_Error |
|
519 | - */ |
|
513 | + /** |
|
514 | + * get_ticket_total_with_taxes |
|
515 | + * |
|
516 | + * @param bool $no_cache |
|
517 | + * @return float |
|
518 | + * @throws \EE_Error |
|
519 | + */ |
|
520 | 520 | public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
521 | 521 | if ($this->_ticket_total_with_taxes === null || $no_cache ) { |
522 | 522 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
@@ -533,201 +533,201 @@ discard block |
||
533 | 533 | |
534 | 534 | |
535 | 535 | |
536 | - /** |
|
537 | - * @return float |
|
538 | - * @throws \EE_Error |
|
539 | - */ |
|
536 | + /** |
|
537 | + * @return float |
|
538 | + * @throws \EE_Error |
|
539 | + */ |
|
540 | 540 | public function get_ticket_subtotal() { |
541 | 541 | return EE_Taxes::get_subtotal_for_admin( $this ); |
542 | 542 | } |
543 | 543 | |
544 | 544 | |
545 | 545 | |
546 | - /** |
|
547 | - * Returns the total taxes applied to this ticket |
|
548 | - * |
|
549 | - * @return float |
|
550 | - * @throws \EE_Error |
|
551 | - */ |
|
546 | + /** |
|
547 | + * Returns the total taxes applied to this ticket |
|
548 | + * |
|
549 | + * @return float |
|
550 | + * @throws \EE_Error |
|
551 | + */ |
|
552 | 552 | public function get_ticket_taxes_total_for_admin() { |
553 | 553 | return EE_Taxes::get_total_taxes_for_admin( $this ); |
554 | 554 | } |
555 | 555 | |
556 | 556 | |
557 | 557 | |
558 | - /** |
|
559 | - * Sets name |
|
560 | - * |
|
561 | - * @param string $name |
|
562 | - * @throws \EE_Error |
|
563 | - */ |
|
558 | + /** |
|
559 | + * Sets name |
|
560 | + * |
|
561 | + * @param string $name |
|
562 | + * @throws \EE_Error |
|
563 | + */ |
|
564 | 564 | public function set_name( $name ) { |
565 | 565 | $this->set( 'TKT_name', $name ); |
566 | 566 | } |
567 | 567 | |
568 | 568 | |
569 | 569 | |
570 | - /** |
|
571 | - * Gets description |
|
572 | - * |
|
573 | - * @return string |
|
574 | - * @throws \EE_Error |
|
575 | - */ |
|
570 | + /** |
|
571 | + * Gets description |
|
572 | + * |
|
573 | + * @return string |
|
574 | + * @throws \EE_Error |
|
575 | + */ |
|
576 | 576 | public function description() { |
577 | 577 | return $this->get( 'TKT_description' ); |
578 | 578 | } |
579 | 579 | |
580 | 580 | |
581 | 581 | |
582 | - /** |
|
583 | - * Sets description |
|
584 | - * |
|
585 | - * @param string $description |
|
586 | - * @throws \EE_Error |
|
587 | - */ |
|
582 | + /** |
|
583 | + * Sets description |
|
584 | + * |
|
585 | + * @param string $description |
|
586 | + * @throws \EE_Error |
|
587 | + */ |
|
588 | 588 | public function set_description( $description ) { |
589 | 589 | $this->set( 'TKT_description', $description ); |
590 | 590 | } |
591 | 591 | |
592 | 592 | |
593 | 593 | |
594 | - /** |
|
595 | - * Gets start_date |
|
596 | - * |
|
597 | - * @param string $dt_frmt |
|
598 | - * @param string $tm_frmt |
|
599 | - * @return string |
|
600 | - * @throws \EE_Error |
|
601 | - */ |
|
594 | + /** |
|
595 | + * Gets start_date |
|
596 | + * |
|
597 | + * @param string $dt_frmt |
|
598 | + * @param string $tm_frmt |
|
599 | + * @return string |
|
600 | + * @throws \EE_Error |
|
601 | + */ |
|
602 | 602 | public function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
603 | 603 | return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
604 | 604 | } |
605 | 605 | |
606 | 606 | |
607 | 607 | |
608 | - /** |
|
609 | - * Sets start_date |
|
610 | - * |
|
611 | - * @param string $start_date |
|
612 | - * @return void |
|
613 | - * @throws \EE_Error |
|
614 | - */ |
|
608 | + /** |
|
609 | + * Sets start_date |
|
610 | + * |
|
611 | + * @param string $start_date |
|
612 | + * @return void |
|
613 | + * @throws \EE_Error |
|
614 | + */ |
|
615 | 615 | public function set_start_date( $start_date ) { |
616 | 616 | $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
617 | 617 | } |
618 | 618 | |
619 | 619 | |
620 | 620 | |
621 | - /** |
|
622 | - * Gets end_date |
|
623 | - * |
|
624 | - * @param string $dt_frmt |
|
625 | - * @param string $tm_frmt |
|
626 | - * @return string |
|
627 | - * @throws \EE_Error |
|
628 | - */ |
|
621 | + /** |
|
622 | + * Gets end_date |
|
623 | + * |
|
624 | + * @param string $dt_frmt |
|
625 | + * @param string $tm_frmt |
|
626 | + * @return string |
|
627 | + * @throws \EE_Error |
|
628 | + */ |
|
629 | 629 | public function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
630 | 630 | return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
631 | 631 | } |
632 | 632 | |
633 | 633 | |
634 | 634 | |
635 | - /** |
|
636 | - * Sets end_date |
|
637 | - * |
|
638 | - * @param string $end_date |
|
639 | - * @return void |
|
640 | - * @throws \EE_Error |
|
641 | - */ |
|
635 | + /** |
|
636 | + * Sets end_date |
|
637 | + * |
|
638 | + * @param string $end_date |
|
639 | + * @return void |
|
640 | + * @throws \EE_Error |
|
641 | + */ |
|
642 | 642 | public function set_end_date( $end_date ) { |
643 | 643 | $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
644 | 644 | } |
645 | 645 | |
646 | 646 | |
647 | 647 | |
648 | - /** |
|
649 | - * Sets sell until time |
|
650 | - * |
|
651 | - * @since 4.5.0 |
|
652 | - * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
|
653 | - * @throws \EE_Error |
|
654 | - */ |
|
648 | + /** |
|
649 | + * Sets sell until time |
|
650 | + * |
|
651 | + * @since 4.5.0 |
|
652 | + * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
|
653 | + * @throws \EE_Error |
|
654 | + */ |
|
655 | 655 | public function set_end_time( $time ) { |
656 | 656 | $this->_set_time_for( $time, 'TKT_end_date' ); |
657 | 657 | } |
658 | 658 | |
659 | 659 | |
660 | 660 | |
661 | - /** |
|
662 | - * Sets min |
|
663 | - * |
|
664 | - * @param int $min |
|
665 | - * @return void |
|
666 | - * @throws \EE_Error |
|
667 | - */ |
|
661 | + /** |
|
662 | + * Sets min |
|
663 | + * |
|
664 | + * @param int $min |
|
665 | + * @return void |
|
666 | + * @throws \EE_Error |
|
667 | + */ |
|
668 | 668 | public function set_min( $min ) { |
669 | 669 | $this->set( 'TKT_min', $min ); |
670 | 670 | } |
671 | 671 | |
672 | 672 | |
673 | 673 | |
674 | - /** |
|
675 | - * Gets max |
|
676 | - * |
|
677 | - * @return int |
|
678 | - * @throws \EE_Error |
|
679 | - */ |
|
674 | + /** |
|
675 | + * Gets max |
|
676 | + * |
|
677 | + * @return int |
|
678 | + * @throws \EE_Error |
|
679 | + */ |
|
680 | 680 | public function max() { |
681 | 681 | return $this->get( 'TKT_max' ); |
682 | 682 | } |
683 | 683 | |
684 | 684 | |
685 | 685 | |
686 | - /** |
|
687 | - * Sets max |
|
688 | - * |
|
689 | - * @param int $max |
|
690 | - * @return void |
|
691 | - * @throws \EE_Error |
|
692 | - */ |
|
686 | + /** |
|
687 | + * Sets max |
|
688 | + * |
|
689 | + * @param int $max |
|
690 | + * @return void |
|
691 | + * @throws \EE_Error |
|
692 | + */ |
|
693 | 693 | public function set_max( $max ) { |
694 | 694 | $this->set( 'TKT_max', $max ); |
695 | 695 | } |
696 | 696 | |
697 | 697 | |
698 | 698 | |
699 | - /** |
|
700 | - * Sets price |
|
701 | - * |
|
702 | - * @param float $price |
|
703 | - * @return void |
|
704 | - * @throws \EE_Error |
|
705 | - */ |
|
699 | + /** |
|
700 | + * Sets price |
|
701 | + * |
|
702 | + * @param float $price |
|
703 | + * @return void |
|
704 | + * @throws \EE_Error |
|
705 | + */ |
|
706 | 706 | public function set_price( $price ) { |
707 | 707 | $this->set( 'TKT_price', $price ); |
708 | 708 | } |
709 | 709 | |
710 | 710 | |
711 | 711 | |
712 | - /** |
|
713 | - * Gets sold |
|
714 | - * |
|
715 | - * @return int |
|
716 | - * @throws \EE_Error |
|
717 | - */ |
|
712 | + /** |
|
713 | + * Gets sold |
|
714 | + * |
|
715 | + * @return int |
|
716 | + * @throws \EE_Error |
|
717 | + */ |
|
718 | 718 | public function sold() { |
719 | 719 | return $this->get_raw( 'TKT_sold' ); |
720 | 720 | } |
721 | 721 | |
722 | 722 | |
723 | 723 | |
724 | - /** |
|
725 | - * Sets sold |
|
726 | - * |
|
727 | - * @param int $sold |
|
728 | - * @return void |
|
729 | - * @throws \EE_Error |
|
730 | - */ |
|
724 | + /** |
|
725 | + * Sets sold |
|
726 | + * |
|
727 | + * @param int $sold |
|
728 | + * @return void |
|
729 | + * @throws \EE_Error |
|
730 | + */ |
|
731 | 731 | public function set_sold( $sold ) { |
732 | 732 | // sold can not go below zero |
733 | 733 | $sold = max( 0, $sold ); |
@@ -736,13 +736,13 @@ discard block |
||
736 | 736 | |
737 | 737 | |
738 | 738 | |
739 | - /** |
|
740 | - * increments sold by amount passed by $qty |
|
741 | - * |
|
742 | - * @param int $qty |
|
743 | - * @return void |
|
744 | - * @throws \EE_Error |
|
745 | - */ |
|
739 | + /** |
|
740 | + * increments sold by amount passed by $qty |
|
741 | + * |
|
742 | + * @param int $qty |
|
743 | + * @return void |
|
744 | + * @throws \EE_Error |
|
745 | + */ |
|
746 | 746 | public function increase_sold( $qty = 1 ) { |
747 | 747 | $sold = $this->sold() + $qty; |
748 | 748 | // remove ticket reservation, but don't adjust datetime reservations, because that will happen |
@@ -751,22 +751,22 @@ discard block |
||
751 | 751 | $this->_increase_sold_for_datetimes( $qty ); |
752 | 752 | $this->set_sold( $sold ); |
753 | 753 | do_action( |
754 | - 'AHEE__EE_Ticket__increase_sold', |
|
755 | - $this, |
|
756 | - $qty, |
|
757 | - $sold |
|
758 | - ); |
|
754 | + 'AHEE__EE_Ticket__increase_sold', |
|
755 | + $this, |
|
756 | + $qty, |
|
757 | + $sold |
|
758 | + ); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | |
762 | 762 | |
763 | - /** |
|
764 | - * Increases sold on related datetimes |
|
765 | - * |
|
766 | - * @param int $qty |
|
767 | - * @return void |
|
768 | - * @throws \EE_Error |
|
769 | - */ |
|
763 | + /** |
|
764 | + * Increases sold on related datetimes |
|
765 | + * |
|
766 | + * @param int $qty |
|
767 | + * @return void |
|
768 | + * @throws \EE_Error |
|
769 | + */ |
|
770 | 770 | protected function _increase_sold_for_datetimes( $qty = 1 ) { |
771 | 771 | $datetimes = $this->datetimes(); |
772 | 772 | if ( is_array( $datetimes ) ) { |
@@ -781,34 +781,34 @@ discard block |
||
781 | 781 | |
782 | 782 | |
783 | 783 | |
784 | - /** |
|
785 | - * decrements (subtracts) sold by amount passed by $qty |
|
786 | - * |
|
787 | - * @param int $qty |
|
788 | - * @return void |
|
789 | - * @throws \EE_Error |
|
790 | - */ |
|
784 | + /** |
|
785 | + * decrements (subtracts) sold by amount passed by $qty |
|
786 | + * |
|
787 | + * @param int $qty |
|
788 | + * @return void |
|
789 | + * @throws \EE_Error |
|
790 | + */ |
|
791 | 791 | public function decrease_sold( $qty = 1 ) { |
792 | 792 | $sold = $this->sold() - $qty; |
793 | 793 | $this->_decrease_sold_for_datetimes( $qty ); |
794 | 794 | $this->set_sold( $sold ); |
795 | - do_action( |
|
796 | - 'AHEE__EE_Ticket__decrease_sold', |
|
797 | - $this, |
|
798 | - $qty, |
|
799 | - $sold |
|
800 | - ); |
|
801 | - } |
|
802 | - |
|
803 | - |
|
804 | - |
|
805 | - /** |
|
806 | - * Decreases sold on related datetimes |
|
807 | - * |
|
808 | - * @param int $qty |
|
809 | - * @return void |
|
810 | - * @throws \EE_Error |
|
811 | - */ |
|
795 | + do_action( |
|
796 | + 'AHEE__EE_Ticket__decrease_sold', |
|
797 | + $this, |
|
798 | + $qty, |
|
799 | + $sold |
|
800 | + ); |
|
801 | + } |
|
802 | + |
|
803 | + |
|
804 | + |
|
805 | + /** |
|
806 | + * Decreases sold on related datetimes |
|
807 | + * |
|
808 | + * @param int $qty |
|
809 | + * @return void |
|
810 | + * @throws \EE_Error |
|
811 | + */ |
|
812 | 812 | protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
813 | 813 | $datetimes = $this->datetimes(); |
814 | 814 | if ( is_array( $datetimes ) ) { |
@@ -823,25 +823,25 @@ discard block |
||
823 | 823 | |
824 | 824 | |
825 | 825 | |
826 | - /** |
|
827 | - * Gets qty of reserved tickets |
|
828 | - * |
|
829 | - * @return int |
|
830 | - * @throws \EE_Error |
|
831 | - */ |
|
826 | + /** |
|
827 | + * Gets qty of reserved tickets |
|
828 | + * |
|
829 | + * @return int |
|
830 | + * @throws \EE_Error |
|
831 | + */ |
|
832 | 832 | public function reserved() { |
833 | 833 | return $this->get_raw( 'TKT_reserved' ); |
834 | 834 | } |
835 | 835 | |
836 | 836 | |
837 | 837 | |
838 | - /** |
|
839 | - * Sets reserved |
|
840 | - * |
|
841 | - * @param int $reserved |
|
842 | - * @return void |
|
843 | - * @throws \EE_Error |
|
844 | - */ |
|
838 | + /** |
|
839 | + * Sets reserved |
|
840 | + * |
|
841 | + * @param int $reserved |
|
842 | + * @return void |
|
843 | + * @throws \EE_Error |
|
844 | + */ |
|
845 | 845 | public function set_reserved( $reserved ) { |
846 | 846 | // reserved can not go below zero |
847 | 847 | $reserved = max( 0, (int) $reserved ); |
@@ -849,48 +849,48 @@ discard block |
||
849 | 849 | } |
850 | 850 | |
851 | 851 | |
852 | - /** |
|
853 | - * increments reserved by amount passed by $qty |
|
854 | - * |
|
855 | - * @param int $qty |
|
856 | - * @param string $source |
|
857 | - * @return void |
|
858 | - * @throws EE_Error |
|
859 | - * @throws InvalidArgumentException |
|
860 | - * @throws ReflectionException |
|
861 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
862 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
863 | - */ |
|
852 | + /** |
|
853 | + * increments reserved by amount passed by $qty |
|
854 | + * |
|
855 | + * @param int $qty |
|
856 | + * @param string $source |
|
857 | + * @return void |
|
858 | + * @throws EE_Error |
|
859 | + * @throws InvalidArgumentException |
|
860 | + * @throws ReflectionException |
|
861 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
862 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
863 | + */ |
|
864 | 864 | public function increase_reserved( $qty = 1, $source = 'unknown' ) { |
865 | 865 | $qty = absint( $qty ); |
866 | 866 | $reserved = $this->reserved() + $qty; |
867 | - if ( |
|
868 | - $reserved |
|
869 | - && $this->add_extra_meta( |
|
870 | - EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
|
871 | - "{$qty} from {$source}" |
|
872 | - ) |
|
873 | - ) { |
|
874 | - $this->_increase_reserved_for_datetimes($qty); |
|
875 | - $this->set_reserved($reserved); |
|
876 | - do_action( |
|
877 | - 'AHEE__EE_Ticket__increase_reserved', |
|
878 | - $this, |
|
879 | - $qty, |
|
880 | - $reserved |
|
881 | - ); |
|
882 | - } |
|
883 | - } |
|
884 | - |
|
885 | - |
|
886 | - |
|
887 | - /** |
|
888 | - * Increases sold on related datetimes |
|
889 | - * |
|
890 | - * @param int $qty |
|
891 | - * @return void |
|
892 | - * @throws \EE_Error |
|
893 | - */ |
|
867 | + if ( |
|
868 | + $reserved |
|
869 | + && $this->add_extra_meta( |
|
870 | + EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
|
871 | + "{$qty} from {$source}" |
|
872 | + ) |
|
873 | + ) { |
|
874 | + $this->_increase_reserved_for_datetimes($qty); |
|
875 | + $this->set_reserved($reserved); |
|
876 | + do_action( |
|
877 | + 'AHEE__EE_Ticket__increase_reserved', |
|
878 | + $this, |
|
879 | + $qty, |
|
880 | + $reserved |
|
881 | + ); |
|
882 | + } |
|
883 | + } |
|
884 | + |
|
885 | + |
|
886 | + |
|
887 | + /** |
|
888 | + * Increases sold on related datetimes |
|
889 | + * |
|
890 | + * @param int $qty |
|
891 | + * @return void |
|
892 | + * @throws \EE_Error |
|
893 | + */ |
|
894 | 894 | protected function _increase_reserved_for_datetimes( $qty = 1 ) { |
895 | 895 | $datetimes = $this->datetimes(); |
896 | 896 | if ( is_array( $datetimes ) ) { |
@@ -904,49 +904,49 @@ discard block |
||
904 | 904 | } |
905 | 905 | |
906 | 906 | |
907 | - /** |
|
908 | - * decrements (subtracts) reserved by amount passed by $qty |
|
909 | - * |
|
910 | - * @param int $qty |
|
911 | - * @param bool $adjust_datetimes |
|
912 | - * @param string $source |
|
913 | - * @return void |
|
914 | - * @throws EE_Error |
|
915 | - * @throws InvalidArgumentException |
|
916 | - * @throws ReflectionException |
|
917 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
918 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
919 | - */ |
|
907 | + /** |
|
908 | + * decrements (subtracts) reserved by amount passed by $qty |
|
909 | + * |
|
910 | + * @param int $qty |
|
911 | + * @param bool $adjust_datetimes |
|
912 | + * @param string $source |
|
913 | + * @return void |
|
914 | + * @throws EE_Error |
|
915 | + * @throws InvalidArgumentException |
|
916 | + * @throws ReflectionException |
|
917 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
918 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
919 | + */ |
|
920 | 920 | public function decrease_reserved( $qty = 1, $adjust_datetimes = true, $source = 'unknown' ) { |
921 | 921 | $reserved = $this->reserved() - absint( $qty ); |
922 | - if ( |
|
923 | - $this->add_extra_meta( |
|
924 | - EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
|
925 | - "-{$qty} from {$source}" |
|
926 | - ) |
|
927 | - ) { |
|
928 | - if ($adjust_datetimes) { |
|
929 | - $this->_decrease_reserved_for_datetimes($qty); |
|
930 | - } |
|
931 | - $this->set_reserved($reserved); |
|
932 | - do_action( |
|
933 | - 'AHEE__EE_Ticket__decrease_reserved', |
|
934 | - $this, |
|
935 | - $qty, |
|
936 | - $reserved |
|
937 | - ); |
|
938 | - } |
|
939 | - } |
|
940 | - |
|
941 | - |
|
942 | - |
|
943 | - /** |
|
944 | - * Increases sold on related datetimes |
|
945 | - * |
|
946 | - * @param int $qty |
|
947 | - * @return void |
|
948 | - * @throws \EE_Error |
|
949 | - */ |
|
922 | + if ( |
|
923 | + $this->add_extra_meta( |
|
924 | + EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
|
925 | + "-{$qty} from {$source}" |
|
926 | + ) |
|
927 | + ) { |
|
928 | + if ($adjust_datetimes) { |
|
929 | + $this->_decrease_reserved_for_datetimes($qty); |
|
930 | + } |
|
931 | + $this->set_reserved($reserved); |
|
932 | + do_action( |
|
933 | + 'AHEE__EE_Ticket__decrease_reserved', |
|
934 | + $this, |
|
935 | + $qty, |
|
936 | + $reserved |
|
937 | + ); |
|
938 | + } |
|
939 | + } |
|
940 | + |
|
941 | + |
|
942 | + |
|
943 | + /** |
|
944 | + * Increases sold on related datetimes |
|
945 | + * |
|
946 | + * @param int $qty |
|
947 | + * @return void |
|
948 | + * @throws \EE_Error |
|
949 | + */ |
|
950 | 950 | protected function _decrease_reserved_for_datetimes( $qty = 1 ) { |
951 | 951 | $datetimes = $this->datetimes(); |
952 | 952 | if ( is_array( $datetimes ) ) { |
@@ -961,18 +961,18 @@ discard block |
||
961 | 961 | |
962 | 962 | |
963 | 963 | |
964 | - /** |
|
965 | - * Gets ticket quantity |
|
966 | - * |
|
967 | - * @param string $context ticket quantity is somewhat subjective depending on the exact information sought |
|
968 | - * therefore $context can be one of three values: '', 'reg_limit', or 'saleable' |
|
969 | - * '' (default) quantity is the actual db value for TKT_qty, unaffected by other objects |
|
970 | - * REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes |
|
971 | - * SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and |
|
972 | - * is therefore the truest measure of tickets that can be purchased at the moment |
|
973 | - * @return int |
|
974 | - * @throws \EE_Error |
|
975 | - */ |
|
964 | + /** |
|
965 | + * Gets ticket quantity |
|
966 | + * |
|
967 | + * @param string $context ticket quantity is somewhat subjective depending on the exact information sought |
|
968 | + * therefore $context can be one of three values: '', 'reg_limit', or 'saleable' |
|
969 | + * '' (default) quantity is the actual db value for TKT_qty, unaffected by other objects |
|
970 | + * REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes |
|
971 | + * SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and |
|
972 | + * is therefore the truest measure of tickets that can be purchased at the moment |
|
973 | + * @return int |
|
974 | + * @throws \EE_Error |
|
975 | + */ |
|
976 | 976 | public function qty( $context = '' ) { |
977 | 977 | switch ( $context ) { |
978 | 978 | case 'reg_limit' : |
@@ -986,19 +986,19 @@ discard block |
||
986 | 986 | |
987 | 987 | |
988 | 988 | |
989 | - /** |
|
990 | - * Gets ticket quantity |
|
991 | - * |
|
992 | - * @param string $context ticket quantity is somewhat subjective depending on the exact information sought |
|
993 | - * therefore $context can be one of two values: 'reg_limit', or 'saleable' |
|
994 | - * REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes |
|
995 | - * SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and |
|
996 | - * is therefore the truest measure of tickets that can be purchased at the moment |
|
997 | - * @param int $DTT_ID the primary key for a particular datetime. |
|
998 | - * set to 0 for all related datetimes |
|
999 | - * @return int |
|
1000 | - * @throws \EE_Error |
|
1001 | - */ |
|
989 | + /** |
|
990 | + * Gets ticket quantity |
|
991 | + * |
|
992 | + * @param string $context ticket quantity is somewhat subjective depending on the exact information sought |
|
993 | + * therefore $context can be one of two values: 'reg_limit', or 'saleable' |
|
994 | + * REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes |
|
995 | + * SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and |
|
996 | + * is therefore the truest measure of tickets that can be purchased at the moment |
|
997 | + * @param int $DTT_ID the primary key for a particular datetime. |
|
998 | + * set to 0 for all related datetimes |
|
999 | + * @return int |
|
1000 | + * @throws \EE_Error |
|
1001 | + */ |
|
1002 | 1002 | public function real_quantity_on_ticket( $context = 'reg_limit', $DTT_ID = 0 ) { |
1003 | 1003 | $raw = $this->get_raw( 'TKT_qty' ); |
1004 | 1004 | // return immediately if it's zero |
@@ -1081,212 +1081,212 @@ discard block |
||
1081 | 1081 | |
1082 | 1082 | |
1083 | 1083 | |
1084 | - /** |
|
1085 | - * Gets uses |
|
1086 | - * |
|
1087 | - * @return int |
|
1088 | - * @throws \EE_Error |
|
1089 | - */ |
|
1084 | + /** |
|
1085 | + * Gets uses |
|
1086 | + * |
|
1087 | + * @return int |
|
1088 | + * @throws \EE_Error |
|
1089 | + */ |
|
1090 | 1090 | public function uses() { |
1091 | 1091 | return $this->get( 'TKT_uses' ); |
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | |
1095 | 1095 | |
1096 | - /** |
|
1097 | - * Sets uses |
|
1098 | - * |
|
1099 | - * @param int $uses |
|
1100 | - * @return void |
|
1101 | - * @throws \EE_Error |
|
1102 | - */ |
|
1096 | + /** |
|
1097 | + * Sets uses |
|
1098 | + * |
|
1099 | + * @param int $uses |
|
1100 | + * @return void |
|
1101 | + * @throws \EE_Error |
|
1102 | + */ |
|
1103 | 1103 | public function set_uses( $uses ) { |
1104 | 1104 | $this->set( 'TKT_uses', $uses ); |
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | |
1108 | 1108 | |
1109 | - /** |
|
1110 | - * returns whether ticket is required or not. |
|
1111 | - * |
|
1112 | - * @return boolean |
|
1113 | - * @throws \EE_Error |
|
1114 | - */ |
|
1109 | + /** |
|
1110 | + * returns whether ticket is required or not. |
|
1111 | + * |
|
1112 | + * @return boolean |
|
1113 | + * @throws \EE_Error |
|
1114 | + */ |
|
1115 | 1115 | public function required() { |
1116 | 1116 | return $this->get( 'TKT_required' ); |
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
1120 | 1120 | |
1121 | - /** |
|
1122 | - * sets the TKT_required property |
|
1123 | - * |
|
1124 | - * @param boolean $required |
|
1125 | - * @return void |
|
1126 | - * @throws \EE_Error |
|
1127 | - */ |
|
1121 | + /** |
|
1122 | + * sets the TKT_required property |
|
1123 | + * |
|
1124 | + * @param boolean $required |
|
1125 | + * @return void |
|
1126 | + * @throws \EE_Error |
|
1127 | + */ |
|
1128 | 1128 | public function set_required( $required ) { |
1129 | 1129 | $this->set( 'TKT_required', $required ); |
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | |
1133 | 1133 | |
1134 | - /** |
|
1135 | - * Gets taxable |
|
1136 | - * |
|
1137 | - * @return boolean |
|
1138 | - * @throws \EE_Error |
|
1139 | - */ |
|
1134 | + /** |
|
1135 | + * Gets taxable |
|
1136 | + * |
|
1137 | + * @return boolean |
|
1138 | + * @throws \EE_Error |
|
1139 | + */ |
|
1140 | 1140 | public function taxable() { |
1141 | 1141 | return $this->get( 'TKT_taxable' ); |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
1145 | 1145 | |
1146 | - /** |
|
1147 | - * Sets taxable |
|
1148 | - * |
|
1149 | - * @param boolean $taxable |
|
1150 | - * @return void |
|
1151 | - * @throws \EE_Error |
|
1152 | - */ |
|
1146 | + /** |
|
1147 | + * Sets taxable |
|
1148 | + * |
|
1149 | + * @param boolean $taxable |
|
1150 | + * @return void |
|
1151 | + * @throws \EE_Error |
|
1152 | + */ |
|
1153 | 1153 | public function set_taxable( $taxable ) { |
1154 | 1154 | $this->set( 'TKT_taxable', $taxable ); |
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | |
1158 | 1158 | |
1159 | - /** |
|
1160 | - * Gets is_default |
|
1161 | - * |
|
1162 | - * @return boolean |
|
1163 | - * @throws \EE_Error |
|
1164 | - */ |
|
1159 | + /** |
|
1160 | + * Gets is_default |
|
1161 | + * |
|
1162 | + * @return boolean |
|
1163 | + * @throws \EE_Error |
|
1164 | + */ |
|
1165 | 1165 | public function is_default() { |
1166 | 1166 | return $this->get( 'TKT_is_default' ); |
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
1170 | 1170 | |
1171 | - /** |
|
1172 | - * Sets is_default |
|
1173 | - * |
|
1174 | - * @param boolean $is_default |
|
1175 | - * @return void |
|
1176 | - * @throws \EE_Error |
|
1177 | - */ |
|
1171 | + /** |
|
1172 | + * Sets is_default |
|
1173 | + * |
|
1174 | + * @param boolean $is_default |
|
1175 | + * @return void |
|
1176 | + * @throws \EE_Error |
|
1177 | + */ |
|
1178 | 1178 | public function set_is_default( $is_default ) { |
1179 | 1179 | $this->set( 'TKT_is_default', $is_default ); |
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | |
1183 | 1183 | |
1184 | - /** |
|
1185 | - * Gets order |
|
1186 | - * |
|
1187 | - * @return int |
|
1188 | - * @throws \EE_Error |
|
1189 | - */ |
|
1184 | + /** |
|
1185 | + * Gets order |
|
1186 | + * |
|
1187 | + * @return int |
|
1188 | + * @throws \EE_Error |
|
1189 | + */ |
|
1190 | 1190 | public function order() { |
1191 | 1191 | return $this->get( 'TKT_order' ); |
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | |
1195 | 1195 | |
1196 | - /** |
|
1197 | - * Sets order |
|
1198 | - * |
|
1199 | - * @param int $order |
|
1200 | - * @return void |
|
1201 | - * @throws \EE_Error |
|
1202 | - */ |
|
1196 | + /** |
|
1197 | + * Sets order |
|
1198 | + * |
|
1199 | + * @param int $order |
|
1200 | + * @return void |
|
1201 | + * @throws \EE_Error |
|
1202 | + */ |
|
1203 | 1203 | public function set_order( $order ) { |
1204 | 1204 | $this->set( 'TKT_order', $order ); |
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | |
1208 | 1208 | |
1209 | - /** |
|
1210 | - * Gets row |
|
1211 | - * |
|
1212 | - * @return int |
|
1213 | - * @throws \EE_Error |
|
1214 | - */ |
|
1209 | + /** |
|
1210 | + * Gets row |
|
1211 | + * |
|
1212 | + * @return int |
|
1213 | + * @throws \EE_Error |
|
1214 | + */ |
|
1215 | 1215 | public function row() { |
1216 | 1216 | return $this->get( 'TKT_row' ); |
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | 1220 | |
1221 | - /** |
|
1222 | - * Sets row |
|
1223 | - * |
|
1224 | - * @param int $row |
|
1225 | - * @return void |
|
1226 | - * @throws \EE_Error |
|
1227 | - */ |
|
1221 | + /** |
|
1222 | + * Sets row |
|
1223 | + * |
|
1224 | + * @param int $row |
|
1225 | + * @return void |
|
1226 | + * @throws \EE_Error |
|
1227 | + */ |
|
1228 | 1228 | public function set_row( $row ) { |
1229 | 1229 | $this->set( 'TKT_row', $row ); |
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | |
1233 | 1233 | |
1234 | - /** |
|
1235 | - * Gets deleted |
|
1236 | - * |
|
1237 | - * @return boolean |
|
1238 | - * @throws \EE_Error |
|
1239 | - */ |
|
1234 | + /** |
|
1235 | + * Gets deleted |
|
1236 | + * |
|
1237 | + * @return boolean |
|
1238 | + * @throws \EE_Error |
|
1239 | + */ |
|
1240 | 1240 | public function deleted() { |
1241 | 1241 | return $this->get( 'TKT_deleted' ); |
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | |
1245 | 1245 | |
1246 | - /** |
|
1247 | - * Sets deleted |
|
1248 | - * |
|
1249 | - * @param boolean $deleted |
|
1250 | - * @return void |
|
1251 | - * @throws \EE_Error |
|
1252 | - */ |
|
1246 | + /** |
|
1247 | + * Sets deleted |
|
1248 | + * |
|
1249 | + * @param boolean $deleted |
|
1250 | + * @return void |
|
1251 | + * @throws \EE_Error |
|
1252 | + */ |
|
1253 | 1253 | public function set_deleted( $deleted ) { |
1254 | 1254 | $this->set( 'TKT_deleted', $deleted ); |
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
1258 | 1258 | |
1259 | - /** |
|
1260 | - * Gets parent |
|
1261 | - * |
|
1262 | - * @return int |
|
1263 | - * @throws \EE_Error |
|
1264 | - */ |
|
1259 | + /** |
|
1260 | + * Gets parent |
|
1261 | + * |
|
1262 | + * @return int |
|
1263 | + * @throws \EE_Error |
|
1264 | + */ |
|
1265 | 1265 | public function parent_ID() { |
1266 | 1266 | return $this->get( 'TKT_parent' ); |
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | |
1270 | 1270 | |
1271 | - /** |
|
1272 | - * Sets parent |
|
1273 | - * |
|
1274 | - * @param int $parent |
|
1275 | - * @return void |
|
1276 | - * @throws \EE_Error |
|
1277 | - */ |
|
1271 | + /** |
|
1272 | + * Sets parent |
|
1273 | + * |
|
1274 | + * @param int $parent |
|
1275 | + * @return void |
|
1276 | + * @throws \EE_Error |
|
1277 | + */ |
|
1278 | 1278 | public function set_parent_ID( $parent ) { |
1279 | 1279 | $this->set( 'TKT_parent', $parent ); |
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | |
1283 | 1283 | |
1284 | - /** |
|
1285 | - * Gets a string which is handy for showing in gateways etc that describes the ticket. |
|
1286 | - * |
|
1287 | - * @return string |
|
1288 | - * @throws \EE_Error |
|
1289 | - */ |
|
1284 | + /** |
|
1285 | + * Gets a string which is handy for showing in gateways etc that describes the ticket. |
|
1286 | + * |
|
1287 | + * @return string |
|
1288 | + * @throws \EE_Error |
|
1289 | + */ |
|
1290 | 1290 | public function name_and_info() { |
1291 | 1291 | $times = array(); |
1292 | 1292 | foreach ( $this->datetimes() as $datetime ) { |
@@ -1297,67 +1297,67 @@ discard block |
||
1297 | 1297 | |
1298 | 1298 | |
1299 | 1299 | |
1300 | - /** |
|
1301 | - * Gets name |
|
1302 | - * |
|
1303 | - * @return string |
|
1304 | - * @throws \EE_Error |
|
1305 | - */ |
|
1300 | + /** |
|
1301 | + * Gets name |
|
1302 | + * |
|
1303 | + * @return string |
|
1304 | + * @throws \EE_Error |
|
1305 | + */ |
|
1306 | 1306 | public function name() { |
1307 | 1307 | return $this->get( 'TKT_name' ); |
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | |
1311 | 1311 | |
1312 | - /** |
|
1313 | - * Gets price |
|
1314 | - * |
|
1315 | - * @return float |
|
1316 | - * @throws \EE_Error |
|
1317 | - */ |
|
1312 | + /** |
|
1313 | + * Gets price |
|
1314 | + * |
|
1315 | + * @return float |
|
1316 | + * @throws \EE_Error |
|
1317 | + */ |
|
1318 | 1318 | public function price() { |
1319 | 1319 | return $this->get( 'TKT_price' ); |
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | |
1323 | 1323 | |
1324 | - /** |
|
1325 | - * Gets all the registrations for this ticket |
|
1326 | - * |
|
1327 | - * @param array $query_params like EEM_Base::get_all's |
|
1328 | - * @return EE_Registration[]|EE_Base_Class[] |
|
1329 | - * @throws \EE_Error |
|
1330 | - */ |
|
1324 | + /** |
|
1325 | + * Gets all the registrations for this ticket |
|
1326 | + * |
|
1327 | + * @param array $query_params like EEM_Base::get_all's |
|
1328 | + * @return EE_Registration[]|EE_Base_Class[] |
|
1329 | + * @throws \EE_Error |
|
1330 | + */ |
|
1331 | 1331 | public function registrations( $query_params = array() ) { |
1332 | 1332 | return $this->get_many_related( 'Registration', $query_params ); |
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | |
1336 | 1336 | |
1337 | - /** |
|
1338 | - * Updates the TKT_sold attribute (and saves) based on the number of APPROVED registrations for this ticket. |
|
1339 | - * into account |
|
1340 | - * |
|
1341 | - * @return int |
|
1342 | - * @throws \EE_Error |
|
1343 | - */ |
|
1337 | + /** |
|
1338 | + * Updates the TKT_sold attribute (and saves) based on the number of APPROVED registrations for this ticket. |
|
1339 | + * into account |
|
1340 | + * |
|
1341 | + * @return int |
|
1342 | + * @throws \EE_Error |
|
1343 | + */ |
|
1344 | 1344 | public function update_tickets_sold() { |
1345 | - $count_regs_for_this_ticket = $this->count_registrations( |
|
1346 | - array( |
|
1347 | - array( |
|
1348 | - 'STS_ID' => EEM_Registration::status_id_approved, |
|
1349 | - 'REG_deleted' => 0, |
|
1350 | - ), |
|
1351 | - ) |
|
1352 | - ); |
|
1353 | - $sold = $this->sold(); |
|
1354 | - if ($count_regs_for_this_ticket > $sold) { |
|
1355 | - $this->increase_sold($count_regs_for_this_ticket - $sold); |
|
1356 | - $this->save(); |
|
1357 | - } else if ($count_regs_for_this_ticket < $sold) { |
|
1358 | - $this->decrease_sold($count_regs_for_this_ticket - $sold); |
|
1359 | - $this->save(); |
|
1360 | - } |
|
1345 | + $count_regs_for_this_ticket = $this->count_registrations( |
|
1346 | + array( |
|
1347 | + array( |
|
1348 | + 'STS_ID' => EEM_Registration::status_id_approved, |
|
1349 | + 'REG_deleted' => 0, |
|
1350 | + ), |
|
1351 | + ) |
|
1352 | + ); |
|
1353 | + $sold = $this->sold(); |
|
1354 | + if ($count_regs_for_this_ticket > $sold) { |
|
1355 | + $this->increase_sold($count_regs_for_this_ticket - $sold); |
|
1356 | + $this->save(); |
|
1357 | + } else if ($count_regs_for_this_ticket < $sold) { |
|
1358 | + $this->decrease_sold($count_regs_for_this_ticket - $sold); |
|
1359 | + $this->save(); |
|
1360 | + } |
|
1361 | 1361 | return $count_regs_for_this_ticket; |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1385,21 +1385,21 @@ discard block |
||
1385 | 1385 | |
1386 | 1386 | |
1387 | 1387 | |
1388 | - /** |
|
1389 | - * Implementation of the EEI_Event_Relation interface method |
|
1390 | - * |
|
1391 | - * @see EEI_Event_Relation for comments |
|
1392 | - * @return EE_Event |
|
1393 | - * @throws \EE_Error |
|
1394 | - * @throws UnexpectedEntityException |
|
1395 | - */ |
|
1388 | + /** |
|
1389 | + * Implementation of the EEI_Event_Relation interface method |
|
1390 | + * |
|
1391 | + * @see EEI_Event_Relation for comments |
|
1392 | + * @return EE_Event |
|
1393 | + * @throws \EE_Error |
|
1394 | + * @throws UnexpectedEntityException |
|
1395 | + */ |
|
1396 | 1396 | public function get_related_event() { |
1397 | 1397 | //get one datetime to use for getting the event |
1398 | 1398 | $datetime = $this->first_datetime(); |
1399 | 1399 | if ( ! $datetime instanceof \EE_Datetime ) { |
1400 | 1400 | throw new UnexpectedEntityException( |
1401 | 1401 | $datetime, |
1402 | - 'EE_Datetime', |
|
1402 | + 'EE_Datetime', |
|
1403 | 1403 | sprintf( |
1404 | 1404 | __( 'The ticket (%s) is not associated with any valid datetimes.', 'event_espresso'), |
1405 | 1405 | $this->name() |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | if ( ! $event instanceof \EE_Event ) { |
1411 | 1411 | throw new UnexpectedEntityException( |
1412 | 1412 | $event, |
1413 | - 'EE_Event', |
|
1413 | + 'EE_Event', |
|
1414 | 1414 | sprintf( |
1415 | 1415 | __( 'The ticket (%s) is not associated with a valid event.', 'event_espresso'), |
1416 | 1416 | $this->name() |
@@ -1422,14 +1422,14 @@ discard block |
||
1422 | 1422 | |
1423 | 1423 | |
1424 | 1424 | |
1425 | - /** |
|
1426 | - * Implementation of the EEI_Event_Relation interface method |
|
1427 | - * |
|
1428 | - * @see EEI_Event_Relation for comments |
|
1429 | - * @return string |
|
1430 | - * @throws UnexpectedEntityException |
|
1431 | - * @throws \EE_Error |
|
1432 | - */ |
|
1425 | + /** |
|
1426 | + * Implementation of the EEI_Event_Relation interface method |
|
1427 | + * |
|
1428 | + * @see EEI_Event_Relation for comments |
|
1429 | + * @return string |
|
1430 | + * @throws UnexpectedEntityException |
|
1431 | + * @throws \EE_Error |
|
1432 | + */ |
|
1433 | 1433 | public function get_event_name() { |
1434 | 1434 | $event = $this->get_related_event(); |
1435 | 1435 | return $event instanceof EE_Event ? $event->name() : ''; |
@@ -1437,28 +1437,28 @@ discard block |
||
1437 | 1437 | |
1438 | 1438 | |
1439 | 1439 | |
1440 | - /** |
|
1441 | - * Implementation of the EEI_Event_Relation interface method |
|
1442 | - * |
|
1443 | - * @see EEI_Event_Relation for comments |
|
1444 | - * @return int |
|
1445 | - * @throws UnexpectedEntityException |
|
1446 | - * @throws \EE_Error |
|
1447 | - */ |
|
1440 | + /** |
|
1441 | + * Implementation of the EEI_Event_Relation interface method |
|
1442 | + * |
|
1443 | + * @see EEI_Event_Relation for comments |
|
1444 | + * @return int |
|
1445 | + * @throws UnexpectedEntityException |
|
1446 | + * @throws \EE_Error |
|
1447 | + */ |
|
1448 | 1448 | public function get_event_ID() { |
1449 | 1449 | $event = $this->get_related_event(); |
1450 | 1450 | return $event instanceof EE_Event ? $event->ID() : 0; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | |
1454 | - /** |
|
1455 | - * This simply returns whether a ticket can be permanently deleted or not. |
|
1456 | - * The criteria for determining this is whether the ticket has any related registrations. |
|
1457 | - * If there are none then it can be permanently deleted. |
|
1458 | - * |
|
1459 | - * @return bool |
|
1460 | - */ |
|
1454 | + /** |
|
1455 | + * This simply returns whether a ticket can be permanently deleted or not. |
|
1456 | + * The criteria for determining this is whether the ticket has any related registrations. |
|
1457 | + * If there are none then it can be permanently deleted. |
|
1458 | + * |
|
1459 | + * @return bool |
|
1460 | + */ |
|
1461 | 1461 | public function is_permanently_deleteable() { |
1462 | - return $this->count_registrations() === 0; |
|
1463 | - } |
|
1462 | + return $this->count_registrations() === 0; |
|
1463 | + } |
|
1464 | 1464 | } //end EE_Ticket class |
@@ -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 |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * @return EE_Ticket |
78 | 78 | * @throws \EE_Error |
79 | 79 | */ |
80 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
81 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
82 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
80 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
81 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
82 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @return EE_Ticket |
92 | 92 | * @throws \EE_Error |
93 | 93 | */ |
94 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
95 | - return new self( $props_n_values, TRUE, $timezone ); |
|
94 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
95 | + return new self($props_n_values, TRUE, $timezone); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @throws \EE_Error |
103 | 103 | */ |
104 | 104 | public function parent() { |
105 | - return $this->get( 'TKT_parent' ); |
|
105 | + return $this->get('TKT_parent'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | * @return boolean |
115 | 115 | * @throws \EE_Error |
116 | 116 | */ |
117 | - public function available( $DTT_ID = 0 ) { |
|
117 | + public function available($DTT_ID = 0) { |
|
118 | 118 | // are we checking availability for a particular datetime ? |
119 | - if ( $DTT_ID ) { |
|
119 | + if ($DTT_ID) { |
|
120 | 120 | // get that datetime object |
121 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
121 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
122 | 122 | // if ticket sales for this datetime have exceeded the reg limit... |
123 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
123 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
124 | 124 | return FALSE; |
125 | 125 | } |
126 | 126 | } |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | * @return mixed status int if the display string isn't requested |
139 | 139 | * @throws \EE_Error |
140 | 140 | */ |
141 | - public function ticket_status( $display = FALSE, $remaining = null ) { |
|
142 | - $remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining(); |
|
143 | - if ( ! $remaining ) { |
|
144 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
141 | + public function ticket_status($display = FALSE, $remaining = null) { |
|
142 | + $remaining = is_bool($remaining) ? $remaining : $this->is_remaining(); |
|
143 | + if ( ! $remaining) { |
|
144 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
145 | 145 | } |
146 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
147 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
146 | + if ($this->get('TKT_deleted')) { |
|
147 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
148 | 148 | } |
149 | - if ( $this->is_expired() ) { |
|
150 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
149 | + if ($this->is_expired()) { |
|
150 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
151 | 151 | } |
152 | - if ( $this->is_pending() ) { |
|
153 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
152 | + if ($this->is_pending()) { |
|
153 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
154 | 154 | } |
155 | - if ( $this->is_on_sale() ) { |
|
156 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
155 | + if ($this->is_on_sale()) { |
|
156 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
157 | 157 | } |
158 | 158 | return ''; |
159 | 159 | } |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | * @return boolean true = tickets remaining, false not. |
169 | 169 | * @throws \EE_Error |
170 | 170 | */ |
171 | - public function is_remaining( $DTT_ID = 0 ) { |
|
172 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
173 | - if ( $num_remaining === 0 ) { |
|
171 | + public function is_remaining($DTT_ID = 0) { |
|
172 | + $num_remaining = $this->remaining($DTT_ID); |
|
173 | + if ($num_remaining === 0) { |
|
174 | 174 | return FALSE; |
175 | 175 | } |
176 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
176 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
177 | 177 | return FALSE; |
178 | 178 | } |
179 | 179 | return TRUE; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * @return int |
190 | 190 | * @throws \EE_Error |
191 | 191 | */ |
192 | - public function remaining( $DTT_ID = 0 ) { |
|
193 | - return $this->real_quantity_on_ticket('saleable', $DTT_ID ); |
|
192 | + public function remaining($DTT_ID = 0) { |
|
193 | + return $this->real_quantity_on_ticket('saleable', $DTT_ID); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | 204 | public function min() { |
205 | - return $this->get( 'TKT_min' ); |
|
205 | + return $this->get('TKT_min'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @throws \EE_Error |
215 | 215 | */ |
216 | 216 | public function is_expired() { |
217 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
217 | + return ($this->get_raw('TKT_end_date') < time()); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | 228 | public function is_pending() { |
229 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
229 | + return ($this->get_raw('TKT_start_date') > time()); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @throws \EE_Error |
239 | 239 | */ |
240 | 240 | public function is_on_sale() { |
241 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
241 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | * @return string |
252 | 252 | * @throws \EE_Error |
253 | 253 | */ |
254 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
255 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
256 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
254 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
255 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
256 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
257 | 257 | |
258 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
258 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @throws \EE_Error |
268 | 268 | */ |
269 | 269 | public function first_datetime() { |
270 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
271 | - return reset( $datetimes ); |
|
270 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
271 | + return reset($datetimes); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | * @return EE_Datetime[]|EE_Base_Class[] |
282 | 282 | * @throws \EE_Error |
283 | 283 | */ |
284 | - public function datetimes( $query_params = array() ) { |
|
285 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
286 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
284 | + public function datetimes($query_params = array()) { |
|
285 | + if ( ! isset($query_params['order_by'])) { |
|
286 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
287 | 287 | } |
288 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
288 | + return $this->get_many_related('Datetime', $query_params); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @throws \EE_Error |
298 | 298 | */ |
299 | 299 | public function last_datetime() { |
300 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
301 | - return end( $datetimes ); |
|
300 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
301 | + return end($datetimes); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -316,22 +316,22 @@ discard block |
||
316 | 316 | * @return mixed (array|int) how many tickets have sold |
317 | 317 | * @throws \EE_Error |
318 | 318 | */ |
319 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
319 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
320 | 320 | $total = 0; |
321 | 321 | $tickets_sold = $this->_all_tickets_sold(); |
322 | - switch ( $what ) { |
|
322 | + switch ($what) { |
|
323 | 323 | case 'ticket' : |
324 | - return $tickets_sold[ 'ticket' ]; |
|
324 | + return $tickets_sold['ticket']; |
|
325 | 325 | break; |
326 | 326 | case 'datetime' : |
327 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
327 | + if (empty($tickets_sold['datetime'])) { |
|
328 | 328 | return $total; |
329 | 329 | } |
330 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
331 | - 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__ ); |
|
330 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
331 | + 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__); |
|
332 | 332 | return $total; |
333 | 333 | } |
334 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
334 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
335 | 335 | break; |
336 | 336 | default: |
337 | 337 | return $total; |
@@ -347,15 +347,15 @@ discard block |
||
347 | 347 | * @throws \EE_Error |
348 | 348 | */ |
349 | 349 | protected function _all_tickets_sold() { |
350 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
350 | + $datetimes = $this->get_many_related('Datetime'); |
|
351 | 351 | $tickets_sold = array(); |
352 | - if ( ! empty( $datetimes ) ) { |
|
353 | - foreach ( $datetimes as $datetime ) { |
|
354 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
352 | + if ( ! empty($datetimes)) { |
|
353 | + foreach ($datetimes as $datetime) { |
|
354 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | //Tickets sold |
358 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
358 | + $tickets_sold['ticket'] = $this->sold(); |
|
359 | 359 | return $tickets_sold; |
360 | 360 | } |
361 | 361 | |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | * @return EE_Price|EE_Base_Class|EE_Price[]|EE_Base_Class[] |
369 | 369 | * @throws \EE_Error |
370 | 370 | */ |
371 | - public function base_price( $return_array = FALSE ) { |
|
372 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
371 | + public function base_price($return_array = FALSE) { |
|
372 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
373 | 373 | return $return_array |
374 | - ? $this->get_many_related( 'Price', array( $_where ) ) |
|
375 | - : $this->get_first_related( 'Price', array( $_where ) ); |
|
374 | + ? $this->get_many_related('Price', array($_where)) |
|
375 | + : $this->get_first_related('Price', array($_where)); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | * @throws \EE_Error |
386 | 386 | */ |
387 | 387 | public function price_modifiers() { |
388 | - $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 ) ) ) ); |
|
389 | - return $this->prices( $query_params ); |
|
388 | + $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)))); |
|
389 | + return $this->prices($query_params); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | * @return EE_Price[]|EE_Base_Class[] |
399 | 399 | * @throws \EE_Error |
400 | 400 | */ |
401 | - public function prices( $query_params = array() ) { |
|
402 | - return $this->get_many_related( 'Price', $query_params ); |
|
401 | + public function prices($query_params = array()) { |
|
402 | + return $this->get_many_related('Price', $query_params); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | * @return EE_Datetime_Ticket|EE_Base_Class[] |
412 | 412 | * @throws \EE_Error |
413 | 413 | */ |
414 | - public function datetime_tickets( $query_params = array() ) { |
|
415 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
414 | + public function datetime_tickets($query_params = array()) { |
|
415 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | * @return EE_Datetime[] |
426 | 426 | * @throws \EE_Error |
427 | 427 | */ |
428 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
429 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
428 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
429 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * @throws \EE_Error |
439 | 439 | */ |
440 | 440 | public function ID() { |
441 | - return $this->get( 'TKT_ID' ); |
|
441 | + return $this->get('TKT_ID'); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @throws \EE_Error |
464 | 464 | */ |
465 | 465 | public function template() { |
466 | - return $this->get_first_related( 'Ticket_Template' ); |
|
466 | + return $this->get_first_related('Ticket_Template'); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @throws \EE_Error |
486 | 486 | */ |
487 | 487 | public function ticket_price() { |
488 | - return $this->get( 'TKT_price' ); |
|
488 | + return $this->get('TKT_price'); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * @throws \EE_Error |
496 | 496 | */ |
497 | 497 | public function pretty_price() { |
498 | - return $this->get_pretty( 'TKT_price' ); |
|
498 | + return $this->get_pretty('TKT_price'); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * @return float |
518 | 518 | * @throws \EE_Error |
519 | 519 | */ |
520 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
521 | - if ($this->_ticket_total_with_taxes === null || $no_cache ) { |
|
520 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
521 | + if ($this->_ticket_total_with_taxes === null || $no_cache) { |
|
522 | 522 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
523 | 523 | } |
524 | 524 | return (float) $this->_ticket_total_with_taxes; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | |
528 | 528 | |
529 | 529 | public function ensure_TKT_Price_correct() { |
530 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
530 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
531 | 531 | $this->save(); |
532 | 532 | } |
533 | 533 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * @throws \EE_Error |
539 | 539 | */ |
540 | 540 | public function get_ticket_subtotal() { |
541 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
541 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * @throws \EE_Error |
551 | 551 | */ |
552 | 552 | public function get_ticket_taxes_total_for_admin() { |
553 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
553 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | * @param string $name |
562 | 562 | * @throws \EE_Error |
563 | 563 | */ |
564 | - public function set_name( $name ) { |
|
565 | - $this->set( 'TKT_name', $name ); |
|
564 | + public function set_name($name) { |
|
565 | + $this->set('TKT_name', $name); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * @throws \EE_Error |
575 | 575 | */ |
576 | 576 | public function description() { |
577 | - return $this->get( 'TKT_description' ); |
|
577 | + return $this->get('TKT_description'); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -585,8 +585,8 @@ discard block |
||
585 | 585 | * @param string $description |
586 | 586 | * @throws \EE_Error |
587 | 587 | */ |
588 | - public function set_description( $description ) { |
|
589 | - $this->set( 'TKT_description', $description ); |
|
588 | + public function set_description($description) { |
|
589 | + $this->set('TKT_description', $description); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | * @return string |
600 | 600 | * @throws \EE_Error |
601 | 601 | */ |
602 | - public function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
603 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
602 | + public function start_date($dt_frmt = '', $tm_frmt = '') { |
|
603 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | |
@@ -612,8 +612,8 @@ discard block |
||
612 | 612 | * @return void |
613 | 613 | * @throws \EE_Error |
614 | 614 | */ |
615 | - public function set_start_date( $start_date ) { |
|
616 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
615 | + public function set_start_date($start_date) { |
|
616 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | |
@@ -626,8 +626,8 @@ discard block |
||
626 | 626 | * @return string |
627 | 627 | * @throws \EE_Error |
628 | 628 | */ |
629 | - public function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
630 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
629 | + public function end_date($dt_frmt = '', $tm_frmt = '') { |
|
630 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @return void |
640 | 640 | * @throws \EE_Error |
641 | 641 | */ |
642 | - public function set_end_date( $end_date ) { |
|
643 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
642 | + public function set_end_date($end_date) { |
|
643 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
653 | 653 | * @throws \EE_Error |
654 | 654 | */ |
655 | - public function set_end_time( $time ) { |
|
656 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
655 | + public function set_end_time($time) { |
|
656 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | * @return void |
666 | 666 | * @throws \EE_Error |
667 | 667 | */ |
668 | - public function set_min( $min ) { |
|
669 | - $this->set( 'TKT_min', $min ); |
|
668 | + public function set_min($min) { |
|
669 | + $this->set('TKT_min', $min); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @throws \EE_Error |
679 | 679 | */ |
680 | 680 | public function max() { |
681 | - return $this->get( 'TKT_max' ); |
|
681 | + return $this->get('TKT_max'); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -690,8 +690,8 @@ discard block |
||
690 | 690 | * @return void |
691 | 691 | * @throws \EE_Error |
692 | 692 | */ |
693 | - public function set_max( $max ) { |
|
694 | - $this->set( 'TKT_max', $max ); |
|
693 | + public function set_max($max) { |
|
694 | + $this->set('TKT_max', $max); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | * @return void |
704 | 704 | * @throws \EE_Error |
705 | 705 | */ |
706 | - public function set_price( $price ) { |
|
707 | - $this->set( 'TKT_price', $price ); |
|
706 | + public function set_price($price) { |
|
707 | + $this->set('TKT_price', $price); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | * @throws \EE_Error |
717 | 717 | */ |
718 | 718 | public function sold() { |
719 | - return $this->get_raw( 'TKT_sold' ); |
|
719 | + return $this->get_raw('TKT_sold'); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | |
@@ -728,10 +728,10 @@ discard block |
||
728 | 728 | * @return void |
729 | 729 | * @throws \EE_Error |
730 | 730 | */ |
731 | - public function set_sold( $sold ) { |
|
731 | + public function set_sold($sold) { |
|
732 | 732 | // sold can not go below zero |
733 | - $sold = max( 0, $sold ); |
|
734 | - $this->set( 'TKT_sold', $sold ); |
|
733 | + $sold = max(0, $sold); |
|
734 | + $this->set('TKT_sold', $sold); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | |
@@ -743,13 +743,13 @@ discard block |
||
743 | 743 | * @return void |
744 | 744 | * @throws \EE_Error |
745 | 745 | */ |
746 | - public function increase_sold( $qty = 1 ) { |
|
746 | + public function increase_sold($qty = 1) { |
|
747 | 747 | $sold = $this->sold() + $qty; |
748 | 748 | // remove ticket reservation, but don't adjust datetime reservations, because that will happen |
749 | 749 | // via \EE_Datetime::increase_sold() when \EE_Ticket::_increase_sold_for_datetimes() is called |
750 | - $this->decrease_reserved( $qty, false, "TKT: {$this->ID()} (ln:" . __LINE__ . ')'); |
|
751 | - $this->_increase_sold_for_datetimes( $qty ); |
|
752 | - $this->set_sold( $sold ); |
|
750 | + $this->decrease_reserved($qty, false, "TKT: {$this->ID()} (ln:".__LINE__.')'); |
|
751 | + $this->_increase_sold_for_datetimes($qty); |
|
752 | + $this->set_sold($sold); |
|
753 | 753 | do_action( |
754 | 754 | 'AHEE__EE_Ticket__increase_sold', |
755 | 755 | $this, |
@@ -767,12 +767,12 @@ discard block |
||
767 | 767 | * @return void |
768 | 768 | * @throws \EE_Error |
769 | 769 | */ |
770 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
770 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
771 | 771 | $datetimes = $this->datetimes(); |
772 | - if ( is_array( $datetimes ) ) { |
|
773 | - foreach ( $datetimes as $datetime ) { |
|
774 | - if ( $datetime instanceof EE_Datetime ) { |
|
775 | - $datetime->increase_sold( $qty ); |
|
772 | + if (is_array($datetimes)) { |
|
773 | + foreach ($datetimes as $datetime) { |
|
774 | + if ($datetime instanceof EE_Datetime) { |
|
775 | + $datetime->increase_sold($qty); |
|
776 | 776 | $datetime->save(); |
777 | 777 | } |
778 | 778 | } |
@@ -788,10 +788,10 @@ discard block |
||
788 | 788 | * @return void |
789 | 789 | * @throws \EE_Error |
790 | 790 | */ |
791 | - public function decrease_sold( $qty = 1 ) { |
|
791 | + public function decrease_sold($qty = 1) { |
|
792 | 792 | $sold = $this->sold() - $qty; |
793 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
794 | - $this->set_sold( $sold ); |
|
793 | + $this->_decrease_sold_for_datetimes($qty); |
|
794 | + $this->set_sold($sold); |
|
795 | 795 | do_action( |
796 | 796 | 'AHEE__EE_Ticket__decrease_sold', |
797 | 797 | $this, |
@@ -809,12 +809,12 @@ discard block |
||
809 | 809 | * @return void |
810 | 810 | * @throws \EE_Error |
811 | 811 | */ |
812 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
812 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
813 | 813 | $datetimes = $this->datetimes(); |
814 | - if ( is_array( $datetimes ) ) { |
|
815 | - foreach ( $datetimes as $datetime ) { |
|
816 | - if ( $datetime instanceof EE_Datetime ) { |
|
817 | - $datetime->decrease_sold( $qty ); |
|
814 | + if (is_array($datetimes)) { |
|
815 | + foreach ($datetimes as $datetime) { |
|
816 | + if ($datetime instanceof EE_Datetime) { |
|
817 | + $datetime->decrease_sold($qty); |
|
818 | 818 | $datetime->save(); |
819 | 819 | } |
820 | 820 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | * @throws \EE_Error |
831 | 831 | */ |
832 | 832 | public function reserved() { |
833 | - return $this->get_raw( 'TKT_reserved' ); |
|
833 | + return $this->get_raw('TKT_reserved'); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | |
@@ -842,10 +842,10 @@ discard block |
||
842 | 842 | * @return void |
843 | 843 | * @throws \EE_Error |
844 | 844 | */ |
845 | - public function set_reserved( $reserved ) { |
|
845 | + public function set_reserved($reserved) { |
|
846 | 846 | // reserved can not go below zero |
847 | - $reserved = max( 0, (int) $reserved ); |
|
848 | - $this->set( 'TKT_reserved', $reserved ); |
|
847 | + $reserved = max(0, (int) $reserved); |
|
848 | + $this->set('TKT_reserved', $reserved); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | |
@@ -861,8 +861,8 @@ discard block |
||
861 | 861 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
862 | 862 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
863 | 863 | */ |
864 | - public function increase_reserved( $qty = 1, $source = 'unknown' ) { |
|
865 | - $qty = absint( $qty ); |
|
864 | + public function increase_reserved($qty = 1, $source = 'unknown') { |
|
865 | + $qty = absint($qty); |
|
866 | 866 | $reserved = $this->reserved() + $qty; |
867 | 867 | if ( |
868 | 868 | $reserved |
@@ -891,12 +891,12 @@ discard block |
||
891 | 891 | * @return void |
892 | 892 | * @throws \EE_Error |
893 | 893 | */ |
894 | - protected function _increase_reserved_for_datetimes( $qty = 1 ) { |
|
894 | + protected function _increase_reserved_for_datetimes($qty = 1) { |
|
895 | 895 | $datetimes = $this->datetimes(); |
896 | - if ( is_array( $datetimes ) ) { |
|
897 | - foreach ( $datetimes as $datetime ) { |
|
898 | - if ( $datetime instanceof EE_Datetime ) { |
|
899 | - $datetime->increase_reserved( $qty ); |
|
896 | + if (is_array($datetimes)) { |
|
897 | + foreach ($datetimes as $datetime) { |
|
898 | + if ($datetime instanceof EE_Datetime) { |
|
899 | + $datetime->increase_reserved($qty); |
|
900 | 900 | $datetime->save(); |
901 | 901 | } |
902 | 902 | } |
@@ -917,8 +917,8 @@ discard block |
||
917 | 917 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
918 | 918 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
919 | 919 | */ |
920 | - public function decrease_reserved( $qty = 1, $adjust_datetimes = true, $source = 'unknown' ) { |
|
921 | - $reserved = $this->reserved() - absint( $qty ); |
|
920 | + public function decrease_reserved($qty = 1, $adjust_datetimes = true, $source = 'unknown') { |
|
921 | + $reserved = $this->reserved() - absint($qty); |
|
922 | 922 | if ( |
923 | 923 | $this->add_extra_meta( |
924 | 924 | EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
@@ -947,12 +947,12 @@ discard block |
||
947 | 947 | * @return void |
948 | 948 | * @throws \EE_Error |
949 | 949 | */ |
950 | - protected function _decrease_reserved_for_datetimes( $qty = 1 ) { |
|
950 | + protected function _decrease_reserved_for_datetimes($qty = 1) { |
|
951 | 951 | $datetimes = $this->datetimes(); |
952 | - if ( is_array( $datetimes ) ) { |
|
953 | - foreach ( $datetimes as $datetime ) { |
|
954 | - if ( $datetime instanceof EE_Datetime ) { |
|
955 | - $datetime->decrease_reserved( $qty ); |
|
952 | + if (is_array($datetimes)) { |
|
953 | + foreach ($datetimes as $datetime) { |
|
954 | + if ($datetime instanceof EE_Datetime) { |
|
955 | + $datetime->decrease_reserved($qty); |
|
956 | 956 | $datetime->save(); |
957 | 957 | } |
958 | 958 | } |
@@ -973,14 +973,14 @@ discard block |
||
973 | 973 | * @return int |
974 | 974 | * @throws \EE_Error |
975 | 975 | */ |
976 | - public function qty( $context = '' ) { |
|
977 | - switch ( $context ) { |
|
976 | + public function qty($context = '') { |
|
977 | + switch ($context) { |
|
978 | 978 | case 'reg_limit' : |
979 | 979 | return $this->real_quantity_on_ticket(); |
980 | 980 | case 'saleable' : |
981 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
981 | + return $this->real_quantity_on_ticket('saleable'); |
|
982 | 982 | default: |
983 | - return $this->get_raw( 'TKT_qty' ); |
|
983 | + return $this->get_raw('TKT_qty'); |
|
984 | 984 | } |
985 | 985 | } |
986 | 986 | |
@@ -999,15 +999,15 @@ discard block |
||
999 | 999 | * @return int |
1000 | 1000 | * @throws \EE_Error |
1001 | 1001 | */ |
1002 | - public function real_quantity_on_ticket( $context = 'reg_limit', $DTT_ID = 0 ) { |
|
1003 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
1002 | + public function real_quantity_on_ticket($context = 'reg_limit', $DTT_ID = 0) { |
|
1003 | + $raw = $this->get_raw('TKT_qty'); |
|
1004 | 1004 | // return immediately if it's zero |
1005 | - if ( $raw === 0 ) { |
|
1005 | + if ($raw === 0) { |
|
1006 | 1006 | return $raw; |
1007 | 1007 | } |
1008 | 1008 | //echo "\n\n<br />Ticket: " . $this->name() . '<br />'; |
1009 | 1009 | // ensure qty doesn't exceed raw value for THIS ticket |
1010 | - $qty = min( EE_INF, $raw ); |
|
1010 | + $qty = min(EE_INF, $raw); |
|
1011 | 1011 | //echo "\n . qty: " . $qty . '<br />'; |
1012 | 1012 | // calculate this ticket's total sales and reservations |
1013 | 1013 | $sold_and_reserved_for_this_ticket = $this->sold() + $this->reserved(); |
@@ -1016,23 +1016,23 @@ discard block |
||
1016 | 1016 | //echo "\n . sold_and_reserved_for_this_ticket: " . $sold_and_reserved_for_this_ticket . '<br />'; |
1017 | 1017 | // first we need to calculate the maximum number of tickets available for the datetime |
1018 | 1018 | // do we want data for one datetime or all of them ? |
1019 | - $query_params = $DTT_ID ? array( array( 'DTT_ID' => $DTT_ID ) ) : array(); |
|
1020 | - $datetimes = $this->datetimes( $query_params ); |
|
1021 | - if ( is_array( $datetimes ) && ! empty( $datetimes ) ) { |
|
1022 | - foreach ( $datetimes as $datetime ) { |
|
1023 | - if ( $datetime instanceof EE_Datetime ) { |
|
1019 | + $query_params = $DTT_ID ? array(array('DTT_ID' => $DTT_ID)) : array(); |
|
1020 | + $datetimes = $this->datetimes($query_params); |
|
1021 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
1022 | + foreach ($datetimes as $datetime) { |
|
1023 | + if ($datetime instanceof EE_Datetime) { |
|
1024 | 1024 | $datetime->refresh_from_db(); |
1025 | 1025 | //echo "\n . . datetime name: " . $datetime->name() . '<br />'; |
1026 | 1026 | //echo "\n . . datetime ID: " . $datetime->ID() . '<br />'; |
1027 | 1027 | // initialize with no restrictions for each datetime |
1028 | 1028 | // but adjust datetime qty based on datetime reg limit |
1029 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
1029 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
1030 | 1030 | //echo "\n . . . datetime reg_limit: " . $datetime->reg_limit() . '<br />'; |
1031 | 1031 | //echo "\n . . . datetime_qty: " . $datetime_qty . '<br />'; |
1032 | 1032 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
1033 | 1033 | // and reservations for this datetime, that do NOT include sales and reservations |
1034 | 1034 | // for this ticket (so we add $this->sold() and $this->reserved() back in) |
1035 | - if ( $context === 'saleable' ) { |
|
1035 | + if ($context === 'saleable') { |
|
1036 | 1036 | $datetime_qty = max( |
1037 | 1037 | $datetime_qty - $datetime->sold_and_reserved() + $sold_and_reserved_for_this_ticket, |
1038 | 1038 | 0 |
@@ -1044,16 +1044,16 @@ discard block |
||
1044 | 1044 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
1045 | 1045 | //echo "\n . . . datetime_qty: " . $datetime_qty . '<br />'; |
1046 | 1046 | } |
1047 | - $qty = min( $datetime_qty, $qty ); |
|
1047 | + $qty = min($datetime_qty, $qty); |
|
1048 | 1048 | //echo "\n . . qty: " . $qty . '<br />'; |
1049 | 1049 | } |
1050 | 1050 | } |
1051 | 1051 | } |
1052 | 1052 | // NOW that we know the maximum number of tickets available for the datetime |
1053 | 1053 | // we can finally factor in the details for this specific ticket |
1054 | - if ( $qty > 0 && $context === 'saleable' ) { |
|
1054 | + if ($qty > 0 && $context === 'saleable') { |
|
1055 | 1055 | // and subtract the sales for THIS ticket |
1056 | - $qty = max( $qty - $sold_and_reserved_for_this_ticket, 0 ); |
|
1056 | + $qty = max($qty - $sold_and_reserved_for_this_ticket, 0); |
|
1057 | 1057 | //echo "\n . qty: " . $qty . '<br />'; |
1058 | 1058 | } |
1059 | 1059 | //echo "\nFINAL QTY: " . $qty . "<br /><br />"; |
@@ -1069,14 +1069,14 @@ discard block |
||
1069 | 1069 | * @return void |
1070 | 1070 | * @throws \EE_Error |
1071 | 1071 | */ |
1072 | - public function set_qty( $qty ) { |
|
1072 | + public function set_qty($qty) { |
|
1073 | 1073 | $datetimes = $this->datetimes(); |
1074 | - foreach ( $datetimes as $datetime ) { |
|
1075 | - if ( $datetime instanceof EE_Datetime ) { |
|
1076 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
1074 | + foreach ($datetimes as $datetime) { |
|
1075 | + if ($datetime instanceof EE_Datetime) { |
|
1076 | + $qty = min($qty, $datetime->reg_limit()); |
|
1077 | 1077 | } |
1078 | 1078 | } |
1079 | - $this->set( 'TKT_qty', $qty ); |
|
1079 | + $this->set('TKT_qty', $qty); |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | * @throws \EE_Error |
1089 | 1089 | */ |
1090 | 1090 | public function uses() { |
1091 | - return $this->get( 'TKT_uses' ); |
|
1091 | + return $this->get('TKT_uses'); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | |
@@ -1100,8 +1100,8 @@ discard block |
||
1100 | 1100 | * @return void |
1101 | 1101 | * @throws \EE_Error |
1102 | 1102 | */ |
1103 | - public function set_uses( $uses ) { |
|
1104 | - $this->set( 'TKT_uses', $uses ); |
|
1103 | + public function set_uses($uses) { |
|
1104 | + $this->set('TKT_uses', $uses); |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | * @throws \EE_Error |
1114 | 1114 | */ |
1115 | 1115 | public function required() { |
1116 | - return $this->get( 'TKT_required' ); |
|
1116 | + return $this->get('TKT_required'); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
@@ -1125,8 +1125,8 @@ discard block |
||
1125 | 1125 | * @return void |
1126 | 1126 | * @throws \EE_Error |
1127 | 1127 | */ |
1128 | - public function set_required( $required ) { |
|
1129 | - $this->set( 'TKT_required', $required ); |
|
1128 | + public function set_required($required) { |
|
1129 | + $this->set('TKT_required', $required); |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | * @throws \EE_Error |
1139 | 1139 | */ |
1140 | 1140 | public function taxable() { |
1141 | - return $this->get( 'TKT_taxable' ); |
|
1141 | + return $this->get('TKT_taxable'); |
|
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
@@ -1150,8 +1150,8 @@ discard block |
||
1150 | 1150 | * @return void |
1151 | 1151 | * @throws \EE_Error |
1152 | 1152 | */ |
1153 | - public function set_taxable( $taxable ) { |
|
1154 | - $this->set( 'TKT_taxable', $taxable ); |
|
1153 | + public function set_taxable($taxable) { |
|
1154 | + $this->set('TKT_taxable', $taxable); |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @throws \EE_Error |
1164 | 1164 | */ |
1165 | 1165 | public function is_default() { |
1166 | - return $this->get( 'TKT_is_default' ); |
|
1166 | + return $this->get('TKT_is_default'); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
@@ -1175,8 +1175,8 @@ discard block |
||
1175 | 1175 | * @return void |
1176 | 1176 | * @throws \EE_Error |
1177 | 1177 | */ |
1178 | - public function set_is_default( $is_default ) { |
|
1179 | - $this->set( 'TKT_is_default', $is_default ); |
|
1178 | + public function set_is_default($is_default) { |
|
1179 | + $this->set('TKT_is_default', $is_default); |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | * @throws \EE_Error |
1189 | 1189 | */ |
1190 | 1190 | public function order() { |
1191 | - return $this->get( 'TKT_order' ); |
|
1191 | + return $this->get('TKT_order'); |
|
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | |
@@ -1200,8 +1200,8 @@ discard block |
||
1200 | 1200 | * @return void |
1201 | 1201 | * @throws \EE_Error |
1202 | 1202 | */ |
1203 | - public function set_order( $order ) { |
|
1204 | - $this->set( 'TKT_order', $order ); |
|
1203 | + public function set_order($order) { |
|
1204 | + $this->set('TKT_order', $order); |
|
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | * @throws \EE_Error |
1214 | 1214 | */ |
1215 | 1215 | public function row() { |
1216 | - return $this->get( 'TKT_row' ); |
|
1216 | + return $this->get('TKT_row'); |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
@@ -1225,8 +1225,8 @@ discard block |
||
1225 | 1225 | * @return void |
1226 | 1226 | * @throws \EE_Error |
1227 | 1227 | */ |
1228 | - public function set_row( $row ) { |
|
1229 | - $this->set( 'TKT_row', $row ); |
|
1228 | + public function set_row($row) { |
|
1229 | + $this->set('TKT_row', $row); |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * @throws \EE_Error |
1239 | 1239 | */ |
1240 | 1240 | public function deleted() { |
1241 | - return $this->get( 'TKT_deleted' ); |
|
1241 | + return $this->get('TKT_deleted'); |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | * @return void |
1251 | 1251 | * @throws \EE_Error |
1252 | 1252 | */ |
1253 | - public function set_deleted( $deleted ) { |
|
1254 | - $this->set( 'TKT_deleted', $deleted ); |
|
1253 | + public function set_deleted($deleted) { |
|
1254 | + $this->set('TKT_deleted', $deleted); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | * @throws \EE_Error |
1264 | 1264 | */ |
1265 | 1265 | public function parent_ID() { |
1266 | - return $this->get( 'TKT_parent' ); |
|
1266 | + return $this->get('TKT_parent'); |
|
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | |
@@ -1275,8 +1275,8 @@ discard block |
||
1275 | 1275 | * @return void |
1276 | 1276 | * @throws \EE_Error |
1277 | 1277 | */ |
1278 | - public function set_parent_ID( $parent ) { |
|
1279 | - $this->set( 'TKT_parent', $parent ); |
|
1278 | + public function set_parent_ID($parent) { |
|
1279 | + $this->set('TKT_parent', $parent); |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | |
@@ -1289,10 +1289,10 @@ discard block |
||
1289 | 1289 | */ |
1290 | 1290 | public function name_and_info() { |
1291 | 1291 | $times = array(); |
1292 | - foreach ( $this->datetimes() as $datetime ) { |
|
1292 | + foreach ($this->datetimes() as $datetime) { |
|
1293 | 1293 | $times[] = $datetime->start_date_and_time(); |
1294 | 1294 | } |
1295 | - return $this->name() . ' @ ' . implode( ', ', $times ) . ' for ' . $this->pretty_price(); |
|
1295 | + return $this->name().' @ '.implode(', ', $times).' for '.$this->pretty_price(); |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | * @throws \EE_Error |
1305 | 1305 | */ |
1306 | 1306 | public function name() { |
1307 | - return $this->get( 'TKT_name' ); |
|
1307 | + return $this->get('TKT_name'); |
|
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | * @throws \EE_Error |
1317 | 1317 | */ |
1318 | 1318 | public function price() { |
1319 | - return $this->get( 'TKT_price' ); |
|
1319 | + return $this->get('TKT_price'); |
|
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | |
@@ -1328,8 +1328,8 @@ discard block |
||
1328 | 1328 | * @return EE_Registration[]|EE_Base_Class[] |
1329 | 1329 | * @throws \EE_Error |
1330 | 1330 | */ |
1331 | - public function registrations( $query_params = array() ) { |
|
1332 | - return $this->get_many_related( 'Registration', $query_params ); |
|
1331 | + public function registrations($query_params = array()) { |
|
1332 | + return $this->get_many_related('Registration', $query_params); |
|
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | * @param array $query_params like EEM_Base::get_all's |
1369 | 1369 | * @return int |
1370 | 1370 | */ |
1371 | - public function count_registrations( $query_params = array() ) { |
|
1371 | + public function count_registrations($query_params = array()) { |
|
1372 | 1372 | return $this->count_related('Registration', $query_params); |
1373 | 1373 | } |
1374 | 1374 | |
@@ -1396,23 +1396,23 @@ discard block |
||
1396 | 1396 | public function get_related_event() { |
1397 | 1397 | //get one datetime to use for getting the event |
1398 | 1398 | $datetime = $this->first_datetime(); |
1399 | - if ( ! $datetime instanceof \EE_Datetime ) { |
|
1399 | + if ( ! $datetime instanceof \EE_Datetime) { |
|
1400 | 1400 | throw new UnexpectedEntityException( |
1401 | 1401 | $datetime, |
1402 | 1402 | 'EE_Datetime', |
1403 | 1403 | sprintf( |
1404 | - __( 'The ticket (%s) is not associated with any valid datetimes.', 'event_espresso'), |
|
1404 | + __('The ticket (%s) is not associated with any valid datetimes.', 'event_espresso'), |
|
1405 | 1405 | $this->name() |
1406 | 1406 | ) |
1407 | 1407 | ); |
1408 | 1408 | } |
1409 | 1409 | $event = $datetime->event(); |
1410 | - if ( ! $event instanceof \EE_Event ) { |
|
1410 | + if ( ! $event instanceof \EE_Event) { |
|
1411 | 1411 | throw new UnexpectedEntityException( |
1412 | 1412 | $event, |
1413 | 1413 | 'EE_Event', |
1414 | 1414 | sprintf( |
1415 | - __( 'The ticket (%s) is not associated with a valid event.', 'event_espresso'), |
|
1415 | + __('The ticket (%s) is not associated with a valid event.', 'event_espresso'), |
|
1416 | 1416 | $this->name() |
1417 | 1417 | ) |
1418 | 1418 | ); |
@@ -16,175 +16,175 @@ |
||
16 | 16 | class DatetimeSelector |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var \EE_Event $event |
|
21 | - */ |
|
22 | - protected $event; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var \EE_Ticket[] $tickets |
|
26 | - */ |
|
27 | - protected $tickets; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var \EE_Datetime[] $datetimes |
|
31 | - */ |
|
32 | - protected $datetimes; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var \EE_Datetime[] $unique_dates |
|
36 | - */ |
|
37 | - protected $unique_dates; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
41 | - */ |
|
42 | - protected $template_settings; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var boolean $active |
|
46 | - */ |
|
47 | - protected $active = false; |
|
48 | - |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * DatetimeSelector constructor. |
|
53 | - * |
|
54 | - * @param \EE_Event $event |
|
55 | - * @param \EE_Ticket[] $tickets |
|
56 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
57 | - * @param string $date_format |
|
58 | - * @param string $time_format |
|
59 | - * @throws \EE_Error |
|
60 | - */ |
|
61 | - public function __construct( |
|
62 | - \EE_Event $event, |
|
63 | - array $tickets, |
|
64 | - \EE_Ticket_Selector_Config $template_settings, |
|
65 | - $date_format = 'Y-m-d', |
|
66 | - $time_format = 'g:i a' |
|
67 | - ) { |
|
68 | - $this->event = $event; |
|
69 | - $this->tickets = $tickets; |
|
70 | - $this->template_settings = $template_settings; |
|
71 | - $this->datetimes = $this->getAllDatetimesForAllTicket($tickets); |
|
72 | - $this->unique_dates = $this->getUniqueDatetimeOptions($date_format, $time_format); |
|
73 | - $this->active = $this->template_settings->showDatetimeSelector($this->unique_dates); |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @param \EE_Ticket[] $tickets |
|
80 | - * @return array |
|
81 | - * @throws \EE_Error |
|
82 | - */ |
|
83 | - protected function getAllDatetimesForAllTicket($tickets = array()) |
|
84 | - { |
|
85 | - $datetimes = array(); |
|
86 | - foreach ($tickets as $ticket) { |
|
87 | - $datetimes = $this->getTicketDatetimes($ticket, $datetimes); |
|
88 | - } |
|
89 | - return $datetimes; |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * @param \EE_Ticket $ticket |
|
96 | - * @param \EE_Datetime[] $datetimes |
|
97 | - * @return \EE_Datetime[] |
|
98 | - * @throws \EE_Error |
|
99 | - */ |
|
100 | - protected function getTicketDatetimes(\EE_Ticket $ticket, $datetimes = array()) |
|
101 | - { |
|
102 | - $ticket_datetimes = $ticket->datetimes( |
|
103 | - array( |
|
104 | - 'order_by' => array( |
|
105 | - 'DTT_order' => 'ASC', |
|
106 | - 'DTT_EVT_start' => 'ASC' |
|
107 | - ), |
|
108 | - 'default_where_conditions' => 'none', |
|
109 | - ) |
|
110 | - ); |
|
111 | - foreach ($ticket_datetimes as $ticket_datetime) { |
|
112 | - if ( ! $ticket_datetime instanceof \EE_Datetime) { |
|
113 | - continue; |
|
114 | - } |
|
115 | - $datetimes[ $ticket_datetime->ID() ] = $ticket_datetime; |
|
116 | - } |
|
117 | - return $datetimes; |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @param \EE_Ticket $ticket |
|
124 | - * @return string |
|
125 | - * @throws \EE_Error |
|
126 | - */ |
|
127 | - public function getTicketDatetimeClasses( \EE_Ticket $ticket ) { |
|
128 | - if ( ! $this->active) { |
|
129 | - return ''; |
|
130 | - } |
|
131 | - $ticket_datetimes = $this->getTicketDatetimes($ticket); |
|
132 | - $classes = ''; |
|
133 | - foreach ($this->datetimes as $datetime) { |
|
134 | - if ( ! $datetime instanceof \EE_Datetime || ! in_array($datetime, $ticket_datetimes, true)) { |
|
135 | - continue; |
|
136 | - } |
|
137 | - $classes .= ' ee-ticket-datetimes-' . $datetime->date_and_time_range('Y_m_d', 'H_i', '-', '_'); |
|
138 | - } |
|
139 | - return $classes; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @param string $date_format |
|
146 | - * @param string $time_format |
|
147 | - * @return array |
|
148 | - * @throws \EE_Error |
|
149 | - */ |
|
150 | - public function getUniqueDatetimeOptions($date_format = 'Y-m-d', $time_format = 'g:i a') { |
|
151 | - $datetime_options = array(); |
|
152 | - foreach ($this->datetimes as $datetime) { |
|
153 | - if ( ! $datetime instanceof \EE_Datetime) { |
|
154 | - continue; |
|
155 | - } |
|
156 | - $datetime_options[$datetime->date_and_time_range('Y_m_d', 'H_i', '-', '_')] = |
|
157 | - $datetime->date_and_time_range($date_format, $time_format, ' - '); |
|
158 | - } |
|
159 | - return $datetime_options; |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * @return string |
|
166 | - * @throws \EE_Error |
|
167 | - */ |
|
168 | - public function getDatetimeSelector() { |
|
169 | - if ( ! $this->active) { |
|
170 | - return ''; |
|
171 | - } |
|
172 | - $dropdown_selector = new \EE_Checkbox_Dropdown_Selector_Input( |
|
173 | - $this->unique_dates, |
|
174 | - array( |
|
175 | - 'html_id' => 'datetime-selector-' . $this->event->ID(), |
|
176 | - 'html_name' => 'datetime_selector_' . $this->event->ID(), |
|
177 | - 'html_class' => 'datetime-selector', |
|
178 | - 'select_button_text' => '<span class="dashicons dashicons-calendar-alt"></span> ' |
|
179 | - . esc_html__('Filter by Date', 'event_espresso'), |
|
180 | - 'other_html_attributes' => ' data-tkt_slctr_evt="' . $this->event->ID() . '"', |
|
181 | - ) |
|
182 | - ); |
|
183 | - return \EEH_HTML::div( |
|
184 | - $dropdown_selector->get_html_for_input(), |
|
185 | - '', 'datetime_selector-dv' |
|
186 | - ); |
|
187 | - } |
|
19 | + /** |
|
20 | + * @var \EE_Event $event |
|
21 | + */ |
|
22 | + protected $event; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var \EE_Ticket[] $tickets |
|
26 | + */ |
|
27 | + protected $tickets; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var \EE_Datetime[] $datetimes |
|
31 | + */ |
|
32 | + protected $datetimes; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var \EE_Datetime[] $unique_dates |
|
36 | + */ |
|
37 | + protected $unique_dates; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
41 | + */ |
|
42 | + protected $template_settings; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var boolean $active |
|
46 | + */ |
|
47 | + protected $active = false; |
|
48 | + |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * DatetimeSelector constructor. |
|
53 | + * |
|
54 | + * @param \EE_Event $event |
|
55 | + * @param \EE_Ticket[] $tickets |
|
56 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
57 | + * @param string $date_format |
|
58 | + * @param string $time_format |
|
59 | + * @throws \EE_Error |
|
60 | + */ |
|
61 | + public function __construct( |
|
62 | + \EE_Event $event, |
|
63 | + array $tickets, |
|
64 | + \EE_Ticket_Selector_Config $template_settings, |
|
65 | + $date_format = 'Y-m-d', |
|
66 | + $time_format = 'g:i a' |
|
67 | + ) { |
|
68 | + $this->event = $event; |
|
69 | + $this->tickets = $tickets; |
|
70 | + $this->template_settings = $template_settings; |
|
71 | + $this->datetimes = $this->getAllDatetimesForAllTicket($tickets); |
|
72 | + $this->unique_dates = $this->getUniqueDatetimeOptions($date_format, $time_format); |
|
73 | + $this->active = $this->template_settings->showDatetimeSelector($this->unique_dates); |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @param \EE_Ticket[] $tickets |
|
80 | + * @return array |
|
81 | + * @throws \EE_Error |
|
82 | + */ |
|
83 | + protected function getAllDatetimesForAllTicket($tickets = array()) |
|
84 | + { |
|
85 | + $datetimes = array(); |
|
86 | + foreach ($tickets as $ticket) { |
|
87 | + $datetimes = $this->getTicketDatetimes($ticket, $datetimes); |
|
88 | + } |
|
89 | + return $datetimes; |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * @param \EE_Ticket $ticket |
|
96 | + * @param \EE_Datetime[] $datetimes |
|
97 | + * @return \EE_Datetime[] |
|
98 | + * @throws \EE_Error |
|
99 | + */ |
|
100 | + protected function getTicketDatetimes(\EE_Ticket $ticket, $datetimes = array()) |
|
101 | + { |
|
102 | + $ticket_datetimes = $ticket->datetimes( |
|
103 | + array( |
|
104 | + 'order_by' => array( |
|
105 | + 'DTT_order' => 'ASC', |
|
106 | + 'DTT_EVT_start' => 'ASC' |
|
107 | + ), |
|
108 | + 'default_where_conditions' => 'none', |
|
109 | + ) |
|
110 | + ); |
|
111 | + foreach ($ticket_datetimes as $ticket_datetime) { |
|
112 | + if ( ! $ticket_datetime instanceof \EE_Datetime) { |
|
113 | + continue; |
|
114 | + } |
|
115 | + $datetimes[ $ticket_datetime->ID() ] = $ticket_datetime; |
|
116 | + } |
|
117 | + return $datetimes; |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @param \EE_Ticket $ticket |
|
124 | + * @return string |
|
125 | + * @throws \EE_Error |
|
126 | + */ |
|
127 | + public function getTicketDatetimeClasses( \EE_Ticket $ticket ) { |
|
128 | + if ( ! $this->active) { |
|
129 | + return ''; |
|
130 | + } |
|
131 | + $ticket_datetimes = $this->getTicketDatetimes($ticket); |
|
132 | + $classes = ''; |
|
133 | + foreach ($this->datetimes as $datetime) { |
|
134 | + if ( ! $datetime instanceof \EE_Datetime || ! in_array($datetime, $ticket_datetimes, true)) { |
|
135 | + continue; |
|
136 | + } |
|
137 | + $classes .= ' ee-ticket-datetimes-' . $datetime->date_and_time_range('Y_m_d', 'H_i', '-', '_'); |
|
138 | + } |
|
139 | + return $classes; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @param string $date_format |
|
146 | + * @param string $time_format |
|
147 | + * @return array |
|
148 | + * @throws \EE_Error |
|
149 | + */ |
|
150 | + public function getUniqueDatetimeOptions($date_format = 'Y-m-d', $time_format = 'g:i a') { |
|
151 | + $datetime_options = array(); |
|
152 | + foreach ($this->datetimes as $datetime) { |
|
153 | + if ( ! $datetime instanceof \EE_Datetime) { |
|
154 | + continue; |
|
155 | + } |
|
156 | + $datetime_options[$datetime->date_and_time_range('Y_m_d', 'H_i', '-', '_')] = |
|
157 | + $datetime->date_and_time_range($date_format, $time_format, ' - '); |
|
158 | + } |
|
159 | + return $datetime_options; |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * @return string |
|
166 | + * @throws \EE_Error |
|
167 | + */ |
|
168 | + public function getDatetimeSelector() { |
|
169 | + if ( ! $this->active) { |
|
170 | + return ''; |
|
171 | + } |
|
172 | + $dropdown_selector = new \EE_Checkbox_Dropdown_Selector_Input( |
|
173 | + $this->unique_dates, |
|
174 | + array( |
|
175 | + 'html_id' => 'datetime-selector-' . $this->event->ID(), |
|
176 | + 'html_name' => 'datetime_selector_' . $this->event->ID(), |
|
177 | + 'html_class' => 'datetime-selector', |
|
178 | + 'select_button_text' => '<span class="dashicons dashicons-calendar-alt"></span> ' |
|
179 | + . esc_html__('Filter by Date', 'event_espresso'), |
|
180 | + 'other_html_attributes' => ' data-tkt_slctr_evt="' . $this->event->ID() . '"', |
|
181 | + ) |
|
182 | + ); |
|
183 | + return \EEH_HTML::div( |
|
184 | + $dropdown_selector->get_html_for_input(), |
|
185 | + '', 'datetime_selector-dv' |
|
186 | + ); |
|
187 | + } |
|
188 | 188 | |
189 | 189 | |
190 | 190 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if ( ! $ticket_datetime instanceof \EE_Datetime) { |
113 | 113 | continue; |
114 | 114 | } |
115 | - $datetimes[ $ticket_datetime->ID() ] = $ticket_datetime; |
|
115 | + $datetimes[$ticket_datetime->ID()] = $ticket_datetime; |
|
116 | 116 | } |
117 | 117 | return $datetimes; |
118 | 118 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @return string |
125 | 125 | * @throws \EE_Error |
126 | 126 | */ |
127 | - public function getTicketDatetimeClasses( \EE_Ticket $ticket ) { |
|
127 | + public function getTicketDatetimeClasses(\EE_Ticket $ticket) { |
|
128 | 128 | if ( ! $this->active) { |
129 | 129 | return ''; |
130 | 130 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | if ( ! $datetime instanceof \EE_Datetime || ! in_array($datetime, $ticket_datetimes, true)) { |
135 | 135 | continue; |
136 | 136 | } |
137 | - $classes .= ' ee-ticket-datetimes-' . $datetime->date_and_time_range('Y_m_d', 'H_i', '-', '_'); |
|
137 | + $classes .= ' ee-ticket-datetimes-'.$datetime->date_and_time_range('Y_m_d', 'H_i', '-', '_'); |
|
138 | 138 | } |
139 | 139 | return $classes; |
140 | 140 | } |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | $dropdown_selector = new \EE_Checkbox_Dropdown_Selector_Input( |
173 | 173 | $this->unique_dates, |
174 | 174 | array( |
175 | - 'html_id' => 'datetime-selector-' . $this->event->ID(), |
|
176 | - 'html_name' => 'datetime_selector_' . $this->event->ID(), |
|
175 | + 'html_id' => 'datetime-selector-'.$this->event->ID(), |
|
176 | + 'html_name' => 'datetime_selector_'.$this->event->ID(), |
|
177 | 177 | 'html_class' => 'datetime-selector', |
178 | 178 | 'select_button_text' => '<span class="dashicons dashicons-calendar-alt"></span> ' |
179 | 179 | . esc_html__('Filter by Date', 'event_espresso'), |
180 | - 'other_html_attributes' => ' data-tkt_slctr_evt="' . $this->event->ID() . '"', |
|
180 | + 'other_html_attributes' => ' data-tkt_slctr_evt="'.$this->event->ID().'"', |
|
181 | 181 | ) |
182 | 182 | ); |
183 | 183 | return \EEH_HTML::div( |
@@ -22,38 +22,38 @@ discard block |
||
22 | 22 | <p><?php echo $ticket->description(); ?></p> |
23 | 23 | |
24 | 24 | <?php |
25 | - do_action( |
|
26 | - 'AHEE__ticket_selector_chart_template__ticket_details__after_description', |
|
27 | - $ticket, |
|
28 | - $ticket_price, |
|
29 | - $display_ticket_price |
|
30 | - ); |
|
31 | - ?> |
|
25 | + do_action( |
|
26 | + 'AHEE__ticket_selector_chart_template__ticket_details__after_description', |
|
27 | + $ticket, |
|
28 | + $ticket_price, |
|
29 | + $display_ticket_price |
|
30 | + ); |
|
31 | + ?> |
|
32 | 32 | |
33 | 33 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
34 | 34 | <h5><?php echo apply_filters( |
35 | - 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', |
|
36 | - esc_html__( 'Sale Dates', 'event_espresso' ) |
|
37 | - ); ?> |
|
35 | + 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', |
|
36 | + esc_html__( 'Sale Dates', 'event_espresso' ) |
|
37 | + ); ?> |
|
38 | 38 | </h5> |
39 | 39 | <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( |
40 | - 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', |
|
41 | - esc_html__( 'The dates when this option is available for purchase.', 'event_espresso' ) |
|
42 | - ); ?></span> |
|
40 | + 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', |
|
41 | + esc_html__( 'The dates when this option is available for purchase.', 'event_espresso' ) |
|
42 | + ); ?></span> |
|
43 | 43 | <br/> |
44 | 44 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
45 | - 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', |
|
46 | - esc_html__( 'Goes On Sale:', 'event_espresso' ) |
|
47 | - ); ?></span> |
|
45 | + 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', |
|
46 | + esc_html__( 'Goes On Sale:', 'event_espresso' ) |
|
47 | + ); ?></span> |
|
48 | 48 | <span class="dashicons dashicons-calendar"></span> |
49 | 49 | <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format) . ' '; ?> |
50 | 50 | <span class="dashicons dashicons-clock"></span> |
51 | 51 | <?php echo $ticket->get_i18n_datetime('TKT_start_date',$time_format); ?> |
52 | 52 | <br/> |
53 | 53 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
54 | - 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', |
|
55 | - esc_html__( 'Sales End:', 'event_espresso' ) |
|
56 | - ); ?></span> |
|
54 | + 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', |
|
55 | + esc_html__( 'Sales End:', 'event_espresso' ) |
|
56 | + ); ?></span> |
|
57 | 57 | <span class="dashicons dashicons-calendar"></span> |
58 | 58 | <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format) . ' '; ?> |
59 | 59 | <span class="dashicons dashicons-clock"></span> |
@@ -67,34 +67,34 @@ discard block |
||
67 | 67 | <?php if ( $ticket->min() && $ticket->max() ) { ?> |
68 | 68 | <section class="tckt-slctr-tkt-quantities-sctn"> |
69 | 69 | <h5><?php echo apply_filters( |
70 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', |
|
71 | - esc_html__( 'Purchasable Quantities', 'event_espresso' ) |
|
72 | - ); ?></h5> |
|
70 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', |
|
71 | + esc_html__( 'Purchasable Quantities', 'event_espresso' ) |
|
72 | + ); ?></h5> |
|
73 | 73 | <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( |
74 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', |
|
75 | - esc_html__( |
|
76 | - 'The number of tickets that can be purchased per transaction (if available).', |
|
77 | - 'event_espresso' |
|
78 | - ) |
|
79 | - ); ?></span><br/> |
|
74 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', |
|
75 | + esc_html__( |
|
76 | + 'The number of tickets that can be purchased per transaction (if available).', |
|
77 | + 'event_espresso' |
|
78 | + ) |
|
79 | + ); ?></span><br/> |
|
80 | 80 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
81 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', |
|
82 | - esc_html__( 'Minimum Qty:', 'event_espresso' ) |
|
83 | - ); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
81 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', |
|
82 | + esc_html__( 'Minimum Qty:', 'event_espresso' ) |
|
83 | + ); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
84 | 84 | <?php if ( $ticket->min() > $remaining ) { ?> <span |
85 | 85 | class="important-notice small-text"><?php echo apply_filters( |
86 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', |
|
87 | - esc_html__( |
|
88 | - 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', |
|
89 | - 'event_espresso' |
|
90 | - ) |
|
91 | - ); ?></span><?php } ?><br/> |
|
86 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', |
|
87 | + esc_html__( |
|
88 | + 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', |
|
89 | + 'event_espresso' |
|
90 | + ) |
|
91 | + ); ?></span><?php } ?><br/> |
|
92 | 92 | <?php //$max = min( $max, $max_atndz );?> |
93 | 93 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
94 | - 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', |
|
95 | - esc_html__( 'Maximum Qty:', 'event_espresso' ) |
|
96 | - ); ?></span><?php echo $ticket->max() === EE_INF ? esc_html__( 'no limit', 'event_espresso' ) |
|
97 | - : max( $ticket->max(), 1 ); ?><br/> |
|
94 | + 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', |
|
95 | + esc_html__( 'Maximum Qty:', 'event_espresso' ) |
|
96 | + ); ?></span><?php echo $ticket->max() === EE_INF ? esc_html__( 'no limit', 'event_espresso' ) |
|
97 | + : max( $ticket->max(), 1 ); ?><br/> |
|
98 | 98 | </section> |
99 | 99 | <br/> |
100 | 100 | <?php } ?> |
@@ -102,43 +102,43 @@ discard block |
||
102 | 102 | <?php if ( ( ! defined( 'EE_DECAF' ) || EE_DECAF !== true ) && $ticket->uses() !== EE_INF ) { ?> |
103 | 103 | <section class="tckt-slctr-tkt-uses-sctn"> |
104 | 104 | <h5><?php echo apply_filters( |
105 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', |
|
106 | - esc_html__( 'Event Date Ticket Uses', 'event_espresso' ) |
|
107 | - ); ?></h5> |
|
105 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', |
|
106 | + esc_html__( 'Event Date Ticket Uses', 'event_espresso' ) |
|
107 | + ); ?></h5> |
|
108 | 108 | <span class="drk-grey-text small-text no-bold"> - <?php |
109 | - echo apply_filters( |
|
110 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
|
111 | - sprintf( |
|
112 | - esc_html__( |
|
113 | - 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', |
|
114 | - 'event_espresso' |
|
115 | - ), |
|
116 | - '<br/>', |
|
117 | - '<strong>', |
|
118 | - '</strong>' |
|
119 | - ) |
|
120 | - ); |
|
121 | - ?></span><br/> |
|
109 | + echo apply_filters( |
|
110 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
|
111 | + sprintf( |
|
112 | + esc_html__( |
|
113 | + 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', |
|
114 | + 'event_espresso' |
|
115 | + ), |
|
116 | + '<br/>', |
|
117 | + '<strong>', |
|
118 | + '</strong>' |
|
119 | + ) |
|
120 | + ); |
|
121 | + ?></span><br/> |
|
122 | 122 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
123 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', |
|
124 | - esc_html__( '# Datetimes:', 'event_espresso' ) |
|
125 | - ); ?></span><?php echo $ticket->uses(); ?><br/> |
|
123 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', |
|
124 | + esc_html__( '# Datetimes:', 'event_espresso' ) |
|
125 | + ); ?></span><?php echo $ticket->uses(); ?><br/> |
|
126 | 126 | </section> |
127 | 127 | <?php } ?> |
128 | 128 | |
129 | 129 | <?php |
130 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, false ); |
|
131 | - $chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
|
132 | - if ( ! empty( $datetimes ) ) { ?> |
|
130 | + $datetimes = $ticket->datetimes_ordered( $event_is_expired, false ); |
|
131 | + $chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
|
132 | + if ( ! empty( $datetimes ) ) { ?> |
|
133 | 133 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
134 | 134 | <h5><?php echo apply_filters( |
135 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', |
|
136 | - esc_html__( 'Access', 'event_espresso' ) |
|
137 | - ); ?></h5> |
|
135 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', |
|
136 | + esc_html__( 'Access', 'event_espresso' ) |
|
137 | + ); ?></h5> |
|
138 | 138 | <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( |
139 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', |
|
140 | - esc_html__( 'This option allows access to the following dates and times.', 'event_espresso' ) |
|
141 | - ); ?></span> |
|
139 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', |
|
140 | + esc_html__( 'This option allows access to the following dates and times.', 'event_espresso' ) |
|
141 | + ); ?></span> |
|
142 | 142 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
143 | 143 | <table class="tckt-slctr-tkt-details-tbl"> |
144 | 144 | <thead> |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | <th class="tckt-slctr-tkt-details-date-th"> |
147 | 147 | <span class="dashicons dashicons-calendar"></span><span |
148 | 148 | class="small-text"><?php echo apply_filters( |
149 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
|
150 | - esc_html__( 'Date ', 'event_espresso' ) |
|
151 | - ); ?></span> |
|
149 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
|
150 | + esc_html__( 'Date ', 'event_espresso' ) |
|
151 | + ); ?></span> |
|
152 | 152 | </th> |
153 | 153 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
154 | 154 | <span class="dashicons dashicons-clock"></span><span |
@@ -157,98 +157,98 @@ discard block |
||
157 | 157 | <?php if ( $show_ticket_sale_columns ) : ?> |
158 | 158 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
159 | 159 | <span class="smaller-text"><?php echo apply_filters( |
160 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
|
161 | - sprintf( esc_html__( 'Sold', 'event_espresso' ), '<br/>' ) |
|
162 | - ); ?></span> |
|
160 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
|
161 | + sprintf( esc_html__( 'Sold', 'event_espresso' ), '<br/>' ) |
|
162 | + ); ?></span> |
|
163 | 163 | </th> |
164 | 164 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
165 | 165 | <span class="smaller-text"><?php echo apply_filters( |
166 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
|
167 | - sprintf( esc_html__( 'Remaining', 'event_espresso' ), '<br/>' ) |
|
168 | - ); ?></span> |
|
166 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
|
167 | + sprintf( esc_html__( 'Remaining', 'event_espresso' ), '<br/>' ) |
|
168 | + ); ?></span> |
|
169 | 169 | </th> |
170 | 170 | <th |
171 | 171 | class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
172 | 172 | <span class="smaller-text"><?php echo apply_filters( |
173 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
|
174 | - sprintf( esc_html__( 'Total%sSold', 'event_espresso' ), '<br/>' ) |
|
175 | - ); ?></span> |
|
173 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
|
174 | + sprintf( esc_html__( 'Total%sSold', 'event_espresso' ), '<br/>' ) |
|
175 | + ); ?></span> |
|
176 | 176 | </th> |
177 | 177 | <th |
178 | 178 | class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
179 | 179 | <span class="smaller-text"><?php echo apply_filters( |
180 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
|
181 | - sprintf( esc_html__( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' ) |
|
182 | - ); ?></span> |
|
180 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
|
181 | + sprintf( esc_html__( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' ) |
|
182 | + ); ?></span> |
|
183 | 183 | </th> |
184 | 184 | <?php endif; //end $show_ticket_sale_columns conditional ?> |
185 | 185 | </tr> |
186 | 186 | </thead> |
187 | 187 | <tbody> |
188 | 188 | <?php |
189 | - foreach ( $datetimes as $datetime ) { |
|
190 | - if ( $datetime instanceof EE_Datetime ) { |
|
191 | - ?> |
|
189 | + foreach ( $datetimes as $datetime ) { |
|
190 | + if ( $datetime instanceof EE_Datetime ) { |
|
191 | + ?> |
|
192 | 192 | |
193 | 193 | <tr> |
194 | 194 | <td data-th="<?php echo apply_filters( |
195 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
|
196 | - esc_html__( 'Event Date ', 'event_espresso' ) |
|
197 | - ); ?>" class="small-text"> |
|
195 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
|
196 | + esc_html__( 'Event Date ', 'event_espresso' ) |
|
197 | + ); ?>" class="small-text"> |
|
198 | 198 | <?php $datetime_name = $datetime->name(); ?> |
199 | 199 | <?php echo ! empty( $datetime_name ) ? '<b>' |
200 | - . $datetime_name |
|
201 | - . '</b><br/>' : ''; ?> |
|
200 | + . $datetime_name |
|
201 | + . '</b><br/>' : ''; ?> |
|
202 | 202 | <?php echo $datetime->date_range( |
203 | - $date_format, |
|
204 | - esc_html__( ' to ', 'event_espresso' ) |
|
205 | - ); ?> |
|
203 | + $date_format, |
|
204 | + esc_html__( ' to ', 'event_espresso' ) |
|
205 | + ); ?> |
|
206 | 206 | </td> |
207 | 207 | <td data-th="<?php esc_html_e( 'Time ', 'event_espresso' ); ?>" |
208 | 208 | class="cntr small-text"> |
209 | 209 | <?php echo $datetime->time_range( |
210 | - $time_format, |
|
211 | - esc_html__( ' to ', 'event_espresso' ) |
|
212 | - ); ?> |
|
210 | + $time_format, |
|
211 | + esc_html__( ' to ', 'event_espresso' ) |
|
212 | + ); ?> |
|
213 | 213 | </td> |
214 | 214 | <?php if ( $show_ticket_sale_columns ) : ?> |
215 | 215 | <td data-th="<?php echo apply_filters( |
216 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
|
217 | - esc_html__( 'Sold', 'event_espresso' ) |
|
218 | - ); ?>" class="cntr small-text"> |
|
216 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
|
217 | + esc_html__( 'Sold', 'event_espresso' ) |
|
218 | + ); ?>" class="cntr small-text"> |
|
219 | 219 | <?php echo $ticket->sold(); ?> |
220 | 220 | </td> |
221 | 221 | <td data-th="<?php echo apply_filters( |
222 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
|
223 | - esc_html__( 'Remaining', 'event_espresso' ) |
|
224 | - ); ?>" class="cntr small-text"> |
|
222 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
|
223 | + esc_html__( 'Remaining', 'event_espresso' ) |
|
224 | + ); ?>" class="cntr small-text"> |
|
225 | 225 | <?php echo $remaining === EE_INF |
226 | - ? '<span class="smaller-text">' . esc_html__( |
|
227 | - 'unlimited ', |
|
228 | - 'event_espresso' |
|
229 | - ) . '</span>' : $remaining; ?> |
|
226 | + ? '<span class="smaller-text">' . esc_html__( |
|
227 | + 'unlimited ', |
|
228 | + 'event_espresso' |
|
229 | + ) . '</span>' : $remaining; ?> |
|
230 | 230 | </td> |
231 | 231 | <td data-th="<?php echo apply_filters( |
232 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
|
233 | - esc_html__( 'Total Sold', 'event_espresso' ) |
|
234 | - ); ?>" class="cntr small-text"> |
|
232 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
|
233 | + esc_html__( 'Total Sold', 'event_espresso' ) |
|
234 | + ); ?>" class="cntr small-text"> |
|
235 | 235 | <?php echo $datetime->sold(); ?> |
236 | 236 | </td> |
237 | 237 | <?php $tkts_left = $datetime->sold_out() |
238 | - ? '<span class="sold-out smaller-text">' . esc_html__( |
|
239 | - 'Sold Out', |
|
240 | - 'event_espresso' |
|
241 | - ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
238 | + ? '<span class="sold-out smaller-text">' . esc_html__( |
|
239 | + 'Sold Out', |
|
240 | + 'event_espresso' |
|
241 | + ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
242 | 242 | <td data-th="<?php echo apply_filters( |
243 | - 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
|
244 | - esc_html__( 'Total Spaces Left', 'event_espresso' ) |
|
245 | - ); ?>" class="cntr small-text"> |
|
243 | + 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
|
244 | + esc_html__( 'Total Spaces Left', 'event_espresso' ) |
|
245 | + ); ?>" class="cntr small-text"> |
|
246 | 246 | <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' |
247 | - . esc_html__( |
|
248 | - 'unlimited ', |
|
249 | - 'event_espresso' |
|
250 | - ) |
|
251 | - . '</span>' : $tkts_left; ?> |
|
247 | + . esc_html__( |
|
248 | + 'unlimited ', |
|
249 | + 'event_espresso' |
|
250 | + ) |
|
251 | + . '</span>' : $tkts_left; ?> |
|
252 | 252 | </td> |
253 | 253 | <?php endif; //end $show_ticket_sale_columns conditional ?> |
254 | 254 | </tr> |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | /** @var string $price_breakdown_heading */ |
13 | 13 | /** @var \EventEspresso\modules\ticket_selector\TicketDetails $ticket_details */ |
14 | 14 | ?> |
15 | -<?php if ( $show_ticket_details ) : ?> |
|
15 | +<?php if ($show_ticket_details) : ?> |
|
16 | 16 | <tr class="tckt-slctr-tkt-details-tr <?php echo $ticket_details_row_class; ?>"> |
17 | 17 | <td class="tckt-slctr-tkt-details-td" colspan="<?php echo $cols; ?>"> |
18 | 18 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
19 | 19 | |
20 | 20 | <section class="tckt-slctr-tkt-details-sctn"> |
21 | - <h4><?php echo esc_html__( 'Details', 'event_espresso' ); ?></h4> |
|
21 | + <h4><?php echo esc_html__('Details', 'event_espresso'); ?></h4> |
|
22 | 22 | <p><?php echo $ticket->description(); ?></p> |
23 | 23 | |
24 | 24 | <?php |
@@ -33,42 +33,42 @@ discard block |
||
33 | 33 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
34 | 34 | <h5><?php echo apply_filters( |
35 | 35 | 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', |
36 | - esc_html__( 'Sale Dates', 'event_espresso' ) |
|
36 | + esc_html__('Sale Dates', 'event_espresso') |
|
37 | 37 | ); ?> |
38 | 38 | </h5> |
39 | 39 | <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( |
40 | 40 | 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', |
41 | - esc_html__( 'The dates when this option is available for purchase.', 'event_espresso' ) |
|
41 | + esc_html__('The dates when this option is available for purchase.', 'event_espresso') |
|
42 | 42 | ); ?></span> |
43 | 43 | <br/> |
44 | 44 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
45 | 45 | 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', |
46 | - esc_html__( 'Goes On Sale:', 'event_espresso' ) |
|
46 | + esc_html__('Goes On Sale:', 'event_espresso') |
|
47 | 47 | ); ?></span> |
48 | 48 | <span class="dashicons dashicons-calendar"></span> |
49 | - <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format) . ' '; ?> |
|
49 | + <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?> |
|
50 | 50 | <span class="dashicons dashicons-clock"></span> |
51 | - <?php echo $ticket->get_i18n_datetime('TKT_start_date',$time_format); ?> |
|
51 | + <?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?> |
|
52 | 52 | <br/> |
53 | 53 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
54 | 54 | 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', |
55 | - esc_html__( 'Sales End:', 'event_espresso' ) |
|
55 | + esc_html__('Sales End:', 'event_espresso') |
|
56 | 56 | ); ?></span> |
57 | 57 | <span class="dashicons dashicons-calendar"></span> |
58 | - <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format) . ' '; ?> |
|
58 | + <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?> |
|
59 | 59 | <span class="dashicons dashicons-clock"></span> |
60 | 60 | <?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?> |
61 | 61 | <br/> |
62 | 62 | </section> |
63 | 63 | <br/> |
64 | 64 | |
65 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
65 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
66 | 66 | |
67 | - <?php if ( $ticket->min() && $ticket->max() ) { ?> |
|
67 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
68 | 68 | <section class="tckt-slctr-tkt-quantities-sctn"> |
69 | 69 | <h5><?php echo apply_filters( |
70 | 70 | 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', |
71 | - esc_html__( 'Purchasable Quantities', 'event_espresso' ) |
|
71 | + esc_html__('Purchasable Quantities', 'event_espresso') |
|
72 | 72 | ); ?></h5> |
73 | 73 | <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( |
74 | 74 | 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | ); ?></span><br/> |
80 | 80 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
81 | 81 | 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', |
82 | - esc_html__( 'Minimum Qty:', 'event_espresso' ) |
|
82 | + esc_html__('Minimum Qty:', 'event_espresso') |
|
83 | 83 | ); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
84 | - <?php if ( $ticket->min() > $remaining ) { ?> <span |
|
84 | + <?php if ($ticket->min() > $remaining) { ?> <span |
|
85 | 85 | class="important-notice small-text"><?php echo apply_filters( |
86 | 86 | 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', |
87 | 87 | esc_html__( |
@@ -92,18 +92,18 @@ discard block |
||
92 | 92 | <?php //$max = min( $max, $max_atndz );?> |
93 | 93 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
94 | 94 | 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', |
95 | - esc_html__( 'Maximum Qty:', 'event_espresso' ) |
|
96 | - ); ?></span><?php echo $ticket->max() === EE_INF ? esc_html__( 'no limit', 'event_espresso' ) |
|
97 | - : max( $ticket->max(), 1 ); ?><br/> |
|
95 | + esc_html__('Maximum Qty:', 'event_espresso') |
|
96 | + ); ?></span><?php echo $ticket->max() === EE_INF ? esc_html__('no limit', 'event_espresso') |
|
97 | + : max($ticket->max(), 1); ?><br/> |
|
98 | 98 | </section> |
99 | 99 | <br/> |
100 | 100 | <?php } ?> |
101 | 101 | |
102 | - <?php if ( ( ! defined( 'EE_DECAF' ) || EE_DECAF !== true ) && $ticket->uses() !== EE_INF ) { ?> |
|
102 | + <?php if (( ! defined('EE_DECAF') || EE_DECAF !== true) && $ticket->uses() !== EE_INF) { ?> |
|
103 | 103 | <section class="tckt-slctr-tkt-uses-sctn"> |
104 | 104 | <h5><?php echo apply_filters( |
105 | 105 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', |
106 | - esc_html__( 'Event Date Ticket Uses', 'event_espresso' ) |
|
106 | + esc_html__('Event Date Ticket Uses', 'event_espresso') |
|
107 | 107 | ); ?></h5> |
108 | 108 | <span class="drk-grey-text small-text no-bold"> - <?php |
109 | 109 | echo apply_filters( |
@@ -121,23 +121,23 @@ discard block |
||
121 | 121 | ?></span><br/> |
122 | 122 | <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( |
123 | 123 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', |
124 | - esc_html__( '# Datetimes:', 'event_espresso' ) |
|
124 | + esc_html__('# Datetimes:', 'event_espresso') |
|
125 | 125 | ); ?></span><?php echo $ticket->uses(); ?><br/> |
126 | 126 | </section> |
127 | 127 | <?php } ?> |
128 | 128 | |
129 | 129 | <?php |
130 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, false ); |
|
130 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, false); |
|
131 | 131 | $chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
132 | - if ( ! empty( $datetimes ) ) { ?> |
|
132 | + if ( ! empty($datetimes)) { ?> |
|
133 | 133 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
134 | 134 | <h5><?php echo apply_filters( |
135 | 135 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', |
136 | - esc_html__( 'Access', 'event_espresso' ) |
|
136 | + esc_html__('Access', 'event_espresso') |
|
137 | 137 | ); ?></h5> |
138 | 138 | <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( |
139 | 139 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', |
140 | - esc_html__( 'This option allows access to the following dates and times.', 'event_espresso' ) |
|
140 | + esc_html__('This option allows access to the following dates and times.', 'event_espresso') |
|
141 | 141 | ); ?></span> |
142 | 142 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
143 | 143 | <table class="tckt-slctr-tkt-details-tbl"> |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | <span class="dashicons dashicons-calendar"></span><span |
148 | 148 | class="small-text"><?php echo apply_filters( |
149 | 149 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
150 | - esc_html__( 'Date ', 'event_espresso' ) |
|
150 | + esc_html__('Date ', 'event_espresso') |
|
151 | 151 | ); ?></span> |
152 | 152 | </th> |
153 | 153 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
154 | 154 | <span class="dashicons dashicons-clock"></span><span |
155 | - class="small-text"><?php esc_html_e( 'Time ', 'event_espresso' ); ?></span> |
|
155 | + class="small-text"><?php esc_html_e('Time ', 'event_espresso'); ?></span> |
|
156 | 156 | </th> |
157 | - <?php if ( $show_ticket_sale_columns ) : ?> |
|
157 | + <?php if ($show_ticket_sale_columns) : ?> |
|
158 | 158 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
159 | 159 | <span class="smaller-text"><?php echo apply_filters( |
160 | 160 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
161 | - sprintf( esc_html__( 'Sold', 'event_espresso' ), '<br/>' ) |
|
161 | + sprintf(esc_html__('Sold', 'event_espresso'), '<br/>') |
|
162 | 162 | ); ?></span> |
163 | 163 | </th> |
164 | 164 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
165 | 165 | <span class="smaller-text"><?php echo apply_filters( |
166 | 166 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
167 | - sprintf( esc_html__( 'Remaining', 'event_espresso' ), '<br/>' ) |
|
167 | + sprintf(esc_html__('Remaining', 'event_espresso'), '<br/>') |
|
168 | 168 | ); ?></span> |
169 | 169 | </th> |
170 | 170 | <th |
171 | 171 | class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
172 | 172 | <span class="smaller-text"><?php echo apply_filters( |
173 | 173 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
174 | - sprintf( esc_html__( 'Total%sSold', 'event_espresso' ), '<br/>' ) |
|
174 | + sprintf(esc_html__('Total%sSold', 'event_espresso'), '<br/>') |
|
175 | 175 | ); ?></span> |
176 | 176 | </th> |
177 | 177 | <th |
178 | 178 | class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
179 | 179 | <span class="smaller-text"><?php echo apply_filters( |
180 | 180 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
181 | - sprintf( esc_html__( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' ) |
|
181 | + sprintf(esc_html__('Total Spaces%sLeft', 'event_espresso'), '<br/>') |
|
182 | 182 | ); ?></span> |
183 | 183 | </th> |
184 | 184 | <?php endif; //end $show_ticket_sale_columns conditional ?> |
@@ -186,62 +186,62 @@ discard block |
||
186 | 186 | </thead> |
187 | 187 | <tbody> |
188 | 188 | <?php |
189 | - foreach ( $datetimes as $datetime ) { |
|
190 | - if ( $datetime instanceof EE_Datetime ) { |
|
189 | + foreach ($datetimes as $datetime) { |
|
190 | + if ($datetime instanceof EE_Datetime) { |
|
191 | 191 | ?> |
192 | 192 | |
193 | 193 | <tr> |
194 | 194 | <td data-th="<?php echo apply_filters( |
195 | 195 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', |
196 | - esc_html__( 'Event Date ', 'event_espresso' ) |
|
196 | + esc_html__('Event Date ', 'event_espresso') |
|
197 | 197 | ); ?>" class="small-text"> |
198 | 198 | <?php $datetime_name = $datetime->name(); ?> |
199 | - <?php echo ! empty( $datetime_name ) ? '<b>' |
|
199 | + <?php echo ! empty($datetime_name) ? '<b>' |
|
200 | 200 | . $datetime_name |
201 | 201 | . '</b><br/>' : ''; ?> |
202 | 202 | <?php echo $datetime->date_range( |
203 | 203 | $date_format, |
204 | - esc_html__( ' to ', 'event_espresso' ) |
|
204 | + esc_html__(' to ', 'event_espresso') |
|
205 | 205 | ); ?> |
206 | 206 | </td> |
207 | - <td data-th="<?php esc_html_e( 'Time ', 'event_espresso' ); ?>" |
|
207 | + <td data-th="<?php esc_html_e('Time ', 'event_espresso'); ?>" |
|
208 | 208 | class="cntr small-text"> |
209 | 209 | <?php echo $datetime->time_range( |
210 | 210 | $time_format, |
211 | - esc_html__( ' to ', 'event_espresso' ) |
|
211 | + esc_html__(' to ', 'event_espresso') |
|
212 | 212 | ); ?> |
213 | 213 | </td> |
214 | - <?php if ( $show_ticket_sale_columns ) : ?> |
|
214 | + <?php if ($show_ticket_sale_columns) : ?> |
|
215 | 215 | <td data-th="<?php echo apply_filters( |
216 | 216 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', |
217 | - esc_html__( 'Sold', 'event_espresso' ) |
|
217 | + esc_html__('Sold', 'event_espresso') |
|
218 | 218 | ); ?>" class="cntr small-text"> |
219 | 219 | <?php echo $ticket->sold(); ?> |
220 | 220 | </td> |
221 | 221 | <td data-th="<?php echo apply_filters( |
222 | 222 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', |
223 | - esc_html__( 'Remaining', 'event_espresso' ) |
|
223 | + esc_html__('Remaining', 'event_espresso') |
|
224 | 224 | ); ?>" class="cntr small-text"> |
225 | 225 | <?php echo $remaining === EE_INF |
226 | - ? '<span class="smaller-text">' . esc_html__( |
|
226 | + ? '<span class="smaller-text">'.esc_html__( |
|
227 | 227 | 'unlimited ', |
228 | 228 | 'event_espresso' |
229 | - ) . '</span>' : $remaining; ?> |
|
229 | + ).'</span>' : $remaining; ?> |
|
230 | 230 | </td> |
231 | 231 | <td data-th="<?php echo apply_filters( |
232 | 232 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', |
233 | - esc_html__( 'Total Sold', 'event_espresso' ) |
|
233 | + esc_html__('Total Sold', 'event_espresso') |
|
234 | 234 | ); ?>" class="cntr small-text"> |
235 | 235 | <?php echo $datetime->sold(); ?> |
236 | 236 | </td> |
237 | 237 | <?php $tkts_left = $datetime->sold_out() |
238 | - ? '<span class="sold-out smaller-text">' . esc_html__( |
|
238 | + ? '<span class="sold-out smaller-text">'.esc_html__( |
|
239 | 239 | 'Sold Out', |
240 | 240 | 'event_espresso' |
241 | - ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
241 | + ).'</span>' : $datetime->spaces_remaining(); ?> |
|
242 | 242 | <td data-th="<?php echo apply_filters( |
243 | 243 | 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', |
244 | - esc_html__( 'Total Spaces Left', 'event_espresso' ) |
|
244 | + esc_html__('Total Spaces Left', 'event_espresso') |
|
245 | 245 | ); ?>" class="cntr small-text"> |
246 | 246 | <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' |
247 | 247 | . esc_html__( |
@@ -266,4 +266,4 @@ discard block |
||
266 | 266 | </div> |
267 | 267 | </td> |
268 | 268 | </tr> |
269 | -<?php endif; //end template_settings->show_ticket_details check?> |
|
270 | 269 | \ No newline at end of file |
270 | +<?php endif; //end template_settings->show_ticket_details check?> |
|
271 | 271 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | if ($display_ticket_price) { ?> |
8 | 8 | <section class="tckt-slctr-tkt-price-sctn"> |
9 | 9 | <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
10 | - esc_html__('Price', 'event_espresso')); ?></h5> |
|
10 | + esc_html__('Price', 'event_espresso')); ?></h5> |
|
11 | 11 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
12 | 12 | <table class="tckt-slctr-tkt-details-tbl"> |
13 | 13 | <thead> |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
31 | 31 | </tr> |
32 | 32 | <?php |
33 | - $running_total = $ticket->base_price()->amount(); |
|
34 | - } else { |
|
35 | - $running_total = 0; |
|
36 | - } |
|
37 | - // now add price modifiers |
|
38 | - foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
33 | + $running_total = $ticket->base_price()->amount(); |
|
34 | + } else { |
|
35 | + $running_total = 0; |
|
36 | + } |
|
37 | + // now add price modifiers |
|
38 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
39 | 39 | <tr> |
40 | 40 | <td data-th="<?php esc_html_e('Name', 'event_espresso'); ?>" |
41 | 41 | class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | % |
46 | 46 | </td> |
47 | 47 | <?php |
48 | - $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
49 | - $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
|
50 | - ?> |
|
48 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
49 | + $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
|
50 | + ?> |
|
51 | 51 | <?php } else { ?> |
52 | 52 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 |
53 | - : $price_mod->amount(); ?> |
|
53 | + : $price_mod->amount(); ?> |
|
54 | 54 | <td data-th="<?php esc_html_e('Description', 'event_espresso'); ?>" |
55 | 55 | class="small-text"><?php echo $price_mod->desc(); ?></td> |
56 | 56 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 |
57 | - : $price_mod->amount(); ?> |
|
57 | + : $price_mod->amount(); ?> |
|
58 | 58 | <?php } ?> |
59 | 59 | <td data-th="<?php esc_html_e('Amount', 'event_espresso'); ?>" |
60 | 60 | class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
66 | 66 | <tr> |
67 | 67 | <td colspan="2" class="jst-rght small-text sbttl"><b><?php esc_html_e('subtotal', |
68 | - 'event_espresso'); ?></b></td> |
|
68 | + 'event_espresso'); ?></b></td> |
|
69 | 69 | <td data-th="<?php esc_html_e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"> |
70 | 70 | <b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
71 | 71 | </tr> |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | <tr> |
88 | 88 | <td colspan="2" class="jst-rght small-text ttl-lbl-td"> |
89 | 89 | <b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', |
90 | - esc_html__('Total', 'event_espresso')); ?></b></td> |
|
90 | + esc_html__('Total', 'event_espresso')); ?></b></td> |
|
91 | 91 | <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', |
92 | - esc_html__('Total', 'event_espresso')); ?>" class="jst-rght small-text"> |
|
92 | + esc_html__('Total', 'event_espresso')); ?>" class="jst-rght small-text"> |
|
93 | 93 | <b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
94 | 94 | </tr> |
95 | 95 | </tbody> |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
41 | - * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations', |
|
41 | + * @param string $capability - the capability to be checked, like: 'ee_edit_registrations', |
|
42 | 42 | * or an array of capability strings |
43 | 43 | * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
44 | 44 | * @param int $ID - (optional) ID for item where current_user_can is being called from |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
5 | 5 | |
6 | 6 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
7 | - exit('No direct script access allowed'); |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -20,72 +20,72 @@ discard block |
||
20 | 20 | class CapCheck implements CapCheckInterface |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var string|array $capability |
|
25 | - */ |
|
26 | - private $capability; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var string $context |
|
30 | - */ |
|
31 | - private $context; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var int|string $ID |
|
35 | - */ |
|
36 | - private $ID; |
|
37 | - |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations', |
|
42 | - * or an array of capability strings |
|
43 | - * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
44 | - * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
45 | - * @throws InvalidDataTypeException |
|
46 | - */ |
|
47 | - public function __construct($capability, $context, $ID = 0) |
|
48 | - { |
|
49 | - if ( ! (is_string($capability) || is_array($capability))) { |
|
50 | - throw new InvalidDataTypeException('$capability', $capability, 'string or array'); |
|
51 | - } |
|
52 | - if ( ! is_string($context)) { |
|
53 | - throw new InvalidDataTypeException('$context', $context, 'string'); |
|
54 | - } |
|
55 | - $this->capability = $capability; |
|
56 | - $this->context = strtolower(str_replace(' ', '_', $context)); |
|
57 | - $this->ID = $ID; |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * @return string|array |
|
64 | - */ |
|
65 | - public function capability() |
|
66 | - { |
|
67 | - return $this->capability; |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public function context() |
|
76 | - { |
|
77 | - return $this->context; |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * @return int|string |
|
84 | - */ |
|
85 | - public function ID() |
|
86 | - { |
|
87 | - return $this->ID; |
|
88 | - } |
|
23 | + /** |
|
24 | + * @var string|array $capability |
|
25 | + */ |
|
26 | + private $capability; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var string $context |
|
30 | + */ |
|
31 | + private $context; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var int|string $ID |
|
35 | + */ |
|
36 | + private $ID; |
|
37 | + |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations', |
|
42 | + * or an array of capability strings |
|
43 | + * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
44 | + * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
45 | + * @throws InvalidDataTypeException |
|
46 | + */ |
|
47 | + public function __construct($capability, $context, $ID = 0) |
|
48 | + { |
|
49 | + if ( ! (is_string($capability) || is_array($capability))) { |
|
50 | + throw new InvalidDataTypeException('$capability', $capability, 'string or array'); |
|
51 | + } |
|
52 | + if ( ! is_string($context)) { |
|
53 | + throw new InvalidDataTypeException('$context', $context, 'string'); |
|
54 | + } |
|
55 | + $this->capability = $capability; |
|
56 | + $this->context = strtolower(str_replace(' ', '_', $context)); |
|
57 | + $this->ID = $ID; |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * @return string|array |
|
64 | + */ |
|
65 | + public function capability() |
|
66 | + { |
|
67 | + return $this->capability; |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public function context() |
|
76 | + { |
|
77 | + return $this->context; |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * @return int|string |
|
84 | + */ |
|
85 | + public function ID() |
|
86 | + { |
|
87 | + return $this->ID; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | 91 | } |