@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * ************************************************************************ |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | $action_or_filter = 'action' |
44 | 44 | ) { |
45 | 45 | $action_or_filter = $action_or_filter === 'action' |
46 | - ? esc_html__( 'action', 'event_espresso' ) |
|
47 | - : esc_html__( 'filter', 'event_espresso' ); |
|
46 | + ? esc_html__('action', 'event_espresso') |
|
47 | + : esc_html__('filter', 'event_espresso'); |
|
48 | 48 | EE_Error::doing_it_wrong( |
49 | 49 | $deprecated_filter, |
50 | 50 | sprintf( |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param \EE_Checkout $checkout |
69 | 69 | * @return string |
70 | 70 | */ |
71 | -function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) { |
|
71 | +function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) { |
|
72 | 72 | // list of old filters |
73 | 73 | $deprecated_filters = array( |
74 | 74 | 'update_registration_details' => true, |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | 'proceed_to' => true, |
79 | 79 | ); |
80 | 80 | // loop thru and call doing_it_wrong() or remove any that aren't being used |
81 | - foreach ( $deprecated_filters as $deprecated_filter => $on ) { |
|
81 | + foreach ($deprecated_filters as $deprecated_filter => $on) { |
|
82 | 82 | // was this filter called ? |
83 | - if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) { |
|
83 | + if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) { |
|
84 | 84 | // only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
85 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) { |
|
85 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) { |
|
86 | 86 | EE_Error::doing_it_wrong( |
87 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
87 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
88 | 88 | sprintf( |
89 | - __( 'The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso' ), |
|
90 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
89 | + __('The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'), |
|
90 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
91 | 91 | '<br />', |
92 | 92 | 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
93 | 93 | '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | ); |
97 | 97 | } |
98 | 98 | } else { |
99 | - unset( $deprecated_filters[ $deprecated_filter ] ); |
|
99 | + unset($deprecated_filters[$deprecated_filter]); |
|
100 | 100 | } |
101 | 101 | } |
102 | - if ( ! empty( $deprecated_filters )) { |
|
103 | - |
|
104 | - if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) { |
|
105 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text ); |
|
106 | - } else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) { |
|
107 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text ); |
|
108 | - } else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) { |
|
109 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text ); |
|
102 | + if ( ! empty($deprecated_filters)) { |
|
103 | + |
|
104 | + if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
|
105 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text); |
|
106 | + } else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) { |
|
107 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text); |
|
108 | + } else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) { |
|
109 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text); |
|
110 | 110 | } |
111 | - if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
112 | - if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) { |
|
113 | - $submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text ); |
|
111 | + if ($checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
112 | + if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) { |
|
113 | + $submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text); |
|
114 | 114 | } |
115 | - if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) { |
|
116 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name(); |
|
115 | + if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) { |
|
116 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name(); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return $submit_button_text; |
122 | 122 | |
123 | 123 | } |
124 | -add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 ); |
|
124 | +add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | * @param \EE_Checkout $checkout |
133 | 133 | * @param boolean $status_updates |
134 | 134 | */ |
135 | -function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) { |
|
135 | +function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) { |
|
136 | 136 | $action_ref = NULL; |
137 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
138 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
139 | - if ( $action_ref ) { |
|
137 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
138 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
139 | + if ($action_ref) { |
|
140 | 140 | |
141 | 141 | EE_Error::doing_it_wrong( |
142 | 142 | $action_ref, |
143 | 143 | sprintf( |
144 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso' ), |
|
144 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso'), |
|
145 | 145 | '<br />', |
146 | 146 | '/core/business/EE_Transaction_Processor.class.php', |
147 | 147 | 'AHEE__EE_Transaction_Processor__finalize', |
@@ -151,39 +151,39 @@ discard block |
||
151 | 151 | ), |
152 | 152 | '4.6.0' |
153 | 153 | ); |
154 | - switch ( $action_ref ) { |
|
154 | + switch ($action_ref) { |
|
155 | 155 | case 'AHEE__EE_Transaction__finalize__new_transaction' : |
156 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request ); |
|
156 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request); |
|
157 | 157 | break; |
158 | 158 | case 'AHEE__EE_Transaction__finalize__all_transaction' : |
159 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request ); |
|
159 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request); |
|
160 | 160 | break; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | } |
164 | -add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 ); |
|
164 | +add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2); |
|
165 | 165 | /** |
166 | 166 | * ee_deprecated_finalize_registration |
167 | 167 | * |
168 | 168 | * @param EE_Registration $registration |
169 | 169 | */ |
170 | -function ee_deprecated_finalize_registration( EE_Registration $registration ) { |
|
171 | - $action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
172 | - if ( $action_ref ) { |
|
170 | +function ee_deprecated_finalize_registration(EE_Registration $registration) { |
|
171 | + $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
172 | + if ($action_ref) { |
|
173 | 173 | EE_Error::doing_it_wrong( |
174 | 174 | $action_ref, |
175 | 175 | sprintf( |
176 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso' ), |
|
176 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso'), |
|
177 | 177 | '<br />', |
178 | 178 | '/core/business/EE_Registration_Processor.class.php', |
179 | 179 | 'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook' |
180 | 180 | ), |
181 | 181 | '4.6.0' |
182 | 182 | ); |
183 | - do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ))); |
|
183 | + do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))); |
|
184 | 184 | } |
185 | 185 | } |
186 | -add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 ); |
|
186 | +add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1); |
|
187 | 187 | |
188 | 188 | |
189 | 189 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called. |
192 | 192 | * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately. |
193 | 193 | */ |
194 | -function ee_deprecated_hooks(){ |
|
194 | +function ee_deprecated_hooks() { |
|
195 | 195 | /** |
196 | 196 | * @var $hooks array where keys are hook names, and their values are array{ |
197 | 197 | * @type string $version when deprecated |
@@ -202,25 +202,25 @@ discard block |
||
202 | 202 | $hooks = array( |
203 | 203 | 'AHEE__EE_System___do_setup_validations' => array( |
204 | 204 | 'version' => '4.6.0', |
205 | - 'alternative' => __( 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso' ), |
|
205 | + 'alternative' => __('Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso'), |
|
206 | 206 | 'still_works' => FALSE |
207 | 207 | ) |
208 | 208 | ); |
209 | - foreach( $hooks as $name => $deprecation_info ){ |
|
210 | - if( has_action( $name ) ){ |
|
209 | + foreach ($hooks as $name => $deprecation_info) { |
|
210 | + if (has_action($name)) { |
|
211 | 211 | EE_Error::doing_it_wrong( |
212 | 212 | $name, |
213 | 213 | sprintf( |
214 | - __('This filter is deprecated. %1$s%2$s','event_espresso'), |
|
215 | - $deprecation_info[ 'still_works' ] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ), |
|
216 | - isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' ) |
|
214 | + __('This filter is deprecated. %1$s%2$s', 'event_espresso'), |
|
215 | + $deprecation_info['still_works'] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __('It has been completely removed.', 'event_espresso'), |
|
216 | + isset($deprecation_info['alternative']) ? $deprecation_info['alternative'] : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso') |
|
217 | 217 | ), |
218 | - isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' ) |
|
218 | + isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso') |
|
219 | 219 | ); |
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
223 | -add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' ); |
|
223 | +add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks'); |
|
224 | 224 | |
225 | 225 | |
226 | 226 | |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @return boolean |
232 | 232 | */ |
233 | 233 | function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() { |
234 | - $in_use = has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' ) |
|
235 | - || has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' ); |
|
236 | - if( $in_use ) { |
|
234 | + $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns') |
|
235 | + || has_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'); |
|
236 | + if ($in_use) { |
|
237 | 237 | $msg = __( |
238 | 238 | 'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.' |
239 | 239 | . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,' |
@@ -242,18 +242,18 @@ discard block |
||
242 | 242 | 'event_espresso' ) |
243 | 243 | ; |
244 | 244 | EE_Error::doing_it_wrong( |
245 | - __CLASS__ . '::' . __FUNCTION__, |
|
245 | + __CLASS__.'::'.__FUNCTION__, |
|
246 | 246 | $msg, |
247 | 247 | '4.8.32.rc.000' |
248 | 248 | ); |
249 | 249 | //it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
250 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
251 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
250 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
251 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | return $in_use; |
255 | 255 | } |
256 | -add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' ); |
|
256 | +add_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165 |
@@ -262,34 +262,34 @@ discard block |
||
262 | 262 | * @param EE_Admin_Page $admin_page |
263 | 263 | * @return void |
264 | 264 | */ |
265 | -function ee_deprecated_update_attendee_registration_form_old( $admin_page ) { |
|
265 | +function ee_deprecated_update_attendee_registration_form_old($admin_page) { |
|
266 | 266 | //check if the old hooks are in use. If not, do the default |
267 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
268 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
267 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
268 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
269 | 269 | return; |
270 | 270 | } |
271 | 271 | $req_data = $admin_page->get_request_data(); |
272 | - $qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE; |
|
273 | - $REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE; |
|
274 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
275 | - if ( ! $REG_ID || ! $qstns ) { |
|
276 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
272 | + $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE; |
|
273 | + $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE; |
|
274 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
275 | + if ( ! $REG_ID || ! $qstns) { |
|
276 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
277 | 277 | } |
278 | 278 | $success = TRUE; |
279 | 279 | |
280 | 280 | // allow others to get in on this awesome fun :D |
281 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
281 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
282 | 282 | // loop thru questions... FINALLY!!! |
283 | 283 | |
284 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
284 | + foreach ($qstns as $QST_ID => $qstn) { |
|
285 | 285 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
286 | - if ( !is_array($qstn) ) { |
|
287 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
286 | + if ( ! is_array($qstn)) { |
|
287 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
288 | 288 | continue; |
289 | 289 | } |
290 | 290 | |
291 | 291 | |
292 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
292 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
293 | 293 | //get answer |
294 | 294 | $query_params = array( |
295 | 295 | 0 => array( |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | ); |
301 | 301 | $answer = EEM_Answer::instance()->get_one($query_params); |
302 | 302 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
303 | - if ( ! $answer instanceof EE_Answer ) { |
|
303 | + if ( ! $answer instanceof EE_Answer) { |
|
304 | 304 | $set_values = array( |
305 | 305 | 'QST_ID' => $QST_ID, |
306 | 306 | 'REG_ID' => $REG_ID, |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | } |
316 | 316 | } |
317 | 317 | $what = __('Registration Form', 'event_espresso'); |
318 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
319 | - $admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
318 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
319 | + $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
320 | 320 | exit; |
321 | 321 | } |
322 | -add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 ); |
|
322 | +add_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1); |
|
323 | 323 | /** |
324 | 324 | * Render the registration admin page's custom questions area in the old fashion |
325 | 325 | * and firing the old hooks. When this method is removed, we can probably also |
@@ -332,31 +332,31 @@ discard block |
||
332 | 332 | * @return bool |
333 | 333 | * @throws \EE_Error |
334 | 334 | */ |
335 | -function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) { |
|
335 | +function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) { |
|
336 | 336 | //check if the old hooks are in use. If not, do the default |
337 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
338 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
337 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
338 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
339 | 339 | return $do_default_action; |
340 | 340 | } |
341 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 ); |
|
342 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 ); |
|
343 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 ); |
|
344 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 ); |
|
341 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($admin_page, 'form_before_question_group'), 10, 1); |
|
342 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($admin_page, 'form_after_question_group'), 10, 1); |
|
343 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1); |
|
344 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1); |
|
345 | 345 | |
346 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') ); |
|
346 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($registration, $registration->get('EVT_ID')); |
|
347 | 347 | |
348 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
348 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
349 | 349 | $template_args = array( |
350 | - 'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ), |
|
350 | + 'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups), |
|
351 | 351 | 'reg_questions_form_action' => 'edit_registration', |
352 | 352 | 'REG_ID' => $registration->ID() |
353 | 353 | ); |
354 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
355 | - echo EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
354 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
355 | + echo EEH_Template::display_template($template_path, $template_args, TRUE); |
|
356 | 356 | //indicate that we should not do the default admin page code |
357 | 357 | return false; |
358 | 358 | } |
359 | -add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 ); |
|
359 | +add_action('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3); |
|
360 | 360 | |
361 | 361 | |
362 | 362 | |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | '4.9.0' |
398 | 398 | ); |
399 | 399 | /** @var EE_Message_Resource_Manager $message_resource_manager */ |
400 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
401 | - $messenger = $message_resource_manager->get_messenger( $messenger_name ); |
|
402 | - $message_type = $message_resource_manager->get_message_type( $message_type_name ); |
|
400 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
401 | + $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
402 | + $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
403 | 403 | return EE_Registry::instance()->load_lib( |
404 | 404 | 'Messages_Template_Defaults', |
405 | 405 | array( |
@@ -464,15 +464,15 @@ discard block |
||
464 | 464 | /** |
465 | 465 | * @param string $method |
466 | 466 | */ |
467 | - public function _class_is_deprecated( $method ) { |
|
467 | + public function _class_is_deprecated($method) { |
|
468 | 468 | EE_Error::doing_it_wrong( |
469 | - 'EE_messages::' . $method, |
|
470 | - __( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
|
469 | + 'EE_messages::'.$method, |
|
470 | + __('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
471 | 471 | '4.9.0', |
472 | 472 | '4.10.0.p' |
473 | 473 | ); |
474 | 474 | // Please use EE_Message_Resource_Manager instead |
475 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
475 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -482,10 +482,10 @@ discard block |
||
482 | 482 | * @param string $messenger_name |
483 | 483 | * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
484 | 484 | */ |
485 | - public function ensure_messenger_is_active( $messenger_name ) { |
|
485 | + public function ensure_messenger_is_active($messenger_name) { |
|
486 | 486 | // EE_messages has been deprecated |
487 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
488 | - return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
|
487 | + $this->_class_is_deprecated(__FUNCTION__); |
|
488 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -497,10 +497,10 @@ discard block |
||
497 | 497 | * @return bool true if it got activated (or was active) and false if not. |
498 | 498 | * @throws \EE_Error |
499 | 499 | */ |
500 | - public function ensure_message_type_is_active( $message_type, $messenger ) { |
|
500 | + public function ensure_message_type_is_active($message_type, $messenger) { |
|
501 | 501 | // EE_messages has been deprecated |
502 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
503 | - return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
|
502 | + $this->_class_is_deprecated(__FUNCTION__); |
|
503 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | * they are already setup.) |
514 | 514 | * @return boolean an array of generated templates or false if nothing generated/activated. |
515 | 515 | */ |
516 | - public function activate_messenger( $messenger_name, $mts_to_activate = array() ) { |
|
516 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) { |
|
517 | 517 | // EE_messages has been deprecated |
518 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
519 | - return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
|
518 | + $this->_class_is_deprecated(__FUNCTION__); |
|
519 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -528,10 +528,10 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
530 | 530 | */ |
531 | - public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
|
531 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) { |
|
532 | 532 | // EE_messages has been deprecated |
533 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
534 | - return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
|
533 | + $this->_class_is_deprecated(__FUNCTION__); |
|
534 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | * @param string $messenger |
542 | 542 | * @return EE_messenger | null |
543 | 543 | */ |
544 | - public function get_messenger_if_active( $messenger ) { |
|
544 | + public function get_messenger_if_active($messenger) { |
|
545 | 545 | // EE_messages has been deprecated |
546 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
547 | - return $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
546 | + $this->_class_is_deprecated(__FUNCTION__); |
|
547 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -565,9 +565,9 @@ discard block |
||
565 | 565 | * 'message_type' => null |
566 | 566 | * ) |
567 | 567 | */ |
568 | - public function validate_for_use( EE_Message $message ) { |
|
568 | + public function validate_for_use(EE_Message $message) { |
|
569 | 569 | // EE_messages has been deprecated |
570 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
570 | + $this->_class_is_deprecated(__FUNCTION__); |
|
571 | 571 | return array( |
572 | 572 | 'messenger' => $message->messenger_object(), |
573 | 573 | 'message_type' => $message->message_type_object(), |
@@ -595,41 +595,41 @@ discard block |
||
595 | 595 | $send = true |
596 | 596 | ) { |
597 | 597 | // EE_messages has been deprecated |
598 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
598 | + $this->_class_is_deprecated(__FUNCTION__); |
|
599 | 599 | /** @type EE_Messages_Processor $processor */ |
600 | - $processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
600 | + $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
601 | 601 | $error = false; |
602 | 602 | //try to intelligently determine what method we'll call based on the incoming data. |
603 | 603 | //if generating and sending are different then generate and send immediately. |
604 | - if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
|
604 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
605 | 605 | //in the legacy system, when generating and sending were different, that means all the |
606 | 606 | //vars are already in the request object. So let's just use that. |
607 | 607 | try { |
608 | 608 | /** @type EE_Message_To_Generate_From_Request $mtg */ |
609 | - $mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
610 | - $processor->generate_and_send_now( $mtg ); |
|
611 | - } catch ( EE_Error $e ) { |
|
609 | + $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
610 | + $processor->generate_and_send_now($mtg); |
|
611 | + } catch (EE_Error $e) { |
|
612 | 612 | $error_msg = __( |
613 | 613 | 'Please note that a system message failed to send due to a technical issue.', |
614 | 614 | 'event_espresso' |
615 | 615 | ); |
616 | 616 | // add specific message for developers if WP_DEBUG in on |
617 | - $error_msg .= '||' . $e->getMessage(); |
|
618 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
617 | + $error_msg .= '||'.$e->getMessage(); |
|
618 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
619 | 619 | $error = true; |
620 | 620 | } |
621 | 621 | } else { |
622 | - $processor->generate_for_all_active_messengers( $type, $vars, $send ); |
|
622 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
623 | 623 | //let's find out if there were any errors and how many successfully were queued. |
624 | 624 | $count_errors = $processor->get_queue()->count_STS_in_queue( |
625 | - array( EEM_Message::status_failed, EEM_Message::status_debug_only ) |
|
625 | + array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
626 | 626 | ); |
627 | - $count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
628 | - $count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
|
627 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
628 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
629 | 629 | $count_errors = $count_errors + $count_retry; |
630 | - if ( $count_errors > 0 ) { |
|
630 | + if ($count_errors > 0) { |
|
631 | 631 | $error = true; |
632 | - if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
|
632 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
633 | 633 | $message = sprintf( |
634 | 634 | __( |
635 | 635 | 'There were %d errors and %d messages successfully queued for generation and sending', |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $count_errors, |
639 | 639 | $count_queued |
640 | 640 | ); |
641 | - } elseif ( $count_errors > 1 && $count_queued === 1 ) { |
|
641 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
642 | 642 | $message = sprintf( |
643 | 643 | __( |
644 | 644 | 'There were %d errors and %d message successfully queued for generation.', |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | $count_errors, |
648 | 648 | $count_queued |
649 | 649 | ); |
650 | - } elseif ( $count_errors === 1 && $count_queued > 1 ) { |
|
650 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
651 | 651 | $message = sprintf( |
652 | 652 | __( |
653 | 653 | 'There was %d error and %d messages successfully queued for generation.', |
@@ -665,9 +665,9 @@ discard block |
||
665 | 665 | $count_errors |
666 | 666 | ); |
667 | 667 | } |
668 | - EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
|
668 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
669 | 669 | } else { |
670 | - if ( $count_queued === 1 ) { |
|
670 | + if ($count_queued === 1) { |
|
671 | 671 | $message = sprintf( |
672 | 672 | __( |
673 | 673 | '%d message successfully queued for generation.', |
@@ -684,18 +684,18 @@ discard block |
||
684 | 684 | $count_queued |
685 | 685 | ); |
686 | 686 | } |
687 | - EE_Error::add_success( $message ); |
|
687 | + EE_Error::add_success($message); |
|
688 | 688 | } |
689 | 689 | } |
690 | 690 | //if no error then return the generated message(s). |
691 | - if ( ! $error && ! $send ) { |
|
692 | - $generated_queue = $processor->generate_queue( false ); |
|
691 | + if ( ! $error && ! $send) { |
|
692 | + $generated_queue = $processor->generate_queue(false); |
|
693 | 693 | //get message and return. |
694 | 694 | $generated_queue->get_message_repository()->rewind(); |
695 | 695 | $messages = array(); |
696 | - while ( $generated_queue->get_message_repository()->valid() ) { |
|
696 | + while ($generated_queue->get_message_repository()->valid()) { |
|
697 | 697 | $message = $generated_queue->get_message_repository()->current(); |
698 | - if ( $message instanceof EE_Message ) { |
|
698 | + if ($message instanceof EE_Message) { |
|
699 | 699 | //set properties that might be expected by add-ons (backward compat) |
700 | 700 | $message->content = $message->content(); |
701 | 701 | $message->template_pack = $message->get_template_pack(); |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
721 | 721 | * @return string The body of the message. |
722 | 722 | */ |
723 | - public function preview_message( $type, $context, $messenger, $send = false ) { |
|
723 | + public function preview_message($type, $context, $messenger, $send = false) { |
|
724 | 724 | // EE_messages has been deprecated |
725 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
726 | - return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
|
725 | + $this->_class_is_deprecated(__FUNCTION__); |
|
726 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | |
@@ -737,14 +737,14 @@ discard block |
||
737 | 737 | * |
738 | 738 | * @return bool success or fail. |
739 | 739 | */ |
740 | - public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
|
740 | + public function send_message_with_messenger_only($messenger, $message_type, $message) { |
|
741 | 741 | // EE_messages has been deprecated |
742 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
742 | + $this->_class_is_deprecated(__FUNCTION__); |
|
743 | 743 | //setup for sending to new method. |
744 | 744 | /** @type EE_Messages_Queue $queue */ |
745 | - $queue = EE_Registry::instance()->load_lib( 'Messages_Queue' ); |
|
745 | + $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
746 | 746 | //make sure we have a proper message object |
747 | - if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
|
747 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
748 | 748 | $msg = EE_Message_Factory::create( |
749 | 749 | array( |
750 | 750 | 'MSG_messenger' => $messenger, |
@@ -756,15 +756,15 @@ discard block |
||
756 | 756 | } else { |
757 | 757 | $msg = $message; |
758 | 758 | } |
759 | - if ( ! $msg instanceof EE_Message ) { |
|
759 | + if ( ! $msg instanceof EE_Message) { |
|
760 | 760 | return false; |
761 | 761 | } |
762 | 762 | //make sure any content in a content property (if not empty) is set on the MSG_content. |
763 | - if ( ! empty( $msg->content ) ) { |
|
764 | - $msg->set( 'MSG_content', $msg->content ); |
|
763 | + if ( ! empty($msg->content)) { |
|
764 | + $msg->set('MSG_content', $msg->content); |
|
765 | 765 | } |
766 | - $queue->add( $msg ); |
|
767 | - return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
|
766 | + $queue->add($msg); |
|
767 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | |
@@ -778,11 +778,11 @@ discard block |
||
778 | 778 | * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
779 | 779 | * @throws \EE_Error |
780 | 780 | */ |
781 | - public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
|
781 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) { |
|
782 | 782 | // EE_messages has been deprecated |
783 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
784 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
785 | - return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
|
783 | + $this->_class_is_deprecated(__FUNCTION__); |
|
784 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
785 | + return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | |
@@ -793,11 +793,11 @@ discard block |
||
793 | 793 | * @param string $message_type_name name of EE_message_type |
794 | 794 | * @return array |
795 | 795 | */ |
796 | - public function get_fields( $messenger_name, $message_type_name ) { |
|
796 | + public function get_fields($messenger_name, $message_type_name) { |
|
797 | 797 | // EE_messages has been deprecated |
798 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
799 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
800 | - return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name ); |
|
798 | + $this->_class_is_deprecated(__FUNCTION__); |
|
799 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
800 | + return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | |
@@ -811,13 +811,13 @@ discard block |
||
811 | 811 | * @return array multidimensional array of messenger and message_type objects |
812 | 812 | * (messengers index, and message_type index); |
813 | 813 | */ |
814 | - public function get_installed( $type = 'all', $skip_cache = false ) { |
|
814 | + public function get_installed($type = 'all', $skip_cache = false) { |
|
815 | 815 | // EE_messages has been deprecated |
816 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
817 | - if ( $skip_cache ) { |
|
816 | + $this->_class_is_deprecated(__FUNCTION__); |
|
817 | + if ($skip_cache) { |
|
818 | 818 | $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
819 | 819 | } |
820 | - switch ( $type ) { |
|
820 | + switch ($type) { |
|
821 | 821 | case 'messengers' : |
822 | 822 | return array( |
823 | 823 | 'messenger' => $this->_message_resource_manager->installed_messengers(), |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | */ |
847 | 847 | public function get_active_messengers() { |
848 | 848 | // EE_messages has been deprecated |
849 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
849 | + $this->_class_is_deprecated(__FUNCTION__); |
|
850 | 850 | return $this->_message_resource_manager->active_messengers(); |
851 | 851 | } |
852 | 852 | |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | */ |
859 | 859 | public function get_active_message_types() { |
860 | 860 | // EE_messages has been deprecated |
861 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
861 | + $this->_class_is_deprecated(__FUNCTION__); |
|
862 | 862 | return $this->_message_resource_manager->list_of_active_message_types(); |
863 | 863 | } |
864 | 864 | |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | */ |
871 | 871 | public function get_active_message_type_objects() { |
872 | 872 | // EE_messages has been deprecated |
873 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
873 | + $this->_class_is_deprecated(__FUNCTION__); |
|
874 | 874 | return $this->_message_resource_manager->get_active_message_type_objects(); |
875 | 875 | } |
876 | 876 | |
@@ -882,10 +882,10 @@ discard block |
||
882 | 882 | * @param string $messenger The messenger being checked |
883 | 883 | * @return EE_message_type[] (or empty array if none present) |
884 | 884 | */ |
885 | - public function get_active_message_types_per_messenger( $messenger ) { |
|
885 | + public function get_active_message_types_per_messenger($messenger) { |
|
886 | 886 | // EE_messages has been deprecated |
887 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
888 | - return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
|
887 | + $this->_class_is_deprecated(__FUNCTION__); |
|
888 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | |
@@ -896,10 +896,10 @@ discard block |
||
896 | 896 | * @param string $message_type The string should correspond to a message type. |
897 | 897 | * @return EE_message_type|null |
898 | 898 | */ |
899 | - public function get_active_message_type( $messenger, $message_type ) { |
|
899 | + public function get_active_message_type($messenger, $message_type) { |
|
900 | 900 | // EE_messages has been deprecated |
901 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
902 | - return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
|
901 | + $this->_class_is_deprecated(__FUNCTION__); |
|
902 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | */ |
911 | 911 | public function get_installed_message_types() { |
912 | 912 | // EE_messages has been deprecated |
913 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
913 | + $this->_class_is_deprecated(__FUNCTION__); |
|
914 | 914 | return $this->_message_resource_manager->installed_message_types(); |
915 | 915 | } |
916 | 916 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | */ |
923 | 923 | public function get_installed_messengers() { |
924 | 924 | // EE_messages has been deprecated |
925 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
925 | + $this->_class_is_deprecated(__FUNCTION__); |
|
926 | 926 | return $this->_message_resource_manager->installed_messengers(); |
927 | 927 | } |
928 | 928 | |
@@ -933,10 +933,10 @@ discard block |
||
933 | 933 | * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
934 | 934 | * @return array |
935 | 935 | */ |
936 | - public function get_all_contexts( $slugs_only = true ) { |
|
936 | + public function get_all_contexts($slugs_only = true) { |
|
937 | 937 | // EE_messages has been deprecated |
938 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
939 | - return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
|
938 | + $this->_class_is_deprecated(__FUNCTION__); |
|
939 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | add_filter( |
996 | 996 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
997 | 997 | function($event_list_iframe_css) { |
998 | - if ( ! has_filter( 'FHEE__EventsArchiveIframe__event_list_iframe__css' )) { |
|
998 | + if ( ! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) { |
|
999 | 999 | return $event_list_iframe_css; |
1000 | 1000 | } |
1001 | 1001 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | add_filter( |
1016 | 1016 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
1017 | 1017 | function($event_list_iframe_js) { |
1018 | - if ( ! has_filter( 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js' )) { |
|
1018 | + if ( ! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) { |
|
1019 | 1019 | return $event_list_iframe_js; |
1020 | 1020 | } |
1021 | 1021 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -239,7 +239,7 @@ |
||
239 | 239 | * setTicketMinAndMax |
240 | 240 | * |
241 | 241 | * @param int $remaining |
242 | - * @return array |
|
242 | + * @return integer[] |
|
243 | 243 | */ |
244 | 244 | protected function setTicketMinAndMax($remaining) |
245 | 245 | { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | $ticket_selector_row_html = \EEH_HTML::tr( |
184 | 184 | '', '', |
185 | - "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
185 | + "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} ".espresso_get_object_css_class($this->ticket) |
|
186 | 186 | ); |
187 | 187 | /** |
188 | 188 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $status_class |
207 | 207 | ); |
208 | 208 | if ($new_row_cells_content !== false) { |
209 | - return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
209 | + return $ticket_selector_row_html.$new_row_cells_content.\EEH_HTML::trx(); |
|
210 | 210 | } |
211 | 211 | $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
212 | 212 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
375 | 375 | $html .= \EEH_Template::format_currency($ticket_price); |
376 | 376 | $html .= $this->ticket->taxable() |
377 | - ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
377 | + ? \EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
378 | 378 | : ''; |
379 | 379 | $html .= ' '; |
380 | 380 | $html .= \EEH_HTML::span( |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | // display submit button since we have tickets available |
409 | 409 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
410 | 410 | $this->hidden_input_qty = false; |
411 | - $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
412 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
413 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
411 | + $html = '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"'; |
|
412 | + $html .= ' id="ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row.'"'; |
|
413 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"'; |
|
414 | 414 | $html .= $this->row === 1 ? ' checked="checked"' : ''; |
415 | 415 | $html .= ' title=""/>'; |
416 | 416 | return $html; |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | // display submit button since we have tickets available |
431 | 431 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
432 | 432 | $this->hidden_input_qty = false; |
433 | - $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
434 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
433 | + $html = '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"'; |
|
434 | + $html .= ' id="ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row.'"'; |
|
435 | 435 | $html .= ' class="ticket-selector-tbl-qty-slct">'; |
436 | 436 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
437 | 437 | if ($min !== 0 && ! $this->ticket->required()) { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | // offer ticket quantities from the min to the max |
441 | 441 | for ($i = $min; $i <= $max; $i++) { |
442 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
442 | + $html .= '<option value="'.$i.'"> '.$i.' </option>'; |
|
443 | 443 | } |
444 | 444 | $html .= '</select>'; |
445 | 445 | return $html; |
@@ -457,10 +457,10 @@ discard block |
||
457 | 457 | $html = ''; |
458 | 458 | // depending on group reg we need to change the format for qty |
459 | 459 | if ($this->hidden_input_qty) { |
460 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
460 | + $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>'; |
|
461 | 461 | } |
462 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
463 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
462 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"'; |
|
463 | + $html .= ' value="'.$this->ticket->ID().'"/>'; |
|
464 | 464 | return $html; |
465 | 465 | } |
466 | 466 |
@@ -16,458 +16,458 @@ |
||
16 | 16 | class TicketSelectorRowStandard extends TicketSelectorRow |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var TicketDetails $ticket_details |
|
21 | - */ |
|
22 | - protected $ticket_details; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
26 | - */ |
|
27 | - protected $template_settings; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var \EE_Tax_Config $tax_settings |
|
31 | - */ |
|
32 | - protected $tax_settings; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var boolean $required_ticket_sold_out |
|
36 | - */ |
|
37 | - protected $required_ticket_sold_out; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var boolean $prices_displayed_including_taxes |
|
41 | - */ |
|
42 | - protected $prices_displayed_including_taxes; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string $event_status |
|
46 | - */ |
|
47 | - protected $event_status; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var int $row |
|
51 | - */ |
|
52 | - protected $row; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var int $cols |
|
56 | - */ |
|
57 | - protected $cols; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var boolean $hidden_input_qty |
|
61 | - */ |
|
62 | - protected $hidden_input_qty; |
|
63 | - |
|
64 | - /** |
|
65 | - * @var string $ticket_datetime_classes |
|
66 | - */ |
|
67 | - protected $ticket_datetime_classes; |
|
68 | - |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * TicketDetails constructor. |
|
73 | - * |
|
74 | - * @param \EE_Ticket $ticket |
|
75 | - * @param TicketDetails $ticket_details |
|
76 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
77 | - * @param \EE_Tax_Config $tax_settings |
|
78 | - * @param int $max_atndz |
|
79 | - * @param int $row |
|
80 | - * @param int $cols |
|
81 | - * @param boolean $required_ticket_sold_out |
|
82 | - * @param string $event_status |
|
83 | - * @param string $date_format |
|
84 | - * @param string $ticket_datetime_classes |
|
85 | - */ |
|
86 | - public function __construct( |
|
87 | - \EE_Ticket $ticket, |
|
88 | - TicketDetails $ticket_details, |
|
89 | - \EE_Ticket_Selector_Config $template_settings, |
|
90 | - \EE_Tax_Config $tax_settings, |
|
91 | - $max_atndz, |
|
92 | - $row, |
|
93 | - $cols, |
|
94 | - $required_ticket_sold_out, |
|
95 | - $event_status, |
|
96 | - $date_format, |
|
97 | - $ticket_datetime_classes |
|
98 | - ) { |
|
99 | - $this->ticket = $ticket; |
|
100 | - $this->ticket_details = $ticket_details; |
|
101 | - $this->template_settings = $template_settings; |
|
102 | - $this->tax_settings = $tax_settings; |
|
103 | - $this->max_atndz = $max_atndz; |
|
104 | - $this->row = $row; |
|
105 | - $this->cols = $cols; |
|
106 | - $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
107 | - $this->event_status = $event_status; |
|
108 | - $this->date_format = $date_format; |
|
109 | - $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
110 | - parent::__construct($ticket, $max_atndz, $date_format); |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * other ticket rows will need to know if a required ticket is sold out, |
|
117 | - * so that they are not offered for sale |
|
118 | - * |
|
119 | - * @return boolean |
|
120 | - */ |
|
121 | - public function getRequiredTicketSoldOut() |
|
122 | - { |
|
123 | - return $this->required_ticket_sold_out; |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * @return int |
|
130 | - */ |
|
131 | - public function getCols() |
|
132 | - { |
|
133 | - return $this->cols; |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * getHtml |
|
140 | - * |
|
141 | - * @return string |
|
142 | - * @throws \EE_Error |
|
143 | - */ |
|
144 | - public function getHtml() |
|
145 | - { |
|
146 | - $min = 0; |
|
147 | - $max = $this->ticket->max(); |
|
148 | - $remaining = $this->ticket->remaining(); |
|
149 | - if ($this->ticket->is_on_sale() && $this->ticket->is_remaining()) { |
|
150 | - list($min, $max) = $this->setTicketMinAndMax($remaining); |
|
151 | - } else { |
|
152 | - // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
153 | - $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
154 | - ? $this->ticket->start_date() |
|
155 | - : $this->required_ticket_sold_out; |
|
156 | - } |
|
157 | - list($ticket_price, $ticket_bundle) = $this->getTicketPriceDetails(); |
|
158 | - list($tkt_status, $ticket_status, $status_class) = $this->getTicketStatusClasses($remaining); |
|
159 | - /** |
|
160 | - * Allow plugins to hook in and abort the generation and display of this row to do |
|
161 | - * something else if they want. |
|
162 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
163 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
164 | - * current row. |
|
165 | - * |
|
166 | - * @var string|bool |
|
167 | - */ |
|
168 | - $ticket_selector_row_html = apply_filters( |
|
169 | - 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
170 | - false, |
|
171 | - $this->ticket, |
|
172 | - $max, |
|
173 | - $min, |
|
174 | - $this->required_ticket_sold_out, |
|
175 | - $ticket_price, |
|
176 | - $ticket_bundle, |
|
177 | - $ticket_status, |
|
178 | - $status_class |
|
179 | - ); |
|
180 | - if ($ticket_selector_row_html !== false) { |
|
181 | - return $ticket_selector_row_html; |
|
182 | - } |
|
183 | - $ticket_selector_row_html = \EEH_HTML::tr( |
|
184 | - '', '', |
|
185 | - "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
186 | - ); |
|
187 | - /** |
|
188 | - * Allow plugins to hook in and abort the generation and display of the contents of this |
|
189 | - * row to do something else if they want. |
|
190 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
191 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
192 | - * current row. |
|
193 | - * |
|
194 | - * @var string|bool |
|
195 | - */ |
|
196 | - $new_row_cells_content = apply_filters( |
|
197 | - 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
198 | - false, |
|
199 | - $this->ticket, |
|
200 | - $max, |
|
201 | - $min, |
|
202 | - $this->required_ticket_sold_out, |
|
203 | - $ticket_price, |
|
204 | - $ticket_bundle, |
|
205 | - $ticket_status, |
|
206 | - $status_class |
|
207 | - ); |
|
208 | - if ($new_row_cells_content !== false) { |
|
209 | - return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
210 | - } |
|
211 | - $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
|
212 | - |
|
213 | - $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
214 | - $ticket_selector_row_html .= $this->ticketPriceTableCell($ticket_price, $ticket_bundle); |
|
215 | - $ticket_selector_row_html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-qty cntr'); |
|
216 | - $this->setTicketStatusDisplay($tkt_status, $ticket_status, $remaining); |
|
217 | - if (empty($this->ticket_status_display)) { |
|
218 | - if ($this->max_atndz === 1) { |
|
219 | - // only ONE attendee is allowed to register at a time |
|
220 | - $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
221 | - } else if ($max > 0) { |
|
222 | - $ticket_selector_row_html .= $this->ticketQuantitySelector($min, $max); |
|
223 | - } |
|
224 | - } |
|
225 | - $ticket_selector_row_html .= $this->ticket_status_display; |
|
226 | - $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
227 | - $ticket_selector_row_html .= $this->ticket_details->display($ticket_price, $remaining, $this->cols); |
|
228 | - $ticket_selector_row_html .= \EEH_HTML::tdx(); |
|
229 | - $ticket_selector_row_html .= \EEH_HTML::trx(); |
|
230 | - |
|
231 | - |
|
232 | - $this->row++; |
|
233 | - return $ticket_selector_row_html; |
|
234 | - } |
|
235 | - |
|
236 | - |
|
237 | - |
|
238 | - /** |
|
239 | - * setTicketMinAndMax |
|
240 | - * |
|
241 | - * @param int $remaining |
|
242 | - * @return array |
|
243 | - */ |
|
244 | - protected function setTicketMinAndMax($remaining) |
|
245 | - { |
|
246 | - // offer the number of $tickets_remaining or $this->max_atndz, whichever is smaller |
|
247 | - $max = min($remaining, $this->max_atndz); |
|
248 | - // but... we also want to restrict the number of tickets by the ticket max setting, |
|
249 | - // however, the max still can't be higher than what was just set above |
|
250 | - $max = $this->ticket->max() > 0 ? min($this->ticket->max(), $max) : $max; |
|
251 | - // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
252 | - $min = $this->ticket->min() > 0 ? $this->ticket->min() : 0; |
|
253 | - // and if the ticket is required, then make sure that min qty is at least 1 |
|
254 | - $min = $this->ticket->required() ? max($min, 1) : $min; |
|
255 | - return array($min, $max); |
|
256 | - } |
|
257 | - |
|
258 | - |
|
259 | - /** |
|
260 | - * getTicketPriceDetails |
|
261 | - * |
|
262 | - * @return array |
|
263 | - */ |
|
264 | - protected function getTicketPriceDetails() |
|
265 | - { |
|
266 | - $ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
267 | - ? $this->ticket->get_ticket_total_with_taxes() |
|
268 | - : $this->ticket->get_ticket_subtotal(); |
|
269 | - $ticket_bundle = false; |
|
270 | - $ticket_min = $this->ticket->min(); |
|
271 | - // for ticket bundles, set min and max qty the same |
|
272 | - if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
273 | - $ticket_price *= $ticket_min; |
|
274 | - $ticket_bundle = true; |
|
275 | - } |
|
276 | - $ticket_price = apply_filters( |
|
277 | - 'FHEE__ticket_selector_chart_template__ticket_price', |
|
278 | - $ticket_price, |
|
279 | - $this->ticket |
|
280 | - ); |
|
281 | - return array($ticket_price, $ticket_bundle); |
|
282 | - } |
|
283 | - |
|
284 | - |
|
285 | - |
|
286 | - /** |
|
287 | - * getTicketStatusClasses |
|
288 | - * |
|
289 | - * @param int $remaining |
|
290 | - * @return array |
|
291 | - * @throws \EE_Error |
|
292 | - */ |
|
293 | - protected function getTicketStatusClasses($remaining = 0) |
|
294 | - { |
|
295 | - // if a previous required ticket with the same sale start date is sold out, |
|
296 | - // then mark this ticket as sold out as well. |
|
297 | - // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
298 | - $tkt_status = $this->required_ticket_sold_out !== false |
|
299 | - && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
300 | - ? \EE_Ticket::sold_out |
|
301 | - : $this->ticket->ticket_status(); |
|
302 | - $tkt_status = $this->event_status === \EE_Datetime::sold_out |
|
303 | - ? \EE_Ticket::sold_out |
|
304 | - : $tkt_status; |
|
305 | - // check ticket status |
|
306 | - switch ($tkt_status) { |
|
307 | - // sold_out |
|
308 | - case \EE_Ticket::sold_out : |
|
309 | - $ticket_status = 'ticket-sales-sold-out'; |
|
310 | - $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
311 | - break; |
|
312 | - // expired |
|
313 | - case \EE_Ticket::expired : |
|
314 | - $ticket_status = 'ticket-sales-expired'; |
|
315 | - $status_class = 'ticket-sales-expired lt-grey-text'; |
|
316 | - break; |
|
317 | - // archived |
|
318 | - case \EE_Ticket::archived : |
|
319 | - $ticket_status = 'archived-ticket'; |
|
320 | - $status_class = 'archived-ticket hidden'; |
|
321 | - break; |
|
322 | - // pending |
|
323 | - case \EE_Ticket::pending : |
|
324 | - $ticket_status = 'ticket-pending'; |
|
325 | - $status_class = 'ticket-pending'; |
|
326 | - break; |
|
327 | - // onsale |
|
328 | - case \EE_Ticket::onsale : |
|
329 | - default : |
|
330 | - $ticket_status = 'ticket-on-sale'; |
|
331 | - $status_class = 'ticket-on-sale'; |
|
332 | - break; |
|
333 | - } |
|
334 | - $ticket_status = \EEH_HTML::span($this->ticket->ticket_status(true, ($remaining > 0)), '', $ticket_status); |
|
335 | - return array($tkt_status, $ticket_status, $status_class); |
|
336 | - } |
|
337 | - |
|
338 | - |
|
339 | - |
|
340 | - /** |
|
341 | - * ticketNameTableCell |
|
342 | - * |
|
343 | - * @return string |
|
344 | - * @throws \EE_Error |
|
345 | - */ |
|
346 | - protected function ticketNameTableCell() |
|
347 | - { |
|
348 | - $html = \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-name'); |
|
349 | - $html .= \EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
350 | - $html .= $this->ticket_details->getShowHideLinks(); |
|
351 | - if ($this->ticket->required()) { |
|
352 | - $html .= \EEH_HTML::p( |
|
353 | - apply_filters( |
|
354 | - 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
355 | - esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
356 | - ), |
|
357 | - '', 'ticket-required-pg' |
|
358 | - ); |
|
359 | - } |
|
360 | - $html .= \EEH_HTML::tdx(); |
|
361 | - return $html; |
|
362 | - } |
|
363 | - |
|
364 | - |
|
365 | - |
|
366 | - /** |
|
367 | - * ticketPriceTableCell |
|
368 | - * |
|
369 | - * @param float $ticket_price |
|
370 | - * @param bool $ticket_bundle |
|
371 | - * @return string |
|
372 | - * @throws \EE_Error |
|
373 | - */ |
|
374 | - protected function ticketPriceTableCell($ticket_price, $ticket_bundle) |
|
375 | - { |
|
376 | - $html = ''; |
|
377 | - if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
378 | - $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
|
379 | - $html .= \EEH_Template::format_currency($ticket_price); |
|
380 | - $html .= $this->ticket->taxable() |
|
381 | - ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
382 | - : ''; |
|
383 | - $html .= ' '; |
|
384 | - $html .= \EEH_HTML::span( |
|
385 | - $ticket_bundle |
|
386 | - ? apply_filters( |
|
387 | - 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
388 | - __(' / bundle', 'event_espresso') |
|
389 | - ) |
|
390 | - : apply_filters( |
|
391 | - 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
392 | - __('', 'event_espresso') |
|
393 | - ), |
|
394 | - '', 'smaller-text no-bold' |
|
395 | - ); |
|
396 | - $html .= ' '; |
|
397 | - $html .= \EEH_HTML::tdx(); |
|
398 | - $this->cols++; |
|
399 | - } |
|
400 | - return $html; |
|
401 | - } |
|
402 | - |
|
403 | - |
|
404 | - |
|
405 | - /** |
|
406 | - * onlyOneAttendeeCanRegister |
|
407 | - * |
|
408 | - * @return string |
|
409 | - */ |
|
410 | - protected function onlyOneAttendeeCanRegister() |
|
411 | - { |
|
412 | - // display submit button since we have tickets available |
|
413 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
414 | - $this->hidden_input_qty = false; |
|
415 | - $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
416 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
417 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
418 | - $html .= $this->row === 1 ? ' checked="checked"' : ''; |
|
419 | - $html .= ' title=""/>'; |
|
420 | - return $html; |
|
421 | - } |
|
422 | - |
|
423 | - |
|
424 | - |
|
425 | - /** |
|
426 | - * ticketQuantitySelector |
|
427 | - * |
|
428 | - * @param int $min |
|
429 | - * @param int $max |
|
430 | - * @return string |
|
431 | - */ |
|
432 | - protected function ticketQuantitySelector($min = 0, $max = 0) |
|
433 | - { |
|
434 | - // display submit button since we have tickets available |
|
435 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
436 | - $this->hidden_input_qty = false; |
|
437 | - $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
438 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
439 | - $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
440 | - // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
441 | - if ($min !== 0 && ! $this->ticket->required()) { |
|
442 | - $html .= '<option value="0"> 0 </option>'; |
|
443 | - } |
|
444 | - // offer ticket quantities from the min to the max |
|
445 | - for ($i = $min; $i <= $max; $i++) { |
|
446 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
447 | - } |
|
448 | - $html .= '</select>'; |
|
449 | - return $html; |
|
450 | - } |
|
451 | - |
|
452 | - |
|
453 | - |
|
454 | - /** |
|
455 | - * getHiddenInputs |
|
456 | - * |
|
457 | - * @return string |
|
458 | - * @throws \EE_Error |
|
459 | - */ |
|
460 | - protected function ticketQtyAndIdHiddenInputs() |
|
461 | - { |
|
462 | - $html = ''; |
|
463 | - // depending on group reg we need to change the format for qty |
|
464 | - if ($this->hidden_input_qty) { |
|
465 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
466 | - } |
|
467 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
468 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
469 | - return $html; |
|
470 | - } |
|
19 | + /** |
|
20 | + * @var TicketDetails $ticket_details |
|
21 | + */ |
|
22 | + protected $ticket_details; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
26 | + */ |
|
27 | + protected $template_settings; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var \EE_Tax_Config $tax_settings |
|
31 | + */ |
|
32 | + protected $tax_settings; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var boolean $required_ticket_sold_out |
|
36 | + */ |
|
37 | + protected $required_ticket_sold_out; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var boolean $prices_displayed_including_taxes |
|
41 | + */ |
|
42 | + protected $prices_displayed_including_taxes; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string $event_status |
|
46 | + */ |
|
47 | + protected $event_status; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var int $row |
|
51 | + */ |
|
52 | + protected $row; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var int $cols |
|
56 | + */ |
|
57 | + protected $cols; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var boolean $hidden_input_qty |
|
61 | + */ |
|
62 | + protected $hidden_input_qty; |
|
63 | + |
|
64 | + /** |
|
65 | + * @var string $ticket_datetime_classes |
|
66 | + */ |
|
67 | + protected $ticket_datetime_classes; |
|
68 | + |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * TicketDetails constructor. |
|
73 | + * |
|
74 | + * @param \EE_Ticket $ticket |
|
75 | + * @param TicketDetails $ticket_details |
|
76 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
77 | + * @param \EE_Tax_Config $tax_settings |
|
78 | + * @param int $max_atndz |
|
79 | + * @param int $row |
|
80 | + * @param int $cols |
|
81 | + * @param boolean $required_ticket_sold_out |
|
82 | + * @param string $event_status |
|
83 | + * @param string $date_format |
|
84 | + * @param string $ticket_datetime_classes |
|
85 | + */ |
|
86 | + public function __construct( |
|
87 | + \EE_Ticket $ticket, |
|
88 | + TicketDetails $ticket_details, |
|
89 | + \EE_Ticket_Selector_Config $template_settings, |
|
90 | + \EE_Tax_Config $tax_settings, |
|
91 | + $max_atndz, |
|
92 | + $row, |
|
93 | + $cols, |
|
94 | + $required_ticket_sold_out, |
|
95 | + $event_status, |
|
96 | + $date_format, |
|
97 | + $ticket_datetime_classes |
|
98 | + ) { |
|
99 | + $this->ticket = $ticket; |
|
100 | + $this->ticket_details = $ticket_details; |
|
101 | + $this->template_settings = $template_settings; |
|
102 | + $this->tax_settings = $tax_settings; |
|
103 | + $this->max_atndz = $max_atndz; |
|
104 | + $this->row = $row; |
|
105 | + $this->cols = $cols; |
|
106 | + $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
107 | + $this->event_status = $event_status; |
|
108 | + $this->date_format = $date_format; |
|
109 | + $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
110 | + parent::__construct($ticket, $max_atndz, $date_format); |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * other ticket rows will need to know if a required ticket is sold out, |
|
117 | + * so that they are not offered for sale |
|
118 | + * |
|
119 | + * @return boolean |
|
120 | + */ |
|
121 | + public function getRequiredTicketSoldOut() |
|
122 | + { |
|
123 | + return $this->required_ticket_sold_out; |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * @return int |
|
130 | + */ |
|
131 | + public function getCols() |
|
132 | + { |
|
133 | + return $this->cols; |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * getHtml |
|
140 | + * |
|
141 | + * @return string |
|
142 | + * @throws \EE_Error |
|
143 | + */ |
|
144 | + public function getHtml() |
|
145 | + { |
|
146 | + $min = 0; |
|
147 | + $max = $this->ticket->max(); |
|
148 | + $remaining = $this->ticket->remaining(); |
|
149 | + if ($this->ticket->is_on_sale() && $this->ticket->is_remaining()) { |
|
150 | + list($min, $max) = $this->setTicketMinAndMax($remaining); |
|
151 | + } else { |
|
152 | + // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
153 | + $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
154 | + ? $this->ticket->start_date() |
|
155 | + : $this->required_ticket_sold_out; |
|
156 | + } |
|
157 | + list($ticket_price, $ticket_bundle) = $this->getTicketPriceDetails(); |
|
158 | + list($tkt_status, $ticket_status, $status_class) = $this->getTicketStatusClasses($remaining); |
|
159 | + /** |
|
160 | + * Allow plugins to hook in and abort the generation and display of this row to do |
|
161 | + * something else if they want. |
|
162 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
163 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
164 | + * current row. |
|
165 | + * |
|
166 | + * @var string|bool |
|
167 | + */ |
|
168 | + $ticket_selector_row_html = apply_filters( |
|
169 | + 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
170 | + false, |
|
171 | + $this->ticket, |
|
172 | + $max, |
|
173 | + $min, |
|
174 | + $this->required_ticket_sold_out, |
|
175 | + $ticket_price, |
|
176 | + $ticket_bundle, |
|
177 | + $ticket_status, |
|
178 | + $status_class |
|
179 | + ); |
|
180 | + if ($ticket_selector_row_html !== false) { |
|
181 | + return $ticket_selector_row_html; |
|
182 | + } |
|
183 | + $ticket_selector_row_html = \EEH_HTML::tr( |
|
184 | + '', '', |
|
185 | + "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
186 | + ); |
|
187 | + /** |
|
188 | + * Allow plugins to hook in and abort the generation and display of the contents of this |
|
189 | + * row to do something else if they want. |
|
190 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
191 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
192 | + * current row. |
|
193 | + * |
|
194 | + * @var string|bool |
|
195 | + */ |
|
196 | + $new_row_cells_content = apply_filters( |
|
197 | + 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
198 | + false, |
|
199 | + $this->ticket, |
|
200 | + $max, |
|
201 | + $min, |
|
202 | + $this->required_ticket_sold_out, |
|
203 | + $ticket_price, |
|
204 | + $ticket_bundle, |
|
205 | + $ticket_status, |
|
206 | + $status_class |
|
207 | + ); |
|
208 | + if ($new_row_cells_content !== false) { |
|
209 | + return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
210 | + } |
|
211 | + $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
|
212 | + |
|
213 | + $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
214 | + $ticket_selector_row_html .= $this->ticketPriceTableCell($ticket_price, $ticket_bundle); |
|
215 | + $ticket_selector_row_html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-qty cntr'); |
|
216 | + $this->setTicketStatusDisplay($tkt_status, $ticket_status, $remaining); |
|
217 | + if (empty($this->ticket_status_display)) { |
|
218 | + if ($this->max_atndz === 1) { |
|
219 | + // only ONE attendee is allowed to register at a time |
|
220 | + $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
221 | + } else if ($max > 0) { |
|
222 | + $ticket_selector_row_html .= $this->ticketQuantitySelector($min, $max); |
|
223 | + } |
|
224 | + } |
|
225 | + $ticket_selector_row_html .= $this->ticket_status_display; |
|
226 | + $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
227 | + $ticket_selector_row_html .= $this->ticket_details->display($ticket_price, $remaining, $this->cols); |
|
228 | + $ticket_selector_row_html .= \EEH_HTML::tdx(); |
|
229 | + $ticket_selector_row_html .= \EEH_HTML::trx(); |
|
230 | + |
|
231 | + |
|
232 | + $this->row++; |
|
233 | + return $ticket_selector_row_html; |
|
234 | + } |
|
235 | + |
|
236 | + |
|
237 | + |
|
238 | + /** |
|
239 | + * setTicketMinAndMax |
|
240 | + * |
|
241 | + * @param int $remaining |
|
242 | + * @return array |
|
243 | + */ |
|
244 | + protected function setTicketMinAndMax($remaining) |
|
245 | + { |
|
246 | + // offer the number of $tickets_remaining or $this->max_atndz, whichever is smaller |
|
247 | + $max = min($remaining, $this->max_atndz); |
|
248 | + // but... we also want to restrict the number of tickets by the ticket max setting, |
|
249 | + // however, the max still can't be higher than what was just set above |
|
250 | + $max = $this->ticket->max() > 0 ? min($this->ticket->max(), $max) : $max; |
|
251 | + // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
252 | + $min = $this->ticket->min() > 0 ? $this->ticket->min() : 0; |
|
253 | + // and if the ticket is required, then make sure that min qty is at least 1 |
|
254 | + $min = $this->ticket->required() ? max($min, 1) : $min; |
|
255 | + return array($min, $max); |
|
256 | + } |
|
257 | + |
|
258 | + |
|
259 | + /** |
|
260 | + * getTicketPriceDetails |
|
261 | + * |
|
262 | + * @return array |
|
263 | + */ |
|
264 | + protected function getTicketPriceDetails() |
|
265 | + { |
|
266 | + $ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
267 | + ? $this->ticket->get_ticket_total_with_taxes() |
|
268 | + : $this->ticket->get_ticket_subtotal(); |
|
269 | + $ticket_bundle = false; |
|
270 | + $ticket_min = $this->ticket->min(); |
|
271 | + // for ticket bundles, set min and max qty the same |
|
272 | + if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
273 | + $ticket_price *= $ticket_min; |
|
274 | + $ticket_bundle = true; |
|
275 | + } |
|
276 | + $ticket_price = apply_filters( |
|
277 | + 'FHEE__ticket_selector_chart_template__ticket_price', |
|
278 | + $ticket_price, |
|
279 | + $this->ticket |
|
280 | + ); |
|
281 | + return array($ticket_price, $ticket_bundle); |
|
282 | + } |
|
283 | + |
|
284 | + |
|
285 | + |
|
286 | + /** |
|
287 | + * getTicketStatusClasses |
|
288 | + * |
|
289 | + * @param int $remaining |
|
290 | + * @return array |
|
291 | + * @throws \EE_Error |
|
292 | + */ |
|
293 | + protected function getTicketStatusClasses($remaining = 0) |
|
294 | + { |
|
295 | + // if a previous required ticket with the same sale start date is sold out, |
|
296 | + // then mark this ticket as sold out as well. |
|
297 | + // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
298 | + $tkt_status = $this->required_ticket_sold_out !== false |
|
299 | + && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
300 | + ? \EE_Ticket::sold_out |
|
301 | + : $this->ticket->ticket_status(); |
|
302 | + $tkt_status = $this->event_status === \EE_Datetime::sold_out |
|
303 | + ? \EE_Ticket::sold_out |
|
304 | + : $tkt_status; |
|
305 | + // check ticket status |
|
306 | + switch ($tkt_status) { |
|
307 | + // sold_out |
|
308 | + case \EE_Ticket::sold_out : |
|
309 | + $ticket_status = 'ticket-sales-sold-out'; |
|
310 | + $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
311 | + break; |
|
312 | + // expired |
|
313 | + case \EE_Ticket::expired : |
|
314 | + $ticket_status = 'ticket-sales-expired'; |
|
315 | + $status_class = 'ticket-sales-expired lt-grey-text'; |
|
316 | + break; |
|
317 | + // archived |
|
318 | + case \EE_Ticket::archived : |
|
319 | + $ticket_status = 'archived-ticket'; |
|
320 | + $status_class = 'archived-ticket hidden'; |
|
321 | + break; |
|
322 | + // pending |
|
323 | + case \EE_Ticket::pending : |
|
324 | + $ticket_status = 'ticket-pending'; |
|
325 | + $status_class = 'ticket-pending'; |
|
326 | + break; |
|
327 | + // onsale |
|
328 | + case \EE_Ticket::onsale : |
|
329 | + default : |
|
330 | + $ticket_status = 'ticket-on-sale'; |
|
331 | + $status_class = 'ticket-on-sale'; |
|
332 | + break; |
|
333 | + } |
|
334 | + $ticket_status = \EEH_HTML::span($this->ticket->ticket_status(true, ($remaining > 0)), '', $ticket_status); |
|
335 | + return array($tkt_status, $ticket_status, $status_class); |
|
336 | + } |
|
337 | + |
|
338 | + |
|
339 | + |
|
340 | + /** |
|
341 | + * ticketNameTableCell |
|
342 | + * |
|
343 | + * @return string |
|
344 | + * @throws \EE_Error |
|
345 | + */ |
|
346 | + protected function ticketNameTableCell() |
|
347 | + { |
|
348 | + $html = \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-name'); |
|
349 | + $html .= \EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
350 | + $html .= $this->ticket_details->getShowHideLinks(); |
|
351 | + if ($this->ticket->required()) { |
|
352 | + $html .= \EEH_HTML::p( |
|
353 | + apply_filters( |
|
354 | + 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
355 | + esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
356 | + ), |
|
357 | + '', 'ticket-required-pg' |
|
358 | + ); |
|
359 | + } |
|
360 | + $html .= \EEH_HTML::tdx(); |
|
361 | + return $html; |
|
362 | + } |
|
363 | + |
|
364 | + |
|
365 | + |
|
366 | + /** |
|
367 | + * ticketPriceTableCell |
|
368 | + * |
|
369 | + * @param float $ticket_price |
|
370 | + * @param bool $ticket_bundle |
|
371 | + * @return string |
|
372 | + * @throws \EE_Error |
|
373 | + */ |
|
374 | + protected function ticketPriceTableCell($ticket_price, $ticket_bundle) |
|
375 | + { |
|
376 | + $html = ''; |
|
377 | + if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
378 | + $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
|
379 | + $html .= \EEH_Template::format_currency($ticket_price); |
|
380 | + $html .= $this->ticket->taxable() |
|
381 | + ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
382 | + : ''; |
|
383 | + $html .= ' '; |
|
384 | + $html .= \EEH_HTML::span( |
|
385 | + $ticket_bundle |
|
386 | + ? apply_filters( |
|
387 | + 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
388 | + __(' / bundle', 'event_espresso') |
|
389 | + ) |
|
390 | + : apply_filters( |
|
391 | + 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
392 | + __('', 'event_espresso') |
|
393 | + ), |
|
394 | + '', 'smaller-text no-bold' |
|
395 | + ); |
|
396 | + $html .= ' '; |
|
397 | + $html .= \EEH_HTML::tdx(); |
|
398 | + $this->cols++; |
|
399 | + } |
|
400 | + return $html; |
|
401 | + } |
|
402 | + |
|
403 | + |
|
404 | + |
|
405 | + /** |
|
406 | + * onlyOneAttendeeCanRegister |
|
407 | + * |
|
408 | + * @return string |
|
409 | + */ |
|
410 | + protected function onlyOneAttendeeCanRegister() |
|
411 | + { |
|
412 | + // display submit button since we have tickets available |
|
413 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
414 | + $this->hidden_input_qty = false; |
|
415 | + $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
416 | + $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
417 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
418 | + $html .= $this->row === 1 ? ' checked="checked"' : ''; |
|
419 | + $html .= ' title=""/>'; |
|
420 | + return $html; |
|
421 | + } |
|
422 | + |
|
423 | + |
|
424 | + |
|
425 | + /** |
|
426 | + * ticketQuantitySelector |
|
427 | + * |
|
428 | + * @param int $min |
|
429 | + * @param int $max |
|
430 | + * @return string |
|
431 | + */ |
|
432 | + protected function ticketQuantitySelector($min = 0, $max = 0) |
|
433 | + { |
|
434 | + // display submit button since we have tickets available |
|
435 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
436 | + $this->hidden_input_qty = false; |
|
437 | + $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
438 | + $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
439 | + $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
440 | + // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
441 | + if ($min !== 0 && ! $this->ticket->required()) { |
|
442 | + $html .= '<option value="0"> 0 </option>'; |
|
443 | + } |
|
444 | + // offer ticket quantities from the min to the max |
|
445 | + for ($i = $min; $i <= $max; $i++) { |
|
446 | + $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
447 | + } |
|
448 | + $html .= '</select>'; |
|
449 | + return $html; |
|
450 | + } |
|
451 | + |
|
452 | + |
|
453 | + |
|
454 | + /** |
|
455 | + * getHiddenInputs |
|
456 | + * |
|
457 | + * @return string |
|
458 | + * @throws \EE_Error |
|
459 | + */ |
|
460 | + protected function ticketQtyAndIdHiddenInputs() |
|
461 | + { |
|
462 | + $html = ''; |
|
463 | + // depending on group reg we need to change the format for qty |
|
464 | + if ($this->hidden_input_qty) { |
|
465 | + $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
466 | + } |
|
467 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
468 | + $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
469 | + return $html; |
|
470 | + } |
|
471 | 471 | |
472 | 472 | } |
473 | 473 | // End of file TicketSelectorRowStandard.php |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | 43 | // check if class object is instantiated, and instantiated properly |
44 | - if ( ! self::$_instance instanceof EEH_HTML ) { |
|
44 | + if ( ! self::$_instance instanceof EEH_HTML) { |
|
45 | 45 | self::$_instance = new EEH_HTML(); |
46 | 46 | } |
47 | 47 | return self::$_instance; |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | $other_attributes = '', |
103 | 103 | $force_close = false |
104 | 104 | ) { |
105 | - $attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
106 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
107 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
108 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
109 | - $html = EEH_HTML::nl( 0, $tag ) . '<' . $tag . $attributes . '>'; |
|
110 | - $html .= ! empty( $content ) ? EEH_HTML::nl( 1, $tag ) . $content : ''; |
|
111 | - $indent = ! empty( $content ) || $force_close ? TRUE : FALSE; |
|
112 | - $html .= ! empty( $content ) || $force_close ? EEH_HTML::_close_tag( $tag, $id, $class, $indent ) : ''; |
|
105 | + $attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
106 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
107 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
108 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
109 | + $html = EEH_HTML::nl(0, $tag).'<'.$tag.$attributes.'>'; |
|
110 | + $html .= ! empty($content) ? EEH_HTML::nl(1, $tag).$content : ''; |
|
111 | + $indent = ! empty($content) || $force_close ? TRUE : FALSE; |
|
112 | + $html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : ''; |
|
113 | 113 | return $html; |
114 | 114 | } |
115 | 115 | |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | * @param bool $indent |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - protected static function _close_tag( $tag = 'div', $id = '', $class = '', $indent = TRUE ) { |
|
129 | + protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = TRUE) { |
|
130 | 130 | $comment = ''; |
131 | - if ( $id ) { |
|
132 | - $comment = EEH_HTML::comment( 'close ' . $id ) . EEH_HTML::nl( 0, $tag ); |
|
133 | - } else if ( $class ) { |
|
134 | - $comment = EEH_HTML::comment( 'close ' . $class ) . EEH_HTML::nl( 0, $tag ); |
|
131 | + if ($id) { |
|
132 | + $comment = EEH_HTML::comment('close '.$id).EEH_HTML::nl(0, $tag); |
|
133 | + } else if ($class) { |
|
134 | + $comment = EEH_HTML::comment('close '.$class).EEH_HTML::nl(0, $tag); |
|
135 | 135 | } |
136 | 136 | $html = $indent ? EEH_HTML::nl( -1, $tag ) : ''; |
137 | - $html .= '</' . $tag . '>' . $comment; |
|
137 | + $html .= '</'.$tag.'>'.$comment; |
|
138 | 138 | return $html; |
139 | 139 | } |
140 | 140 | |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
154 | 154 | * @return string |
155 | 155 | */ |
156 | - public static function div( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
157 | - return EEH_HTML::_open_tag( 'div', $content, $id, $class, $style, $other_attributes ); |
|
156 | + public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
157 | + return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param string $class - html class attribute |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public static function divx( $id = '', $class = '' ) { |
|
171 | - return EEH_HTML::_close_tag( 'div', $id, $class ); |
|
170 | + public static function divx($id = '', $class = '') { |
|
171 | + return EEH_HTML::_close_tag('div', $id, $class); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
185 | 185 | * @return string |
186 | 186 | */ |
187 | - public static function h1( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
188 | - return EEH_HTML::_open_tag( 'h1', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
187 | + public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
188 | + return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, TRUE); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public static function h2( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
205 | - return EEH_HTML::_open_tag( 'h2', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
204 | + public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
205 | + return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, TRUE); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
219 | 219 | * @return string |
220 | 220 | */ |
221 | - public static function h3( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
222 | - return EEH_HTML::_open_tag( 'h3', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
221 | + public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
222 | + return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, TRUE); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - public static function h4( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
239 | - return EEH_HTML::_open_tag( 'h4', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
238 | + public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
239 | + return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, TRUE); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
253 | 253 | * @return string |
254 | 254 | */ |
255 | - public static function h5( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
256 | - return EEH_HTML::_open_tag( 'h5', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
255 | + public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
256 | + return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, TRUE); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
270 | 270 | * @return string |
271 | 271 | */ |
272 | - public static function h6( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
273 | - return EEH_HTML::_open_tag( 'h6', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
272 | + public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
273 | + return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, TRUE); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
287 | 287 | * @return string |
288 | 288 | */ |
289 | - public static function p( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
290 | - return EEH_HTML::_open_tag( 'p', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
289 | + public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
290 | + return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, TRUE); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
303 | 303 | * @return string |
304 | 304 | */ |
305 | - public static function ul( $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
306 | - return EEH_HTML::_open_tag( 'ul', '', $id, $class, $style, $other_attributes ); |
|
305 | + public static function ul($id = '', $class = '', $style = '', $other_attributes = '') { |
|
306 | + return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | |
@@ -316,8 +316,8 @@ discard block |
||
316 | 316 | * @param string $class - html class attribute |
317 | 317 | * @return string |
318 | 318 | */ |
319 | - public static function ulx( $id = '', $class = '' ) { |
|
320 | - return EEH_HTML::_close_tag( 'ul', $id, $class ); |
|
319 | + public static function ulx($id = '', $class = '') { |
|
320 | + return EEH_HTML::_close_tag('ul', $id, $class); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
335 | 335 | * @return string |
336 | 336 | */ |
337 | - public static function li( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
338 | - return EEH_HTML::_open_tag( 'li', $content, $id, $class, $style, $other_attributes ); |
|
337 | + public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
338 | + return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | * @param string $class - html class attribute |
349 | 349 | * @return string |
350 | 350 | */ |
351 | - public static function lix( $id = '', $class = '' ) { |
|
352 | - return EEH_HTML::_close_tag( 'li', $id, $class ); |
|
351 | + public static function lix($id = '', $class = '') { |
|
352 | + return EEH_HTML::_close_tag('li', $id, $class); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public static function table( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
369 | - return EEH_HTML::_open_tag( 'table', $content, $id, $class, $style, $other_attributes ); |
|
368 | + public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
369 | + return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -378,8 +378,8 @@ discard block |
||
378 | 378 | * @param string $class - html class attribute |
379 | 379 | * @return string |
380 | 380 | */ |
381 | - public static function tablex( $id = '', $class = '' ) { |
|
382 | - return EEH_HTML::_close_tag( 'table', $id, $class ); |
|
381 | + public static function tablex($id = '', $class = '') { |
|
382 | + return EEH_HTML::_close_tag('table', $id, $class); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | |
@@ -395,8 +395,8 @@ discard block |
||
395 | 395 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
396 | 396 | * @return string |
397 | 397 | */ |
398 | - public static function thead( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
399 | - return EEH_HTML::_open_tag( 'thead', $content, $id, $class, $style, $other_attributes ); |
|
398 | + public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
399 | + return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | * @param string $class - html class attribute |
409 | 409 | * @return string |
410 | 410 | */ |
411 | - public static function theadx( $id = '', $class = '' ) { |
|
412 | - return EEH_HTML::_close_tag( 'thead', $id, $class ); |
|
411 | + public static function theadx($id = '', $class = '') { |
|
412 | + return EEH_HTML::_close_tag('thead', $id, $class); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
426 | 426 | * @return string |
427 | 427 | */ |
428 | - public static function tbody( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
429 | - return EEH_HTML::_open_tag( 'tbody', $content, $id, $class, $style, $other_attributes ); |
|
428 | + public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
429 | + return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | * @param string $class - html class attribute |
439 | 439 | * @return string |
440 | 440 | */ |
441 | - public static function tbodyx( $id = '', $class = '' ) { |
|
442 | - return EEH_HTML::_close_tag( 'tbody', $id, $class ); |
|
441 | + public static function tbodyx($id = '', $class = '') { |
|
442 | + return EEH_HTML::_close_tag('tbody', $id, $class); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
456 | 456 | * @return string |
457 | 457 | */ |
458 | - public static function tr( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
459 | - return EEH_HTML::_open_tag( 'tr', $content, $id, $class, $style, $other_attributes ); |
|
458 | + public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
459 | + return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | * @param string $class - html class attribute |
469 | 469 | * @return string |
470 | 470 | */ |
471 | - public static function trx( $id = '', $class = '' ) { |
|
472 | - return EEH_HTML::_close_tag( 'tr', $id, $class ); |
|
471 | + public static function trx($id = '', $class = '') { |
|
472 | + return EEH_HTML::_close_tag('tr', $id, $class); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
486 | 486 | * @return string |
487 | 487 | */ |
488 | - public static function th( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
489 | - return EEH_HTML::_open_tag( 'th', $content, $id, $class, $style, $other_attributes ); |
|
488 | + public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
489 | + return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | * @param string $class - html class attribute |
499 | 499 | * @return string |
500 | 500 | */ |
501 | - public static function thx( $id = '', $class = '' ) { |
|
502 | - return EEH_HTML::_close_tag( 'th', $id, $class ); |
|
501 | + public static function thx($id = '', $class = '') { |
|
502 | + return EEH_HTML::_close_tag('th', $id, $class); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
516 | 516 | * @return string |
517 | 517 | */ |
518 | - public static function td( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
519 | - return EEH_HTML::_open_tag( 'td', $content, $id, $class, $style, $other_attributes ); |
|
518 | + public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
519 | + return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | * @param string $class - html class attribute |
529 | 529 | * @return string |
530 | 530 | */ |
531 | - public static function tdx( $id = '', $class = '' ) { |
|
532 | - return EEH_HTML::_close_tag( 'td', $id, $class ); |
|
531 | + public static function tdx($id = '', $class = '') { |
|
532 | + return EEH_HTML::_close_tag('td', $id, $class); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | * @param int $colspan |
544 | 544 | * @return string |
545 | 545 | */ |
546 | - public static function no_row( $content = '', $colspan = 2 ) { |
|
546 | + public static function no_row($content = '', $colspan = 2) { |
|
547 | 547 | return EEH_HTML::tr( |
548 | - EEH_HTML::td( $content, '', '', 'padding:0; border:none;', 'colspan="' . $colspan . '"' ), |
|
549 | - '', '', 'padding:0; border:none;' |
|
548 | + EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="'.$colspan.'"'), |
|
549 | + '', '', 'padding:0; border:none;' |
|
550 | 550 | ); |
551 | 551 | } |
552 | 552 | |
@@ -566,14 +566,14 @@ discard block |
||
566 | 566 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
567 | 567 | * @return string |
568 | 568 | */ |
569 | - public static function link( $href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
570 | - $link_text = ! empty( $link_text ) ? $link_text : $href; |
|
571 | - $attributes = ! empty($href ) ? ' href="' . $href . '"' : ''; |
|
572 | - $attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
573 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
574 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
575 | - $attributes .= ! empty( $title ) ? ' title="' . esc_attr( $title ) . '"' : ''; |
|
576 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
569 | + public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
570 | + $link_text = ! empty($link_text) ? $link_text : $href; |
|
571 | + $attributes = ! empty($href) ? ' href="'.$href.'"' : ''; |
|
572 | + $attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
573 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
574 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
575 | + $attributes .= ! empty($title) ? ' title="'.esc_attr($title).'"' : ''; |
|
576 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
577 | 577 | return "<a{$attributes}>{$link_text}</a>"; |
578 | 578 | } |
579 | 579 | |
@@ -591,14 +591,14 @@ discard block |
||
591 | 591 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
592 | 592 | * @return string |
593 | 593 | */ |
594 | - public static function img( $src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
595 | - $attributes = ! empty( $src ) ? ' src="' . esc_url_raw( $src ) . '"' : ''; |
|
596 | - $attributes .= ! empty( $alt ) ? ' alt="' . esc_attr( $alt ) . '"' : ''; |
|
597 | - $attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
598 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
599 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
600 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
601 | - return '<img' . $attributes . '/>'; |
|
594 | + public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
595 | + $attributes = ! empty($src) ? ' src="'.esc_url_raw($src).'"' : ''; |
|
596 | + $attributes .= ! empty($alt) ? ' alt="'.esc_attr($alt).'"' : ''; |
|
597 | + $attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
598 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
599 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
600 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
601 | + return '<img'.$attributes.'/>'; |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | |
@@ -616,12 +616,12 @@ discard block |
||
616 | 616 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
617 | 617 | * @return string |
618 | 618 | */ |
619 | - protected static function _inline_tag( $tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
620 | - $attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
621 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
622 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
623 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
624 | - return '<' . $tag . ' ' . $attributes . '>' . $content . '</' . $tag . '>'; |
|
619 | + protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
620 | + $attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
621 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
622 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
623 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
624 | + return '<'.$tag.' '.$attributes.'>'.$content.'</'.$tag.'>'; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
@@ -637,8 +637,8 @@ discard block |
||
637 | 637 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
638 | 638 | * @return string |
639 | 639 | */ |
640 | - public static function label( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
641 | - return EEH_HTML::_inline_tag( 'label', $content, $id, $class, $style, $other_attributes ); |
|
640 | + public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
641 | + return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | |
@@ -654,8 +654,8 @@ discard block |
||
654 | 654 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
655 | 655 | * @return string |
656 | 656 | */ |
657 | - public static function span( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
658 | - return EEH_HTML::_inline_tag( 'span', $content, $id, $class, $style, $other_attributes ); |
|
657 | + public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
658 | + return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes); |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | |
@@ -671,8 +671,8 @@ discard block |
||
671 | 671 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
672 | 672 | * @return string |
673 | 673 | */ |
674 | - public static function strong( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
675 | - return EEH_HTML::_inline_tag( 'strong', $content, $id, $class, $style, $other_attributes ); |
|
674 | + public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
675 | + return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes); |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | |
@@ -684,8 +684,8 @@ discard block |
||
684 | 684 | * @param string $comment |
685 | 685 | * @return string |
686 | 686 | */ |
687 | - public static function comment( $comment = '' ) { |
|
688 | - return ! empty( $comment ) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : ''; |
|
687 | + public static function comment($comment = '') { |
|
688 | + return ! empty($comment) ? EEH_HTML::nl().'<!-- '.$comment.' -->' : ''; |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * @param int $nmbr - the number of line breaks to return |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public static function br( $nmbr = 1 ) { |
|
700 | - return str_repeat( '<br />', $nmbr ); |
|
699 | + public static function br($nmbr = 1) { |
|
700 | + return str_repeat('<br />', $nmbr); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | * @param int $nmbr - the number of non-breaking spaces to return |
709 | 709 | * @return string |
710 | 710 | */ |
711 | - public static function nbsp( $nmbr = 1 ) { |
|
712 | - return str_repeat( ' ', $nmbr ); |
|
711 | + public static function nbsp($nmbr = 1) { |
|
712 | + return str_repeat(' ', $nmbr); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -723,9 +723,9 @@ discard block |
||
723 | 723 | * @param string $id |
724 | 724 | * @return string |
725 | 725 | */ |
726 | - public static function sanitize_id( $id = '' ) { |
|
727 | - $key = str_replace( ' ', '-', trim( $id ) ); |
|
728 | - return preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key ); |
|
726 | + public static function sanitize_id($id = '') { |
|
727 | + $key = str_replace(' ', '-', trim($id)); |
|
728 | + return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key); |
|
729 | 729 | } |
730 | 730 | |
731 | 731 | |
@@ -737,10 +737,10 @@ discard block |
||
737 | 737 | * @param string $tag |
738 | 738 | * @return string - newline character plus # of indents passed (can be + or -) |
739 | 739 | */ |
740 | - public static function nl( $indent = 0, $tag = 'none' ) { |
|
740 | + public static function nl($indent = 0, $tag = 'none') { |
|
741 | 741 | $html = "\n"; |
742 | - EEH_HTML::indent( $indent, $tag ); |
|
743 | - for ( $x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++ ) { |
|
742 | + EEH_HTML::indent($indent, $tag); |
|
743 | + for ($x = 0; $x < EEH_HTML::$_indent[$tag]; $x++) { |
|
744 | 744 | $html .= "\t"; |
745 | 745 | } |
746 | 746 | return $html; |
@@ -755,17 +755,17 @@ discard block |
||
755 | 755 | * @param int $indent can be negative to decrease the indentation level |
756 | 756 | * @param string $tag |
757 | 757 | */ |
758 | - public static function indent( $indent, $tag = 'none' ){ |
|
758 | + public static function indent($indent, $tag = 'none') { |
|
759 | 759 | static $default_indentation = FALSE; |
760 | - if ( ! $default_indentation ) { |
|
760 | + if ( ! $default_indentation) { |
|
761 | 761 | EEH_HTML::_set_default_indentation(); |
762 | 762 | $default_indentation = TRUE; |
763 | 763 | } |
764 | - if ( ! isset( EEH_HTML::$_indent[ $tag ] )) { |
|
765 | - EEH_HTML::$_indent[ $tag ] = 0; |
|
764 | + if ( ! isset(EEH_HTML::$_indent[$tag])) { |
|
765 | + EEH_HTML::$_indent[$tag] = 0; |
|
766 | 766 | } |
767 | - EEH_HTML::$_indent[ $tag ] += (int)$indent; |
|
768 | - EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0; |
|
767 | + EEH_HTML::$_indent[$tag] += (int) $indent; |
|
768 | + EEH_HTML::$_indent[$tag] = EEH_HTML::$_indent[$tag] >= 0 ? EEH_HTML::$_indent[$tag] : 0; |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -811,15 +811,15 @@ discard block |
||
811 | 811 | * @global array $allowedtags |
812 | 812 | * @return array |
813 | 813 | */ |
814 | - public static function get_simple_tags(){ |
|
814 | + public static function get_simple_tags() { |
|
815 | 815 | global $allowedtags; |
816 | 816 | $tags_we_allow = $allowedtags; |
817 | - $tags_we_allow['ol']=array(); |
|
818 | - $tags_we_allow['ul']=array(); |
|
819 | - $tags_we_allow['li']=array(); |
|
820 | - $tags_we_allow['br']=array(); |
|
821 | - $tags_we_allow['p']=array(); |
|
822 | - return apply_filters( 'FHEE__EEH_HTML__get_simple_tags', $tags_we_allow ); |
|
817 | + $tags_we_allow['ol'] = array(); |
|
818 | + $tags_we_allow['ul'] = array(); |
|
819 | + $tags_we_allow['li'] = array(); |
|
820 | + $tags_we_allow['br'] = array(); |
|
821 | + $tags_we_allow['p'] = array(); |
|
822 | + return apply_filters('FHEE__EEH_HTML__get_simple_tags', $tags_we_allow); |
|
823 | 823 | } |
824 | 824 | |
825 | 825 |
@@ -17,158 +17,158 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * @var \EE_Ticket $ticket |
|
22 | - */ |
|
23 | - protected $ticket; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
27 | - */ |
|
28 | - protected $template_settings; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string $date_format |
|
32 | - */ |
|
33 | - protected $date_format; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var string $time_format |
|
37 | - */ |
|
38 | - protected $time_format; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var boolean $event_is_expired |
|
42 | - */ |
|
43 | - protected $event_is_expired; |
|
44 | - |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * TicketDetails constructor. |
|
49 | - * |
|
50 | - * @param \EE_Ticket $ticket |
|
51 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
52 | - * @param array $template_args |
|
53 | - */ |
|
54 | - public function __construct( |
|
55 | - \EE_Ticket $ticket, |
|
56 | - \EE_Ticket_Selector_Config $template_settings, |
|
57 | - array $template_args |
|
58 | - ) |
|
59 | - { |
|
60 | - $this->ticket = $ticket; |
|
61 | - $this->template_settings = $template_settings; |
|
62 | - $this->date_format = $template_args['date_format']; |
|
63 | - $this->time_format = $template_args['time_format']; |
|
64 | - $this->event_is_expired = $template_args['event_is_expired']; |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @return bool |
|
71 | - */ |
|
72 | - public function showTicketDetails() |
|
73 | - { |
|
74 | - return $this->template_settings->show_ticket_details; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @return string |
|
81 | - */ |
|
82 | - public function getShowHideLinks() |
|
83 | - { |
|
84 | - if ( ! $this->showTicketDetails()) { |
|
85 | - return ''; |
|
86 | - } |
|
87 | - return \EEH_HTML::link( |
|
88 | - '', |
|
89 | - sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
90 | - esc_attr( |
|
91 | - apply_filters( |
|
92 | - 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
93 | - __('click to show additional ticket details', 'event_espresso') |
|
94 | - ) |
|
95 | - ), |
|
96 | - "display-{$this->cssId()}", |
|
97 | - 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
98 | - '', |
|
99 | - 'rel="' . $this->cssId() . '"' |
|
100 | - ) . \EEH_HTML::link( |
|
101 | - '', |
|
102 | - sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
103 | - esc_attr( |
|
104 | - apply_filters( |
|
105 | - 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
106 | - __('click to hide additional ticket details', 'event_espresso') |
|
107 | - ) |
|
108 | - ), |
|
109 | - "hide-{$this->cssId()}", |
|
110 | - 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
111 | - 'display:none;', |
|
112 | - 'rel="' . $this->cssId() . '"' |
|
113 | - ); |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - public function cssId() |
|
122 | - { |
|
123 | - return apply_filters( |
|
124 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
125 | - "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
126 | - ); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * @param float $ticket_price |
|
133 | - * @param int $remaining |
|
134 | - * @param int $cols |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - public function display( |
|
138 | - $ticket_price = 0.00, |
|
139 | - $remaining, |
|
140 | - $cols = 2 |
|
141 | - ) { |
|
142 | - $template_args = array(); |
|
143 | - $template_args['ticket'] = $this->ticket; |
|
144 | - $template_args['ticket_price'] = $ticket_price; |
|
145 | - $template_args['remaining'] = $remaining; |
|
146 | - $template_args['cols'] = $cols; |
|
147 | - $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
148 | - $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
149 | - $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
150 | - $template_args['ticket_details_css_id'] = $this->cssId(); |
|
151 | - $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
152 | - 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
153 | - true |
|
154 | - ); |
|
155 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
156 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
157 | - esc_html__('Price', 'event_espresso') |
|
158 | - ); |
|
159 | - $template_args['date_format'] = $this->date_format; |
|
160 | - $template_args['time_format'] = $this->time_format; |
|
161 | - $template_args['event_is_expired'] = $this->event_is_expired; |
|
162 | - |
|
163 | - return \EEH_Template::locate_template( |
|
164 | - apply_filters( |
|
165 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
166 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
167 | - $this->ticket |
|
168 | - ), |
|
169 | - $template_args |
|
170 | - ); |
|
171 | - } |
|
20 | + /** |
|
21 | + * @var \EE_Ticket $ticket |
|
22 | + */ |
|
23 | + protected $ticket; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
27 | + */ |
|
28 | + protected $template_settings; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string $date_format |
|
32 | + */ |
|
33 | + protected $date_format; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var string $time_format |
|
37 | + */ |
|
38 | + protected $time_format; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var boolean $event_is_expired |
|
42 | + */ |
|
43 | + protected $event_is_expired; |
|
44 | + |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * TicketDetails constructor. |
|
49 | + * |
|
50 | + * @param \EE_Ticket $ticket |
|
51 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
52 | + * @param array $template_args |
|
53 | + */ |
|
54 | + public function __construct( |
|
55 | + \EE_Ticket $ticket, |
|
56 | + \EE_Ticket_Selector_Config $template_settings, |
|
57 | + array $template_args |
|
58 | + ) |
|
59 | + { |
|
60 | + $this->ticket = $ticket; |
|
61 | + $this->template_settings = $template_settings; |
|
62 | + $this->date_format = $template_args['date_format']; |
|
63 | + $this->time_format = $template_args['time_format']; |
|
64 | + $this->event_is_expired = $template_args['event_is_expired']; |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @return bool |
|
71 | + */ |
|
72 | + public function showTicketDetails() |
|
73 | + { |
|
74 | + return $this->template_settings->show_ticket_details; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @return string |
|
81 | + */ |
|
82 | + public function getShowHideLinks() |
|
83 | + { |
|
84 | + if ( ! $this->showTicketDetails()) { |
|
85 | + return ''; |
|
86 | + } |
|
87 | + return \EEH_HTML::link( |
|
88 | + '', |
|
89 | + sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
90 | + esc_attr( |
|
91 | + apply_filters( |
|
92 | + 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
93 | + __('click to show additional ticket details', 'event_espresso') |
|
94 | + ) |
|
95 | + ), |
|
96 | + "display-{$this->cssId()}", |
|
97 | + 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
98 | + '', |
|
99 | + 'rel="' . $this->cssId() . '"' |
|
100 | + ) . \EEH_HTML::link( |
|
101 | + '', |
|
102 | + sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
103 | + esc_attr( |
|
104 | + apply_filters( |
|
105 | + 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
106 | + __('click to hide additional ticket details', 'event_espresso') |
|
107 | + ) |
|
108 | + ), |
|
109 | + "hide-{$this->cssId()}", |
|
110 | + 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
111 | + 'display:none;', |
|
112 | + 'rel="' . $this->cssId() . '"' |
|
113 | + ); |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + public function cssId() |
|
122 | + { |
|
123 | + return apply_filters( |
|
124 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
125 | + "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
126 | + ); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * @param float $ticket_price |
|
133 | + * @param int $remaining |
|
134 | + * @param int $cols |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + public function display( |
|
138 | + $ticket_price = 0.00, |
|
139 | + $remaining, |
|
140 | + $cols = 2 |
|
141 | + ) { |
|
142 | + $template_args = array(); |
|
143 | + $template_args['ticket'] = $this->ticket; |
|
144 | + $template_args['ticket_price'] = $ticket_price; |
|
145 | + $template_args['remaining'] = $remaining; |
|
146 | + $template_args['cols'] = $cols; |
|
147 | + $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
148 | + $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
149 | + $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
150 | + $template_args['ticket_details_css_id'] = $this->cssId(); |
|
151 | + $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
152 | + 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
153 | + true |
|
154 | + ); |
|
155 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
156 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
157 | + esc_html__('Price', 'event_espresso') |
|
158 | + ); |
|
159 | + $template_args['date_format'] = $this->date_format; |
|
160 | + $template_args['time_format'] = $this->time_format; |
|
161 | + $template_args['event_is_expired'] = $this->event_is_expired; |
|
162 | + |
|
163 | + return \EEH_Template::locate_template( |
|
164 | + apply_filters( |
|
165 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
166 | + TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
167 | + $this->ticket |
|
168 | + ), |
|
169 | + $template_args |
|
170 | + ); |
|
171 | + } |
|
172 | 172 | |
173 | 173 | } |
174 | 174 | // End of file TicketDetails.php |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | "display-{$this->cssId()}", |
97 | 97 | 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
98 | 98 | '', |
99 | - 'rel="' . $this->cssId() . '"' |
|
100 | - ) . \EEH_HTML::link( |
|
99 | + 'rel="'.$this->cssId().'"' |
|
100 | + ).\EEH_HTML::link( |
|
101 | 101 | '', |
102 | 102 | sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
103 | 103 | esc_attr( |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | "hide-{$this->cssId()}", |
110 | 110 | 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
111 | 111 | 'display:none;', |
112 | - 'rel="' . $this->cssId() . '"' |
|
112 | + 'rel="'.$this->cssId().'"' |
|
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return \EEH_Template::locate_template( |
164 | 164 | apply_filters( |
165 | 165 | 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
166 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
166 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php', |
|
167 | 167 | $this->ticket |
168 | 168 | ), |
169 | 169 | $template_args |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
7 | 7 | <?php |
8 | 8 | if ( $ticket instanceof EE_Ticket ) { |
9 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
10 | - $ticket_description = $ticket->description(); |
|
11 | - $ticket_description .= ! empty( $ticket_description ) |
|
12 | - ? '<br />' . $ticket_status_display |
|
13 | - : $ticket_status_display; |
|
14 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
15 | - $ticket_description = "<p>{$ticket_description}</p>"; |
|
16 | - } |
|
9 | + do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
10 | + $ticket_description = $ticket->description(); |
|
11 | + $ticket_description .= ! empty( $ticket_description ) |
|
12 | + ? '<br />' . $ticket_status_display |
|
13 | + : $ticket_status_display; |
|
14 | + if ( ! strpos( $ticket_description, '<div' ) ) { |
|
15 | + $ticket_description = "<p>{$ticket_description}</p>"; |
|
16 | + } |
|
17 | 17 | ?> |
18 | 18 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
19 | 19 | <div class="no-tkt-slctr-ticket-content-dv"> |
@@ -23,6 +23,6 @@ discard block |
||
23 | 23 | <?php } ?> |
24 | 24 | </div> |
25 | 25 | <?php |
26 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
26 | + do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
27 | 27 | } |
28 | 28 | ?> |
@@ -5,24 +5,24 @@ |
||
5 | 5 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
6 | 6 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
7 | 7 | <?php |
8 | -if ( $ticket instanceof EE_Ticket ) { |
|
9 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
8 | +if ($ticket instanceof EE_Ticket) { |
|
9 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
10 | 10 | $ticket_description = $ticket->description(); |
11 | - $ticket_description .= ! empty( $ticket_description ) |
|
12 | - ? '<br />' . $ticket_status_display |
|
11 | + $ticket_description .= ! empty($ticket_description) |
|
12 | + ? '<br />'.$ticket_status_display |
|
13 | 13 | : $ticket_status_display; |
14 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
14 | + if ( ! strpos($ticket_description, '<div')) { |
|
15 | 15 | $ticket_description = "<p>{$ticket_description}</p>"; |
16 | 16 | } |
17 | 17 | ?> |
18 | 18 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
19 | 19 | <div class="no-tkt-slctr-ticket-content-dv"> |
20 | 20 | <h5><?php echo $ticket->name(); ?></h5> |
21 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
21 | + <?php if ( ! empty($ticket_description)) { ?> |
|
22 | 22 | <?php echo $ticket_description; ?> |
23 | 23 | <?php } ?> |
24 | 24 | </div> |
25 | 25 | <?php |
26 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
26 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
27 | 27 | } |
28 | 28 | ?> |
@@ -18,46 +18,46 @@ |
||
18 | 18 | class TicketSelectorSimple extends TicketSelector |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var \EE_Ticket $ticket |
|
23 | - */ |
|
24 | - protected $ticket; |
|
21 | + /** |
|
22 | + * @var \EE_Ticket $ticket |
|
23 | + */ |
|
24 | + protected $ticket; |
|
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * TicketSelectorSimple constructor. |
|
30 | - * |
|
31 | - * @param \EE_Event $event |
|
32 | - * @param \EE_Ticket $ticket |
|
33 | - * @param int $max_attendees |
|
34 | - * @param array $template_args |
|
35 | - */ |
|
36 | - public function __construct(\EE_Event $event, \EE_Ticket $ticket, $max_attendees, array $template_args) |
|
37 | - { |
|
38 | - $this->ticket = $ticket; |
|
39 | - parent::__construct($event, array($this->ticket), $max_attendees, $template_args); |
|
40 | - } |
|
28 | + /** |
|
29 | + * TicketSelectorSimple constructor. |
|
30 | + * |
|
31 | + * @param \EE_Event $event |
|
32 | + * @param \EE_Ticket $ticket |
|
33 | + * @param int $max_attendees |
|
34 | + * @param array $template_args |
|
35 | + */ |
|
36 | + public function __construct(\EE_Event $event, \EE_Ticket $ticket, $max_attendees, array $template_args) |
|
37 | + { |
|
38 | + $this->ticket = $ticket; |
|
39 | + parent::__construct($event, array($this->ticket), $max_attendees, $template_args); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * sets any and all template args that are required for this Ticket Selector |
|
46 | - * |
|
47 | - * @return void |
|
48 | - */ |
|
49 | - protected function addTemplateArgs() |
|
50 | - { |
|
51 | - unset($this->template_args['tickets']); |
|
52 | - $this->template_args['ticket'] = $this->ticket; |
|
53 | - $ticket_selector_row = new TicketSelectorRowSimple( |
|
54 | - $this->ticket, |
|
55 | - $this->max_attendees, |
|
56 | - $this->template_args['date_format'] |
|
57 | - ); |
|
58 | - $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
59 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
60 | - } |
|
44 | + /** |
|
45 | + * sets any and all template args that are required for this Ticket Selector |
|
46 | + * |
|
47 | + * @return void |
|
48 | + */ |
|
49 | + protected function addTemplateArgs() |
|
50 | + { |
|
51 | + unset($this->template_args['tickets']); |
|
52 | + $this->template_args['ticket'] = $this->ticket; |
|
53 | + $ticket_selector_row = new TicketSelectorRowSimple( |
|
54 | + $this->ticket, |
|
55 | + $this->max_attendees, |
|
56 | + $this->template_args['date_format'] |
|
57 | + ); |
|
58 | + $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
59 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | 63 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $this->template_args['date_format'] |
57 | 57 | ); |
58 | 58 | $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
59 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
59 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'simple_ticket_selector.template.php'; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 |
@@ -16,90 +16,90 @@ |
||
16 | 16 | abstract class TicketSelector |
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 int max_attendees |
|
31 | - */ |
|
32 | - protected $max_attendees; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var array $template_args |
|
36 | - */ |
|
37 | - protected $template_args; |
|
38 | - |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * TicketSelectorSimple constructor. |
|
43 | - * |
|
44 | - * @param \EE_Event $event |
|
45 | - * @param \EE_Ticket[] $tickets |
|
46 | - * @param int $max_attendees |
|
47 | - * @param array $template_args |
|
48 | - */ |
|
49 | - public function __construct(\EE_Event $event, array $tickets, $max_attendees, array $template_args) |
|
50 | - { |
|
51 | - $this->event = $event; |
|
52 | - $this->tickets = $tickets; |
|
53 | - $this->max_attendees = $max_attendees; |
|
54 | - $this->template_args = $template_args; |
|
55 | - $this->addTemplateArgs(); |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * sets any and all template args that are required for this Ticket Selector |
|
62 | - * |
|
63 | - * @return void |
|
64 | - */ |
|
65 | - abstract protected function addTemplateArgs(); |
|
66 | - |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * loadTicketSelectorTemplate |
|
71 | - * |
|
72 | - * @return string |
|
73 | - */ |
|
74 | - protected function loadTicketSelectorTemplate() |
|
75 | - { |
|
76 | - try { |
|
77 | - return \EEH_Template::locate_template( |
|
78 | - apply_filters( |
|
79 | - 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', |
|
80 | - $this->template_args['template_path'], |
|
81 | - $this->event |
|
82 | - ), |
|
83 | - $this->template_args |
|
84 | - ); |
|
85 | - } catch (\Exception $e) { |
|
86 | - \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
87 | - } |
|
88 | - return ''; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * The __toString method allows a class to decide how it will react when it is converted to a string. |
|
95 | - * |
|
96 | - * @return string |
|
97 | - * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring |
|
98 | - */ |
|
99 | - public function __toString() |
|
100 | - { |
|
101 | - return $this->loadTicketSelectorTemplate(); |
|
102 | - } |
|
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 int max_attendees |
|
31 | + */ |
|
32 | + protected $max_attendees; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var array $template_args |
|
36 | + */ |
|
37 | + protected $template_args; |
|
38 | + |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * TicketSelectorSimple constructor. |
|
43 | + * |
|
44 | + * @param \EE_Event $event |
|
45 | + * @param \EE_Ticket[] $tickets |
|
46 | + * @param int $max_attendees |
|
47 | + * @param array $template_args |
|
48 | + */ |
|
49 | + public function __construct(\EE_Event $event, array $tickets, $max_attendees, array $template_args) |
|
50 | + { |
|
51 | + $this->event = $event; |
|
52 | + $this->tickets = $tickets; |
|
53 | + $this->max_attendees = $max_attendees; |
|
54 | + $this->template_args = $template_args; |
|
55 | + $this->addTemplateArgs(); |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * sets any and all template args that are required for this Ticket Selector |
|
62 | + * |
|
63 | + * @return void |
|
64 | + */ |
|
65 | + abstract protected function addTemplateArgs(); |
|
66 | + |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * loadTicketSelectorTemplate |
|
71 | + * |
|
72 | + * @return string |
|
73 | + */ |
|
74 | + protected function loadTicketSelectorTemplate() |
|
75 | + { |
|
76 | + try { |
|
77 | + return \EEH_Template::locate_template( |
|
78 | + apply_filters( |
|
79 | + 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', |
|
80 | + $this->template_args['template_path'], |
|
81 | + $this->event |
|
82 | + ), |
|
83 | + $this->template_args |
|
84 | + ); |
|
85 | + } catch (\Exception $e) { |
|
86 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
87 | + } |
|
88 | + return ''; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * The __toString method allows a class to decide how it will react when it is converted to a string. |
|
95 | + * |
|
96 | + * @return string |
|
97 | + * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring |
|
98 | + */ |
|
99 | + public function __toString() |
|
100 | + { |
|
101 | + return $this->loadTicketSelectorTemplate(); |
|
102 | + } |
|
103 | 103 | |
104 | 104 | |
105 | 105 |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | |
120 | 120 | |
121 | 121 | |
122 | - /** |
|
123 | - * Form constructor. |
|
124 | - * |
|
125 | - * @param string $form_name |
|
126 | - * @param string $admin_name |
|
127 | - * @param string $slug |
|
128 | - * @param string $form_action |
|
129 | - * @param string $form_config |
|
130 | - * @param \EE_Registry $registry |
|
131 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
132 | - * @throws \DomainException |
|
133 | - * @throws \InvalidArgumentException |
|
134 | - */ |
|
122 | + /** |
|
123 | + * Form constructor. |
|
124 | + * |
|
125 | + * @param string $form_name |
|
126 | + * @param string $admin_name |
|
127 | + * @param string $slug |
|
128 | + * @param string $form_action |
|
129 | + * @param string $form_config |
|
130 | + * @param \EE_Registry $registry |
|
131 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
132 | + * @throws \DomainException |
|
133 | + * @throws \InvalidArgumentException |
|
134 | + */ |
|
135 | 135 | public function __construct( |
136 | 136 | $form_name, |
137 | 137 | $admin_name, |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @throws \LogicException |
173 | 173 | */ |
174 | 174 | public function form( $for_display = false ) { |
175 | - if ( ! $this->formIsValid() ) { |
|
175 | + if ( ! $this->formIsValid() ) { |
|
176 | 176 | return null; |
177 | 177 | } |
178 | 178 | if ( $for_display ) { |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | * @throws LogicException |
196 | 196 | */ |
197 | 197 | public function formIsValid() { |
198 | - if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
198 | + if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
199 | 199 | static $generated = false; |
200 | 200 | if ( ! $generated ) { |
201 | 201 | $generated = true; |
202 | 202 | $form = $this->generate(); |
203 | - if ( $form instanceof \EE_Form_Section_Proper) { |
|
204 | - $this->setForm($form); |
|
205 | - } |
|
203 | + if ( $form instanceof \EE_Form_Section_Proper) { |
|
204 | + $this->setForm($form); |
|
205 | + } |
|
206 | 206 | } |
207 | 207 | return $this->verifyForm(); |
208 | 208 | } |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | |
338 | 338 | |
339 | 339 | |
340 | - /** |
|
341 | - * @param string $submit_btn_text |
|
342 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
343 | - * @throws \InvalidArgumentException |
|
344 | - */ |
|
340 | + /** |
|
341 | + * @param string $submit_btn_text |
|
342 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
343 | + * @throws \InvalidArgumentException |
|
344 | + */ |
|
345 | 345 | public function setSubmitBtnText( $submit_btn_text ) { |
346 | 346 | if ( ! is_string( $submit_btn_text ) ) { |
347 | 347 | throw new InvalidDataTypeException( '$submit_btn_text', $submit_btn_text, 'string' ); |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * @throws \EE_Error |
575 | 575 | */ |
576 | 576 | public function display() { |
577 | - $form_html = apply_filters( |
|
577 | + $form_html = apply_filters( |
|
578 | 578 | 'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form', |
579 | 579 | '' |
580 | 580 | ); |
@@ -613,11 +613,11 @@ discard block |
||
613 | 613 | */ |
614 | 614 | public function process( $submitted_form_data = array() ) { |
615 | 615 | if ( ! $this->form()->was_submitted( $submitted_form_data ) ) { |
616 | - throw new InvalidFormSubmissionException( $this->form_name ); |
|
616 | + throw new InvalidFormSubmissionException( $this->form_name ); |
|
617 | 617 | } |
618 | - $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
618 | + $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
619 | 619 | if ( ! $this->form()->is_valid() ) { |
620 | - throw new InvalidFormSubmissionException( |
|
620 | + throw new InvalidFormSubmissionException( |
|
621 | 621 | $this->form_name, |
622 | 622 | sprintf( |
623 | 623 | __( |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
11 | 11 | use EventEspresso\core\exceptions\InvalidFormSubmissionException; |
12 | 12 | |
13 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
14 | - exit( 'No direct script access allowed' ); |
|
13 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
14 | + exit('No direct script access allowed'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @author Brent Christensen |
28 | 28 | * @since 4.9.0 |
29 | 29 | */ |
30 | -abstract class FormHandler implements FormHandlerInterface{ |
|
30 | +abstract class FormHandler implements FormHandlerInterface { |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * will add opening and closing HTML form tags as well as a submit button |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | $form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT, |
141 | 141 | \EE_Registry $registry |
142 | 142 | ) { |
143 | - $this->setFormName( $form_name ); |
|
144 | - $this->setAdminName( $admin_name ); |
|
145 | - $this->setSlug( $slug ); |
|
146 | - $this->setFormAction( $form_action ); |
|
147 | - $this->setFormConfig( $form_config ); |
|
148 | - $this->setSubmitBtnText( __( 'Submit', 'event_espresso' ) ); |
|
143 | + $this->setFormName($form_name); |
|
144 | + $this->setAdminName($admin_name); |
|
145 | + $this->setSlug($slug); |
|
146 | + $this->setFormAction($form_action); |
|
147 | + $this->setFormConfig($form_config); |
|
148 | + $this->setSubmitBtnText(__('Submit', 'event_espresso')); |
|
149 | 149 | $this->registry = $registry; |
150 | 150 | } |
151 | 151 | |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | * @throws \EE_Error |
172 | 172 | * @throws \LogicException |
173 | 173 | */ |
174 | - public function form( $for_display = false ) { |
|
175 | - if ( ! $this->formIsValid() ) { |
|
174 | + public function form($for_display = false) { |
|
175 | + if ( ! $this->formIsValid()) { |
|
176 | 176 | return null; |
177 | 177 | } |
178 | - if ( $for_display ) { |
|
178 | + if ($for_display) { |
|
179 | 179 | $form_config = $this->formConfig(); |
180 | 180 | if ( |
181 | 181 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | * @throws LogicException |
196 | 196 | */ |
197 | 197 | public function formIsValid() { |
198 | - if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
198 | + if ( ! $this->form instanceof \EE_Form_Section_Proper) { |
|
199 | 199 | static $generated = false; |
200 | - if ( ! $generated ) { |
|
200 | + if ( ! $generated) { |
|
201 | 201 | $generated = true; |
202 | 202 | $form = $this->generate(); |
203 | - if ( $form instanceof \EE_Form_Section_Proper) { |
|
203 | + if ($form instanceof \EE_Form_Section_Proper) { |
|
204 | 204 | $this->setForm($form); |
205 | 205 | } |
206 | 206 | } |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | * @throws LogicException |
217 | 217 | */ |
218 | 218 | public function verifyForm() { |
219 | - if ( $this->form instanceof \EE_Form_Section_Proper ) { |
|
219 | + if ($this->form instanceof \EE_Form_Section_Proper) { |
|
220 | 220 | return true; |
221 | 221 | } |
222 | 222 | throw new LogicException( |
223 | 223 | sprintf( |
224 | - __( 'The "%1$s" form is invalid or missing', 'event_espresso' ), |
|
224 | + __('The "%1$s" form is invalid or missing', 'event_espresso'), |
|
225 | 225 | $this->form_name |
226 | 226 | ) |
227 | 227 | ); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | /** |
233 | 233 | * @param \EE_Form_Section_Proper $form |
234 | 234 | */ |
235 | - public function setForm( \EE_Form_Section_Proper $form ) { |
|
235 | + public function setForm(\EE_Form_Section_Proper $form) { |
|
236 | 236 | $this->form = $form; |
237 | 237 | } |
238 | 238 | |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | /** |
251 | 251 | * @param boolean $displayable |
252 | 252 | */ |
253 | - public function setDisplayable( $displayable = false ) { |
|
254 | - $this->displayable = filter_var( $displayable, FILTER_VALIDATE_BOOLEAN ); |
|
253 | + public function setDisplayable($displayable = false) { |
|
254 | + $this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | * @param string $form_name |
272 | 272 | * @throws InvalidDataTypeException |
273 | 273 | */ |
274 | - public function setFormName( $form_name ) { |
|
275 | - if ( ! is_string( $form_name ) ) { |
|
276 | - throw new InvalidDataTypeException( '$form_name', $form_name, 'string' ); |
|
274 | + public function setFormName($form_name) { |
|
275 | + if ( ! is_string($form_name)) { |
|
276 | + throw new InvalidDataTypeException('$form_name', $form_name, 'string'); |
|
277 | 277 | } |
278 | 278 | $this->form_name = $form_name; |
279 | 279 | } |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | * @param string $admin_name |
296 | 296 | * @throws InvalidDataTypeException |
297 | 297 | */ |
298 | - public function setAdminName( $admin_name ) { |
|
299 | - if ( ! is_string( $admin_name ) ) { |
|
300 | - throw new InvalidDataTypeException( '$admin_name', $admin_name, 'string' ); |
|
298 | + public function setAdminName($admin_name) { |
|
299 | + if ( ! is_string($admin_name)) { |
|
300 | + throw new InvalidDataTypeException('$admin_name', $admin_name, 'string'); |
|
301 | 301 | } |
302 | 302 | $this->admin_name = $admin_name; |
303 | 303 | } |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | * @param string $slug |
320 | 320 | * @throws InvalidDataTypeException |
321 | 321 | */ |
322 | - public function setSlug( $slug ) { |
|
323 | - if ( ! is_string( $slug ) ) { |
|
324 | - throw new InvalidDataTypeException( '$slug', $slug, 'string' ); |
|
322 | + public function setSlug($slug) { |
|
323 | + if ( ! is_string($slug)) { |
|
324 | + throw new InvalidDataTypeException('$slug', $slug, 'string'); |
|
325 | 325 | } |
326 | 326 | $this->slug = $slug; |
327 | 327 | } |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
343 | 343 | * @throws \InvalidArgumentException |
344 | 344 | */ |
345 | - public function setSubmitBtnText( $submit_btn_text ) { |
|
346 | - if ( ! is_string( $submit_btn_text ) ) { |
|
347 | - throw new InvalidDataTypeException( '$submit_btn_text', $submit_btn_text, 'string' ); |
|
345 | + public function setSubmitBtnText($submit_btn_text) { |
|
346 | + if ( ! is_string($submit_btn_text)) { |
|
347 | + throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string'); |
|
348 | 348 | } |
349 | - if ( empty( $submit_btn_text ) ) { |
|
349 | + if (empty($submit_btn_text)) { |
|
350 | 350 | throw new InvalidArgumentException( |
351 | - __( 'Can not set Submit button text because an empty string was provided.', 'event_espresso' ) |
|
351 | + __('Can not set Submit button text because an empty string was provided.', 'event_espresso') |
|
352 | 352 | ); |
353 | 353 | } |
354 | 354 | $this->submit_btn_text = $submit_btn_text; |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @return string |
361 | 361 | */ |
362 | 362 | public function formAction() { |
363 | - return ! empty( $this->form_args ) |
|
364 | - ? add_query_arg( $this->form_args, $this->form_action ) |
|
363 | + return ! empty($this->form_args) |
|
364 | + ? add_query_arg($this->form_args, $this->form_action) |
|
365 | 365 | : $this->form_action; |
366 | 366 | } |
367 | 367 | |
@@ -371,9 +371,9 @@ discard block |
||
371 | 371 | * @param string $form_action |
372 | 372 | * @throws InvalidDataTypeException |
373 | 373 | */ |
374 | - public function setFormAction( $form_action ) { |
|
375 | - if ( ! is_string( $form_action ) ) { |
|
376 | - throw new InvalidDataTypeException( '$form_action', $form_action, 'string' ); |
|
374 | + public function setFormAction($form_action) { |
|
375 | + if ( ! is_string($form_action)) { |
|
376 | + throw new InvalidDataTypeException('$form_action', $form_action, 'string'); |
|
377 | 377 | } |
378 | 378 | $this->form_action = $form_action; |
379 | 379 | } |
@@ -385,20 +385,20 @@ discard block |
||
385 | 385 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
386 | 386 | * @throws \InvalidArgumentException |
387 | 387 | */ |
388 | - public function addFormActionArgs( $form_args = array() ) { |
|
389 | - if ( is_object( $form_args ) ) { |
|
388 | + public function addFormActionArgs($form_args = array()) { |
|
389 | + if (is_object($form_args)) { |
|
390 | 390 | throw new InvalidDataTypeException( |
391 | 391 | '$form_args', |
392 | 392 | $form_args, |
393 | 393 | 'anything other than an object was expected.' |
394 | 394 | ); |
395 | 395 | } |
396 | - if ( empty( $form_args ) ) { |
|
396 | + if (empty($form_args)) { |
|
397 | 397 | throw new InvalidArgumentException( |
398 | - __( 'The redirect arguments can not be an empty array.', 'event_espresso' ) |
|
398 | + __('The redirect arguments can not be an empty array.', 'event_espresso') |
|
399 | 399 | ); |
400 | 400 | } |
401 | - $this->form_args = array_merge( $this->form_args, $form_args ); |
|
401 | + $this->form_args = array_merge($this->form_args, $form_args); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @param string $form_config |
417 | 417 | * @throws DomainException |
418 | 418 | */ |
419 | - public function setFormConfig( $form_config ) { |
|
419 | + public function setFormConfig($form_config) { |
|
420 | 420 | if ( |
421 | 421 | ! in_array( |
422 | 422 | $form_config, |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | ) { |
431 | 431 | throw new DomainException( |
432 | 432 | sprintf( |
433 | - __( '"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form', 'event_espresso' ), |
|
433 | + __('"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form', 'event_espresso'), |
|
434 | 434 | $form_config |
435 | 435 | ) |
436 | 436 | ); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * @return boolean |
451 | 451 | */ |
452 | 452 | public function initialize() { |
453 | - $this->form_has_errors = \EE_Error::has_error( true ); |
|
453 | + $this->form_has_errors = \EE_Error::has_error(true); |
|
454 | 454 | return true; |
455 | 455 | } |
456 | 456 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @throws \EE_Error |
465 | 465 | */ |
466 | 466 | public function enqueueStylesAndScripts() { |
467 | - $this->form( false )->enqueue_js(); |
|
467 | + $this->form(false)->enqueue_js(); |
|
468 | 468 | |
469 | 469 | } |
470 | 470 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @return EE_Form_Section_Proper |
477 | 477 | */ |
478 | - abstract public function generate() ; |
|
478 | + abstract public function generate(); |
|
479 | 479 | |
480 | 480 | |
481 | 481 | |
@@ -485,15 +485,15 @@ discard block |
||
485 | 485 | * @param string $text |
486 | 486 | * @return \EE_Submit_Input |
487 | 487 | */ |
488 | - public function generateSubmitButton( $text = '' ) { |
|
489 | - $text = ! empty( $text ) ? $text : $this->submitBtnText(); |
|
488 | + public function generateSubmitButton($text = '') { |
|
489 | + $text = ! empty($text) ? $text : $this->submitBtnText(); |
|
490 | 490 | return new EE_Submit_Input( |
491 | 491 | array( |
492 | - 'html_name' => 'ee-form-submit-' . $this->slug(), |
|
493 | - 'html_id' => 'ee-form-submit-' . $this->slug(), |
|
492 | + 'html_name' => 'ee-form-submit-'.$this->slug(), |
|
493 | + 'html_id' => 'ee-form-submit-'.$this->slug(), |
|
494 | 494 | 'html_class' => 'ee-form-submit', |
495 | 495 | 'html_label' => ' ', |
496 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
496 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
497 | 497 | 'default' => $text |
498 | 498 | ) |
499 | 499 | ); |
@@ -509,12 +509,12 @@ discard block |
||
509 | 509 | * @throws \LogicException |
510 | 510 | * @throws \EE_Error |
511 | 511 | */ |
512 | - public function appendSubmitButton( $text = '' ) { |
|
513 | - if ( $this->form->subsection_exists( $this->slug() . '-submit-btn' ) ) { |
|
512 | + public function appendSubmitButton($text = '') { |
|
513 | + if ($this->form->subsection_exists($this->slug().'-submit-btn')) { |
|
514 | 514 | return; |
515 | 515 | } |
516 | 516 | $this->form->add_subsections( |
517 | - array( $this->slug() . '-submit-btn' => $this->generateSubmitButton( $text ) ), |
|
517 | + array($this->slug().'-submit-btn' => $this->generateSubmitButton($text)), |
|
518 | 518 | null, |
519 | 519 | false |
520 | 520 | ); |
@@ -528,18 +528,18 @@ discard block |
||
528 | 528 | * @param string $text |
529 | 529 | * @return \EE_Submit_Input |
530 | 530 | */ |
531 | - public function generateCancelButton( $text = '' ) { |
|
531 | + public function generateCancelButton($text = '') { |
|
532 | 532 | $cancel_button = new EE_Submit_Input( |
533 | 533 | array( |
534 | - 'html_name' => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!! |
|
535 | - 'html_id' => 'ee-cancel-form-' . $this->slug(), |
|
534 | + 'html_name' => 'ee-form-submit-'.$this->slug(), // YES! Same name as submit !!! |
|
535 | + 'html_id' => 'ee-cancel-form-'.$this->slug(), |
|
536 | 536 | 'html_class' => 'ee-cancel-form', |
537 | 537 | 'html_label' => ' ', |
538 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
539 | - 'default' => ! empty( $text ) ? $text : __( 'Cancel', 'event_espresso' ) |
|
538 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
539 | + 'default' => ! empty($text) ? $text : __('Cancel', 'event_espresso') |
|
540 | 540 | ) |
541 | 541 | ); |
542 | - $cancel_button->set_button_css_attributes( false ); |
|
542 | + $cancel_button->set_button_css_attributes(false); |
|
543 | 543 | return $cancel_button; |
544 | 544 | } |
545 | 545 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | $this->form->add_subsections( |
556 | 556 | array( |
557 | 557 | 'clear-submit-btn-float' => new \EE_Form_Section_HTML( |
558 | - EEH_HTML::div( '', '', 'clear-float' ) . EEH_HTML::divx() |
|
558 | + EEH_HTML::div('', '', 'clear-float').EEH_HTML::divx() |
|
559 | 559 | ) |
560 | 560 | ), |
561 | 561 | null, |
@@ -583,9 +583,9 @@ discard block |
||
583 | 583 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
584 | 584 | || $form_config === FormHandler::ADD_FORM_TAGS_ONLY |
585 | 585 | ) { |
586 | - $form_html .= $this->form()->form_open( $this->formAction() ); |
|
586 | + $form_html .= $this->form()->form_open($this->formAction()); |
|
587 | 587 | } |
588 | - $form_html .= $this->form( true )->get_html( $this->form_has_errors ); |
|
588 | + $form_html .= $this->form(true)->get_html($this->form_has_errors); |
|
589 | 589 | if ( |
590 | 590 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
591 | 591 | || $form_config === FormHandler::ADD_FORM_TAGS_ONLY |
@@ -611,12 +611,12 @@ discard block |
||
611 | 611 | * @throws \LogicException |
612 | 612 | * @throws InvalidFormSubmissionException |
613 | 613 | */ |
614 | - public function process( $submitted_form_data = array() ) { |
|
615 | - if ( ! $this->form()->was_submitted( $submitted_form_data ) ) { |
|
616 | - throw new InvalidFormSubmissionException( $this->form_name ); |
|
614 | + public function process($submitted_form_data = array()) { |
|
615 | + if ( ! $this->form()->was_submitted($submitted_form_data)) { |
|
616 | + throw new InvalidFormSubmissionException($this->form_name); |
|
617 | 617 | } |
618 | - $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
619 | - if ( ! $this->form()->is_valid() ) { |
|
618 | + $this->form(true)->receive_form_submission($submitted_form_data); |
|
619 | + if ( ! $this->form()->is_valid()) { |
|
620 | 620 | throw new InvalidFormSubmissionException( |
621 | 621 | $this->form_name, |
622 | 622 | sprintf( |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
3 | 3 | |
4 | -if ( is_single() || ( is_archive() && espresso_display_datetimes_in_event_list() ) ) : |
|
4 | +if (is_single() || (is_archive() && espresso_display_datetimes_in_event_list())) : |
|
5 | 5 | global $post; |
6 | -do_action( 'AHEE_event_details_before_event_date', $post ); |
|
6 | +do_action('AHEE_event_details_before_event_date', $post); |
|
7 | 7 | ?> |
8 | 8 | <div class="event-datetimes"> |
9 | - <?php espresso_list_of_event_dates( $post->ID );?> |
|
9 | + <?php espresso_list_of_event_dates($post->ID); ?> |
|
10 | 10 | </div> |
11 | 11 | <!-- .event-datetimes --> |
12 | 12 | <?php |
13 | -do_action( 'AHEE_event_details_after_event_date', $post ); |
|
13 | +do_action('AHEE_event_details_after_event_date', $post); |
|
14 | 14 | endif; |
15 | 15 | ?> |
16 | 16 | \ No newline at end of file |