@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * |
491 | 491 | * @access public |
492 | 492 | * @access public |
493 | - * @return array or FALSE |
|
493 | + * @return boolean|null or FALSE |
|
494 | 494 | */ |
495 | 495 | public function process_ticket_selections() { |
496 | 496 | do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * validate_post_data |
636 | 636 | * |
637 | 637 | * @access private |
638 | - * @return array or FALSE |
|
638 | + * @return string or FALSE |
|
639 | 639 | */ |
640 | 640 | private static function _validate_post_data() { |
641 | 641 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | * @access private |
753 | 753 | * @param EE_Ticket $ticket |
754 | 754 | * @param int $qty |
755 | - * @return TRUE on success, FALSE on fail |
|
755 | + * @return boolean on success, FALSE on fail |
|
756 | 756 | */ |
757 | 757 | private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
758 | 758 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | protected static $_event = NULL; |
36 | 36 | |
37 | 37 | /** |
38 | - * array of datetimes and the spaces available for them |
|
39 | - * |
|
40 | - * @access private |
|
41 | - * @var array |
|
42 | - */ |
|
38 | + * array of datetimes and the spaces available for them |
|
39 | + * |
|
40 | + * @access private |
|
41 | + * @var array |
|
42 | + */ |
|
43 | 43 | private static $_available_spaces = array(); |
44 | 44 | |
45 | 45 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | return $permalink_string; |
209 | 209 | } |
210 | 210 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
211 | - . __( 'Embed', 'event_espresso' ) |
|
212 | - . '</a> '; |
|
211 | + . __( 'Embed', 'event_espresso' ) |
|
212 | + . '</a> '; |
|
213 | 213 | $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
214 | 214 | $iframe_string = esc_html( |
215 | 215 | '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
@@ -884,11 +884,11 @@ discard block |
||
884 | 884 | |
885 | 885 | |
886 | 886 | /** |
887 | - * load js |
|
888 | - * |
|
889 | - * @access public |
|
890 | - * @return void |
|
891 | - */ |
|
887 | + * load js |
|
888 | + * |
|
889 | + * @access public |
|
890 | + * @return void |
|
891 | + */ |
|
892 | 892 | public static function load_tckt_slctr_assets() { |
893 | 893 | // add some style |
894 | 894 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @return EED_Ticket_Selector |
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | - return parent::get_instance( __CLASS__ ); |
|
60 | + return parent::get_instance(__CLASS__); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | - protected function set_config(){ |
|
66 | - $this->set_config_section( 'template_settings' ); |
|
67 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
68 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
65 | + protected function set_config() { |
|
66 | + $this->set_config_section('template_settings'); |
|
67 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
68 | + $this->set_config_name('EED_Ticket_Selector'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function set_hooks() { |
82 | 82 | // routing |
83 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
84 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
85 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
83 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
84 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
85 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
86 | 86 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
87 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
87 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
88 | 88 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
89 | 89 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
90 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
90 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public static function set_hooks_admin() { |
102 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
102 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
103 | 103 | //add button for iframe code to event editor. |
104 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
105 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
104 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
105 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @return void |
115 | 115 | */ |
116 | 116 | public static function set_definitions() { |
117 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
118 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
117 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
118 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
119 | 119 | |
120 | 120 | //if config is not set, initialize |
121 | 121 | //If config is not set, set it. |
122 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
122 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
123 | 123 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
124 | 124 | } |
125 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
125 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param object $WP |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function run( $WP ) {} |
|
136 | + public function run($WP) {} |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | public function ticket_selector_iframe() { |
146 | 146 | self::$_in_iframe = true; |
147 | 147 | /** @type EEM_Event $EEM_Event */ |
148 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
148 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
149 | 149 | $event = $EEM_Event->get_one_by_ID( |
150 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
150 | + EE_Registry::instance()->REQ->get('event', 0) |
|
151 | 151 | ); |
152 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
153 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
152 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
153 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
154 | 154 | $template_args['css'] = apply_filters( |
155 | 155 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
156 | 156 | array( |
157 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
158 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
159 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
160 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
157 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
158 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
159 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
160 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
161 | 161 | ) |
162 | 162 | ); |
163 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
164 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
163 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
164 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
165 | 165 | $template_args['eei18n'] = apply_filters( |
166 | 166 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
167 | 167 | EE_Registry::localize_i18n_js_strings() |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | $template_args['js'] = apply_filters( |
170 | 170 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
171 | 171 | array( |
172 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
173 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
174 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
172 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
173 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
174 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
175 | 175 | ) |
176 | 176 | ); |
177 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
178 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
177 | + $template_args['notices'] = EEH_Template::display_template( |
|
178 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
179 | 179 | array(), |
180 | 180 | true |
181 | 181 | ); |
182 | 182 | EEH_Template::display_template( |
183 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
183 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
184 | 184 | $template_args |
185 | 185 | ); |
186 | 186 | exit; |
@@ -199,25 +199,25 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return string The new html string for the permalink area. |
201 | 201 | */ |
202 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
202 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
203 | 203 | //make sure this is ONLY when editing and the event id has been set. |
204 | - if ( ! empty( $id ) ) { |
|
205 | - $post = get_post( $id ); |
|
204 | + if ( ! empty($id)) { |
|
205 | + $post = get_post($id); |
|
206 | 206 | //if NOT event then let's get out. |
207 | - if ( $post->post_type !== 'espresso_events' ) { |
|
207 | + if ($post->post_type !== 'espresso_events') { |
|
208 | 208 | return $permalink_string; |
209 | 209 | } |
210 | 210 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
211 | - . __( 'Embed', 'event_espresso' ) |
|
211 | + . __('Embed', 'event_espresso') |
|
212 | 212 | . '</a> '; |
213 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
213 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
214 | 214 | $iframe_string = esc_html( |
215 | - '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
|
215 | + '<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>' |
|
216 | 216 | ); |
217 | 217 | $permalink_string .= ' |
218 | 218 | <div id="js-ts-iframe" style="display:none"> |
219 | 219 | <div style="width:100%; height: 500px;"> |
220 | - ' . $iframe_string . ' |
|
220 | + ' . $iframe_string.' |
|
221 | 221 | </div> |
222 | 222 | </div>'; |
223 | 223 | } |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | * @param mixed $event |
237 | 237 | * @return bool |
238 | 238 | */ |
239 | - protected static function set_event( $event = null ) { |
|
240 | - if( $event === null ) { |
|
239 | + protected static function set_event($event = null) { |
|
240 | + if ($event === null) { |
|
241 | 241 | global $post; |
242 | 242 | $event = $post; |
243 | 243 | } |
244 | - if ( $event instanceof EE_Event ) { |
|
244 | + if ($event instanceof EE_Event) { |
|
245 | 245 | self::$_event = $event; |
246 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
246 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
247 | 247 | self::$_event = $event->EE_Event; |
248 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
249 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
248 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
249 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
250 | 250 | self::$_event = $event->EE_Event; |
251 | 251 | } else { |
252 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
253 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
254 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
252 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
253 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
254 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | return true; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | * @param bool $view_details |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
273 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
274 | 274 | // reset filter for displaying submit button |
275 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
275 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
276 | 276 | // poke and prod incoming event till it tells us what it is |
277 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
277 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | && ( |
286 | 286 | ! self::$_event->display_ticket_selector() |
287 | 287 | || $view_details |
288 | - || post_password_required( $event_post ) |
|
288 | + || post_password_required($event_post) |
|
289 | 289 | || ( |
290 | 290 | $_event_active_status != EE_Datetime::active |
291 | 291 | && $_event_active_status != EE_Datetime::upcoming |
@@ -303,68 +303,68 @@ discard block |
||
303 | 303 | $template_args = array(); |
304 | 304 | $template_args['event_status'] = $_event_active_status; |
305 | 305 | |
306 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
307 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
306 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
307 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
308 | 308 | |
309 | 309 | $template_args['EVT_ID'] = self::$_event->ID(); |
310 | 310 | $template_args['event'] = self::$_event; |
311 | 311 | |
312 | 312 | // is the event expired ? |
313 | 313 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
314 | - if ( $template_args['event_is_expired'] ) { |
|
315 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
314 | + if ($template_args['event_is_expired']) { |
|
315 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | $ticket_query_args = array( |
319 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
320 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
319 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
320 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
321 | 321 | ); |
322 | 322 | |
323 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
323 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
324 | 324 | //use the correct applicable time query depending on what version of core is being run. |
325 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
326 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
325 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
326 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | // get all tickets for this event ordered by the datetime |
330 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
330 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
331 | 331 | |
332 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
333 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
332 | + if (count($template_args['tickets']) < 1) { |
|
333 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
337 | - $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() ); |
|
338 | - if ( $template_args['max_atndz'] < 1 ) { |
|
339 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
340 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
341 | - $sales_closed_msg .= sprintf( |
|
342 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
337 | + $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit()); |
|
338 | + if ($template_args['max_atndz'] < 1) { |
|
339 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
340 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
341 | + $sales_closed_msg .= sprintf( |
|
342 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
343 | 343 | '<div class="ee-attention" style="text-align: left;"><b>', |
344 | 344 | '</b><br />', |
345 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
345 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
346 | 346 | '</a></span></div>' |
347 | 347 | ); |
348 | 348 | } |
349 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
349 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
350 | 350 | } |
351 | 351 | |
352 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
353 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
352 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
353 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
354 | 354 | |
355 | 355 | // redirecting to another site for registration ?? |
356 | 356 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
357 | 357 | // set up the form (but not for the admin) |
358 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
358 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
359 | 359 | // if not redirecting to another site for registration |
360 | - if ( ! $external_url ) { |
|
360 | + if ( ! $external_url) { |
|
361 | 361 | // then display the ticket selector |
362 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
362 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
363 | 363 | } else { |
364 | 364 | // if not we still need to trigger the display of the submit button |
365 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
365 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
366 | 366 | //display notice to admin that registration is external |
367 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
367 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
368 | 368 | } |
369 | 369 | // submit button and form close tag |
370 | 370 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -384,25 +384,25 @@ discard block |
||
384 | 384 | * @param string $external_url |
385 | 385 | * @return string |
386 | 386 | */ |
387 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
387 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
388 | 388 | // if redirecting, we don't need any anything else |
389 | - if ( $external_url ) { |
|
390 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
391 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
392 | - foreach ( $query_args as $query_arg => $value ) { |
|
393 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
389 | + if ($external_url) { |
|
390 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
391 | + $query_args = EEH_URL::get_query_string($external_url); |
|
392 | + foreach ($query_args as $query_arg => $value) { |
|
393 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
394 | 394 | } |
395 | 395 | return $html; |
396 | 396 | } |
397 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
398 | - if ( ! $checkout_url ) { |
|
399 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
397 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
398 | + if ( ! $checkout_url) { |
|
399 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
400 | 400 | } |
401 | 401 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
402 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
403 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
402 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
403 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
404 | 404 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
405 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
405 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
406 | 406 | return $html; |
407 | 407 | } |
408 | 408 | |
@@ -417,23 +417,23 @@ discard block |
||
417 | 417 | * @return string |
418 | 418 | */ |
419 | 419 | public static function display_ticket_selector_submit() { |
420 | - if ( ! is_admin() ) { |
|
421 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
420 | + if ( ! is_admin()) { |
|
421 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
422 | 422 | $btn_text = apply_filters( |
423 | 423 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
424 | - __('Register Now', 'event_espresso' ), |
|
424 | + __('Register Now', 'event_espresso'), |
|
425 | 425 | self::$_event |
426 | 426 | ); |
427 | 427 | $external_url = self::$_event->external_url(); |
428 | - $html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"'; |
|
428 | + $html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"'; |
|
429 | 429 | $html .= ' class="ticket-selector-submit-btn '; |
430 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
431 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
432 | - $html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event ); |
|
430 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
431 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
432 | + $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event); |
|
433 | 433 | $html .= '<div class="clear"><br/></div></form>'; |
434 | 434 | return $html; |
435 | - } else if ( is_archive() ) { |
|
436 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
435 | + } else if (is_archive()) { |
|
436 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | return ''; |
@@ -465,13 +465,13 @@ discard block |
||
465 | 465 | * @return string |
466 | 466 | */ |
467 | 467 | public static function display_view_details_btn() { |
468 | - if ( ! self::$_event->get_permalink() ) { |
|
469 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
468 | + if ( ! self::$_event->get_permalink()) { |
|
469 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
470 | 470 | } |
471 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
472 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
473 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
474 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
471 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
472 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
473 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
474 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
475 | 475 | $view_details_btn .= '<div class="clear"><br/></div>'; |
476 | 476 | $view_details_btn .= '</form>'; |
477 | 477 | return $view_details_btn; |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | * @return array or FALSE |
491 | 491 | */ |
492 | 492 | public function process_ticket_selections() { |
493 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
493 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
494 | 494 | // check nonce |
495 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
495 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
496 | 496 | EE_Error::add_error( |
497 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
497 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
498 | 498 | __FILE__, __FUNCTION__, __LINE__ |
499 | 499 | ); |
500 | 500 | return FALSE; |
@@ -508,16 +508,16 @@ discard block |
||
508 | 508 | |
509 | 509 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
510 | 510 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
511 | - EE_Registry::instance()->load_core( 'Session' ); |
|
511 | + EE_Registry::instance()->load_core('Session'); |
|
512 | 512 | // unless otherwise requested, clear the session |
513 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
514 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
513 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
514 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
515 | 515 | } |
516 | 516 | //d( EE_Registry::instance()->SSN ); |
517 | 517 | |
518 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
518 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
519 | 519 | // do we have an event id? |
520 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
520 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
521 | 521 | // validate/sanitize data |
522 | 522 | $valid = self::_validate_post_data(); |
523 | 523 | |
@@ -527,41 +527,41 @@ discard block |
||
527 | 527 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
528 | 528 | |
529 | 529 | //check total tickets ordered vs max number of attendees that can register |
530 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
530 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
531 | 531 | |
532 | 532 | // ordering too many tickets !!! |
533 | 533 | $total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso'); |
534 | - $limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] ); |
|
534 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
535 | 535 | // dev only message |
536 | 536 | $max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso'); |
537 | - $limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] ); |
|
538 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
537 | + $limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']); |
|
538 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
539 | 539 | } else { |
540 | 540 | |
541 | 541 | // all data appears to be valid |
542 | 542 | $tckts_slctd = FALSE; |
543 | 543 | $success = TRUE; |
544 | 544 | // load cart |
545 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
545 | + EE_Registry::instance()->load_core('Cart'); |
|
546 | 546 | |
547 | 547 | // cycle thru the number of data rows sent from the event listing |
548 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
548 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
549 | 549 | // does this row actually contain a ticket quantity? |
550 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
550 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
551 | 551 | // YES we have a ticket quantity |
552 | 552 | $tckts_slctd = TRUE; |
553 | 553 | // d( $valid['ticket_obj'][$x] ); |
554 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
554 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
555 | 555 | // then add ticket to cart |
556 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
556 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
557 | 557 | $success = ! $ticket_added ? FALSE : $success; |
558 | - if ( EE_Error::has_error() ) { |
|
558 | + if (EE_Error::has_error()) { |
|
559 | 559 | break; |
560 | 560 | } |
561 | 561 | } else { |
562 | 562 | // nothing added to cart retrieved |
563 | 563 | EE_Error::add_error( |
564 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
564 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
565 | 565 | __FILE__, __FUNCTION__, __LINE__ |
566 | 566 | ); |
567 | 567 | } |
@@ -570,45 +570,45 @@ discard block |
||
570 | 570 | //d( EE_Registry::instance()->CART ); |
571 | 571 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
572 | 572 | |
573 | - if ( $tckts_slctd ) { |
|
574 | - if ( $success ) { |
|
575 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
573 | + if ($tckts_slctd) { |
|
574 | + if ($success) { |
|
575 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
576 | 576 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
577 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
577 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
578 | 578 | EE_Registry::instance()->SSN->update(); |
579 | 579 | //d( EE_Registry::instance()->CART ); |
580 | 580 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
581 | 581 | // just return TRUE for registrations being made from admin |
582 | - if ( is_admin() ) { |
|
582 | + if (is_admin()) { |
|
583 | 583 | return TRUE; |
584 | 584 | } |
585 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
585 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
586 | 586 | exit(); |
587 | 587 | |
588 | 588 | } else { |
589 | - if ( ! EE_Error::has_error() ) { |
|
589 | + if ( ! EE_Error::has_error()) { |
|
590 | 590 | // nothing added to cart |
591 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
591 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | 595 | } else { |
596 | 596 | // no ticket quantities were selected |
597 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
597 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
601 | 601 | // at this point, just return if registration is being made from admin |
602 | - if ( is_admin() ) { |
|
602 | + if (is_admin()) { |
|
603 | 603 | return FALSE; |
604 | 604 | } |
605 | - if ( $valid['return_url'] ) { |
|
606 | - EE_Error::get_notices( FALSE, TRUE ); |
|
607 | - wp_safe_redirect( $valid['return_url'] ); |
|
605 | + if ($valid['return_url']) { |
|
606 | + EE_Error::get_notices(FALSE, TRUE); |
|
607 | + wp_safe_redirect($valid['return_url']); |
|
608 | 608 | exit(); |
609 | - } elseif ( isset( $event_to_add['id'] )) { |
|
610 | - EE_Error::get_notices( FALSE, TRUE ); |
|
611 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
609 | + } elseif (isset($event_to_add['id'])) { |
|
610 | + EE_Error::get_notices(FALSE, TRUE); |
|
611 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
612 | 612 | exit(); |
613 | 613 | } else { |
614 | 614 | echo EE_Error::get_notices(); |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | } else { |
618 | 618 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
619 | 619 | EE_Error::add_error( |
620 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
620 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
621 | 621 | __FILE__, __FUNCTION__, __LINE__ |
622 | 622 | ); |
623 | 623 | } |
@@ -635,18 +635,18 @@ discard block |
||
635 | 635 | * @return array or FALSE |
636 | 636 | */ |
637 | 637 | private static function _validate_post_data() { |
638 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
638 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
639 | 639 | |
640 | 640 | // start with an empty array() |
641 | 641 | $valid_data = array(); |
642 | 642 | // d( $_POST ); |
643 | 643 | //if event id is valid |
644 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
645 | - if ( $id ) { |
|
644 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
645 | + if ($id) { |
|
646 | 646 | // grab valid id |
647 | 647 | $valid_data['id'] = $id; |
648 | 648 | // grab and sanitize return-url |
649 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
649 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
650 | 650 | // array of other form names |
651 | 651 | $inputs_to_clean = array( |
652 | 652 | 'event_id' => 'tkt-slctr-event-id', |
@@ -659,22 +659,22 @@ discard block |
||
659 | 659 | // let's track the total number of tickets ordered.' |
660 | 660 | $valid_data['total_tickets'] = 0; |
661 | 661 | // cycle through $inputs_to_clean array |
662 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
662 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
663 | 663 | // check for POST data |
664 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
664 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
665 | 665 | // grab value |
666 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
666 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
667 | 667 | switch ($what) { |
668 | 668 | |
669 | 669 | // integers |
670 | 670 | case 'event_id': |
671 | - $valid_data[$what] = absint( $input_value ); |
|
671 | + $valid_data[$what] = absint($input_value); |
|
672 | 672 | // get event via the event id we put in the form |
673 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
673 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
674 | 674 | break; |
675 | 675 | case 'rows': |
676 | 676 | case 'max_atndz': |
677 | - $valid_data[$what] = absint( $input_value ); |
|
677 | + $valid_data[$what] = absint($input_value); |
|
678 | 678 | break; |
679 | 679 | |
680 | 680 | // arrays of integers |
@@ -682,27 +682,27 @@ discard block |
||
682 | 682 | // d( $input_value ); |
683 | 683 | $row_qty = $input_value; |
684 | 684 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
685 | - if( ! is_array( $row_qty )) { |
|
685 | + if ( ! is_array($row_qty)) { |
|
686 | 686 | // get number of rows |
687 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
687 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
688 | 688 | // d( $rows ); |
689 | 689 | // explode ints by the dash |
690 | - $row_qty = explode( '-', $row_qty ); |
|
691 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
692 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
693 | - $row_qty = array( $row => $qty ); |
|
690 | + $row_qty = explode('-', $row_qty); |
|
691 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
692 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
693 | + $row_qty = array($row => $qty); |
|
694 | 694 | // d( $row_qty ); |
695 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
696 | - if ( ! isset( $row_qty[$x] )) { |
|
695 | + for ($x = 1; $x <= $rows; $x++) { |
|
696 | + if ( ! isset($row_qty[$x])) { |
|
697 | 697 | $row_qty[$x] = 0; |
698 | 698 | } |
699 | 699 | } |
700 | 700 | } |
701 | - ksort( $row_qty ); |
|
701 | + ksort($row_qty); |
|
702 | 702 | // d( $row_qty ); |
703 | 703 | // cycle thru values |
704 | - foreach ( $row_qty as $qty ) { |
|
705 | - $qty = absint( $qty ); |
|
704 | + foreach ($row_qty as $qty) { |
|
705 | + $qty = absint($qty); |
|
706 | 706 | // sanitize as integers |
707 | 707 | $valid_data[$what][] = $qty; |
708 | 708 | $valid_data['total_tickets'] += $qty; |
@@ -713,19 +713,19 @@ discard block |
||
713 | 713 | case 'ticket_id': |
714 | 714 | $value_array = array(); |
715 | 715 | // cycle thru values |
716 | - foreach ( $input_value as $key=>$value ) { |
|
716 | + foreach ($input_value as $key=>$value) { |
|
717 | 717 | // allow only numbers, letters, spaces, commas and dashes |
718 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
718 | + $value_array[$key] = wp_strip_all_tags($value); |
|
719 | 719 | // get ticket via the ticket id we put in the form |
720 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
721 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
720 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
721 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
722 | 722 | } |
723 | - $valid_data[ $what ] = $value_array; |
|
723 | + $valid_data[$what] = $value_array; |
|
724 | 724 | break; |
725 | 725 | |
726 | 726 | case 'return_url' : |
727 | 727 | // grab and sanitize return-url |
728 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
728 | + $valid_data[$what] = esc_url_raw($input_value); |
|
729 | 729 | break; |
730 | 730 | |
731 | 731 | } // end switch $what |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | } // end foreach $inputs_to_clean |
734 | 734 | |
735 | 735 | } else { |
736 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
736 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
737 | 737 | return FALSE; |
738 | 738 | } |
739 | 739 | |
@@ -751,28 +751,28 @@ discard block |
||
751 | 751 | * @param int $qty |
752 | 752 | * @return TRUE on success, FALSE on fail |
753 | 753 | */ |
754 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
755 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
754 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
755 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
756 | 756 | // get the number of spaces left for this datetime ticket |
757 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
757 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
758 | 758 | // compare available spaces against the number of tickets being purchased |
759 | - if ( $available_spaces >= $qty ) { |
|
759 | + if ($available_spaces >= $qty) { |
|
760 | 760 | // allow addons to prevent a ticket from being added to cart |
761 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
761 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
762 | 762 | return false; |
763 | 763 | } |
764 | 764 | // add event to cart |
765 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
766 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
765 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
766 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
767 | 767 | return true; |
768 | 768 | } else { |
769 | 769 | return false; |
770 | 770 | } |
771 | 771 | } else { |
772 | 772 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
773 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
773 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
774 | 774 | // greedy greedy greedy eh? |
775 | - if ( $available_spaces > 0 ) { |
|
775 | + if ($available_spaces > 0) { |
|
776 | 776 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
777 | 777 | EE_Error::add_error( |
778 | 778 | sprintf( |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | __FILE__, __FUNCTION__, __LINE__ |
789 | 789 | ); |
790 | 790 | } else { |
791 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
791 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
792 | 792 | } |
793 | 793 | return false; |
794 | 794 | } |
@@ -806,22 +806,22 @@ discard block |
||
806 | 806 | * @param bool $get_original_ticket_spaces |
807 | 807 | * @return int |
808 | 808 | */ |
809 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
809 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
810 | 810 | // if the $_available_spaces array has not been set up yet... |
811 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
812 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
811 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
812 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
813 | 813 | } |
814 | 814 | $available_spaces = $ticket->qty() - $ticket->sold(); |
815 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
815 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
816 | 816 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
817 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
817 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
818 | 818 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
819 | - if ( $get_original_ticket_spaces ) { |
|
819 | + if ($get_original_ticket_spaces) { |
|
820 | 820 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
821 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
821 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
822 | 822 | } else { |
823 | 823 | // we want the updated ticket availability as stored in the "datetimes" array |
824 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
824 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | } |
@@ -837,23 +837,23 @@ discard block |
||
837 | 837 | * @param EE_Ticket $ticket |
838 | 838 | * @return int |
839 | 839 | */ |
840 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
840 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
841 | 841 | // first, get all of the datetimes that are available to this ticket |
842 | 842 | $datetimes = $ticket->get_many_related( |
843 | 843 | 'Datetime', |
844 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
844 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
845 | 845 | ); |
846 | - if ( ! empty( $datetimes )) { |
|
846 | + if ( ! empty($datetimes)) { |
|
847 | 847 | // now loop thru all of the datetimes |
848 | - foreach ( $datetimes as $datetime ) { |
|
849 | - if ( $datetime instanceof EE_Datetime ) { |
|
848 | + foreach ($datetimes as $datetime) { |
|
849 | + if ($datetime instanceof EE_Datetime) { |
|
850 | 850 | // the number of spaces available for the datetime without considering individual ticket quantities |
851 | 851 | $spaces_remaining = $datetime->spaces_remaining(); |
852 | 852 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
853 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
853 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
854 | 854 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
855 | 855 | // else just take the datetime spaces remaining, and assign to the datetimes array |
856 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
856 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
857 | 857 | } |
858 | 858 | } |
859 | 859 | } |
@@ -869,12 +869,12 @@ discard block |
||
869 | 869 | * @param int $qty |
870 | 870 | * @return int |
871 | 871 | */ |
872 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
873 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
872 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
873 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
874 | 874 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
875 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
875 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
876 | 876 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
877 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
877 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | } |
@@ -891,8 +891,8 @@ discard block |
||
891 | 891 | */ |
892 | 892 | public static function load_tckt_slctr_assets() { |
893 | 893 | // add some style |
894 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
895 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
894 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
895 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
896 | 896 | wp_enqueue_style('ticket_selector'); |
897 | 897 | // make it dance |
898 | 898 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -906,9 +906,9 @@ discard block |
||
906 | 906 | |
907 | 907 | public static function load_tckt_slctr_assets_admin() { |
908 | 908 | //iframe button js on admin event editor page |
909 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
910 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
911 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
909 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
910 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
911 | + wp_enqueue_script('ticket_selector_embed'); |
|
912 | 912 | } |
913 | 913 | } |
914 | 914 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venue_Single |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - EE_Config::register_route( 'venue', 'Venue_Single', 'run' ); |
|
40 | + EE_Config::register_route('venue', 'Venue_Single', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
82 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
83 | 83 | // don't display entry meta because the existing theme will take car of that |
84 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
84 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
85 | 85 | } |
86 | 86 | return $template; |
87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $title |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function the_title( $title = '' ) { |
|
98 | + public function the_title($title = '') { |
|
99 | 99 | return $title; |
100 | 100 | } |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $content |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function venue_details( $content ) { |
|
110 | + public function venue_details($content) { |
|
111 | 111 | global $post; |
112 | 112 | if ( |
113 | 113 | $post->post_type == 'espresso_venues' |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | // it uses the_content() for displaying the $post->post_content |
118 | 118 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
119 | 119 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
120 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
120 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
121 | 121 | // add filters we want |
122 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
122 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
123 | 123 | // now load our template |
124 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
124 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
125 | 125 | // remove other filters we added so they won't get applied to the next post |
126 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
126 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | 127 | } |
128 | 128 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
129 | - return ! empty( $template ) ? $template : $content; |
|
129 | + return ! empty($template) ? $template : $content; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param string $content |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function venue_location( $content ) { |
|
142 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
141 | + public function venue_location($content) { |
|
142 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function wp_enqueue_scripts() { |
154 | 154 | // get some style |
155 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) { |
|
155 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) { |
|
156 | 156 | // first check theme folder |
157 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
158 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
159 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
160 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
157 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
158 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
159 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
160 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
161 | 161 | } |
162 | - wp_enqueue_style( $this->theme ); |
|
163 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
164 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
162 | + wp_enqueue_style($this->theme); |
|
163 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
164 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venues_Archive |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - EE_Config::register_route( 'venues', 'Venues_Archive', 'run' ); |
|
40 | + EE_Config::register_route('venues', 'Venues_Archive', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | 82 | // don't know if theme uses the_excerpt |
83 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
83 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
84 | 84 | // or the_content |
85 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
85 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
86 | 86 | // don't display entry meta because the existing theme will take care of that |
87 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
87 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
88 | 88 | } |
89 | 89 | return $template; |
90 | 90 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $title |
99 | 99 | * @return string |
100 | 100 | */ |
101 | - public function the_title( $title = '' ) { |
|
101 | + public function the_title($title = '') { |
|
102 | 102 | return $title; |
103 | 103 | } |
104 | 104 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param string $content |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - public function venue_details( $content ) { |
|
113 | + public function venue_details($content) { |
|
114 | 114 | global $post; |
115 | 115 | if ( |
116 | 116 | $post->post_type == 'espresso_venues' |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | // it uses the_content() for displaying the $post->post_content |
121 | 121 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
122 | 122 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
123 | - remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
124 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
123 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
124 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
125 | 125 | // add filters we want |
126 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
127 | - add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
126 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
128 | 128 | // now load our template |
129 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
129 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
130 | 130 | //now add our filter back in, plus some others |
131 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
132 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
131 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
132 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
133 | 133 | // remove other filters we added so they won't get applied to the next post |
134 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
135 | - remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
134 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
135 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
136 | 136 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
137 | 137 | } |
138 | - return ! empty( $template ) ? $template : $content; |
|
138 | + return ! empty($template) ? $template : $content; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $content |
148 | 148 | * @return string |
149 | 149 | */ |
150 | - public function venue_location( $content ) { |
|
151 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
150 | + public function venue_location($content) { |
|
151 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function wp_enqueue_scripts() { |
164 | 164 | // get some style |
165 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
|
165 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) { |
|
166 | 166 | // first check theme folder |
167 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
168 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
169 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
170 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
167 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
168 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
169 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
170 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
171 | 171 | } |
172 | - wp_enqueue_style( $this->theme ); |
|
172 | + wp_enqueue_style($this->theme); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Bank extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Bank extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->_pretty_name = __("Bank", 'event_espresso'); |
39 | 39 | parent::__construct($pm_instance); |
40 | 40 | $this->_default_button_url = $this->file_url().'lib'.DS.'bank-logo.png'; |
41 | - $this->_default_description = __( 'Make payment using an electronic funds transfer from your bank.', 'event_espresso' ); |
|
41 | + $this->_default_description = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \EE_Transaction $transaction |
49 | 49 | * @return NULL |
50 | 50 | */ |
51 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
52 | 52 | return NULL; |
53 | 53 | } |
54 | 54 | |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | return new EE_Payment_Method_Form(array( |
63 | 63 | 'extra_meta_inputs'=>array( |
64 | 64 | 'page_title'=>new EE_Text_Input(array( |
65 | - 'html_label_text'=> sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
65 | + 'html_label_text'=> sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
66 | 66 | 'default'=> __("Electronic Funds Transfers", 'event_espresso') |
67 | 67 | )), |
68 | - 'payment_instructions'=>new EE_Text_Area_Input( array( |
|
69 | - 'html_label_text'=> sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
70 | - 'html_help_text' => __( 'Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso' ), |
|
68 | + 'payment_instructions'=>new EE_Text_Area_Input(array( |
|
69 | + 'html_label_text'=> sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
70 | + 'html_help_text' => __('Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso'), |
|
71 | 71 | 'default'=> sprintf( |
72 | 72 | __('Please initiate an electronic payment using the following bank information: %1$sAccount Owner: Luke Skywalker%1$sBank Account # 1234567890%1$sBank Name: Rebellion Bank%1$sRouting Number: 12345%1$sBank Address: 12345 Wookie Rd., Planet Corellian.%1$sPayment must be received within 48 hours of event date.', 'event_espresso'), |
73 | 73 | "\n" |
74 | 74 | ), |
75 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
75 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
76 | 76 | )), |
77 | 77 | ), |
78 | 78 | 'exclude'=>array('PMD_debug_mode') |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @see EE_PMT_Base::help_tabs_config() |
87 | 87 | * @return array |
88 | 88 | */ |
89 | - public function help_tabs_config(){ |
|
89 | + public function help_tabs_config() { |
|
90 | 90 | return array( |
91 | 91 | $this->get_help_tab_name() => array( |
92 | 92 | 'title' => __('Bank Draft Settings', 'event_espresso'), |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * Other gateways may want to override this, such as offline gateways. |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function payment_overview_content(EE_Payment $payment){ |
|
106 | + public function payment_overview_content(EE_Payment $payment) { |
|
107 | 107 | EE_Registry::instance()->load_helper('Template'); |
108 | 108 | $extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array(); |
109 | 109 | $template_vars = array_merge( |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ), |
116 | 116 | $extra_meta_for_payment_method); |
117 | 117 | return EEH_Template::locate_template( |
118 | - 'payment_methods' . DS . 'Bank'. DS . 'templates' . DS . 'bank_payment_details_content.template.php', |
|
118 | + 'payment_methods'.DS.'Bank'.DS.'templates'.DS.'bank_payment_details_content.template.php', |
|
119 | 119 | $template_vars); |
120 | 120 | } |
121 | 121 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Invoice extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Invoice extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct($pm_instance = NULL) { |
38 | 38 | $this->_pretty_name = __("Invoice", 'event_espresso'); |
39 | - $this->_default_description = __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso' ); |
|
39 | + $this->_default_description = __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso'); |
|
40 | 40 | parent::__construct($pm_instance); |
41 | 41 | $this->_default_button_url = $this->file_url().'lib'.DS.'invoice-logo.png'; |
42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \EE_Transaction $transaction |
49 | 49 | * @return NULL |
50 | 50 | */ |
51 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
52 | 52 | return NULL; |
53 | 53 | } |
54 | 54 | |
@@ -61,53 +61,53 @@ discard block |
||
61 | 61 | public function generate_new_settings_form() { |
62 | 62 | $pdf_payee_input_name = 'pdf_payee_name'; |
63 | 63 | $confirmation_text_input_name = 'page_confirmation_text'; |
64 | - $form = new EE_Payment_Method_Form(array( |
|
64 | + $form = new EE_Payment_Method_Form(array( |
|
65 | 65 | // 'payment_method_type' => $this, |
66 | 66 | 'extra_meta_inputs'=>array( |
67 | 67 | $pdf_payee_input_name => new EE_Text_Input(array( |
68 | - 'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link()) |
|
68 | + 'html_label_text' => sprintf(__('Payee Name %s', 'event_espresso'), $this->get_help_tab_link()) |
|
69 | 69 | )), |
70 | 70 | 'pdf_payee_email' => new EE_Email_Input(array( |
71 | - 'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
71 | + 'html_label_text' => sprintf(__('Payee Email %s', 'event_espresso'), $this->get_help_tab_link()), |
|
72 | 72 | )), |
73 | 73 | 'pdf_payee_tax_number' => new EE_Text_Input(array( |
74 | - 'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
74 | + 'html_label_text' => sprintf(__('Payee Tax Number %s', 'event_espresso'), $this->get_help_tab_link()), |
|
75 | 75 | )), |
76 | - 'pdf_payee_address' => new EE_Text_Area_Input( array( |
|
77 | - 'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
78 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
76 | + 'pdf_payee_address' => new EE_Text_Area_Input(array( |
|
77 | + 'html_label_text' => sprintf(__('Payee Address %s', 'event_espresso'), $this->get_help_tab_link()), |
|
78 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
79 | 79 | )), |
80 | 80 | 'pdf_instructions'=>new EE_Text_Area_Input(array( |
81 | - 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
81 | + 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
82 | 82 | 'default'=> __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
83 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
83 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
84 | 84 | )), |
85 | 85 | 'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array( |
86 | - 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
86 | + 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
87 | 87 | 'default'=> EE_Config::instance()->organization->logo_url, |
88 | 88 | 'html_help_text'=> __("(Logo for the top left of the invoice)", 'event_espresso'), |
89 | 89 | )), |
90 | 90 | $confirmation_text_input_name =>new EE_Text_Area_Input(array( |
91 | - 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
91 | + 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
92 | 92 | 'default'=> __("Payment must be received within 48 hours of event date. Details about where to send payment is included on the invoice.", 'event_espresso'), |
93 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
93 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
94 | 94 | )), |
95 | 95 | 'page_extra_info'=>new EE_Text_Area_Input(array( |
96 | - 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
96 | + 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
98 | 98 | )), |
99 | 99 | ), |
100 | 100 | 'include'=>array( |
101 | - 'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order', |
|
102 | - $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image', |
|
101 | + 'PMD_ID', 'PMD_name', 'PMD_desc', 'PMD_admin_name', 'PMD_admin_desc', 'PMD_type', 'PMD_slug', 'PMD_open_by_default', 'PMD_button_url', 'PMD_scope', 'Currency', 'PMD_order', |
|
102 | + $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions', 'pdf_logo_image', |
|
103 | 103 | $confirmation_text_input_name, 'page_extra_info'), |
104 | 104 | )); |
105 | 105 | $form->add_subsections( |
106 | - array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )), |
|
106 | + array('header1' => new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_display.template.php')), |
|
107 | 107 | $pdf_payee_input_name |
108 | 108 | ); |
109 | 109 | $form->add_subsections( |
110 | - array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )), |
|
110 | + array('header2'=>new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php')), |
|
111 | 111 | $confirmation_text_input_name |
112 | 112 | ); |
113 | 113 | return $form; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @see EE_PMT_Base::help_tabs_config() |
121 | 121 | * @return array |
122 | 122 | */ |
123 | - public function help_tabs_config(){ |
|
123 | + public function help_tabs_config() { |
|
124 | 124 | return array( |
125 | 125 | $this->get_help_tab_name() => array( |
126 | 126 | 'title' => __('Invoice Settings', 'event_espresso'), |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | * @param \EE_Payment $payment |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function payment_overview_content( EE_Payment $payment ){ |
|
141 | + public function payment_overview_content(EE_Payment $payment) { |
|
142 | 142 | EE_Registry::instance()->load_helper('Template'); |
143 | 143 | return EEH_Template::locate_template( |
144 | - 'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php', |
|
144 | + 'payment_methods'.DS.'Invoice'.DS.'templates'.DS.'invoice_payment_details_content.template.php', |
|
145 | 145 | array_merge( |
146 | 146 | array( |
147 | 147 | 'payment_method' => $this->_pm_instance, |
148 | 148 | 'payment' => $payment, |
149 | 149 | 'page_confirmation_text' => '', |
150 | 150 | 'page_extra_info' => '', |
151 | - 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url( 'html' ) |
|
151 | + 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url('html') |
|
152 | 152 | ), |
153 | 153 | $this->_pm_instance->all_extra_meta_array() |
154 | 154 | ) |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | * @param WP $WP |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - public function run( WP $WP ) { |
|
55 | - if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) { |
|
54 | + public function run(WP $WP) { |
|
55 | + if (did_action('pre_get_posts') && did_action('send_headers')) { |
|
56 | 56 | global $wp_query; |
57 | 57 | EED_Single_Page_Checkout::load_reg_steps(); |
58 | - EED_Single_Page_Checkout::init( $wp_query ); |
|
58 | + EED_Single_Page_Checkout::init($wp_query); |
|
59 | 59 | } else { |
60 | 60 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
61 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
61 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
62 | 62 | // this will trigger the EED_Single_Page_Checkout module's run() method during the pre_get_posts hook point, |
63 | 63 | // this allows us to initialize things, enqueue assets, etc, |
64 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'init' ), 10, 1 ); |
|
64 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'init'), 10, 1); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param array $attributes |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function process_shortcode( $attributes = array() ) { |
|
77 | + public function process_shortcode($attributes = array()) { |
|
78 | 78 | return EE_Registry::instance()->REQ->get_output(); |
79 | 79 | } |
80 | 80 |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * process_registration_from_admin |
281 | 281 | * |
282 | 282 | * @access public |
283 | - * @return int |
|
283 | + * @return EE_Transaction |
|
284 | 284 | */ |
285 | 285 | public static function process_registration_from_admin() { |
286 | 286 | EED_Single_Page_Checkout::load_reg_steps(); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * _get_transaction_and_cart_for_previous_visit |
609 | 609 | * |
610 | 610 | * @access private |
611 | - * @return mixed EE_Transaction|NULL |
|
611 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
612 | 612 | */ |
613 | 613 | private function _get_transaction_and_cart_for_previous_visit() { |
614 | 614 | /** @var $TXN_model EEM_Transaction */ |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
678 | 678 | * |
679 | 679 | * @access private |
680 | - * @return mixed EE_Transaction|NULL |
|
680 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
681 | 681 | */ |
682 | 682 | private function _initialize_transaction() { |
683 | 683 | try { |
@@ -817,12 +817,12 @@ |
||
817 | 817 | if ( $registration instanceof EE_Registration ) { |
818 | 818 | // we display all attendee info for the primary registrant |
819 | 819 | if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
820 | - && $registration->is_primary_registrant() |
|
820 | + && $registration->is_primary_registrant() |
|
821 | 821 | ) { |
822 | 822 | $this->checkout->primary_revisit = true; |
823 | 823 | break; |
824 | 824 | } else if ( $this->checkout->revisit |
825 | - && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
825 | + && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
826 | 826 | ) { |
827 | 827 | // but hide info if it doesn't belong to you |
828 | 828 | $transaction->clear_cache( 'Registration', $registration->ID() ); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Single Page Checkout (SPCO) |
4 | 4 | * |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @return EED_Single_Page_Checkout |
48 | 48 | */ |
49 | 49 | public static function instance() { |
50 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
51 | - return parent::get_instance( __CLASS__ ); |
|
50 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
51 | + return parent::get_instance(__CLASS__); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -93,22 +93,22 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public static function set_hooks_admin() { |
95 | 95 | EED_Single_Page_Checkout::set_definitions(); |
96 | - if ( defined( 'DOING_AJAX' )) { |
|
96 | + if (defined('DOING_AJAX')) { |
|
97 | 97 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
98 | 98 | ob_start(); |
99 | 99 | EED_Single_Page_Checkout::load_request_handler(); |
100 | 100 | EED_Single_Page_Checkout::load_reg_steps(); |
101 | 101 | } else { |
102 | 102 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
103 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
103 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
104 | 104 | } |
105 | 105 | // set ajax hooks |
106 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
107 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
108 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
109 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
110 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
111 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
106 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
107 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
108 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
109 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
110 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
111 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param string $ajax_action |
120 | 120 | * @throws \EE_Error |
121 | 121 | */ |
122 | - public static function process_ajax_request( $ajax_action ) { |
|
123 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
122 | + public static function process_ajax_request($ajax_action) { |
|
123 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
124 | 124 | EED_Single_Page_Checkout::instance()->_initialize(); |
125 | 125 | } |
126 | 126 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @throws \EE_Error |
133 | 133 | */ |
134 | 134 | public static function display_reg_step() { |
135 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
135 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @throws \EE_Error |
144 | 144 | */ |
145 | 145 | public static function process_reg_step() { |
146 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
146 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @throws \EE_Error |
155 | 155 | */ |
156 | 156 | public static function update_reg_step() { |
157 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
157 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @throws \EE_Error |
168 | 168 | */ |
169 | 169 | public static function update_checkout() { |
170 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
170 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public static function load_request_handler() { |
182 | 182 | // load core Request_Handler class |
183 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
184 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
183 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
184 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | * @throws \EE_Error |
196 | 196 | */ |
197 | 197 | public static function set_definitions() { |
198 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
199 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
200 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
201 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
202 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
203 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
204 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
205 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
198 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
199 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
200 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
201 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
202 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
203 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
204 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
205 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public static function load_reg_steps() { |
219 | 219 | static $reg_steps_loaded = FALSE; |
220 | - if ( $reg_steps_loaded ) { |
|
220 | + if ($reg_steps_loaded) { |
|
221 | 221 | return; |
222 | 222 | } |
223 | 223 | // filter list of reg_steps |
@@ -226,24 +226,24 @@ discard block |
||
226 | 226 | EED_Single_Page_Checkout::get_reg_steps() |
227 | 227 | ); |
228 | 228 | // sort by key (order) |
229 | - ksort( $reg_steps_to_load ); |
|
229 | + ksort($reg_steps_to_load); |
|
230 | 230 | // loop through folders |
231 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
231 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
232 | 232 | // we need a |
233 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
233 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
234 | 234 | // copy over to the reg_steps_array |
235 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
235 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
236 | 236 | // register custom key route for each reg step |
237 | 237 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
238 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
238 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
239 | 239 | // add AJAX or other hooks |
240 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
240 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
241 | 241 | // setup autoloaders if necessary |
242 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
243 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
242 | + if ( ! class_exists($reg_step['class_name'])) { |
|
243 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
244 | 244 | } |
245 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
246 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
245 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
246 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | } |
@@ -262,28 +262,28 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public static function get_reg_steps() { |
264 | 264 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
265 | - if ( empty( $reg_steps )) { |
|
265 | + if (empty($reg_steps)) { |
|
266 | 266 | $reg_steps = array( |
267 | 267 | 10 => array( |
268 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
268 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
269 | 269 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
270 | 270 | 'slug' => 'attendee_information', |
271 | 271 | 'has_hooks' => FALSE |
272 | 272 | ), |
273 | 273 | 20 => array( |
274 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
274 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
275 | 275 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
276 | 276 | 'slug' => 'registration_confirmation', |
277 | 277 | 'has_hooks' => FALSE |
278 | 278 | ), |
279 | 279 | 30 => array( |
280 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
280 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
281 | 281 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
282 | 282 | 'slug' => 'payment_options', |
283 | 283 | 'has_hooks' => TRUE |
284 | 284 | ), |
285 | 285 | 999 => array( |
286 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
286 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
287 | 287 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
288 | 288 | 'slug' => 'finalize_registration', |
289 | 289 | 'has_hooks' => FALSE |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public static function registration_checkout_for_admin() { |
306 | 306 | EED_Single_Page_Checkout::load_reg_steps(); |
307 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
308 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
309 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
307 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
308 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
309 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
310 | 310 | EED_Single_Page_Checkout::instance()->_initialize(); |
311 | 311 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
312 | 312 | return EE_Registry::instance()->REQ->get_output(); |
@@ -323,15 +323,15 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public static function process_registration_from_admin() { |
325 | 325 | EED_Single_Page_Checkout::load_reg_steps(); |
326 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
327 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
328 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
326 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
327 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
328 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
329 | 329 | EED_Single_Page_Checkout::instance()->_initialize(); |
330 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
331 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
332 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
333 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
334 | - if ( $final_reg_step->process_reg_step() ) { |
|
330 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
331 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
332 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
333 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
334 | + if ($final_reg_step->process_reg_step()) { |
|
335 | 335 | $final_reg_step->set_completed(); |
336 | 336 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
337 | 337 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | * @return void |
352 | 352 | * @throws \EE_Error |
353 | 353 | */ |
354 | - public function run( $WP_Query ) { |
|
354 | + public function run($WP_Query) { |
|
355 | 355 | if ( |
356 | 356 | $WP_Query instanceof WP_Query |
357 | 357 | && $WP_Query->is_main_query() |
358 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
358 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
359 | 359 | ) { |
360 | 360 | $this->_initialize(); |
361 | 361 | } |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @return void |
372 | 372 | * @throws \EE_Error |
373 | 373 | */ |
374 | - public static function init( $WP_Query ) { |
|
375 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
374 | + public static function init($WP_Query) { |
|
375 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,34 +386,34 @@ discard block |
||
386 | 386 | */ |
387 | 387 | private function _initialize() { |
388 | 388 | // ensure SPCO doesn't run twice |
389 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
389 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
390 | 390 | return; |
391 | 391 | } |
392 | 392 | try { |
393 | 393 | // setup the EE_Checkout object |
394 | 394 | $this->checkout = $this->_initialize_checkout(); |
395 | 395 | // filter checkout |
396 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
396 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
397 | 397 | // get the $_GET |
398 | 398 | $this->_get_request_vars(); |
399 | 399 | // filter continue_reg |
400 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
400 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
401 | 401 | // load the reg steps array |
402 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
402 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
403 | 403 | EED_Single_Page_Checkout::$_initialized = true; |
404 | 404 | return; |
405 | 405 | } |
406 | 406 | // set the current step |
407 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
407 | + $this->checkout->set_current_step($this->checkout->step); |
|
408 | 408 | // and the next step |
409 | 409 | $this->checkout->set_next_step(); |
410 | 410 | // was there already a valid transaction in the checkout from the session ? |
411 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
411 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
412 | 412 | // get transaction from db or session |
413 | 413 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
414 | 414 | ? $this->_get_transaction_and_cart_for_previous_visit() |
415 | 415 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
416 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
416 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
417 | 417 | // add some style and make it dance |
418 | 418 | $this->checkout->transaction = EE_Transaction::new_instance(); |
419 | 419 | $this->add_styles_and_scripts(); |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | return; |
422 | 422 | } |
423 | 423 | // and the registrations for the transaction |
424 | - $this->_get_registrations( $this->checkout->transaction ); |
|
424 | + $this->_get_registrations($this->checkout->transaction); |
|
425 | 425 | } |
426 | 426 | // verify that everything has been setup correctly |
427 | - if ( ! $this->_final_verifications() ) { |
|
427 | + if ( ! $this->_final_verifications()) { |
|
428 | 428 | EED_Single_Page_Checkout::$_initialized = true; |
429 | 429 | return; |
430 | 430 | } |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | // set no cache headers and constants |
450 | 450 | EE_System::do_not_cache(); |
451 | 451 | // add anchor |
452 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
453 | - } catch ( Exception $e ) { |
|
454 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
452 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
453 | + } catch (Exception $e) { |
|
454 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
@@ -469,20 +469,20 @@ discard block |
||
469 | 469 | // look in session for existing checkout |
470 | 470 | $checkout = EE_Registry::instance()->SSN->checkout(); |
471 | 471 | // verify |
472 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
472 | + if ( ! $checkout instanceof EE_Checkout) { |
|
473 | 473 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
474 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
474 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
475 | 475 | } else { |
476 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
476 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
477 | 477 | $this->unlock_transaction(); |
478 | - wp_safe_redirect( $checkout->redirect_url ); |
|
478 | + wp_safe_redirect($checkout->redirect_url); |
|
479 | 479 | exit(); |
480 | 480 | } |
481 | 481 | } |
482 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
482 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
483 | 483 | // verify again |
484 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
485 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
484 | + if ( ! $checkout instanceof EE_Checkout) { |
|
485 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
486 | 486 | } |
487 | 487 | // reset anything that needs a clean slate for each request |
488 | 488 | $checkout->reset_for_current_request(); |
@@ -502,24 +502,24 @@ discard block |
||
502 | 502 | // load classes |
503 | 503 | EED_Single_Page_Checkout::load_request_handler(); |
504 | 504 | //make sure this request is marked as belonging to EE |
505 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
505 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
506 | 506 | // which step is being requested ? |
507 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
507 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
508 | 508 | // which step is being edited ? |
509 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
509 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
510 | 510 | // and what we're doing on the current step |
511 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
511 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
512 | 512 | // returning to edit ? |
513 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
513 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
514 | 514 | // or some other kind of revisit ? |
515 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
515 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
516 | 516 | // and whether or not to generate a reg form for this request |
517 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
517 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
518 | 518 | // and whether or not to process a reg form submission for this request |
519 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
519 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
520 | 520 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
521 | 521 | ? $this->checkout->process_form_submission |
522 | - : FALSE; // TRUE FALSE |
|
522 | + : FALSE; // TRUE FALSE |
|
523 | 523 | // $this->_display_request_vars(); |
524 | 524 | } |
525 | 525 | |
@@ -532,17 +532,17 @@ discard block |
||
532 | 532 | * @return void |
533 | 533 | */ |
534 | 534 | protected function _display_request_vars() { |
535 | - if ( ! WP_DEBUG ) { |
|
535 | + if ( ! WP_DEBUG) { |
|
536 | 536 | return; |
537 | 537 | } |
538 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
539 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
540 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
541 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
542 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
543 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
544 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
545 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
538 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
539 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
540 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
541 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
542 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
543 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
544 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
545 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | * @return array |
557 | 557 | */ |
558 | 558 | private function _get_first_step() { |
559 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
560 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
559 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
560 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -573,27 +573,27 @@ discard block |
||
573 | 573 | private function _load_and_instantiate_reg_steps() { |
574 | 574 | // have reg_steps already been instantiated ? |
575 | 575 | if ( |
576 | - empty( $this->checkout->reg_steps ) || |
|
577 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
576 | + empty($this->checkout->reg_steps) || |
|
577 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
578 | 578 | ) { |
579 | 579 | // if not, then loop through raw reg steps array |
580 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
581 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
580 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
581 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
582 | 582 | return false; |
583 | 583 | } |
584 | 584 | } |
585 | 585 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
586 | 586 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
587 | 587 | // skip the registration_confirmation page ? |
588 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
588 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
589 | 589 | // just remove it from the reg steps array |
590 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
590 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
591 | 591 | } else if ( |
592 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
592 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
593 | 593 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
594 | 594 | ) { |
595 | 595 | // set the order to something big like 100 |
596 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
596 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
597 | 597 | } |
598 | 598 | // filter the array for good luck |
599 | 599 | $this->checkout->reg_steps = apply_filters( |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | // finally re-sort based on the reg step class order properties |
604 | 604 | $this->checkout->sort_reg_steps(); |
605 | 605 | } else { |
606 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
606 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
607 | 607 | // set all current step stati to FALSE |
608 | - $reg_step->set_is_current_step( FALSE ); |
|
608 | + $reg_step->set_is_current_step(FALSE); |
|
609 | 609 | } |
610 | 610 | } |
611 | - if ( empty( $this->checkout->reg_steps )) { |
|
612 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
611 | + if (empty($this->checkout->reg_steps)) { |
|
612 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
613 | 613 | return false; |
614 | 614 | } |
615 | 615 | // make reg step details available to JS |
@@ -627,10 +627,10 @@ discard block |
||
627 | 627 | * @param int $order |
628 | 628 | * @return bool |
629 | 629 | */ |
630 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
630 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
631 | 631 | |
632 | 632 | // we need a file_path, class_name, and slug to add a reg step |
633 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
633 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
634 | 634 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
635 | 635 | if ( |
636 | 636 | $this->checkout->reg_url_link |
@@ -648,26 +648,26 @@ discard block |
||
648 | 648 | FALSE |
649 | 649 | ); |
650 | 650 | // did we gets the goods ? |
651 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
651 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
652 | 652 | // set reg step order based on config |
653 | - $reg_step_obj->set_order( $order ); |
|
653 | + $reg_step_obj->set_order($order); |
|
654 | 654 | // add instantiated reg step object to the master reg steps array |
655 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
655 | + $this->checkout->add_reg_step($reg_step_obj); |
|
656 | 656 | } else { |
657 | 657 | EE_Error::add_error( |
658 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
658 | + __('The current step could not be set.', 'event_espresso'), |
|
659 | 659 | __FILE__, __FUNCTION__, __LINE__ |
660 | 660 | ); |
661 | 661 | return false; |
662 | 662 | } |
663 | 663 | } else { |
664 | - if ( WP_DEBUG ) { |
|
664 | + if (WP_DEBUG) { |
|
665 | 665 | EE_Error::add_error( |
666 | 666 | sprintf( |
667 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
668 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
669 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
670 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
667 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
668 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
669 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
670 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
671 | 671 | '<ul>', |
672 | 672 | '<li>', |
673 | 673 | '</li>', |
@@ -691,16 +691,16 @@ discard block |
||
691 | 691 | */ |
692 | 692 | private function _get_transaction_and_cart_for_previous_visit() { |
693 | 693 | /** @var $TXN_model EEM_Transaction */ |
694 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
694 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
695 | 695 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
696 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
696 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
697 | 697 | // verify transaction |
698 | - if ( $transaction instanceof EE_Transaction ) { |
|
698 | + if ($transaction instanceof EE_Transaction) { |
|
699 | 699 | // and get the cart that was used for that transaction |
700 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
700 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
701 | 701 | return $transaction; |
702 | 702 | } else { |
703 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
703 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
704 | 704 | return NULL; |
705 | 705 | } |
706 | 706 | } |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | * @param EE_Transaction $transaction |
715 | 715 | * @return EE_Cart |
716 | 716 | */ |
717 | - private function _get_cart_for_transaction( $transaction ) { |
|
718 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
717 | + private function _get_cart_for_transaction($transaction) { |
|
718 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
@@ -727,8 +727,8 @@ discard block |
||
727 | 727 | * @param EE_Transaction $transaction |
728 | 728 | * @return EE_Cart |
729 | 729 | */ |
730 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
731 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
730 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
731 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | |
@@ -744,17 +744,17 @@ discard block |
||
744 | 744 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
745 | 745 | // if there's no transaction, then this is the FIRST visit to SPCO |
746 | 746 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
747 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
747 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
748 | 748 | // and then create a new transaction |
749 | 749 | $transaction = $this->_initialize_transaction(); |
750 | 750 | // verify transaction |
751 | - if ( $transaction instanceof EE_Transaction ) { |
|
751 | + if ($transaction instanceof EE_Transaction) { |
|
752 | 752 | // save it so that we have an ID for other objects to use |
753 | 753 | $transaction->save(); |
754 | 754 | // and save TXN data to the cart |
755 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
755 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
756 | 756 | } else { |
757 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
757 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
758 | 758 | } |
759 | 759 | return $transaction; |
760 | 760 | } |
@@ -774,15 +774,15 @@ discard block |
||
774 | 774 | // grab the cart grand total |
775 | 775 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
776 | 776 | // create new TXN |
777 | - return EE_Transaction::new_instance( array( |
|
777 | + return EE_Transaction::new_instance(array( |
|
778 | 778 | 'TXN_timestamp' => time(), |
779 | 779 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
780 | 780 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
781 | 781 | 'TXN_paid' => 0, |
782 | 782 | 'STS_ID' => EEM_Transaction::failed_status_code, |
783 | 783 | )); |
784 | - } catch( Exception $e ) { |
|
785 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
784 | + } catch (Exception $e) { |
|
785 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
786 | 786 | } |
787 | 787 | return NULL; |
788 | 788 | } |
@@ -797,38 +797,38 @@ discard block |
||
797 | 797 | * @return EE_Cart |
798 | 798 | * @throws \EE_Error |
799 | 799 | */ |
800 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
800 | + private function _get_registrations(EE_Transaction $transaction) { |
|
801 | 801 | // first step: grab the registrants { : o |
802 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
802 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
803 | 803 | // verify registrations have been set |
804 | - if ( empty( $registrations )) { |
|
804 | + if (empty($registrations)) { |
|
805 | 805 | // if no cached registrations, then check the db |
806 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
806 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
807 | 807 | // still nothing ? well as long as this isn't a revisit |
808 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
808 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
809 | 809 | // generate new registrations from scratch |
810 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
810 | + $registrations = $this->_initialize_registrations($transaction); |
|
811 | 811 | } |
812 | 812 | } |
813 | 813 | // sort by their original registration order |
814 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
814 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
815 | 815 | // then loop thru the array |
816 | - foreach ( $registrations as $registration ) { |
|
816 | + foreach ($registrations as $registration) { |
|
817 | 817 | // verify each registration |
818 | - if ( $registration instanceof EE_Registration ) { |
|
818 | + if ($registration instanceof EE_Registration) { |
|
819 | 819 | // we display all attendee info for the primary registrant |
820 | - if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
|
820 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
821 | 821 | && $registration->is_primary_registrant() |
822 | 822 | ) { |
823 | 823 | $this->checkout->primary_revisit = true; |
824 | 824 | break; |
825 | - } else if ( $this->checkout->revisit |
|
825 | + } else if ($this->checkout->revisit |
|
826 | 826 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
827 | 827 | ) { |
828 | 828 | // but hide info if it doesn't belong to you |
829 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
829 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
830 | 830 | } |
831 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
831 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
832 | 832 | } |
833 | 833 | } |
834 | 834 | } |
@@ -843,17 +843,17 @@ discard block |
||
843 | 843 | * @return array |
844 | 844 | * @throws \EE_Error |
845 | 845 | */ |
846 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
846 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
847 | 847 | $att_nmbr = 0; |
848 | 848 | $registrations = array(); |
849 | - if ( $transaction instanceof EE_Transaction ) { |
|
849 | + if ($transaction instanceof EE_Transaction) { |
|
850 | 850 | /** @type EE_Registration_Processor $registration_processor */ |
851 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
851 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
852 | 852 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
853 | 853 | // now let's add the cart items to the $transaction |
854 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
854 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
855 | 855 | //do the following for each ticket of this type they selected |
856 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
856 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
857 | 857 | $att_nmbr++; |
858 | 858 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
859 | 859 | $line_item, |
@@ -861,12 +861,12 @@ discard block |
||
861 | 861 | $att_nmbr, |
862 | 862 | $this->checkout->total_ticket_count |
863 | 863 | ); |
864 | - if ( $registration instanceof EE_Registration ) { |
|
865 | - $registrations[ $registration->ID() ] = $registration; |
|
864 | + if ($registration instanceof EE_Registration) { |
|
865 | + $registrations[$registration->ID()] = $registration; |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | } |
869 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
869 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
870 | 870 | } |
871 | 871 | return $registrations; |
872 | 872 | } |
@@ -881,12 +881,12 @@ discard block |
||
881 | 881 | * @param EE_Registration $reg_B |
882 | 882 | * @return array() |
883 | 883 | */ |
884 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
884 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
885 | 885 | // this shouldn't ever happen within the same TXN, but oh well |
886 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
886 | + if ($reg_A->count() === $reg_B->count()) { |
|
887 | 887 | return 0; |
888 | 888 | } |
889 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
889 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | |
@@ -901,21 +901,21 @@ discard block |
||
901 | 901 | */ |
902 | 902 | private function _final_verifications() { |
903 | 903 | // filter checkout |
904 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
904 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
905 | 905 | //verify that current step is still set correctly |
906 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
907 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
906 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
907 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
908 | 908 | return false; |
909 | 909 | } |
910 | 910 | // if returning to SPCO, then verify that primary registrant is set |
911 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
911 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
912 | 912 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
913 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
914 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
913 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
914 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
915 | 915 | return false; |
916 | 916 | } |
917 | 917 | $valid_registrant = null; |
918 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
918 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
919 | 919 | if ( |
920 | 920 | $registration instanceof EE_Registration |
921 | 921 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -923,9 +923,9 @@ discard block |
||
923 | 923 | $valid_registrant = $registration; |
924 | 924 | } |
925 | 925 | } |
926 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
926 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
927 | 927 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
928 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
928 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
929 | 929 | // clear the session, mark the checkout as unverified, and try again |
930 | 930 | EE_Registry::instance()->SSN->clear_session(); |
931 | 931 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -934,13 +934,13 @@ discard block |
||
934 | 934 | EE_Error::reset_notices(); |
935 | 935 | return false; |
936 | 936 | } |
937 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
937 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
938 | 938 | return false; |
939 | 939 | } |
940 | 940 | } |
941 | 941 | // now that things have been kinda sufficiently verified, |
942 | 942 | // let's add the checkout to the session so that's available other systems |
943 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
943 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
944 | 944 | return true; |
945 | 945 | } |
946 | 946 | |
@@ -955,28 +955,28 @@ discard block |
||
955 | 955 | * @param bool $reinitializing |
956 | 956 | * @throws \EE_Error |
957 | 957 | */ |
958 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
959 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
958 | + private function _initialize_reg_steps($reinitializing = false) { |
|
959 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
960 | 960 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
961 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
962 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
961 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
962 | + if ( ! $reg_step->initialize_reg_step()) { |
|
963 | 963 | // if not initialized then maybe this step is being removed... |
964 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
964 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
965 | 965 | // if it was the current step, then we need to start over here |
966 | - $this->_initialize_reg_steps( true ); |
|
966 | + $this->_initialize_reg_steps(true); |
|
967 | 967 | return; |
968 | 968 | } |
969 | 969 | continue; |
970 | 970 | } |
971 | 971 | // i18n |
972 | 972 | $reg_step->translate_js_strings(); |
973 | - if ( $reg_step->is_current_step() ) { |
|
973 | + if ($reg_step->is_current_step()) { |
|
974 | 974 | // the text that appears on the reg step form submit button |
975 | 975 | $reg_step->set_submit_button_text(); |
976 | 976 | } |
977 | 977 | } |
978 | 978 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
979 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
979 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
980 | 980 | } |
981 | 981 | |
982 | 982 | |
@@ -989,43 +989,43 @@ discard block |
||
989 | 989 | */ |
990 | 990 | private function _check_form_submission() { |
991 | 991 | //does this request require the reg form to be generated ? |
992 | - if ( $this->checkout->generate_reg_form ) { |
|
992 | + if ($this->checkout->generate_reg_form) { |
|
993 | 993 | // ever heard that song by Blue Rodeo ? |
994 | 994 | try { |
995 | 995 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
996 | 996 | // if not displaying a form, then check for form submission |
997 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
997 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
998 | 998 | // clear out any old data in case this step is being run again |
999 | - $this->checkout->current_step->set_valid_data( array() ); |
|
999 | + $this->checkout->current_step->set_valid_data(array()); |
|
1000 | 1000 | // capture submitted form data |
1001 | 1001 | $this->checkout->current_step->reg_form->receive_form_submission( |
1002 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1002 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1003 | 1003 | ); |
1004 | 1004 | // validate submitted form data |
1005 | - if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1005 | + if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1006 | 1006 | // thou shall not pass !!! |
1007 | 1007 | $this->checkout->continue_reg = FALSE; |
1008 | 1008 | // any form validation errors? |
1009 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1009 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1010 | 1010 | $submission_error_messages = array(); |
1011 | 1011 | // bad, bad, bad registrant |
1012 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1013 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1012 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1013 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1014 | 1014 | $submission_error_messages[] = sprintf( |
1015 | - __( '%s : %s', 'event_espresso' ), |
|
1015 | + __('%s : %s', 'event_espresso'), |
|
1016 | 1016 | $validation_error->get_form_section()->html_label_text(), |
1017 | 1017 | $validation_error->getMessage() |
1018 | 1018 | ); |
1019 | 1019 | } |
1020 | 1020 | } |
1021 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1021 | + EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1022 | 1022 | } |
1023 | 1023 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1024 | 1024 | $this->go_to_next_step(); |
1025 | 1025 | return; |
1026 | 1026 | } |
1027 | 1027 | } |
1028 | - } catch( EE_Error $e ) { |
|
1028 | + } catch (EE_Error $e) { |
|
1029 | 1029 | $e->get_error(); |
1030 | 1030 | } |
1031 | 1031 | } |
@@ -1042,22 +1042,22 @@ discard block |
||
1042 | 1042 | */ |
1043 | 1043 | private function _process_form_action() { |
1044 | 1044 | // what cha wanna do? |
1045 | - switch( $this->checkout->action ) { |
|
1045 | + switch ($this->checkout->action) { |
|
1046 | 1046 | // AJAX next step reg form |
1047 | 1047 | case 'display_spco_reg_step' : |
1048 | 1048 | $this->checkout->redirect = FALSE; |
1049 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1050 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1049 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1050 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1051 | 1051 | } |
1052 | 1052 | break; |
1053 | 1053 | |
1054 | 1054 | default : |
1055 | 1055 | // meh... do one of those other steps first |
1056 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1056 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1057 | 1057 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1058 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1058 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1059 | 1059 | // call action on current step |
1060 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1060 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1061 | 1061 | // good registrant, you get to proceed |
1062 | 1062 | if ( |
1063 | 1063 | $this->checkout->current_step->success_message() !== '' |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | ) { |
1069 | 1069 | EE_Error::add_success( |
1070 | 1070 | $this->checkout->current_step->success_message() |
1071 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1071 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1072 | 1072 | ); |
1073 | 1073 | |
1074 | 1074 | } |
@@ -1076,12 +1076,12 @@ discard block |
||
1076 | 1076 | $this->_setup_redirect(); |
1077 | 1077 | } |
1078 | 1078 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1079 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1079 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1080 | 1080 | |
1081 | 1081 | } else { |
1082 | 1082 | EE_Error::add_error( |
1083 | 1083 | sprintf( |
1084 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1084 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1085 | 1085 | $this->checkout->action, |
1086 | 1086 | $this->checkout->current_step->name() |
1087 | 1087 | ), |
@@ -1107,10 +1107,10 @@ discard block |
||
1107 | 1107 | public function add_styles_and_scripts() { |
1108 | 1108 | // i18n |
1109 | 1109 | $this->translate_js_strings(); |
1110 | - if ( $this->checkout->admin_request ) { |
|
1111 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1110 | + if ($this->checkout->admin_request) { |
|
1111 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1112 | 1112 | } else { |
1113 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1113 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1114 | 1114 | } |
1115 | 1115 | } |
1116 | 1116 | |
@@ -1126,42 +1126,42 @@ discard block |
||
1126 | 1126 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1127 | 1127 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1128 | 1128 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1129 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1130 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1131 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1129 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1130 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1131 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1132 | 1132 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1133 | 1133 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1134 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1135 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1134 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1135 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1136 | 1136 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1137 | 1137 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1138 | 1138 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1139 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1140 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1141 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1142 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1143 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1144 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1145 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1146 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1147 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1148 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1149 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1150 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1151 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1152 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1139 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1140 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1141 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1142 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1143 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1144 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1145 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1146 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1147 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1148 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1149 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1150 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1151 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1152 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1153 | 1153 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1154 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1154 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1155 | 1155 | '<h4 class="important-notice">', |
1156 | 1156 | '</h4>', |
1157 | 1157 | '<br />', |
1158 | 1158 | '<p>', |
1159 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1159 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1160 | 1160 | '">', |
1161 | 1161 | '</a>', |
1162 | 1162 | '</p>' |
1163 | 1163 | ); |
1164 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1164 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | |
@@ -1174,25 +1174,25 @@ discard block |
||
1174 | 1174 | */ |
1175 | 1175 | public function enqueue_styles_and_scripts() { |
1176 | 1176 | // load css |
1177 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1178 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1177 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1178 | + wp_enqueue_style('single_page_checkout'); |
|
1179 | 1179 | // load JS |
1180 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1181 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1182 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1183 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1180 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1181 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1182 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1183 | + wp_enqueue_script('single_page_checkout'); |
|
1184 | 1184 | |
1185 | 1185 | /** |
1186 | 1186 | * global action hook for enqueueing styles and scripts with |
1187 | 1187 | * spco calls. |
1188 | 1188 | */ |
1189 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1189 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1190 | 1190 | |
1191 | 1191 | /** |
1192 | 1192 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1193 | 1193 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1194 | 1194 | */ |
1195 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1195 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1196 | 1196 | |
1197 | 1197 | // add css and JS for current step |
1198 | 1198 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1209,19 +1209,19 @@ discard block |
||
1209 | 1209 | */ |
1210 | 1210 | private function _display_spco_reg_form() { |
1211 | 1211 | // if registering via the admin, just display the reg form for the current step |
1212 | - if ( $this->checkout->admin_request ) { |
|
1213 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1212 | + if ($this->checkout->admin_request) { |
|
1213 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1214 | 1214 | } else { |
1215 | 1215 | // add powered by EE msg |
1216 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1216 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1217 | 1217 | |
1218 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1218 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1219 | 1219 | $cookies_not_set_msg = ''; |
1220 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1220 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1221 | 1221 | $cookies_not_set_msg = apply_filters( |
1222 | 1222 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1223 | 1223 | sprintf( |
1224 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1224 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1225 | 1225 | '<div class="ee-attention">', |
1226 | 1226 | '</div>', |
1227 | 1227 | '<h6 class="important-notice">', |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | 'layout_strategy' => |
1242 | 1242 | new EE_Template_Layout( |
1243 | 1243 | array( |
1244 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1244 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1245 | 1245 | 'template_args' => array( |
1246 | 1246 | 'empty_cart' => $empty_cart, |
1247 | 1247 | 'revisit' => $this->checkout->revisit, |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | 'empty_msg' => apply_filters( |
1251 | 1251 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1252 | 1252 | sprintf( |
1253 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1254 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1253 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1254 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1255 | 1255 | '">', |
1256 | 1256 | '</a>' |
1257 | 1257 | ) |
@@ -1259,14 +1259,14 @@ discard block |
||
1259 | 1259 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1260 | 1260 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1261 | 1261 | 'session_expiration' => |
1262 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1262 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1263 | 1263 | ) |
1264 | 1264 | ) |
1265 | 1265 | ) |
1266 | 1266 | ) |
1267 | 1267 | ); |
1268 | 1268 | // load template and add to output sent that gets filtered into the_content() |
1269 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1269 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1270 | 1270 | } |
1271 | 1271 | } |
1272 | 1272 | |
@@ -1280,8 +1280,8 @@ discard block |
||
1280 | 1280 | * @internal param string $label |
1281 | 1281 | * @return string |
1282 | 1282 | */ |
1283 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1284 | - if ( $next_step === 'finalize_registration' ) { |
|
1283 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1284 | + if ($next_step === 'finalize_registration') { |
|
1285 | 1285 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1286 | 1286 | } |
1287 | 1287 | } |
@@ -1295,18 +1295,18 @@ discard block |
||
1295 | 1295 | * @return string |
1296 | 1296 | */ |
1297 | 1297 | public static function display_registration_footer() { |
1298 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1299 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1300 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1301 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1298 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1299 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1300 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1301 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1302 | 1302 | echo apply_filters( |
1303 | 1303 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1304 | 1304 | sprintf( |
1305 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1306 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1305 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1306 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1307 | 1307 | '" target="_blank">', |
1308 | 1308 | '</a>', |
1309 | - '<a href="' . $url . '" title="', |
|
1309 | + '<a href="'.$url.'" title="', |
|
1310 | 1310 | '" target="_blank">', |
1311 | 1311 | '</a></div>' |
1312 | 1312 | ) |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | * @throws \EE_Error |
1325 | 1325 | */ |
1326 | 1326 | public function unlock_transaction() { |
1327 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1327 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1328 | 1328 | $this->checkout->transaction->unlock(); |
1329 | 1329 | } |
1330 | 1330 | } |
@@ -1339,12 +1339,12 @@ discard block |
||
1339 | 1339 | * @return array |
1340 | 1340 | */ |
1341 | 1341 | private function _setup_redirect() { |
1342 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1342 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1343 | 1343 | $this->checkout->redirect = TRUE; |
1344 | - if ( empty( $this->checkout->redirect_url )) { |
|
1344 | + if (empty($this->checkout->redirect_url)) { |
|
1345 | 1345 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1346 | 1346 | } |
1347 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1347 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1348 | 1348 | } |
1349 | 1349 | } |
1350 | 1350 | |
@@ -1358,9 +1358,9 @@ discard block |
||
1358 | 1358 | * @throws \EE_Error |
1359 | 1359 | */ |
1360 | 1360 | public function go_to_next_step() { |
1361 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1361 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1362 | 1362 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1363 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1363 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1364 | 1364 | } |
1365 | 1365 | $this->unlock_transaction(); |
1366 | 1366 | // just return for these conditions |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | */ |
1390 | 1390 | protected function _handle_json_response() { |
1391 | 1391 | // if this is an ajax request |
1392 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1392 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1393 | 1393 | // DEBUG LOG |
1394 | 1394 | //$this->checkout->log( |
1395 | 1395 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1402,7 +1402,7 @@ discard block |
||
1402 | 1402 | $this->checkout->json_response->set_registration_time_limit( |
1403 | 1403 | $this->checkout->get_registration_time_limit() |
1404 | 1404 | ); |
1405 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1405 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1406 | 1406 | // just send the ajax ( |
1407 | 1407 | $json_response = apply_filters( |
1408 | 1408 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1423,9 +1423,9 @@ discard block |
||
1423 | 1423 | */ |
1424 | 1424 | protected function _handle_html_redirects() { |
1425 | 1425 | // going somewhere ? |
1426 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1426 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1427 | 1427 | // store notices in a transient |
1428 | - EE_Error::get_notices( false, true, true ); |
|
1428 | + EE_Error::get_notices(false, true, true); |
|
1429 | 1429 | // DEBUG LOG |
1430 | 1430 | //$this->checkout->log( |
1431 | 1431 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1435,7 +1435,7 @@ discard block |
||
1435 | 1435 | // 'headers_list' => headers_list(), |
1436 | 1436 | // ) |
1437 | 1437 | //); |
1438 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1438 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1439 | 1439 | exit(); |
1440 | 1440 | } |
1441 | 1441 | } |
@@ -6,11 +6,11 @@ |
||
6 | 6 | <li class="ticket-registration"> |
7 | 7 | <table class="registration-details"> |
8 | 8 | <tr class="odd"> |
9 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
9 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
10 | 10 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
11 | 11 | </tr> |
12 | 12 | <tr> |
13 | - <th><?php _e("Registration Code:", "event_espresso");?></th> |
|
13 | + <th><?php _e("Registration Code:", "event_espresso"); ?></th> |
|
14 | 14 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
15 | 15 | </tr> |
16 | 16 | </table> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @param EE_Line_Item $line_item |
18 | 18 | * @param array $options |
19 | - * @return mixed |
|
19 | + * @return string |
|
20 | 20 | */ |
21 | 21 | public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
22 | 22 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param EE_Line_Item $line_item |
96 | 96 | * @param array $options |
97 | - * @return mixed |
|
97 | + * @return string |
|
98 | 98 | */ |
99 | 99 | private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
100 | 100 | // start of row |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param EE_Line_Item $line_item |
125 | 125 | * @param array $options |
126 | - * @return mixed |
|
126 | + * @return string |
|
127 | 127 | */ |
128 | 128 | private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
129 | 129 | // start of row |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param EE_Line_Item $line_item |
155 | 155 | * @param array $options |
156 | - * @return mixed |
|
156 | + * @return string |
|
157 | 157 | */ |
158 | 158 | private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
159 | 159 | // start of row |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param EE_Line_Item $line_item |
180 | 180 | * @param string $text |
181 | 181 | * @param array $options |
182 | - * @return mixed |
|
182 | + * @return string |
|
183 | 183 | */ |
184 | 184 | private function _total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
185 | 185 | // colspan |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * _separator_row |
204 | 204 | * |
205 | 205 | * @param array $options |
206 | - * @return mixed |
|
206 | + * @return string |
|
207 | 207 | */ |
208 | 208 | private function _separator_row( $options = array() ) { |
209 | 209 | // colspan |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param array $options |
50 | 50 | * @return mixed |
51 | 51 | */ |
52 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
52 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
53 | 53 | |
54 | 54 | $html = ''; |
55 | 55 | // set some default options and merge with incoming |
@@ -60,40 +60,40 @@ discard block |
||
60 | 60 | 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr', |
61 | 61 | 'total_tr_css_class' => 'admin-primary-mbox-total-tr' |
62 | 62 | ); |
63 | - $options = array_merge( $default_options, (array)$options ); |
|
63 | + $options = array_merge($default_options, (array) $options); |
|
64 | 64 | |
65 | - switch( $line_item->type() ) { |
|
65 | + switch ($line_item->type()) { |
|
66 | 66 | |
67 | 67 | case EEM_Line_Item::type_line_item: |
68 | 68 | // item row |
69 | - $html .= $this->_item_row( $line_item, $options ); |
|
69 | + $html .= $this->_item_row($line_item, $options); |
|
70 | 70 | break; |
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_sub_line_item: |
73 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
73 | + $html .= $this->_sub_item_row($line_item, $options); |
|
74 | 74 | break; |
75 | 75 | |
76 | 76 | case EEM_Line_Item::type_sub_total: |
77 | 77 | //loop through children |
78 | 78 | $child_line_items = $line_item->children(); |
79 | 79 | //loop through children |
80 | - foreach ( $child_line_items as $child_line_item ) { |
|
80 | + foreach ($child_line_items as $child_line_item) { |
|
81 | 81 | //recursively feed children back into this method |
82 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
82 | + $html .= $this->display_line_item($child_line_item, $options); |
|
83 | 83 | } |
84 | - $html .= $this->_sub_total_row( $line_item, $options ); |
|
84 | + $html .= $this->_sub_total_row($line_item, $options); |
|
85 | 85 | break; |
86 | 86 | |
87 | 87 | case EEM_Line_Item::type_tax: |
88 | - if ( $this->_show_taxes ) { |
|
89 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
88 | + if ($this->_show_taxes) { |
|
89 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
90 | 90 | } |
91 | 91 | break; |
92 | 92 | |
93 | 93 | case EEM_Line_Item::type_tax_sub_total: |
94 | - foreach( $line_item->children() as $child_line_item ) { |
|
95 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
96 | - $this->display_line_item( $child_line_item, $options ); |
|
94 | + foreach ($line_item->children() as $child_line_item) { |
|
95 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
96 | + $this->display_line_item($child_line_item, $options); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | break; |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | $children = $line_item->children(); |
106 | 106 | |
107 | 107 | // loop thru all non-tax child line items |
108 | - foreach( $children as $child_line_item ) { |
|
109 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
108 | + foreach ($children as $child_line_item) { |
|
109 | + $html .= $this->display_line_item($child_line_item, $options); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $html .= $this->_taxes_html; |
113 | - $html .= $this->_total_row( $line_item, $options ); |
|
114 | - if ( $options['use_table_wrapper'] ) { |
|
115 | - $html = $this->_table_header( $options ) . $html . $this->_table_footer( $options ); |
|
113 | + $html .= $this->_total_row($line_item, $options); |
|
114 | + if ($options['use_table_wrapper']) { |
|
115 | + $html = $this->_table_header($options).$html.$this->_table_footer($options); |
|
116 | 116 | } |
117 | 117 | break; |
118 | 118 | |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | * @param array $options |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - protected function _table_header( $options ) { |
|
133 | - $html = EEH_HTML::table( '','', $options['table_css_class'] ); |
|
132 | + protected function _table_header($options) { |
|
133 | + $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
134 | 134 | $html .= EEH_HTML::thead(); |
135 | 135 | $html .= EEH_HTML::tr(); |
136 | - $html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' ); |
|
137 | - $html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' ); |
|
138 | - $html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' ); |
|
139 | - $html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' ); |
|
140 | - $html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' ); |
|
136 | + $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
137 | + $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
138 | + $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
139 | + $html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr'); |
|
140 | + $html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr'); |
|
141 | 141 | $html .= EEH_HTML::tbody(); |
142 | 142 | return $html; |
143 | 143 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param array $options array of options for the table. |
150 | 150 | * @return string |
151 | 151 | */ |
152 | - protected function _table_footer( $options ) { |
|
153 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex(); |
|
152 | + protected function _table_footer($options) { |
|
153 | + return EEH_HTML::tbodyx().EEH_HTML::tablex(); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | * @param array $options |
163 | 163 | * @return mixed |
164 | 164 | */ |
165 | - protected function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
165 | + protected function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
166 | 166 | $line_item_related_object = $line_item->get_object(); |
167 | 167 | $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null; |
168 | 168 | // start of row |
169 | 169 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
170 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
170 | + $html = EEH_HTML::tr('', '', $row_class); |
|
171 | 171 | |
172 | 172 | |
173 | 173 | //Name Column |
@@ -175,44 +175,44 @@ discard block |
||
175 | 175 | |
176 | 176 | //related object scope. |
177 | 177 | $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : ''; |
178 | - $parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; |
|
178 | + $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; |
|
179 | 179 | $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : ''; |
180 | 180 | |
181 | 181 | |
182 | 182 | $name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name(); |
183 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; |
|
183 | + $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html; |
|
184 | 184 | $name_html .= $line_item->is_taxable() ? ' *' : ''; |
185 | 185 | //maybe preface with icon? |
186 | - $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html; |
|
187 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
188 | - $name_html .= sprintf( |
|
189 | - _x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
186 | + $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html; |
|
187 | + $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>'; |
|
188 | + $name_html .= sprintf( |
|
189 | + _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
190 | 190 | '<span class="ee-line-item-related-parent-object">', |
191 | - $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type() : __( 'Item:', 'event_espresso' ), |
|
192 | - $parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name, |
|
191 | + $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type() : __('Item:', 'event_espresso'), |
|
192 | + $parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name, |
|
193 | 193 | '</span>' |
194 | 194 | ); |
195 | - $html .= EEH_HTML::td( $name_html, '', 'jst-left' ); |
|
195 | + $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
196 | 196 | |
197 | 197 | //Type Column |
198 | - $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type() . '<br />' : ''; |
|
198 | + $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type().'<br />' : ''; |
|
199 | 199 | $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
200 | - $type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : ''; |
|
201 | - $html .= EEH_HTML::td( $type_html, '', 'jst-left' ); |
|
200 | + $type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : ''; |
|
201 | + $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
202 | 202 | |
203 | 203 | |
204 | 204 | //Amount Column |
205 | - if ( $line_item->is_percent() ) { |
|
206 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' ); |
|
205 | + if ($line_item->is_percent()) { |
|
206 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght'); |
|
207 | 207 | } else { |
208 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' ); |
|
208 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | //QTY column |
212 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' ); |
|
212 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght'); |
|
213 | 213 | |
214 | 214 | //total column |
215 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
215 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
216 | 216 | |
217 | 217 | //finish things off and return |
218 | 218 | $html .= EEH_HTML::trx(); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @param array $options |
229 | 229 | * @return mixed |
230 | 230 | */ |
231 | - protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
231 | + protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
232 | 232 | //for now we're not showing sub-items |
233 | 233 | return ''; |
234 | 234 | } |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | * @param array $options |
243 | 243 | * @return mixed |
244 | 244 | */ |
245 | - protected function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
245 | + protected function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
246 | 246 | // start of row |
247 | - $html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' ); |
|
247 | + $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
248 | 248 | // name th |
249 | - $html .= EEH_HTML::th( $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '', 'jst-rght', '', ' colspan="4"' ); |
|
249 | + $html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"'); |
|
250 | 250 | // total th |
251 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
251 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
252 | 252 | // end of row |
253 | 253 | $html .= EEH_HTML::trx(); |
254 | 254 | return $html; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @param array $options |
266 | 266 | * @return mixed |
267 | 267 | */ |
268 | - protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
268 | + protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
269 | 269 | //currently not showing subtotal row |
270 | 270 | return ''; |
271 | 271 | } |
@@ -279,15 +279,15 @@ discard block |
||
279 | 279 | * @param array $options |
280 | 280 | * @return mixed |
281 | 281 | */ |
282 | - protected function _total_row( EE_Line_Item $line_item, $options = array() ) { |
|
282 | + protected function _total_row(EE_Line_Item $line_item, $options = array()) { |
|
283 | 283 | // start of row |
284 | - $html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' ); |
|
284 | + $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
285 | 285 | // Total th label |
286 | - $total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' ); |
|
287 | - $html .= EEH_HTML::th( $total_label, '', 'jst-rght', '', ' colspan="4"' ); |
|
286 | + $total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); |
|
287 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"'); |
|
288 | 288 | // total th |
289 | 289 | |
290 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
290 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
291 | 291 | // end of row |
292 | 292 | $html .= EEH_HTML::trx(); |
293 | 293 | return $html; |