@@ -495,7 +495,7 @@ |
||
495 | 495 | * display_description |
496 | 496 | * |
497 | 497 | * @access public |
498 | - * @param $value |
|
498 | + * @param integer $value |
|
499 | 499 | * @return bool |
500 | 500 | */ |
501 | 501 | public static function display_description( $value ) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return EED_Events_Archive |
34 | 34 | */ |
35 | 35 | public static function instance() { |
36 | - return parent::get_instance( __CLASS__ ); |
|
36 | + return parent::get_instance(__CLASS__); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | public static function set_hooks() { |
48 | - EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' ); |
|
49 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
50 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
48 | + EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run'); |
|
49 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
50 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return void |
58 | 58 | */ |
59 | 59 | public static function set_hooks_admin() { |
60 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
60 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | public static function set_definitions() { |
73 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
74 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
73 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
74 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return \EE_Events_Archive_Config |
83 | 83 | */ |
84 | - protected function set_config(){ |
|
85 | - $this->set_config_section( 'template_settings' ); |
|
86 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
87 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
84 | + protected function set_config() { |
|
85 | + $this->set_config_section('template_settings'); |
|
86 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
87 | + $this->set_config_name('EED_Events_Archive'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -96,26 +96,26 @@ discard block |
||
96 | 96 | * @param WP $WP |
97 | 97 | * @return void |
98 | 98 | */ |
99 | - public function run( $WP ) { |
|
100 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
99 | + public function run($WP) { |
|
100 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
101 | 101 | // ensure valid EE_Events_Archive_Config() object exists |
102 | 102 | $this->set_config(); |
103 | 103 | // load other required components |
104 | 104 | $this->load_event_list_assets(); |
105 | 105 | // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
106 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
106 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
107 | 107 | //add query filters |
108 | 108 | EEH_Event_Query::add_query_filters(); |
109 | 109 | // set params that will get used by the filters |
110 | 110 | EEH_Event_Query::set_query_params( |
111 | - '', // month |
|
112 | - '', // category |
|
113 | - $this->config()->display_expired_events, // show_expired |
|
114 | - 'start_date', // orderby |
|
111 | + '', // month |
|
112 | + '', // category |
|
113 | + $this->config()->display_expired_events, // show_expired |
|
114 | + 'start_date', // orderby |
|
115 | 115 | 'ASC' // sort |
116 | 116 | ); |
117 | 117 | // check what template is loaded |
118 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
118 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -147,30 +147,30 @@ discard block |
||
147 | 147 | * @param string $template |
148 | 148 | * @return string |
149 | 149 | */ |
150 | - public function template_include( $template = '' ) { |
|
150 | + public function template_include($template = '') { |
|
151 | 151 | // ensure valid EE_Events_Archive_Config() object exists |
152 | 152 | // EED_Events_Archive::_set_config(); |
153 | 153 | // don't add content filter for dedicated EE child themes or private posts |
154 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
155 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
154 | + EE_Registry::instance()->load_helper('Template'); |
|
155 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
156 | 156 | // add status banner ? |
157 | - if ( $this->config()->display_status_banner ) { |
|
158 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
157 | + if ($this->config()->display_status_banner) { |
|
158 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
159 | 159 | } |
160 | 160 | // if NOT a custom template |
161 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
161 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
162 | 162 | // don't display entry meta because the existing theme will take care of that |
163 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
163 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
164 | 164 | // load functions.php file for the theme (loaded by WP if using child theme) |
165 | 165 | EEH_Template::load_espresso_theme_functions(); |
166 | 166 | // because we don't know if the theme is using the_excerpt() |
167 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
167 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
168 | 168 | // or the_content |
169 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
169 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
170 | 170 | // and just in case they are running get_the_excerpt() which DESTROYS things |
171 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
171 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
172 | 172 | // don't display entry meta because the existing theme will take care of that |
173 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
173 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | * @param string $excerpt |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
190 | - if ( post_password_required() ) { |
|
189 | + public static function get_the_excerpt($excerpt = '') { |
|
190 | + if (post_password_required()) { |
|
191 | 191 | return $excerpt; |
192 | 192 | } |
193 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
194 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
195 | - return EED_Events_Archive::event_details( $excerpt ); |
|
193 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
194 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
195 | + return EED_Events_Archive::event_details($excerpt); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * @param string $id |
206 | 206 | * @return string |
207 | 207 | */ |
208 | - public static function the_title( $title = '', $id = '' ) { |
|
208 | + public static function the_title($title = '', $id = '') { |
|
209 | 209 | global $post; |
210 | - if ( $post instanceof WP_Post ) { |
|
211 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
210 | + if ($post instanceof WP_Post) { |
|
211 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
212 | 212 | } |
213 | 213 | return $title; |
214 | 214 | } |
@@ -222,33 +222,33 @@ discard block |
||
222 | 222 | * @param string $content |
223 | 223 | * @return string |
224 | 224 | */ |
225 | - public static function event_details( $content ) { |
|
225 | + public static function event_details($content) { |
|
226 | 226 | |
227 | 227 | global $post; |
228 | 228 | $template = ''; |
229 | 229 | if ( |
230 | 230 | $post->post_type == 'espresso_events' |
231 | - && ! apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', FALSE ) |
|
231 | + && ! apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', FALSE) |
|
232 | 232 | && ! post_password_required() |
233 | 233 | ) { |
234 | 234 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
235 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
236 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
237 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
235 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
236 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
237 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
238 | 238 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
239 | 239 | EED_Events_Archive::_add_additional_excerpt_filters(); |
240 | 240 | EED_Events_Archive::_add_additional_content_filters(); |
241 | 241 | // now load our template |
242 | - $template = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
242 | + $template = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
243 | 243 | // re-add our main filters (or else the next event won't have them) |
244 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
245 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
246 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
244 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
245 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
246 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
247 | 247 | // but remove the other filters so that they don't get applied to the next post |
248 | 248 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
249 | 249 | } |
250 | 250 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
251 | - return ! empty( $template ) ? $template : $content; |
|
251 | + return ! empty($template) ? $template : $content; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | * @return void |
261 | 261 | */ |
262 | 262 | private static function _add_additional_excerpt_filters() { |
263 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
264 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
265 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
263 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
264 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
265 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @return void |
275 | 275 | */ |
276 | 276 | private static function _add_additional_content_filters() { |
277 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
278 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
279 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
277 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
278 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
279 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | * @param string $content |
289 | 289 | * @return string |
290 | 290 | */ |
291 | - public static function event_datetimes( $content ) { |
|
292 | - if ( post_password_required() ) { |
|
291 | + public static function event_datetimes($content) { |
|
292 | + if (post_password_required()) { |
|
293 | 293 | return $content; |
294 | 294 | } |
295 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
295 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -302,11 +302,11 @@ discard block |
||
302 | 302 | * @param string $content |
303 | 303 | * @return string |
304 | 304 | */ |
305 | - public static function event_tickets( $content ) { |
|
306 | - if ( post_password_required() ) { |
|
305 | + public static function event_tickets($content) { |
|
306 | + if (post_password_required()) { |
|
307 | 307 | return $content; |
308 | 308 | } |
309 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
309 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | * @param string $content |
317 | 317 | * @return string |
318 | 318 | */ |
319 | - public static function event_venues( $content ) { |
|
320 | - if ( post_password_required() ) { |
|
319 | + public static function event_venues($content) { |
|
320 | + if (post_password_required()) { |
|
321 | 321 | return $content; |
322 | 322 | } |
323 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
323 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | * @return void |
331 | 331 | */ |
332 | 332 | private static function _remove_additional_events_archive_filters() { |
333 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
334 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
335 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
336 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
337 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
338 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
333 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
334 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
335 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
336 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
337 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
338 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
339 | 339 | } |
340 | 340 | /** |
341 | 341 | * remove_all_events_archive_filters |
@@ -344,18 +344,18 @@ discard block |
||
344 | 344 | * @return void |
345 | 345 | */ |
346 | 346 | public static function remove_all_events_archive_filters() { |
347 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
348 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
349 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
350 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
351 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
352 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
353 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
354 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
355 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
356 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
347 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
348 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
349 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
350 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
351 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
352 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
353 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
354 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
355 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
356 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
357 | 357 | // don't display entry meta because the existing theme will take care of that |
358 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
358 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -370,15 +370,15 @@ discard block |
||
370 | 370 | * @return void |
371 | 371 | */ |
372 | 372 | public function load_event_list_assets() { |
373 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
374 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
375 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
376 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
377 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
378 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
379 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
373 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
374 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
375 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
376 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
377 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
378 | + EE_Registry::instance()->load_helper('Maps'); |
|
379 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
380 | 380 | } |
381 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
381 | + EE_Registry::instance()->load_helper('Event_View'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -394,14 +394,14 @@ discard block |
||
394 | 394 | */ |
395 | 395 | public function wp_enqueue_scripts() { |
396 | 396 | // get some style |
397 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
397 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
398 | 398 | // first check uploads folder |
399 | - EE_Registry::instance()->load_helper( 'File' ); |
|
400 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
401 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
399 | + EE_Registry::instance()->load_helper('File'); |
|
400 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
401 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
402 | 402 | } else { |
403 | 403 | } |
404 | - wp_enqueue_style( $this->theme ); |
|
404 | + wp_enqueue_style($this->theme); |
|
405 | 405 | |
406 | 406 | } |
407 | 407 | } |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public static function template_settings_form() { |
421 | 421 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
422 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
423 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
422 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
423 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
424 | 424 | $events_archive_settings = array( |
425 | 425 | 'display_status_banner' => 0, |
426 | 426 | 'display_description' => 1, |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | 'display_venue' => 0, |
430 | 430 | 'display_expired_events' => 0 |
431 | 431 | ); |
432 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
433 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
432 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
433 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -446,16 +446,16 @@ discard block |
||
446 | 446 | * @param EE_Request_Handler $REQ |
447 | 447 | * @return EE_Template_Config |
448 | 448 | */ |
449 | - public static function update_template_settings( $CFG, $REQ ) { |
|
449 | + public static function update_template_settings($CFG, $REQ) { |
|
450 | 450 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
451 | 451 | // unless we are resetting the config... |
452 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
453 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
454 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
455 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
456 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
457 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
458 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
452 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
453 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
454 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
455 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
456 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
457 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
458 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
459 | 459 | return $CFG; |
460 | 460 | } |
461 | 461 | |
@@ -468,10 +468,10 @@ discard block |
||
468 | 468 | * @param string $extra_class |
469 | 469 | * @return string |
470 | 470 | */ |
471 | - public static function event_list_css( $extra_class = '' ) { |
|
472 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
471 | + public static function event_list_css($extra_class = '') { |
|
472 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
473 | 473 | $event_list_css[] = 'espresso-event-list-event'; |
474 | - return implode( ' ', $event_list_css ); |
|
474 | + return implode(' ', $event_list_css); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -498,9 +498,9 @@ discard block |
||
498 | 498 | * @param $value |
499 | 499 | * @return bool |
500 | 500 | */ |
501 | - public static function display_description( $value ) { |
|
501 | + public static function display_description($value) { |
|
502 | 502 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
503 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
503 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
504 | 504 | return $display_description === $value ? TRUE : FALSE; |
505 | 505 | } |
506 | 506 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | */ |
514 | 514 | public static function display_ticket_selector() { |
515 | 515 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
516 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
516 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | |
@@ -525,9 +525,9 @@ discard block |
||
525 | 525 | * @return bool |
526 | 526 | */ |
527 | 527 | public static function display_venue() { |
528 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
528 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
529 | 529 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
530 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
530 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | */ |
540 | 540 | public static function display_datetimes() { |
541 | 541 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
542 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
542 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @return string |
555 | 555 | */ |
556 | 556 | public static function event_list_title() { |
557 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
557 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | |
@@ -563,11 +563,11 @@ discard block |
||
563 | 563 | /** |
564 | 564 | * @since 4.4.0 |
565 | 565 | */ |
566 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
566 | + public static function _doing_it_wrong_notice($function = '') { |
|
567 | 567 | EE_Error::doing_it_wrong( |
568 | 568 | __FUNCTION__, |
569 | 569 | sprintf( |
570 | - __( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ), |
|
570 | + __('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'), |
|
571 | 571 | $function, |
572 | 572 | '<br />', |
573 | 573 | '4.6.0' |
@@ -583,107 +583,107 @@ discard block |
||
583 | 583 | * @since 4.4.0 |
584 | 584 | */ |
585 | 585 | public function get_post_data() { |
586 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
586 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
587 | 587 | EEH_Event_Query::set_query_params(); |
588 | 588 | } |
589 | 589 | /** |
590 | 590 | * @deprecated |
591 | 591 | * @since 4.4.0 |
592 | 592 | */ |
593 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
594 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
595 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
596 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
593 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
594 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
595 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
596 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
597 | 597 | } |
598 | 598 | /** |
599 | 599 | * @deprecated |
600 | 600 | * @since 4.4.0 |
601 | 601 | */ |
602 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
603 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
604 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
605 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
602 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
603 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
604 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
605 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
606 | 606 | } |
607 | 607 | /** |
608 | 608 | * @deprecated |
609 | 609 | * @since 4.4.0 |
610 | 610 | */ |
611 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
612 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
613 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
614 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
611 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
612 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
613 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
614 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
615 | 615 | } |
616 | 616 | /** |
617 | 617 | * @deprecated |
618 | 618 | * @since 4.4.0 |
619 | 619 | */ |
620 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
621 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
622 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
623 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
620 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
621 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
622 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
623 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
624 | 624 | } |
625 | 625 | /** |
626 | 626 | * @deprecated |
627 | 627 | * @since 4.4.0 |
628 | 628 | */ |
629 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
630 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
631 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
632 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
629 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
630 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
631 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
632 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
633 | 633 | } |
634 | 634 | /** |
635 | 635 | * @deprecated |
636 | 636 | * @since 4.4.0 |
637 | 637 | */ |
638 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
639 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
640 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
641 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
638 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
639 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
640 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
641 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
642 | 642 | } |
643 | 643 | /** |
644 | 644 | * @deprecated |
645 | 645 | * @since 4.4.0 |
646 | 646 | */ |
647 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
648 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
649 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
650 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
647 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
648 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
649 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
650 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
651 | 651 | } |
652 | 652 | /** |
653 | 653 | * @deprecated |
654 | 654 | * @since 4.4.0 |
655 | 655 | */ |
656 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
657 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
658 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
659 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
656 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
657 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
658 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
659 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
660 | 660 | } |
661 | 661 | /** |
662 | 662 | * @deprecated |
663 | 663 | * @since 4.4.0 |
664 | 664 | */ |
665 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
666 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
667 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
668 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
665 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
666 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
667 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
668 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
669 | 669 | } |
670 | 670 | /** |
671 | 671 | * @deprecated |
672 | 672 | * @since 4.4.0 |
673 | 673 | */ |
674 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
675 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
676 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
677 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
674 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
675 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
676 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
677 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
678 | 678 | } |
679 | 679 | /** |
680 | 680 | * @deprecated |
681 | 681 | * @since 4.4.0 |
682 | 682 | */ |
683 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
684 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
685 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
686 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
683 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
684 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
685 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
686 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | * @param string $extra_class |
715 | 715 | * @return string |
716 | 716 | */ |
717 | -function espresso_event_list_css( $extra_class = '' ) { |
|
718 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
717 | +function espresso_event_list_css($extra_class = '') { |
|
718 | + return EED_Events_Archive::event_list_css($extra_class); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | /** |
@@ -729,14 +729,14 @@ discard block |
||
729 | 729 | * @return bool |
730 | 730 | */ |
731 | 731 | function espresso_display_full_description_in_event_list() { |
732 | - return EED_Events_Archive::display_description( 2 ); |
|
732 | + return EED_Events_Archive::display_description(2); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | /** |
736 | 736 | * @return bool |
737 | 737 | */ |
738 | 738 | function espresso_display_excerpt_in_event_list() { |
739 | - return EED_Events_Archive::display_description( 1 ); |
|
739 | + return EED_Events_Archive::display_description(1); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | /** |
@@ -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 | * |
@@ -271,6 +271,7 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @access public |
273 | 273 | * @param mixed boolean|string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet |
274 | + * @param string $join_terms |
|
274 | 275 | * @return string |
275 | 276 | */ |
276 | 277 | public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
@@ -423,7 +424,7 @@ discard block |
||
423 | 424 | * or else some of the table references below will result in MySQL errors |
424 | 425 | * |
425 | 426 | * @access public |
426 | - * @param boolean $orderby_params |
|
427 | + * @param string[] $orderby_params |
|
427 | 428 | * @return string |
428 | 429 | */ |
429 | 430 | public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
@@ -534,7 +535,7 @@ discard block |
||
534 | 535 | * |
535 | 536 | * @access public |
536 | 537 | * @param string $content |
537 | - * @return void |
|
538 | + * @return string |
|
538 | 539 | */ |
539 | 540 | public function event_details( $content ) { |
540 | 541 | return EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-details.php', array( 'the_content' => $content ), TRUE ); |
@@ -546,7 +547,7 @@ discard block |
||
546 | 547 | * |
547 | 548 | * @access public |
548 | 549 | * @param string $content |
549 | - * @return void |
|
550 | + * @return string |
|
550 | 551 | */ |
551 | 552 | public function event_tickets( $content ) { |
552 | 553 | return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-tickets.php', array(), TRUE ); |
@@ -557,7 +558,7 @@ discard block |
||
557 | 558 | * |
558 | 559 | * @access public |
559 | 560 | * @param string $content |
560 | - * @return void |
|
561 | + * @return string |
|
561 | 562 | */ |
562 | 563 | public function event_datetimes( $content ) { |
563 | 564 | return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-datetimes.php', array(), TRUE ); |
@@ -568,7 +569,7 @@ discard block |
||
568 | 569 | * |
569 | 570 | * @access public |
570 | 571 | * @param string $content |
571 | - * @return void |
|
572 | + * @return string |
|
572 | 573 | */ |
573 | 574 | public function event_venues( $content ) { |
574 | 575 | return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-venues.php', array(), TRUE ); |
@@ -618,7 +619,7 @@ discard block |
||
618 | 619 | * excerpt_length |
619 | 620 | * |
620 | 621 | * @access public |
621 | - * @return void |
|
622 | + * @return integer|null |
|
622 | 623 | */ |
623 | 624 | public function excerpt_length( $length ) { |
624 | 625 | |
@@ -648,7 +649,7 @@ discard block |
||
648 | 649 | * excerpt_more |
649 | 650 | * |
650 | 651 | * @access public |
651 | - * @return void |
|
652 | + * @return string |
|
652 | 653 | */ |
653 | 654 | public function excerpt_more( $more ) { |
654 | 655 | return '…'; |
@@ -813,7 +814,7 @@ discard block |
||
813 | 814 | * get_template_part |
814 | 815 | * |
815 | 816 | * @access public |
816 | - * @return void |
|
817 | + * @return string|null |
|
817 | 818 | */ |
818 | 819 | public static function get_template_part() { |
819 | 820 | switch ( self::$_type ) { |
@@ -857,7 +858,7 @@ discard block |
||
857 | 858 | * event_list_css |
858 | 859 | * |
859 | 860 | * @access public |
860 | - * @return void |
|
861 | + * @return string |
|
861 | 862 | */ |
862 | 863 | public static function event_list_css( $extra_class = '' ) { |
863 | 864 | $EE = EE_Registry::instance(); |
@@ -892,7 +893,7 @@ discard block |
||
892 | 893 | * display_description |
893 | 894 | * |
894 | 895 | * @access public |
895 | - * @return void |
|
896 | + * @return boolean |
|
896 | 897 | */ |
897 | 898 | public static function display_description( $value ) { |
898 | 899 | $EE = EE_Registry::instance(); |
@@ -906,7 +907,7 @@ discard block |
||
906 | 907 | * display_venue_details |
907 | 908 | * |
908 | 909 | * @access public |
909 | - * @return void |
|
910 | + * @return boolean |
|
910 | 911 | */ |
911 | 912 | public static function display_venue_details() { |
912 | 913 | $EE = EE_Registry::instance(); |
@@ -921,7 +922,7 @@ discard block |
||
921 | 922 | * display_address |
922 | 923 | * |
923 | 924 | * @access public |
924 | - * @return void |
|
925 | + * @return boolean |
|
925 | 926 | */ |
926 | 927 | public static function display_address() { |
927 | 928 | $EE = EE_Registry::instance(); |
@@ -937,7 +938,7 @@ discard block |
||
937 | 938 | * pagination |
938 | 939 | * |
939 | 940 | * @access public |
940 | - * @return void |
|
941 | + * @return string |
|
941 | 942 | */ |
942 | 943 | public static function pagination() { |
943 | 944 | global $wp_query; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Events_Archive_Filters |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @var $_types |
72 | 72 | * @access protected |
73 | 73 | */ |
74 | - protected static $_types = array( 'grid', 'text', 'dates' ); |
|
74 | + protected static $_types = array('grid', 'text', 'dates'); |
|
75 | 75 | |
76 | 76 | |
77 | 77 | // public static $espresso_event_list_ID = 0; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @access public |
126 | 126 | * @return void |
127 | 127 | */ |
128 | - public function run( $WP ) { |
|
128 | + public function run($WP) { |
|
129 | 129 | // do_action( 'AHEE__EED_Events_Archive_Filters__before_run' ); |
130 | 130 | // // set config |
131 | 131 | // if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters ) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters instanceof EE_Events_Archive_Config ) { |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | */ |
171 | 171 | private function _filter_query_parts() { |
172 | 172 | // build event list query |
173 | - add_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 ); |
|
174 | - add_filter( 'posts_where', array( $this, 'posts_where' ), 1, 2 ); |
|
175 | - add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 ); |
|
173 | + add_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
174 | + add_filter('posts_where', array($this, 'posts_where'), 1, 2); |
|
175 | + add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | * @return string |
183 | 183 | */ |
184 | 184 | public static function set_type() { |
185 | - do_action( 'AHEE__EED_Events_Archive_Filters__before_set_type' ); |
|
186 | - EED_Events_Archive_Filters::$_types = apply_filters( 'EED_Events_Archive_Filters__set_type__types', EED_Events_Archive_Filters::$_types ); |
|
187 | - $view = isset( EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type'] ) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type'] : 'grid'; |
|
188 | - $elf_type = EE_Registry::instance()->REQ->is_set( 'elf_type' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'elf_type' )) : ''; |
|
189 | - $view = ! empty( $elf_type ) ? $elf_type : $view; |
|
190 | - $view = apply_filters( 'EED_Events_Archive_Filters__set_type__type', $view ); |
|
191 | - if ( ! empty( $view ) && in_array( $view, EED_Events_Archive_Filters::$_types )) { |
|
185 | + do_action('AHEE__EED_Events_Archive_Filters__before_set_type'); |
|
186 | + EED_Events_Archive_Filters::$_types = apply_filters('EED_Events_Archive_Filters__set_type__types', EED_Events_Archive_Filters::$_types); |
|
187 | + $view = isset(EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type']) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type'] : 'grid'; |
|
188 | + $elf_type = EE_Registry::instance()->REQ->is_set('elf_type') ? sanitize_text_field(EE_Registry::instance()->REQ->get('elf_type')) : ''; |
|
189 | + $view = ! empty($elf_type) ? $elf_type : $view; |
|
190 | + $view = apply_filters('EED_Events_Archive_Filters__set_type__type', $view); |
|
191 | + if ( ! empty($view) && in_array($view, EED_Events_Archive_Filters::$_types)) { |
|
192 | 192 | self::$_type = $view; |
193 | 193 | } |
194 | 194 | } |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | * @param boolean $req_only if TRUE, then ignore defaults and only return $_POST value |
201 | 201 | * @return boolean |
202 | 202 | */ |
203 | - private static function _show_expired( $req_only = FALSE ) { |
|
203 | + private static function _show_expired($req_only = FALSE) { |
|
204 | 204 | // get default value for "display_expired_events" as set in the EE General Settings > Templates > Event Listings |
205 | - $show_expired = ! $req_only && isset( EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] ) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] : FALSE; |
|
205 | + $show_expired = ! $req_only && isset(EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events']) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] : FALSE; |
|
206 | 206 | // override default expired option if set via filter |
207 | - $show_expired = EE_Registry::instance()->REQ->is_set( 'elf_expired_chk' ) ? absint( EE_Registry::instance()->REQ->get( 'elf_expired_chk' )) : $show_expired; |
|
207 | + $show_expired = EE_Registry::instance()->REQ->is_set('elf_expired_chk') ? absint(EE_Registry::instance()->REQ->get('elf_expired_chk')) : $show_expired; |
|
208 | 208 | return $show_expired ? TRUE : FALSE; |
209 | 209 | } |
210 | 210 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @return string |
216 | 216 | */ |
217 | 217 | private static function _event_category_slug() { |
218 | - return EE_Registry::instance()->REQ->is_set( 'elf_category_dd' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'elf_category_dd' )) : ''; |
|
218 | + return EE_Registry::instance()->REQ->is_set('elf_category_dd') ? sanitize_text_field(EE_Registry::instance()->REQ->get('elf_category_dd')) : ''; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @return string |
226 | 226 | */ |
227 | 227 | private static function _display_month() { |
228 | - return EE_Registry::instance()->REQ->is_set( 'elf_month_dd' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'elf_month_dd' )) : ''; |
|
228 | + return EE_Registry::instance()->REQ->is_set('elf_month_dd') ? sanitize_text_field(EE_Registry::instance()->REQ->get('elf_month_dd')) : ''; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | public function get_post_data() { |
240 | 240 | $this->_elf_month = EED_Events_Archive_Filters::_display_month(); |
241 | 241 | $this->_elf_category = EED_Events_Archive_Filters::_event_category_slug(); |
242 | - $this->_show_expired = EED_Events_Archive_Filters::_show_expired( TRUE ); |
|
242 | + $this->_show_expired = EED_Events_Archive_Filters::_show_expired(TRUE); |
|
243 | 243 | // EEH_Debug_Tools::printr( EE_Registry::instance()->REQ, 'EE_Registry::instance()->REQ <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
244 | 244 | // echo '<h4>$this->_elf_month : ' . $this->_elf_month . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
245 | 245 | // echo '<h4>$this->_elf_category : ' . $this->_elf_category . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | * @access public |
257 | 257 | * @return void |
258 | 258 | */ |
259 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
260 | - if ( isset( $wp_query->query ) && isset( $wp_query->query['post_type'] ) && $wp_query->query['post_type'] == 'espresso_events' ) { |
|
259 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
260 | + if (isset($wp_query->query) && isset($wp_query->query['post_type']) && $wp_query->query['post_type'] == 'espresso_events') { |
|
261 | 261 | // Category |
262 | 262 | // $elf_category = EE_Registry::instance()->REQ->is_set( 'elf_category_dd' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'elf_category_dd' )) : ''; |
263 | - $SQL .= EED_Events_Archive_Filters::posts_join_sql_for_terms( EED_Events_Archive_Filters::_event_category_slug() ); |
|
263 | + $SQL .= EED_Events_Archive_Filters::posts_join_sql_for_terms(EED_Events_Archive_Filters::_event_category_slug()); |
|
264 | 264 | } |
265 | 265 | return $SQL; |
266 | 266 | } |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | * @param mixed boolean|string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet |
274 | 274 | * @return string |
275 | 275 | */ |
276 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
277 | - $SQL= ''; |
|
278 | - if ( ! empty( $join_terms )) { |
|
276 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
277 | + $SQL = ''; |
|
278 | + if ( ! empty($join_terms)) { |
|
279 | 279 | global $wpdb; |
280 | 280 | $SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)"; |
281 | 281 | $SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)"; |
@@ -293,28 +293,28 @@ discard block |
||
293 | 293 | * @param array $orderby_params |
294 | 294 | * @return string |
295 | 295 | */ |
296 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
296 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
297 | 297 | global $wpdb; |
298 | - $SQL= ''; |
|
299 | - $orderby_params = is_array( $orderby_params ) ? $orderby_params : array( $orderby_params ); |
|
300 | - foreach( $orderby_params as $orderby ) { |
|
301 | - switch ( $orderby ) { |
|
298 | + $SQL = ''; |
|
299 | + $orderby_params = is_array($orderby_params) ? $orderby_params : array($orderby_params); |
|
300 | + foreach ($orderby_params as $orderby) { |
|
301 | + switch ($orderby) { |
|
302 | 302 | |
303 | 303 | case 'ticket_start' : |
304 | 304 | case 'ticket_end' : |
305 | - $SQL .= ' LEFT JOIN ' . EEM_Datetime_Ticket::instance()->table() . ' ON (' . EEM_Datetime::instance()->table() . '.DTT_ID = ' . EEM_Datetime_Ticket::instance()->table() . '.DTT_ID )'; |
|
306 | - $SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' . EEM_Datetime_Ticket::instance()->table() . '.TKT_ID = ' . EEM_Ticket::instance()->table() . '.TKT_ID )'; |
|
305 | + $SQL .= ' LEFT JOIN '.EEM_Datetime_Ticket::instance()->table().' ON ('.EEM_Datetime::instance()->table().'.DTT_ID = '.EEM_Datetime_Ticket::instance()->table().'.DTT_ID )'; |
|
306 | + $SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON ('.EEM_Datetime_Ticket::instance()->table().'.TKT_ID = '.EEM_Ticket::instance()->table().'.TKT_ID )'; |
|
307 | 307 | break; |
308 | 308 | |
309 | 309 | case 'venue_title' : |
310 | 310 | case 'city' : |
311 | - $SQL .= ' LEFT JOIN ' . EEM_Event_Venue::instance()->table() . ' ON (' . $wpdb->posts . '.ID = ' . EEM_Event_Venue::instance()->table() . '.EVT_ID )'; |
|
312 | - $SQL .= ' LEFT JOIN ' . EEM_Venue::instance()->table() . ' ON (' . EEM_Event_Venue::instance()->table() . '.VNU_ID = ' . EEM_Venue::instance()->table() . '.VNU_ID )'; |
|
311 | + $SQL .= ' LEFT JOIN '.EEM_Event_Venue::instance()->table().' ON ('.$wpdb->posts.'.ID = '.EEM_Event_Venue::instance()->table().'.EVT_ID )'; |
|
312 | + $SQL .= ' LEFT JOIN '.EEM_Venue::instance()->table().' ON ('.EEM_Event_Venue::instance()->table().'.VNU_ID = '.EEM_Venue::instance()->table().'.VNU_ID )'; |
|
313 | 313 | break; |
314 | 314 | |
315 | 315 | case 'state' : |
316 | - $SQL .= ' LEFT JOIN ' . EEM_Event_Venue::instance()->table() . ' ON (' . $wpdb->posts . '.ID = ' . EEM_Event_Venue::instance()->table() . '.EVT_ID )'; |
|
317 | - $SQL .= ' LEFT JOIN ' . EEM_Event_Venue::instance()->second_table() . ' ON (' . EEM_Event_Venue::instance()->table() . '.VNU_ID = ' . EEM_Event_Venue::instance()->second_table() . '.VNU_ID )'; |
|
316 | + $SQL .= ' LEFT JOIN '.EEM_Event_Venue::instance()->table().' ON ('.$wpdb->posts.'.ID = '.EEM_Event_Venue::instance()->table().'.EVT_ID )'; |
|
317 | + $SQL .= ' LEFT JOIN '.EEM_Event_Venue::instance()->second_table().' ON ('.EEM_Event_Venue::instance()->table().'.VNU_ID = '.EEM_Event_Venue::instance()->second_table().'.VNU_ID )'; |
|
318 | 318 | break; |
319 | 319 | |
320 | 320 | break; |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | * @access public |
332 | 332 | * @return void |
333 | 333 | */ |
334 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
335 | - if ( isset( $wp_query->query_vars ) && isset( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'espresso_events' ) { |
|
334 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
335 | + if (isset($wp_query->query_vars) && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') { |
|
336 | 336 | // Show Expired ? |
337 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_show_expired( EED_Events_Archive_Filters::_show_expired() ); |
|
337 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_show_expired(EED_Events_Archive_Filters::_show_expired()); |
|
338 | 338 | // Category |
339 | 339 | //$elf_category = EED_Events_Archive_Filters::_event_category_slug(); |
340 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_category_slug( EED_Events_Archive_Filters::_event_category_slug() ); |
|
340 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_category_slug(EED_Events_Archive_Filters::_event_category_slug()); |
|
341 | 341 | // Start Date |
342 | 342 | //$elf_month = EED_Events_Archive_Filters::_display_month(); |
343 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_list_month( EED_Events_Archive_Filters::_display_month() ); |
|
343 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_list_month(EED_Events_Archive_Filters::_display_month()); |
|
344 | 344 | } |
345 | 345 | return $SQL; |
346 | 346 | } |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | * @param boolean $show_expired if TRUE, then displayed past events |
354 | 354 | * @return string |
355 | 355 | */ |
356 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
357 | - return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . date('Y-m-d H:s:i') . '" ' : ''; |
|
356 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
357 | + return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.date('Y-m-d H:s:i').'" ' : ''; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | * @param boolean $event_category_slug |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
368 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
369 | 369 | global $wpdb; |
370 | - return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : ''; |
|
370 | + return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : ''; |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | * @param boolean $month |
378 | 378 | * @return string |
379 | 379 | */ |
380 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
381 | - $SQL= ''; |
|
382 | - if ( ! empty( $month )) { |
|
380 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
381 | + $SQL = ''; |
|
382 | + if ( ! empty($month)) { |
|
383 | 383 | // event start date is LESS than the end of the month ( so nothing that doesn't start until next month ) |
384 | - $SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . date('Y-m-t 23:59:59', strtotime( $month )) . '"'; |
|
384 | + $SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.date('Y-m-t 23:59:59', strtotime($month)).'"'; |
|
385 | 385 | // event end date is GREATER than the start of the month ( so nothing that ended before this month ) |
386 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . date('Y-m-d 0:0:00', strtotime( $month )) . '" '; |
|
386 | + $SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.date('Y-m-d 0:0:00', strtotime($month)).'" '; |
|
387 | 387 | } |
388 | 388 | return $SQL; |
389 | 389 | } |
@@ -395,9 +395,9 @@ discard block |
||
395 | 395 | * @access public |
396 | 396 | * @return void |
397 | 397 | */ |
398 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
399 | - if ( isset( $wp_query->query ) && isset( $wp_query->query['post_type'] ) && $wp_query->query['post_type'] == 'espresso_events' ) { |
|
400 | - $SQL = EED_Events_Archive_Filters::posts_orderby_sql( array( 'start_date' )); |
|
398 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
399 | + if (isset($wp_query->query) && isset($wp_query->query['post_type']) && $wp_query->query['post_type'] == 'espresso_events') { |
|
400 | + $SQL = EED_Events_Archive_Filters::posts_orderby_sql(array('start_date')); |
|
401 | 401 | } |
402 | 402 | return $SQL; |
403 | 403 | } |
@@ -426,54 +426,54 @@ discard block |
||
426 | 426 | * @param boolean $orderby_params |
427 | 427 | * @return string |
428 | 428 | */ |
429 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
429 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
430 | 430 | global $wpdb; |
431 | 431 | $SQL = ''; |
432 | 432 | $cntr = 1; |
433 | - $orderby_params = is_array( $orderby_params ) ? $orderby_params : array( $orderby_params ); |
|
434 | - foreach( $orderby_params as $orderby ) { |
|
435 | - $glue = $cntr == 1 || $cntr == count( $orderby_params ) ? ' ' : ', '; |
|
436 | - switch ( $orderby ) { |
|
433 | + $orderby_params = is_array($orderby_params) ? $orderby_params : array($orderby_params); |
|
434 | + foreach ($orderby_params as $orderby) { |
|
435 | + $glue = $cntr == 1 || $cntr == count($orderby_params) ? ' ' : ', '; |
|
436 | + switch ($orderby) { |
|
437 | 437 | |
438 | 438 | case 'id' : |
439 | 439 | case 'ID' : |
440 | - $SQL .= $glue . $wpdb->posts . '.ID ' . $sort; |
|
440 | + $SQL .= $glue.$wpdb->posts.'.ID '.$sort; |
|
441 | 441 | break; |
442 | 442 | |
443 | 443 | case 'start_date' : |
444 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort; |
|
444 | + $SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_start '.$sort; |
|
445 | 445 | break; |
446 | 446 | |
447 | 447 | case 'end_date' : |
448 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort; |
|
448 | + $SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort; |
|
449 | 449 | break; |
450 | 450 | |
451 | 451 | case 'event_name' : |
452 | - $SQL .= $glue . $wpdb->posts . '.post_title ' . $sort; |
|
452 | + $SQL .= $glue.$wpdb->posts.'.post_title '.$sort; |
|
453 | 453 | break; |
454 | 454 | |
455 | 455 | case 'category_slug' : |
456 | - $SQL .= $glue . $wpdb->terms . '.slug ' . $sort; |
|
456 | + $SQL .= $glue.$wpdb->terms.'.slug '.$sort; |
|
457 | 457 | break; |
458 | 458 | |
459 | 459 | case 'ticket_start' : |
460 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort; |
|
460 | + $SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort; |
|
461 | 461 | break; |
462 | 462 | |
463 | 463 | case 'ticket_end' : |
464 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort; |
|
464 | + $SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort; |
|
465 | 465 | break; |
466 | 466 | |
467 | 467 | case 'venue_title' : |
468 | - $SQL .= $glue . 'venue_title ' . $sort; |
|
468 | + $SQL .= $glue.'venue_title '.$sort; |
|
469 | 469 | break; |
470 | 470 | |
471 | 471 | case 'city' : |
472 | - $SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort; |
|
472 | + $SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort; |
|
473 | 473 | break; |
474 | 474 | |
475 | 475 | case 'state' : |
476 | - $SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort; |
|
476 | + $SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort; |
|
477 | 477 | break; |
478 | 478 | |
479 | 479 | } |
@@ -493,26 +493,26 @@ discard block |
||
493 | 493 | */ |
494 | 494 | public function template_redirect() { |
495 | 495 | // add event list filters |
496 | - add_action( 'loop_start', array( $this, 'event_list_template_filters' )); |
|
496 | + add_action('loop_start', array($this, 'event_list_template_filters')); |
|
497 | 497 | // and pagination |
498 | - add_action( 'loop_start', array( $this, 'event_list_pagination' )); |
|
499 | - add_action( 'loop_end', array( $this, 'event_list_pagination' )); |
|
498 | + add_action('loop_start', array($this, 'event_list_pagination')); |
|
499 | + add_action('loop_end', array($this, 'event_list_pagination')); |
|
500 | 500 | // if NOT a custom template |
501 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
501 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
502 | 502 | // don't know if theme uses the_excerpt |
503 | - add_filter( 'the_excerpt', array( $this, 'event_details' ), 100 ); |
|
504 | - add_filter( 'the_excerpt', array( $this, 'event_tickets' ), 110 ); |
|
505 | - add_filter( 'the_excerpt', array( $this, 'event_datetimes' ), 120 ); |
|
506 | - add_filter( 'the_excerpt', array( $this, 'event_venues' ), 130 ); |
|
503 | + add_filter('the_excerpt', array($this, 'event_details'), 100); |
|
504 | + add_filter('the_excerpt', array($this, 'event_tickets'), 110); |
|
505 | + add_filter('the_excerpt', array($this, 'event_datetimes'), 120); |
|
506 | + add_filter('the_excerpt', array($this, 'event_venues'), 130); |
|
507 | 507 | // or the_content |
508 | - add_filter( 'the_content', array( $this, 'event_details' ), 100 ); |
|
509 | - add_filter( 'the_content', array( $this, 'event_tickets' ), 110 ); |
|
510 | - add_filter( 'the_content', array( $this, 'event_datetimes' ), 120 ); |
|
511 | - add_filter( 'the_content', array( $this, 'event_venues' ), 130 ); |
|
508 | + add_filter('the_content', array($this, 'event_details'), 100); |
|
509 | + add_filter('the_content', array($this, 'event_tickets'), 110); |
|
510 | + add_filter('the_content', array($this, 'event_datetimes'), 120); |
|
511 | + add_filter('the_content', array($this, 'event_venues'), 130); |
|
512 | 512 | } else { |
513 | - remove_all_filters( 'excerpt_length' ); |
|
514 | - add_filter( 'excerpt_length', array( $this, 'excerpt_length' ), 10 ); |
|
515 | - add_filter( 'excerpt_more', array( $this, 'excerpt_more' ), 10 ); |
|
513 | + remove_all_filters('excerpt_length'); |
|
514 | + add_filter('excerpt_length', array($this, 'excerpt_length'), 10); |
|
515 | + add_filter('excerpt_more', array($this, 'excerpt_more'), 10); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @return void |
526 | 526 | */ |
527 | 527 | public function event_list_pagination() { |
528 | - echo '<div class="ee-pagination-dv clear">' . espresso_event_list_pagination() . '</div>'; |
|
528 | + echo '<div class="ee-pagination-dv clear">'.espresso_event_list_pagination().'</div>'; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | * @param string $content |
537 | 537 | * @return void |
538 | 538 | */ |
539 | - public function event_details( $content ) { |
|
540 | - return EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-details.php', array( 'the_content' => $content ), TRUE ); |
|
539 | + public function event_details($content) { |
|
540 | + return EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'content-espresso_events-details.php', array('the_content' => $content), TRUE); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @param string $content |
549 | 549 | * @return void |
550 | 550 | */ |
551 | - public function event_tickets( $content ) { |
|
552 | - return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-tickets.php', array(), TRUE ); |
|
551 | + public function event_tickets($content) { |
|
552 | + return $content.EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'content-espresso_events-tickets.php', array(), TRUE); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | /** |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * @param string $content |
560 | 560 | * @return void |
561 | 561 | */ |
562 | - public function event_datetimes( $content ) { |
|
563 | - return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-datetimes.php', array(), TRUE ); |
|
562 | + public function event_datetimes($content) { |
|
563 | + return $content.EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'content-espresso_events-datetimes.php', array(), TRUE); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -570,8 +570,8 @@ discard block |
||
570 | 570 | * @param string $content |
571 | 571 | * @return void |
572 | 572 | */ |
573 | - public function event_venues( $content ) { |
|
574 | - return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-venues.php', array(), TRUE ); |
|
573 | + public function event_venues($content) { |
|
574 | + return $content.EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'content-espresso_events-venues.php', array(), TRUE); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -586,16 +586,16 @@ discard block |
||
586 | 586 | * @return void |
587 | 587 | */ |
588 | 588 | private function _load_assests() { |
589 | - do_action( 'AHEE__EED_Events_Archive_Filters__before_load_assests' ); |
|
590 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
591 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
592 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
593 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
594 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
595 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
589 | + do_action('AHEE__EED_Events_Archive_Filters__before_load_assests'); |
|
590 | + add_filter('FHEE_load_css', '__return_true'); |
|
591 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
592 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
593 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
594 | + EE_Registry::instance()->load_helper('Maps'); |
|
595 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
596 | 596 | } |
597 | 597 | //add_filter( 'the_excerpt', array( $this, 'the_excerpt' ), 999 ); |
598 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
598 | + EE_Registry::instance()->load_helper('Event_View'); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | * @access private |
609 | 609 | * @return string |
610 | 610 | */ |
611 | - private function _get_template( $which = 'part' ) { |
|
612 | - return EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events.php'; |
|
611 | + private function _get_template($which = 'part') { |
|
612 | + return EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events.php'; |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | |
@@ -620,13 +620,13 @@ discard block |
||
620 | 620 | * @access public |
621 | 621 | * @return void |
622 | 622 | */ |
623 | - public function excerpt_length( $length ) { |
|
623 | + public function excerpt_length($length) { |
|
624 | 624 | |
625 | - if ( self::$_type == 'grid' ) { |
|
625 | + if (self::$_type == 'grid') { |
|
626 | 626 | return 36; |
627 | 627 | } |
628 | 628 | |
629 | - switch ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size ) { |
|
629 | + switch (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) { |
|
630 | 630 | case 'tiny' : |
631 | 631 | return 12; |
632 | 632 | break; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @access public |
651 | 651 | * @return void |
652 | 652 | */ |
653 | - public function excerpt_more( $more ) { |
|
653 | + public function excerpt_more($more) { |
|
654 | 654 | return '…'; |
655 | 655 | } |
656 | 656 | |
@@ -680,23 +680,23 @@ discard block |
||
680 | 680 | */ |
681 | 681 | public function wp_enqueue_scripts() { |
682 | 682 | // get some style |
683 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
683 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
684 | 684 | // first check uploads folder |
685 | - EE_Registry::instance()->load_helper( 'File' ); |
|
686 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'archive-espresso_events.css' )) { |
|
687 | - wp_register_style( 'archive-espresso_events', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'archive-espresso_events.css', array( 'dashicons', 'espresso_default' )); |
|
685 | + EE_Registry::instance()->load_helper('File'); |
|
686 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'archive-espresso_events.css')) { |
|
687 | + wp_register_style('archive-espresso_events', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'archive-espresso_events.css', array('dashicons', 'espresso_default')); |
|
688 | 688 | } else { |
689 | - wp_register_style( 'archive-espresso_events', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'archive-espresso_events.css', array( 'dashicons', 'espresso_default' )); |
|
689 | + wp_register_style('archive-espresso_events', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'archive-espresso_events.css', array('dashicons', 'espresso_default')); |
|
690 | 690 | } |
691 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'archive-espresso_events.js' )) { |
|
692 | - wp_register_script( 'archive-espresso_events', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'archive-espresso_events.js', array( 'jquery-masonry' ), '1.0', TRUE ); |
|
691 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'archive-espresso_events.js')) { |
|
692 | + wp_register_script('archive-espresso_events', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'archive-espresso_events.js', array('jquery-masonry'), '1.0', TRUE); |
|
693 | 693 | } else { |
694 | - wp_register_script( 'archive-espresso_events', EVENTS_ARCHIVE_ASSETS_URL . 'archive-espresso_events.js', array( 'jquery-masonry' ), '1.0', TRUE ); |
|
694 | + wp_register_script('archive-espresso_events', EVENTS_ARCHIVE_ASSETS_URL.'archive-espresso_events.js', array('jquery-masonry'), '1.0', TRUE); |
|
695 | 695 | } |
696 | - wp_enqueue_style( 'archive-espresso_events' ); |
|
697 | - wp_enqueue_script( 'jquery-masonry' ); |
|
698 | - wp_enqueue_script( 'archive-espresso_events' ); |
|
699 | - add_action( 'wp_footer', array( 'EED_Events_Archive_Filters', 'localize_grid_event_lists' ), 1 ); |
|
696 | + wp_enqueue_style('archive-espresso_events'); |
|
697 | + wp_enqueue_script('jquery-masonry'); |
|
698 | + wp_enqueue_script('archive-espresso_events'); |
|
699 | + add_action('wp_footer', array('EED_Events_Archive_Filters', 'localize_grid_event_lists'), 1); |
|
700 | 700 | } |
701 | 701 | } |
702 | 702 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | * @return void |
712 | 712 | */ |
713 | 713 | public static function localize_grid_event_lists() { |
714 | - wp_localize_script( 'archive-espresso_events', 'espresso_grid_event_lists', EED_Events_Archive_Filters::$espresso_grid_event_lists ); |
|
714 | + wp_localize_script('archive-espresso_events', 'espresso_grid_event_lists', EED_Events_Archive_Filters::$espresso_grid_event_lists); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | |
@@ -726,9 +726,9 @@ discard block |
||
726 | 726 | */ |
727 | 727 | public static function template_settings_form() { |
728 | 728 | $EE = EE_Registry::instance(); |
729 | - $EE->CFG->template_settings->EED_Events_Archive_Filters = isset( $EE->CFG->template_settings->EED_Events_Archive_Filters ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters : new EE_Events_Archive_Config(); |
|
730 | - $EE->CFG->template_settings->EED_Events_Archive_Filters = apply_filters( 'FHEE__Event_List__template_settings_form__event_list_config', $EE->CFG->template_settings->EED_Events_Archive_Filters ); |
|
731 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $EE->CFG->template_settings->EED_Events_Archive_Filters ); |
|
729 | + $EE->CFG->template_settings->EED_Events_Archive_Filters = isset($EE->CFG->template_settings->EED_Events_Archive_Filters) ? $EE->CFG->template_settings->EED_Events_Archive_Filters : new EE_Events_Archive_Config(); |
|
730 | + $EE->CFG->template_settings->EED_Events_Archive_Filters = apply_filters('FHEE__Event_List__template_settings_form__event_list_config', $EE->CFG->template_settings->EED_Events_Archive_Filters); |
|
731 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $EE->CFG->template_settings->EED_Events_Archive_Filters); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | |
@@ -742,16 +742,16 @@ discard block |
||
742 | 742 | * @static |
743 | 743 | * @return void |
744 | 744 | */ |
745 | - public static function set_default_settings( $CFG ) { |
|
745 | + public static function set_default_settings($CFG) { |
|
746 | 746 | //EEH_Debug_Tools::printr( $CFG, '$CFG <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
747 | - $CFG->display_description = isset( $CFG->display_description ) && ! empty( $CFG->display_description ) ? $CFG->display_description : 1; |
|
748 | - $CFG->display_address = isset( $CFG->display_address ) && ! empty( $CFG->display_address ) ? $CFG->display_address : TRUE; |
|
749 | - $CFG->display_venue_details = isset( $CFG->display_venue_details ) && ! empty( $CFG->display_venue_details ) ? $CFG->display_venue_details : TRUE; |
|
750 | - $CFG->display_expired_events = isset( $CFG->display_expired_events ) && ! empty( $CFG->display_expired_events ) ? $CFG->display_expired_events : FALSE; |
|
751 | - $CFG->default_type = isset( $CFG->default_type ) && ! empty( $CFG->default_type ) ? $CFG->default_type : 'grid'; |
|
752 | - $CFG->event_list_grid_size = isset( $CFG->event_list_grid_size ) && ! empty( $CFG->event_list_grid_size ) ? $CFG->event_list_grid_size : 'medium'; |
|
753 | - $CFG->templates['full'] = isset( $CFG->templates['full'] ) && ! empty( $CFG->templates['full'] ) ? $CFG->templates['full'] : EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events.php'; |
|
754 | - $CFG->templates['part'] = isset( $CFG->templates['part'] ) && ! empty( $CFG->templates['part'] ) ? $CFG->templates['part'] : EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-grid-view.php'; |
|
747 | + $CFG->display_description = isset($CFG->display_description) && ! empty($CFG->display_description) ? $CFG->display_description : 1; |
|
748 | + $CFG->display_address = isset($CFG->display_address) && ! empty($CFG->display_address) ? $CFG->display_address : TRUE; |
|
749 | + $CFG->display_venue_details = isset($CFG->display_venue_details) && ! empty($CFG->display_venue_details) ? $CFG->display_venue_details : TRUE; |
|
750 | + $CFG->display_expired_events = isset($CFG->display_expired_events) && ! empty($CFG->display_expired_events) ? $CFG->display_expired_events : FALSE; |
|
751 | + $CFG->default_type = isset($CFG->default_type) && ! empty($CFG->default_type) ? $CFG->default_type : 'grid'; |
|
752 | + $CFG->event_list_grid_size = isset($CFG->event_list_grid_size) && ! empty($CFG->event_list_grid_size) ? $CFG->event_list_grid_size : 'medium'; |
|
753 | + $CFG->templates['full'] = isset($CFG->templates['full']) && ! empty($CFG->templates['full']) ? $CFG->templates['full'] : EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events.php'; |
|
754 | + $CFG->templates['part'] = isset($CFG->templates['part']) && ! empty($CFG->templates['part']) ? $CFG->templates['part'] : EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-grid-view.php'; |
|
755 | 755 | return $CFG; |
756 | 756 | } |
757 | 757 | |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | * @access public |
764 | 764 | * @return void |
765 | 765 | */ |
766 | - public function filter_config( $CFG ) { |
|
766 | + public function filter_config($CFG) { |
|
767 | 767 | return $CFG; |
768 | 768 | } |
769 | 769 | |
@@ -776,32 +776,32 @@ discard block |
||
776 | 776 | * @access public |
777 | 777 | * @return void |
778 | 778 | */ |
779 | - public static function update_template_settings( $CFG, $REQ ) { |
|
779 | + public static function update_template_settings($CFG, $REQ) { |
|
780 | 780 | // EEH_Debug_Tools::printr( $REQ, '$REQ <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
781 | 781 | // EEH_Debug_Tools::printr( $CFG, '$CFG <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
782 | 782 | //$CFG->template_settings->EED_Events_Archive_Filters = new stdClass(); |
783 | - $CFG->EED_Events_Archive_Filters->display_description = isset( $REQ['display_description_in_event_list'] ) ? absint( $REQ['display_description_in_event_list'] ) : 1; |
|
784 | - $CFG->EED_Events_Archive_Filters->display_address = isset( $REQ['display_address_in_event_list'] ) ? absint( $REQ['display_address_in_event_list'] ) : TRUE; |
|
785 | - $CFG->EED_Events_Archive_Filters->display_venue_details = isset( $REQ['display_venue_details_in_event_list'] ) ? absint( $REQ['display_venue_details_in_event_list'] ) : TRUE; |
|
786 | - $CFG->EED_Events_Archive_Filters->display_expired_events = isset( $REQ['display_expired_events'] ) ? absint( $REQ['display_expired_events'] ) : FALSE; |
|
787 | - $CFG->EED_Events_Archive_Filters->default_type = isset( $REQ['default_type'] ) ? sanitize_text_field( $REQ['default_type'] ) : 'grid'; |
|
788 | - $CFG->EED_Events_Archive_Filters->event_list_grid_size = isset( $REQ['event_list_grid_size'] ) ? sanitize_text_field( $REQ['event_list_grid_size'] ) : 'medium'; |
|
783 | + $CFG->EED_Events_Archive_Filters->display_description = isset($REQ['display_description_in_event_list']) ? absint($REQ['display_description_in_event_list']) : 1; |
|
784 | + $CFG->EED_Events_Archive_Filters->display_address = isset($REQ['display_address_in_event_list']) ? absint($REQ['display_address_in_event_list']) : TRUE; |
|
785 | + $CFG->EED_Events_Archive_Filters->display_venue_details = isset($REQ['display_venue_details_in_event_list']) ? absint($REQ['display_venue_details_in_event_list']) : TRUE; |
|
786 | + $CFG->EED_Events_Archive_Filters->display_expired_events = isset($REQ['display_expired_events']) ? absint($REQ['display_expired_events']) : FALSE; |
|
787 | + $CFG->EED_Events_Archive_Filters->default_type = isset($REQ['default_type']) ? sanitize_text_field($REQ['default_type']) : 'grid'; |
|
788 | + $CFG->EED_Events_Archive_Filters->event_list_grid_size = isset($REQ['event_list_grid_size']) ? sanitize_text_field($REQ['event_list_grid_size']) : 'medium'; |
|
789 | 789 | $CFG->EED_Events_Archive_Filters->templates = array( |
790 | - 'full' => EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events.php' |
|
790 | + 'full' => EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events.php' |
|
791 | 791 | ); |
792 | 792 | |
793 | - switch ( $CFG->EED_Events_Archive_Filters->default_type ) { |
|
793 | + switch ($CFG->EED_Events_Archive_Filters->default_type) { |
|
794 | 794 | case 'dates' : |
795 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-dates-view.php'; |
|
795 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-dates-view.php'; |
|
796 | 796 | break; |
797 | 797 | case 'text' : |
798 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-text-view.php'; |
|
798 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-text-view.php'; |
|
799 | 799 | break; |
800 | 800 | default : |
801 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-grid-view.php'; |
|
801 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-grid-view.php'; |
|
802 | 802 | } |
803 | 803 | |
804 | - $CFG->EED_Events_Archive_Filters = isset( $REQ['reset_event_list_settings'] ) && absint( $REQ['reset_event_list_settings'] ) == 1 ? new EE_Events_Archive_Config() : $CFG->EED_Events_Archive_Filters; |
|
804 | + $CFG->EED_Events_Archive_Filters = isset($REQ['reset_event_list_settings']) && absint($REQ['reset_event_list_settings']) == 1 ? new EE_Events_Archive_Config() : $CFG->EED_Events_Archive_Filters; |
|
805 | 805 | return $CFG; |
806 | 806 | } |
807 | 807 | |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * @return void |
817 | 817 | */ |
818 | 818 | public static function get_template_part() { |
819 | - switch ( self::$_type ) { |
|
819 | + switch (self::$_type) { |
|
820 | 820 | case 'dates' : |
821 | 821 | return 'archive-espresso_events-dates-view.php'; |
822 | 822 | break; |
@@ -840,13 +840,13 @@ discard block |
||
840 | 840 | */ |
841 | 841 | public function event_list_template_filters() { |
842 | 842 | $args = array( |
843 | - 'form_url' => get_post_type_archive_link( 'espresso_events' ), //add_query_arg( array( 'post_type' => 'espresso_events' ), home_url() ), |
|
843 | + 'form_url' => get_post_type_archive_link('espresso_events'), //add_query_arg( array( 'post_type' => 'espresso_events' ), home_url() ), |
|
844 | 844 | 'elf_month' => EED_Events_Archive_Filters::_display_month(), |
845 | 845 | 'elf_category' => EED_Events_Archive_Filters::_event_category_slug(), |
846 | 846 | 'elf_show_expired' => EED_Events_Archive_Filters::_show_expired(), |
847 | 847 | 'elf_type' => self::$_type |
848 | 848 | ); |
849 | - EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-filters.php', $args ); |
|
849 | + EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-filters.php', $args); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | |
@@ -859,16 +859,16 @@ discard block |
||
859 | 859 | * @access public |
860 | 860 | * @return void |
861 | 861 | */ |
862 | - public static function event_list_css( $extra_class = '' ) { |
|
862 | + public static function event_list_css($extra_class = '') { |
|
863 | 863 | $EE = EE_Registry::instance(); |
864 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
864 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
865 | 865 | $event_list_css[] = 'espresso-event-list-event'; |
866 | - if ( self::$_type == 'grid' ) { |
|
867 | - $event_list_grid_size = isset( $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size : 'medium'; |
|
868 | - $event_list_css[] = $event_list_grid_size . '-event-list-grid'; |
|
866 | + if (self::$_type == 'grid') { |
|
867 | + $event_list_grid_size = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size : 'medium'; |
|
868 | + $event_list_css[] = $event_list_grid_size.'-event-list-grid'; |
|
869 | 869 | } |
870 | - $event_list_css = apply_filters( 'EED_Events_Archive_Filters__event_list_css__event_list_css_array', $event_list_css ); |
|
871 | - return implode( ' ', $event_list_css ); |
|
870 | + $event_list_css = apply_filters('EED_Events_Archive_Filters__event_list_css__event_list_css_array', $event_list_css); |
|
871 | + return implode(' ', $event_list_css); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
@@ -894,9 +894,9 @@ discard block |
||
894 | 894 | * @access public |
895 | 895 | * @return void |
896 | 896 | */ |
897 | - public static function display_description( $value ) { |
|
897 | + public static function display_description($value) { |
|
898 | 898 | $EE = EE_Registry::instance(); |
899 | - $display_description= isset( $EE->CFG->template_settings->EED_Events_Archive_Filters->display_description ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_description : 1; |
|
899 | + $display_description = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_description) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_description : 1; |
|
900 | 900 | return $display_description === $value ? TRUE : FALSE; |
901 | 901 | } |
902 | 902 | |
@@ -910,10 +910,10 @@ discard block |
||
910 | 910 | */ |
911 | 911 | public static function display_venue_details() { |
912 | 912 | $EE = EE_Registry::instance(); |
913 | - $EE->load_helper( 'Venue_View' ); |
|
914 | - $display_venue_details= isset( $EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details : TRUE; |
|
913 | + $EE->load_helper('Venue_View'); |
|
914 | + $display_venue_details = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details : TRUE; |
|
915 | 915 | $venue_name = EEH_Venue_View::venue_name(); |
916 | - return $display_venue_details && ! empty( $venue_name ) ? TRUE : FALSE; |
|
916 | + return $display_venue_details && ! empty($venue_name) ? TRUE : FALSE; |
|
917 | 917 | } |
918 | 918 | |
919 | 919 | |
@@ -925,10 +925,10 @@ discard block |
||
925 | 925 | */ |
926 | 926 | public static function display_address() { |
927 | 927 | $EE = EE_Registry::instance(); |
928 | - $EE->load_helper( 'Venue_View' ); |
|
929 | - $display_address= isset( $EE->CFG->template_settings->EED_Events_Archive_Filters->display_address ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_address : FALSE; |
|
928 | + $EE->load_helper('Venue_View'); |
|
929 | + $display_address = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_address) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_address : FALSE; |
|
930 | 930 | $venue_name = EEH_Venue_View::venue_name(); |
931 | - return $display_address && ! empty( $venue_name ) ? TRUE : FALSE; |
|
931 | + return $display_address && ! empty($venue_name) ? TRUE : FALSE; |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
@@ -942,22 +942,22 @@ discard block |
||
942 | 942 | public static function pagination() { |
943 | 943 | global $wp_query; |
944 | 944 | $big = 999999999; // need an unlikely integer |
945 | - $pagination = paginate_links( array( |
|
946 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
945 | + $pagination = paginate_links(array( |
|
946 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
947 | 947 | 'format' => '?paged=%#%', |
948 | - 'current' => max( 1, get_query_var('paged') ), |
|
948 | + 'current' => max(1, get_query_var('paged')), |
|
949 | 949 | 'total' => $wp_query->max_num_pages, |
950 | 950 | 'show_all' => TRUE, |
951 | 951 | 'end_size' => 10, |
952 | 952 | 'mid_size' => 6, |
953 | 953 | 'prev_next' => TRUE, |
954 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
955 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
954 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
955 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
956 | 956 | 'type' => 'plain', |
957 | 957 | 'add_args' => FALSE, |
958 | 958 | 'add_fragment' => '' |
959 | 959 | )); |
960 | - return ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
960 | + return ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | * @return void |
972 | 972 | */ |
973 | 973 | public static function event_list_title() { |
974 | - return apply_filters( 'EED_Events_Archive_Filters__event_list_title__event_list_title', __( 'Upcoming Events', 'event_espresso' )); |
|
974 | + return apply_filters('EED_Events_Archive_Filters__event_list_title__event_list_title', __('Upcoming Events', 'event_espresso')); |
|
975 | 975 | } |
976 | 976 | |
977 | 977 |
@@ -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 | * |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @access public |
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | - * @return void |
|
128 | + * @return string |
|
129 | 129 | */ |
130 | 130 | public static function comment_feed_join( $SQL ) { |
131 | 131 | global $wpdb; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @access public |
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | - * @return void |
|
149 | + * @return string |
|
150 | 150 | */ |
151 | 151 | public static function comment_feed_where( $SQL ) { |
152 | 152 | global $wp_query, $wpdb; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @access public |
166 | 166 | * @param string $content |
167 | - * @return void |
|
167 | + * @return string |
|
168 | 168 | */ |
169 | 169 | public static function the_event_feed( $content ) { |
170 | 170 | if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @access public |
207 | 207 | * @param string $content |
208 | - * @return void |
|
208 | + * @return string |
|
209 | 209 | */ |
210 | 210 | public static function the_venue_feed( $content ) { |
211 | 211 | if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Feeds |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | public static function set_hooks() { |
44 | - add_action( 'parse_request', array( 'EED_Feeds', 'parse_request' ), 10 ); |
|
45 | - add_filter( 'default_feed', array( 'EED_Feeds', 'default_feed' ), 10, 1 ); |
|
46 | - add_filter( 'comment_feed_join', array( 'EED_Feeds', 'comment_feed_join' ), 10, 2 ); |
|
47 | - add_filter( 'comment_feed_where', array( 'EED_Feeds', 'comment_feed_where' ), 10, 2 ); |
|
44 | + add_action('parse_request', array('EED_Feeds', 'parse_request'), 10); |
|
45 | + add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1); |
|
46 | + add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2); |
|
47 | + add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access public |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param type rss2, atom, rss, rdf, rssjs |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - public static function default_feed( $type = 'rss2' ) { |
|
79 | + public static function default_feed($type = 'rss2') { |
|
80 | 80 | //rss2, atom, rss, rdf, rssjs |
81 | 81 | $type = 'rss2'; |
82 | 82 | return $type; |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | public static function parse_request() { |
95 | - if ( EE_Registry::instance()->REQ->is_set( 'post_type' )) { |
|
95 | + if (EE_Registry::instance()->REQ->is_set('post_type')) { |
|
96 | 96 | // define path to templates |
97 | - define( 'RSS_FEEDS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
97 | + define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
98 | 98 | // what kinda post_type are we dealing with ? |
99 | - switch( EE_Registry::instance()->REQ->get( 'post_type' )) { |
|
99 | + switch (EE_Registry::instance()->REQ->get('post_type')) { |
|
100 | 100 | case 'espresso_events' : |
101 | 101 | // for rss2, atom, rss, rdf |
102 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
103 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
102 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
103 | + add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
104 | 104 | // for json ( also uses the above filter ) |
105 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_event_rssjs_feed' ), 10, 1 ); |
|
105 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1); |
|
106 | 106 | break; |
107 | 107 | case 'espresso_venues' : |
108 | 108 | // for rss2, atom, rss, rdf |
109 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
110 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
109 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
110 | + add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
111 | 111 | // for json ( also uses the above filter ) |
112 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_venue_rssjs_feed' ), 10, 1 ); |
|
112 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1); |
|
113 | 113 | break; |
114 | 114 | } |
115 | 115 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public static function comment_feed_join( $SQL ) { |
|
130 | + public static function comment_feed_join($SQL) { |
|
131 | 131 | global $wpdb; |
132 | 132 | // check for wp_posts table in JOIN clause |
133 | - if ( strpos( $SQL, $wpdb->posts ) !== FALSE ) { |
|
134 | - add_filter( 'EED_Feeds__comment_feed_where__espresso_attendees', '__return_true' ); |
|
133 | + if (strpos($SQL, $wpdb->posts) !== FALSE) { |
|
134 | + add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true'); |
|
135 | 135 | } |
136 | 136 | return $SQL; |
137 | 137 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public static function comment_feed_where( $SQL ) { |
|
151 | + public static function comment_feed_where($SQL) { |
|
152 | 152 | global $wp_query, $wpdb; |
153 | - if ( $wp_query->is_comment_feed && apply_filters( 'EED_Feeds__comment_feed_where__espresso_attendees', FALSE )) { |
|
153 | + if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', FALSE)) { |
|
154 | 154 | $SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'"; |
155 | 155 | } |
156 | 156 | return $SQL; |
@@ -166,16 +166,16 @@ discard block |
||
166 | 166 | * @param string $content |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function the_event_feed( $content ) { |
|
170 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
|
171 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
172 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
169 | + public static function the_event_feed($content) { |
|
170 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) { |
|
171 | + EE_Registry::instance()->load_helper('Event_View'); |
|
172 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
173 | 173 | global $post; |
174 | 174 | $template_args = array( |
175 | 175 | 'EVT_ID' => $post->ID, |
176 | 176 | 'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
177 | 177 | ); |
178 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php', $template_args, TRUE ); |
|
178 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php', $template_args, TRUE); |
|
179 | 179 | } |
180 | 180 | return $content; |
181 | 181 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * @param object $item |
191 | 191 | * @return void |
192 | 192 | */ |
193 | - public static function the_event_rssjs_feed( $item ) { |
|
194 | - if ( is_feed() && isset( $item->description )) { |
|
195 | - $item->description = EED_Feeds::the_event_feed( $item->description ); |
|
193 | + public static function the_event_rssjs_feed($item) { |
|
194 | + if (is_feed() && isset($item->description)) { |
|
195 | + $item->description = EED_Feeds::the_event_feed($item->description); |
|
196 | 196 | } |
197 | 197 | return $item; |
198 | 198 | } |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | * @param string $content |
208 | 208 | * @return void |
209 | 209 | */ |
210 | - public static function the_venue_feed( $content ) { |
|
211 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
|
212 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
213 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
210 | + public static function the_venue_feed($content) { |
|
211 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) { |
|
212 | + EE_Registry::instance()->load_helper('Event_View'); |
|
213 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
214 | 214 | global $post; |
215 | 215 | $template_args = array( |
216 | 216 | 'VNU_ID' => $post->ID, |
217 | 217 | 'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
218 | 218 | ); |
219 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php', $template_args, TRUE ); |
|
219 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php', $template_args, TRUE); |
|
220 | 220 | } |
221 | 221 | return $content; |
222 | 222 | } |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param object $item |
232 | 232 | * @return void |
233 | 233 | */ |
234 | - public static function the_venue_rssjs_feed( $item ) { |
|
235 | - if ( is_feed() && isset( $item->description )) { |
|
236 | - $item->description = EED_Feeds::the_venue_feed( $item->description ); |
|
234 | + public static function the_venue_rssjs_feed($item) { |
|
235 | + if (is_feed() && isset($item->description)) { |
|
236 | + $item->description = EED_Feeds::the_venue_feed($item->description); |
|
237 | 237 | } |
238 | 238 | return $item; |
239 | 239 | } |
@@ -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 | * |
@@ -558,7 +558,7 @@ |
||
558 | 558 | * |
559 | 559 | * @param string $payment_status The payment status being matched. |
560 | 560 | * |
561 | - * @return string|bool The payment message type slug matching the status or false if no match. |
|
561 | + * @return string|false The payment message type slug matching the status or false if no match. |
|
562 | 562 | */ |
563 | 563 | protected static function _get_payment_message_type( $payment_status ) { |
564 | 564 | $matches = array( |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage modules, messages |
8 | 8 | */ |
9 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
10 | + exit('No direct script access allowed'); |
|
11 | +} |
|
10 | 12 | /** |
11 | 13 | * |
12 | 14 | * Messages module. Takes care of registering all the triggers for messages. |
@@ -216,14 +218,16 @@ discard block |
||
216 | 218 | $template = basename( $template_path ); |
217 | 219 | |
218 | 220 | //is this already set? |
219 | - if ( isset( self::$_TMP_PACKS[$template] ) ) |
|
220 | - continue; |
|
221 | + if ( isset( self::$_TMP_PACKS[$template] ) ) { |
|
222 | + continue; |
|
223 | + } |
|
221 | 224 | |
222 | 225 | //setup classname. |
223 | 226 | $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template ) ) ); |
224 | 227 | |
225 | - if ( ! class_exists( $pack_class ) ) |
|
226 | - continue; |
|
228 | + if ( ! class_exists( $pack_class ) ) { |
|
229 | + continue; |
|
230 | + } |
|
227 | 231 | |
228 | 232 | $template_packs[$template] = new $pack_class; |
229 | 233 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return EED_Module |
59 | 59 | */ |
60 | 60 | public static function instance() { |
61 | - return parent::get_instance( __CLASS__ ); |
|
61 | + return parent::get_instance(__CLASS__); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function set_hooks() { |
75 | 75 | //actions |
76 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
77 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 ); |
|
76 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
77 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2); |
|
78 | 78 | //filters |
79 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
80 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
79 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
80 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
81 | 81 | //register routes |
82 | 82 | self::_register_routes(); |
83 | 83 | } |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function set_hooks_admin() { |
92 | 92 | //actions |
93 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
94 | - add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder'), 10 ); |
|
95 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 ); |
|
96 | - add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', array( 'EED_Messages', 'send_newsletter_message'), 10, 2 ); |
|
97 | - add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 ); |
|
93 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
94 | + add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10); |
|
95 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3); |
|
96 | + add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', array('EED_Messages', 'send_newsletter_message'), 10, 2); |
|
97 | + add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10); |
|
98 | 98 | //filters |
99 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', array( 'EED_Messages', 'process_admin_payment'), 10, 2 ); |
|
100 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
101 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
99 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', array('EED_Messages', 'process_admin_payment'), 10, 2); |
|
100 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
101 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @return void |
113 | 113 | */ |
114 | 114 | protected static function _register_routes() { |
115 | - EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' ); |
|
116 | - do_action( 'AHEE__EED_Messages___register_routes' ); |
|
115 | + EE_Config::register_route('msg_url_trigger', 'Messages', 'run'); |
|
116 | + do_action('AHEE__EED_Messages___register_routes'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @throws EE_Error |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - public function run( $WP ) { |
|
129 | + public function run($WP) { |
|
130 | 130 | |
131 | 131 | $sending_messenger = EE_Registry::instance()->REQ->is_set('snd_msgr') ? EE_Registry::instance()->REQ->get('snd_msgr') : ''; |
132 | 132 | $generating_messenger = EE_Registry::instance()->REQ->is_set('gen_msgr') ? EE_Registry::instance()->REQ->get('gen_msgr') : ''; |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | $data_id = EE_Registry::instance()->REQ->is_set('id') ? (int) EE_Registry::instance()->REQ->get('id') : 0; |
137 | 137 | |
138 | 138 | //verify the needed params are present. |
139 | - if ( empty( $sending_messenger ) || empty( $generating_messenger ) || empty( $message_type ) || empty( $context ) || empty( $token ) ) { |
|
140 | - EE_Error::add_error( __( 'The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
139 | + if (empty($sending_messenger) || empty($generating_messenger) || empty($message_type) || empty($context) || empty($token)) { |
|
140 | + EE_Error::add_error(__('The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
141 | 141 | return; |
142 | 142 | } |
143 | 143 | //get the registration: the token will always be the unique REG_url_link saved with a registration. We use that to make sure we retrieve the correct data for the given registration. |
144 | - $registration = EEM_Registration::instance()->get_one( array( array( 'REG_url_link' => $token ) ) ); |
|
144 | + $registration = EEM_Registration::instance()->get_one(array(array('REG_url_link' => $token))); |
|
145 | 145 | //if no registration then bail early. |
146 | - if ( ! $registration instanceof EE_Registration ) { |
|
147 | - EE_Error::add_error( __( 'Unable to complete the request because the token is invalid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
146 | + if ( ! $registration instanceof EE_Registration) { |
|
147 | + EE_Error::add_error(__('Unable to complete the request because the token is invalid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | //ensure controller is loaded |
@@ -154,16 +154,16 @@ discard block |
||
154 | 154 | // retrieve the data via the handler |
155 | 155 | // Depending on the context and the message type data handler, the data_id will correspond to the specific data handler item we need to retrieve for specific messages |
156 | 156 | // (i.e. a specific payment or specific refund). |
157 | - $data = $this->_get_messages_data_from_url( $generating_messenger, $message_type, $registration, $data_id, $context ); |
|
157 | + $data = $this->_get_messages_data_from_url($generating_messenger, $message_type, $registration, $data_id, $context); |
|
158 | 158 | //make sure we drop generating messenger if both sending and generating are the same. |
159 | 159 | $generating_messenger = $sending_messenger != $generating_messenger ? $generating_messenger : NULL; |
160 | 160 | //now we can trigger the actual sending of the message via the message type. |
161 | - self::$_EEMSG->send_message( $message_type, $data, $sending_messenger, $generating_messenger, $context ); |
|
162 | - } catch ( EE_Error $e ) { |
|
163 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
161 | + self::$_EEMSG->send_message($message_type, $data, $sending_messenger, $generating_messenger, $context); |
|
162 | + } catch (EE_Error $e) { |
|
163 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
164 | 164 | // add specific message for developers if WP_DEBUG in on |
165 | - $error_msg .= '||' . $e->getMessage(); |
|
166 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
165 | + $error_msg .= '||'.$e->getMessage(); |
|
166 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -178,17 +178,17 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return EE_Messages_Template_Pack |
180 | 180 | */ |
181 | - public static function get_template_pack( $template_pack_name ) { |
|
182 | - if ( isset( self::$_TMP_PACKS[$template_pack_name] ) ) { |
|
181 | + public static function get_template_pack($template_pack_name) { |
|
182 | + if (isset(self::$_TMP_PACKS[$template_pack_name])) { |
|
183 | 183 | return self::$_TMP_PACKS[$template_pack_name]; |
184 | 184 | } |
185 | 185 | |
186 | 186 | //not set yet so let's attempt to get it. |
187 | - $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template_pack_name ) ) ); |
|
187 | + $pack_class = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template_pack_name))); |
|
188 | 188 | |
189 | - if ( ! class_exists( $pack_class ) ) { |
|
189 | + if ( ! class_exists($pack_class)) { |
|
190 | 190 | $pack_class = 'EE_Messages_Template_Pack_Default'; |
191 | - self::$_TMP_PACKS['default'] = empty( self::$_TMP_PACKS['default'] ) ? new $pack_class : self::$_TMP_PACKS['default']; |
|
191 | + self::$_TMP_PACKS['default'] = empty(self::$_TMP_PACKS['default']) ? new $pack_class : self::$_TMP_PACKS['default']; |
|
192 | 192 | return self::$_TMP_PACKS['default']; |
193 | 193 | } else { |
194 | 194 | $pack = new $pack_class; |
@@ -208,27 +208,27 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public static function get_template_packs() { |
210 | 210 | //glob the defaults directory for messages |
211 | - $templates = glob( EE_LIBRARIES . 'messages/defaults/*', GLOB_ONLYDIR ); |
|
211 | + $templates = glob(EE_LIBRARIES.'messages/defaults/*', GLOB_ONLYDIR); |
|
212 | 212 | $template_packs = array(); |
213 | - foreach( $templates as $template_path ) { |
|
213 | + foreach ($templates as $template_path) { |
|
214 | 214 | //grab folder name |
215 | - $template = basename( $template_path ); |
|
215 | + $template = basename($template_path); |
|
216 | 216 | |
217 | 217 | //is this already set? |
218 | - if ( isset( self::$_TMP_PACKS[$template] ) ) |
|
218 | + if (isset(self::$_TMP_PACKS[$template])) |
|
219 | 219 | continue; |
220 | 220 | |
221 | 221 | //setup classname. |
222 | - $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template ) ) ); |
|
222 | + $pack_class = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template))); |
|
223 | 223 | |
224 | - if ( ! class_exists( $pack_class ) ) |
|
224 | + if ( ! class_exists($pack_class)) |
|
225 | 225 | continue; |
226 | 226 | |
227 | 227 | $template_packs[$template] = new $pack_class; |
228 | 228 | } |
229 | 229 | |
230 | - $template_packs = apply_filters( 'FHEE__EED_Messages__get_template_packs__template_packs', $template_packs ); |
|
231 | - self::$_TMP_PACKS = array_merge( self::$_TMP_PACKS, $template_packs ); |
|
230 | + $template_packs = apply_filters('FHEE__EED_Messages__get_template_packs__template_packs', $template_packs); |
|
231 | + self::$_TMP_PACKS = array_merge(self::$_TMP_PACKS, $template_packs); |
|
232 | 232 | return self::$_TMP_PACKS; |
233 | 233 | } |
234 | 234 | |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
252 | 252 | */ |
253 | - protected function _get_messages_data_from_url( $generating_messenger, $message_type, EE_Registration $registration, $data_id, $context ) { |
|
253 | + protected function _get_messages_data_from_url($generating_messenger, $message_type, EE_Registration $registration, $data_id, $context) { |
|
254 | 254 | //get message type object then get the correct data setup for that message type. |
255 | - $message_type = self::$_EEMSG->get_active_message_type( $generating_messenger, $message_type ); |
|
255 | + $message_type = self::$_EEMSG->get_active_message_type($generating_messenger, $message_type); |
|
256 | 256 | //if no message type then it likely isn't active for this messenger. |
257 | - if ( ! $message_type instanceof EE_message_type ) { |
|
258 | - throw new EE_Error( sprintf( __('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger ) ); |
|
257 | + if ( ! $message_type instanceof EE_message_type) { |
|
258 | + throw new EE_Error(sprintf(__('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger)); |
|
259 | 259 | } |
260 | 260 | //get data according to data handler requirements |
261 | - return $message_type->get_data_for_context( $context, $registration, $data_id ); |
|
261 | + return $message_type->get_data_for_context($context, $registration, $data_id); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | * @return void |
272 | 272 | */ |
273 | 273 | public static function set_autoloaders() { |
274 | - if ( empty( self::$_MSG_PATHS ) ) { |
|
274 | + if (empty(self::$_MSG_PATHS)) { |
|
275 | 275 | self::_set_messages_paths(); |
276 | 276 | EE_Registry::instance()->load_helper('Autoloader'); |
277 | - foreach ( self::$_MSG_PATHS as $path ) { |
|
278 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path ); |
|
277 | + foreach (self::$_MSG_PATHS as $path) { |
|
278 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
@@ -305,10 +305,10 @@ discard block |
||
305 | 305 | 'shortcodes' |
306 | 306 | ); |
307 | 307 | $paths = array(); |
308 | - foreach ( $dir_ref as $index => $dir ) { |
|
309 | - $paths[$index] = EE_LIBRARIES . $dir; |
|
308 | + foreach ($dir_ref as $index => $dir) { |
|
309 | + $paths[$index] = EE_LIBRARIES.$dir; |
|
310 | 310 | } |
311 | - self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths ); |
|
311 | + self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @return void |
321 | 321 | */ |
322 | 322 | protected static function _load_controller() { |
323 | - if ( ! self::$_EEMSG instanceof EE_messages ) { |
|
323 | + if ( ! self::$_EEMSG instanceof EE_messages) { |
|
324 | 324 | self::set_autoloaders(); |
325 | 325 | self::$_EEMSG = new EE_messages(); |
326 | 326 | } |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * @param EE_Transaction $transaction |
333 | 333 | */ |
334 | - public static function payment_reminder( EE_Transaction $transaction ) { |
|
334 | + public static function payment_reminder(EE_Transaction $transaction) { |
|
335 | 335 | self::_load_controller(); |
336 | - $data = array( $transaction, null ); |
|
337 | - if ( self::$_EEMSG->send_message( 'payment_reminder', $data ) ) { |
|
336 | + $data = array($transaction, null); |
|
337 | + if (self::$_EEMSG->send_message('payment_reminder', $data)) { |
|
338 | 338 | //self::log( |
339 | 339 | // __CLASS__, __FUNCTION__, __LINE__, |
340 | 340 | // $transaction, |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | * @param EE_Payment object |
356 | 356 | * @return void |
357 | 357 | */ |
358 | - public static function payment( EE_Transaction $transaction, EE_Payment $payment ) { |
|
358 | + public static function payment(EE_Transaction $transaction, EE_Payment $payment) { |
|
359 | 359 | self::_load_controller(); |
360 | - $data = array( $transaction, $payment ); |
|
360 | + $data = array($transaction, $payment); |
|
361 | 361 | |
362 | - $message_type = self::_get_payment_message_type( $payment->STS_ID() ); |
|
362 | + $message_type = self::_get_payment_message_type($payment->STS_ID()); |
|
363 | 363 | |
364 | 364 | //if payment amount is less than 0 then switch to payment_refund message type. |
365 | 365 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -367,15 +367,15 @@ discard block |
||
367 | 367 | //verify this message type is present and active. If it isn't then no message is sent. |
368 | 368 | $active_mts = self::$_EEMSG->get_active_message_types(); |
369 | 369 | |
370 | - $message_type = in_array( $message_type, $active_mts ) ? $message_type : false; |
|
371 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, current_time( 'mysql' ), 'delivered' ); |
|
372 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $message_type, '$message_type' ); |
|
373 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()' ); |
|
374 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
375 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, print_r( $active_mts, true ), '$active_mts' ); |
|
370 | + $message_type = in_array($message_type, $active_mts) ? $message_type : false; |
|
371 | + do_action('AHEE_log', __FILE__, __FUNCTION__, current_time('mysql'), 'delivered'); |
|
372 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $message_type, '$message_type'); |
|
373 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()'); |
|
374 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
375 | + do_action('AHEE_log', __FILE__, __FUNCTION__, print_r($active_mts, true), '$active_mts'); |
|
376 | 376 | |
377 | - if ( $message_type ) { |
|
378 | - if ( self::$_EEMSG->send_message( $message_type, $data ) ) { |
|
377 | + if ($message_type) { |
|
378 | + if (self::$_EEMSG->send_message($message_type, $data)) { |
|
379 | 379 | //self::log( |
380 | 380 | // __CLASS__, __FUNCTION__, __LINE__, |
381 | 381 | // $transaction, |
@@ -395,15 +395,15 @@ discard block |
||
395 | 395 | /** |
396 | 396 | * @param EE_Transaction $transaction |
397 | 397 | */ |
398 | - public static function cancelled_registration( EE_Transaction $transaction ) { |
|
398 | + public static function cancelled_registration(EE_Transaction $transaction) { |
|
399 | 399 | self::_load_controller(); |
400 | 400 | |
401 | - $data = array( $transaction, NULL ); |
|
401 | + $data = array($transaction, NULL); |
|
402 | 402 | |
403 | 403 | $active_mts = self::$_EEMSG->get_active_message_types(); |
404 | 404 | |
405 | - if ( in_array( 'cancelled_registration', $active_mts ) ) { |
|
406 | - self::$_EEMSG->send_message( 'cancelled_registration', $data ); |
|
405 | + if (in_array('cancelled_registration', $active_mts)) { |
|
406 | + self::$_EEMSG->send_message('cancelled_registration', $data); |
|
407 | 407 | } |
408 | 408 | return; |
409 | 409 | } |
@@ -418,15 +418,15 @@ discard block |
||
418 | 418 | * @param array $extra_details |
419 | 419 | * @return void |
420 | 420 | */ |
421 | - public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) { |
|
421 | + public static function maybe_registration(EE_Registration $registration, $extra_details = array()) { |
|
422 | 422 | |
423 | - if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) { |
|
423 | + if ( ! self::_verify_registration_notification_send($registration, $extra_details)) { |
|
424 | 424 | //no messages please |
425 | 425 | return; |
426 | 426 | } |
427 | 427 | |
428 | 428 | |
429 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
429 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
430 | 430 | |
431 | 431 | //get all registrations so we make sure we send messages for the right status. |
432 | 432 | $all_registrations = $registration->transaction()->registrations(); |
@@ -435,19 +435,19 @@ discard block |
||
435 | 435 | $statuses_sent = array(); |
436 | 436 | |
437 | 437 | //loop through registrations and trigger messages once per status. |
438 | - foreach ( $all_registrations as $reg ) { |
|
438 | + foreach ($all_registrations as $reg) { |
|
439 | 439 | |
440 | 440 | //already triggered? |
441 | - if ( in_array( $reg->status_ID(), $statuses_sent ) ) { |
|
441 | + if (in_array($reg->status_ID(), $statuses_sent)) { |
|
442 | 442 | continue; |
443 | 443 | } |
444 | 444 | |
445 | - $message_type = self::_get_reg_status_array( $reg->status_ID() ); |
|
446 | - if ( EEH_MSG_Template::is_mt_active( $message_type ) ) { |
|
445 | + $message_type = self::_get_reg_status_array($reg->status_ID()); |
|
446 | + if (EEH_MSG_Template::is_mt_active($message_type)) { |
|
447 | 447 | self::_load_controller(); |
448 | 448 | |
449 | 449 | //send away, send away, uhhuh |
450 | - if ( self::$_EEMSG->send_message( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) ) ) { |
|
450 | + if (self::$_EEMSG->send_message($message_type, array($registration->transaction(), null, $reg->status_ID()))) { |
|
451 | 451 | // DEBUG LOG |
452 | 452 | // self::log( |
453 | 453 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -466,9 +466,9 @@ discard block |
||
466 | 466 | } |
467 | 467 | |
468 | 468 | //now send summary (registration_summary) if active |
469 | - if ( EEH_MSG_Template::is_mt_active( 'registration_summary' ) ) { |
|
469 | + if (EEH_MSG_Template::is_mt_active('registration_summary')) { |
|
470 | 470 | self::_load_controller(); |
471 | - if ( self::$_EEMSG->send_message( 'registration_summary', array( $registration->transaction(), null ) ) ) { |
|
471 | + if (self::$_EEMSG->send_message('registration_summary', array($registration->transaction(), null))) { |
|
472 | 472 | // DEBUG LOG |
473 | 473 | // self::log( |
474 | 474 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -494,39 +494,39 @@ discard block |
||
494 | 494 | * |
495 | 495 | * @return bool true = send away, false = nope halt the presses. |
496 | 496 | */ |
497 | - protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) { |
|
497 | + protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { |
|
498 | 498 | //self::log( |
499 | 499 | // __CLASS__, __FUNCTION__, __LINE__, |
500 | 500 | // $registration->transaction(), |
501 | 501 | // array( '$extra_details' => $extra_details ) |
502 | 502 | //); |
503 | 503 | // currently only using this to send messages for the primary registrant |
504 | - if ( ! $registration->is_primary_registrant() ) { |
|
504 | + if ( ! $registration->is_primary_registrant()) { |
|
505 | 505 | return false; |
506 | 506 | } |
507 | 507 | // first we check if we're in admin and not doing front ajax |
508 | - if ( is_admin() && ! EE_FRONT_AJAX ) { |
|
508 | + if (is_admin() && ! EE_FRONT_AJAX) { |
|
509 | 509 | //make sure appropriate admin params are set for sending messages |
510 | - if ( empty( $_REQUEST[ 'txn_reg_status_change' ][ 'send_notifications' ] ) || ! absint( $_REQUEST[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
510 | + if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) { |
|
511 | 511 | //no messages sent please. |
512 | 512 | return false; |
513 | 513 | } |
514 | 514 | } else { |
515 | 515 | // frontend request (either regular or via AJAX) |
516 | 516 | // TXN is NOT finalized ? |
517 | - if ( ! isset( $extra_details[ 'finalized' ] ) || $extra_details[ 'finalized' ] === false ) { |
|
517 | + if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) { |
|
518 | 518 | return false; |
519 | 519 | } |
520 | 520 | // return visit but nothing changed ??? |
521 | 521 | if ( |
522 | - isset( $extra_details[ 'revisit' ], $extra_details[ 'status_updates' ] ) && |
|
523 | - $extra_details[ 'revisit' ] && ! $extra_details[ 'status_updates' ] |
|
522 | + isset($extra_details['revisit'], $extra_details['status_updates']) && |
|
523 | + $extra_details['revisit'] && ! $extra_details['status_updates'] |
|
524 | 524 | ) { |
525 | 525 | return false; |
526 | 526 | } |
527 | 527 | // NOT sending messages && reg status is something other than "Not-Approved" |
528 | 528 | if ( |
529 | - ! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) && |
|
529 | + ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && |
|
530 | 530 | $registration->status_ID() !== EEM_Registration::status_id_not_approved |
531 | 531 | ) { |
532 | 532 | return false; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * @param string $reg_status |
545 | 545 | * @return array |
546 | 546 | */ |
547 | - protected static function _get_reg_status_array( $reg_status = '' ) { |
|
547 | + protected static function _get_reg_status_array($reg_status = '') { |
|
548 | 548 | $reg_status_array = array( |
549 | 549 | EEM_Registration::status_id_approved => 'registration', |
550 | 550 | EEM_Registration::status_id_pending_payment => 'pending_approval', |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | EEM_Registration::status_id_cancelled => 'cancelled_registration', |
553 | 553 | EEM_Registration::status_id_declined => 'declined_registration' |
554 | 554 | ); |
555 | - return isset( $reg_status_array[ $reg_status ] ) ? $reg_status_array[ $reg_status ] : $reg_status_array; |
|
555 | + return isset($reg_status_array[$reg_status]) ? $reg_status_array[$reg_status] : $reg_status_array; |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | * |
565 | 565 | * @return string|bool The payment message type slug matching the status or false if no match. |
566 | 566 | */ |
567 | - protected static function _get_payment_message_type( $payment_status ) { |
|
567 | + protected static function _get_payment_message_type($payment_status) { |
|
568 | 568 | $matches = array( |
569 | 569 | EEM_Payment::status_id_approved => 'payment', |
570 | 570 | EEM_Payment::status_id_pending => 'payment_pending', |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | EEM_Payment::status_id_failed => 'payment_failed' |
574 | 574 | ); |
575 | 575 | |
576 | - return isset( $matches[$payment_status] ) ? $matches[$payment_status] : false; |
|
576 | + return isset($matches[$payment_status]) ? $matches[$payment_status] : false; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -586,22 +586,22 @@ discard block |
||
586 | 586 | * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages |
587 | 587 | * @return bool success/fail |
588 | 588 | */ |
589 | - public static function process_resend( $req_data ) { |
|
589 | + public static function process_resend($req_data) { |
|
590 | 590 | $regs_to_send = array(); |
591 | 591 | |
592 | 592 | //first let's make sure we have the reg id (needed for resending!); |
593 | - if ( ! isset( $req_data['_REG_ID'] ) ) { |
|
594 | - EE_Error::add_error( __('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
593 | + if ( ! isset($req_data['_REG_ID'])) { |
|
594 | + EE_Error::add_error(__('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
595 | 595 | return false; |
596 | 596 | } |
597 | 597 | |
598 | 598 | //if $req_data['_REG_ID'] is an array then let's group the registrations by transaction and reg status |
599 | 599 | // so we can only trigger messages per group. |
600 | - if ( is_array( $req_data['_REG_ID'] ) ) { |
|
601 | - foreach ( $req_data['_REG_ID'] as $reg_id ) { |
|
602 | - $reg = EE_Registry::instance()->load_model( 'Registration' )->get_one_by_ID( $reg_id ); |
|
603 | - if ( ! $reg instanceof EE_Registration ) { |
|
604 | - EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) ); |
|
600 | + if (is_array($req_data['_REG_ID'])) { |
|
601 | + foreach ($req_data['_REG_ID'] as $reg_id) { |
|
602 | + $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($reg_id); |
|
603 | + if ( ! $reg instanceof EE_Registration) { |
|
604 | + EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'])); |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | $regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg; |
@@ -609,11 +609,11 @@ discard block |
||
609 | 609 | } else { |
610 | 610 | //we have a single registration id, so let's see if we can get a EE_Registration from it, and if so set it up for sending. |
611 | 611 | //get reg object from reg_id |
612 | - $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID( $req_data['_REG_ID'] ); |
|
612 | + $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($req_data['_REG_ID']); |
|
613 | 613 | |
614 | 614 | //if no reg object then send error |
615 | - if ( ! $reg instanceof EE_Registration ) { |
|
616 | - EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) ); |
|
615 | + if ( ! $reg instanceof EE_Registration) { |
|
616 | + EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'])); |
|
617 | 617 | return false; |
618 | 618 | } |
619 | 619 | |
@@ -625,26 +625,26 @@ discard block |
||
625 | 625 | $active_mts = self::$_EEMSG->get_active_message_types(); |
626 | 626 | $success = false; |
627 | 627 | //loop through and send! |
628 | - foreach( $regs_to_send as $status_group ) { |
|
629 | - foreach ( $status_group as $status_id => $registrations ) { |
|
630 | - if ( ! in_array( $status_match_array[ $status_id ], $active_mts ) ) { |
|
628 | + foreach ($regs_to_send as $status_group) { |
|
629 | + foreach ($status_group as $status_id => $registrations) { |
|
630 | + if ( ! in_array($status_match_array[$status_id], $active_mts)) { |
|
631 | 631 | EE_Error::add_error( |
632 | 632 | sprintf( |
633 | 633 | __('Cannot resend the message for this registration because the corresponding message type (%1$s) is not active. If you wish to send messages for this message type then please activate it by visiting the %2$sMessages Admin Page%3$s.', 'event_espresso'), |
634 | - $status_match_array[ $reg->status_ID() ], |
|
635 | - '<a href="' . admin_url('admin.php?page=espresso_messages&action=settings') . '">', |
|
634 | + $status_match_array[$reg->status_ID()], |
|
635 | + '<a href="'.admin_url('admin.php?page=espresso_messages&action=settings').'">', |
|
636 | 636 | '</a>' |
637 | 637 | ) |
638 | 638 | ); |
639 | 639 | return false; |
640 | 640 | } |
641 | 641 | |
642 | - if ( self::$_EEMSG->send_message( $status_match_array[$status_id], array( $registrations, $status_id ) ) ) { |
|
642 | + if (self::$_EEMSG->send_message($status_match_array[$status_id], array($registrations, $status_id))) { |
|
643 | 643 | EE_Error::overwrite_success(); |
644 | - EE_Error::add_success( __('The message for this registration has been re-sent', 'event_espresso') ); |
|
644 | + EE_Error::add_success(__('The message for this registration has been re-sent', 'event_espresso')); |
|
645 | 645 | $success = true; |
646 | 646 | } else { |
647 | - EE_Error::add_error( __('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
647 | + EE_Error::add_error(__('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | } |
@@ -666,12 +666,12 @@ discard block |
||
666 | 666 | * @param EE_Payment $payment EE_payment object |
667 | 667 | * @return bool success/fail |
668 | 668 | */ |
669 | - public static function process_admin_payment( $success = TRUE, EE_Payment $payment ) { |
|
669 | + public static function process_admin_payment($success = TRUE, EE_Payment $payment) { |
|
670 | 670 | //we need to get the transaction object |
671 | 671 | $transaction = $payment->transaction(); |
672 | - if ( $transaction instanceof EE_Transaction ) { |
|
673 | - $data = array( $transaction, $payment ); |
|
674 | - $message_type = self::_get_payment_message_type( $payment->STS_ID() ); |
|
672 | + if ($transaction instanceof EE_Transaction) { |
|
673 | + $data = array($transaction, $payment); |
|
674 | + $message_type = self::_get_payment_message_type($payment->STS_ID()); |
|
675 | 675 | |
676 | 676 | //if payment amount is less than 0 then switch to payment_refund message type. |
677 | 677 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -682,18 +682,18 @@ discard block |
||
682 | 682 | self::_load_controller(); |
683 | 683 | //verify this message type is present and active. If it isn't then no message is sent. |
684 | 684 | $active_mts = self::$_EEMSG->get_active_message_types(); |
685 | - $message_type = in_array( $message_type, $active_mts ) ? $message_type : false; |
|
685 | + $message_type = in_array($message_type, $active_mts) ? $message_type : false; |
|
686 | 686 | |
687 | 687 | |
688 | - if ( $message_type ) { |
|
688 | + if ($message_type) { |
|
689 | 689 | |
690 | - $success = self::$_EEMSG->send_message( $message_type, $data ); |
|
691 | - if ( ! $success ) { |
|
692 | - EE_Error::add_error( __('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
690 | + $success = self::$_EEMSG->send_message($message_type, $data); |
|
691 | + if ( ! $success) { |
|
692 | + EE_Error::add_error(__('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | } else { |
696 | - EE_Error::add_error( __('The message type for the status of this payment is not active or does not exist, so no notification was sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
696 | + EE_Error::add_error(__('The message type for the status of this payment is not active or does not exist, so no notification was sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | } |
@@ -711,9 +711,9 @@ discard block |
||
711 | 711 | * @param int $grp_id a specific message template group id. |
712 | 712 | * @return void |
713 | 713 | */ |
714 | - public static function send_newsletter_message( $contacts, $grp_id ) { |
|
714 | + public static function send_newsletter_message($contacts, $grp_id) { |
|
715 | 715 | //make sure mtp is id and set it in the EE_Request Handler later messages setup. |
716 | - EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id ); |
|
716 | + EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id); |
|
717 | 717 | |
718 | 718 | self::_load_controller(); |
719 | 719 | self::$_EEMSG->send_message('newsletter', $contacts); |
@@ -731,10 +731,10 @@ discard block |
||
731 | 731 | * @param string $message_type |
732 | 732 | * @return string |
733 | 733 | */ |
734 | - public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) { |
|
734 | + public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { |
|
735 | 735 | EE_Registry::instance()->load_helper('MSG_Template'); |
736 | 736 | // whitelist $messenger |
737 | - switch ( $messenger ) { |
|
737 | + switch ($messenger) { |
|
738 | 738 | case 'pdf' : |
739 | 739 | $sending_messenger = 'pdf'; |
740 | 740 | $generating_messenger = 'html'; |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | break; |
747 | 747 | } |
748 | 748 | // whitelist $message_type |
749 | - switch ( $message_type ) { |
|
749 | + switch ($message_type) { |
|
750 | 750 | case 'receipt' : |
751 | 751 | $message_type = 'receipt'; |
752 | 752 | break; |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | break; |
757 | 757 | } |
758 | 758 | // verify that both the messenger AND the message type are active |
759 | - if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type )) { |
|
759 | + if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { |
|
760 | 760 | //need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?) |
761 | 761 | $template_query_params = array( |
762 | 762 | 'MTP_is_active' => TRUE, |
@@ -765,16 +765,16 @@ discard block |
||
765 | 765 | 'Event.EVT_ID' => $registration->event_ID() |
766 | 766 | ); |
767 | 767 | //get the message template group. |
768 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params )); |
|
768 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
769 | 769 | //if we don't have an EE_Message_Template_Group then return |
770 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
770 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
771 | 771 | // remove EVT_ID from query params so that global templates get picked up |
772 | - unset( $template_query_params[ 'Event.EVT_ID' ] ); |
|
772 | + unset($template_query_params['Event.EVT_ID']); |
|
773 | 773 | //get global template as the fallback |
774 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params )); |
|
774 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
775 | 775 | } |
776 | 776 | //if we don't have an EE_Message_Template_Group then return |
777 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
777 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
778 | 778 | return ''; |
779 | 779 | } |
780 | 780 | // generate the URL |
@@ -804,17 +804,17 @@ discard block |
||
804 | 804 | * @param array $info |
805 | 805 | * @param bool $display_request |
806 | 806 | */ |
807 | - protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) { |
|
807 | + protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { |
|
808 | 808 | EE_Registry::instance()->load_helper('Debug_Tools'); |
809 | - if ( WP_DEBUG && false ) { |
|
810 | - if ( $transaction instanceof EE_Transaction ) { |
|
809 | + if (WP_DEBUG && false) { |
|
810 | + if ($transaction instanceof EE_Transaction) { |
|
811 | 811 | // don't serialize objects |
812 | - $info = EEH_Debug_Tools::strip_objects( $info ); |
|
813 | - $info[ 'TXN_status' ] = $transaction->status_ID(); |
|
814 | - $info[ 'TXN_reg_steps' ] = $transaction->reg_steps(); |
|
815 | - if ( $transaction->ID() ) { |
|
816 | - $index = 'EE_Transaction: ' . $transaction->ID(); |
|
817 | - EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index ); |
|
812 | + $info = EEH_Debug_Tools::strip_objects($info); |
|
813 | + $info['TXN_status'] = $transaction->status_ID(); |
|
814 | + $info['TXN_reg_steps'] = $transaction->reg_steps(); |
|
815 | + if ($transaction->ID()) { |
|
816 | + $index = 'EE_Transaction: '.$transaction->ID(); |
|
817 | + EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); |
|
818 | 818 | } |
819 | 819 | } |
820 | 820 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | /** |
253 | 253 | * returns true if ANY reg status was updated during checkout |
254 | - * @return array |
|
254 | + * @return boolean|null |
|
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | 257 | foreach ( $this->reg_status_updated as $reg_status ) { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | /** |
277 | 277 | * @param $REG_ID |
278 | - * @param $reg_status |
|
278 | + * @param boolean $reg_status |
|
279 | 279 | */ |
280 | 280 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
281 | 281 | $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * reset_reg_steps |
531 | 531 | * |
532 | 532 | * @access public |
533 | - * @return bool |
|
533 | + * @return boolean|null |
|
534 | 534 | */ |
535 | 535 | public function reset_reg_steps() { |
536 | 536 | $this->sort_reg_steps(); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | * stores whether any updates were made to the TXN or it's related registrations |
644 | 644 | * |
645 | 645 | * @access public |
646 | - * @return bool |
|
646 | + * @return boolean|null |
|
647 | 647 | */ |
648 | 648 | public function track_transaction_and_registration_status_updates() { |
649 | 649 | // verify the transaction |
@@ -991,6 +991,7 @@ discard block |
||
991 | 991 | * |
992 | 992 | * @param string | int $reg_cache_ID |
993 | 993 | * @param EE_Registration $registration |
994 | + * @param integer $reg_cache_ID |
|
994 | 995 | * @return void |
995 | 996 | */ |
996 | 997 | protected function _refresh_registration( $reg_cache_ID, $registration ) { |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Checkout |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Checkout |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Checkout { |
15 | 15 | |
16 | 16 | /** |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
243 | 243 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
244 | 244 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
245 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
245 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
246 | 246 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
247 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
247 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | * @return array |
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
258 | - if ( $reg_status ) { |
|
257 | + foreach ($this->reg_status_updated as $reg_status) { |
|
258 | + if ($reg_status) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @param $REG_ID |
268 | 268 | * @return array |
269 | 269 | */ |
270 | - public function reg_status_updated( $REG_ID ) { |
|
271 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
270 | + public function reg_status_updated($REG_ID) { |
|
271 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | * @param $REG_ID |
278 | 278 | * @param $reg_status |
279 | 279 | */ |
280 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
281 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
280 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
281 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * can ONLY be set by the Finalize_Registration reg step |
300 | 300 | */ |
301 | 301 | public function set_exit_spco() { |
302 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
302 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
303 | 303 | $this->exit_spco = true; |
304 | 304 | } |
305 | 305 | } |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function reset_for_current_request() { |
318 | 318 | $this->process_form_submission = FALSE; |
319 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
319 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
320 | 320 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
321 | 321 | $this->continue_reg = true; |
322 | 322 | $this->redirect = false; |
323 | 323 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
324 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
324 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
325 | 325 | $this->redirect_form = ''; |
326 | 326 | } |
327 | 327 | $this->redirect_url = ''; |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | * @param EE_SPCO_Reg_Step $reg_step_obj |
339 | 339 | * @return void |
340 | 340 | */ |
341 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
342 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
341 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
342 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | * @param string $reg_step_slug |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public function remove_reg_step( $reg_step_slug = '' ) { |
|
355 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
356 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
354 | + public function remove_reg_step($reg_step_slug = '') { |
|
355 | + unset($this->reg_steps[$reg_step_slug]); |
|
356 | + if ($this->transaction instanceof EE_Transaction) { |
|
357 | 357 | /** @type EE_Transaction_Processor $transaction_processor */ |
358 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
358 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
359 | 359 | // now remove reg step from TXN and save |
360 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
360 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
361 | 361 | $this->transaction->save(); |
362 | 362 | } |
363 | 363 | } |
@@ -372,9 +372,9 @@ discard block |
||
372 | 372 | * @param int $order |
373 | 373 | * @return void |
374 | 374 | */ |
375 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
376 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
377 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
375 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
376 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
377 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
@@ -387,25 +387,25 @@ discard block |
||
387 | 387 | * @param string $current_step |
388 | 388 | * @return void |
389 | 389 | */ |
390 | - public function set_current_step( $current_step ) { |
|
390 | + public function set_current_step($current_step) { |
|
391 | 391 | // grab what step we're on |
392 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
392 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
393 | 393 | // verify instance |
394 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
394 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
395 | 395 | // we don't want to repeat completed steps if this is the first time through SPCO |
396 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
396 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
397 | 397 | // so advance to the next step |
398 | 398 | $this->set_next_step(); |
399 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
399 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
400 | 400 | // and attempt to set it as the current step |
401 | - $this->set_current_step( $this->next_step->slug() ); |
|
401 | + $this->set_current_step($this->next_step->slug()); |
|
402 | 402 | } |
403 | 403 | return; |
404 | 404 | } |
405 | - $this->current_step->set_is_current_step( TRUE ); |
|
405 | + $this->current_step->set_is_current_step(TRUE); |
|
406 | 406 | } else { |
407 | 407 | EE_Error::add_error( |
408 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
408 | + __('The current step could not be set.', 'event_espresso'), |
|
409 | 409 | __FILE__, __FUNCTION__, __LINE__ |
410 | 410 | ); |
411 | 411 | } |
@@ -422,20 +422,20 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function set_next_step() { |
424 | 424 | // set pointer to start of array |
425 | - reset( $this->reg_steps ); |
|
425 | + reset($this->reg_steps); |
|
426 | 426 | // if there is more than one step |
427 | - if ( count( $this->reg_steps ) > 1 ) { |
|
427 | + if (count($this->reg_steps) > 1) { |
|
428 | 428 | // advance to the current step and set pointer |
429 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
430 | - next( $this->reg_steps ); |
|
429 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
430 | + next($this->reg_steps); |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | // advance one more spot ( if it exists ) |
434 | - $this->next_step = next( $this->reg_steps ); |
|
434 | + $this->next_step = next($this->reg_steps); |
|
435 | 435 | // verify instance |
436 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
436 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
437 | 437 | // then back to current step to reset |
438 | - prev( $this->reg_steps ); |
|
438 | + prev($this->reg_steps); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * @return EE_SPCO_Reg_Step | null |
450 | 450 | */ |
451 | 451 | public function get_next_reg_step() { |
452 | - $next = next( $this->reg_steps ); |
|
453 | - prev( $this->reg_steps ); |
|
452 | + $next = next($this->reg_steps); |
|
453 | + prev($this->reg_steps); |
|
454 | 454 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
455 | 455 | } |
456 | 456 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * @return EE_SPCO_Reg_Step | null |
466 | 466 | */ |
467 | 467 | public function get_prev_reg_step() { |
468 | - $prev = prev( $this->reg_steps ); |
|
469 | - next( $this->reg_steps ); |
|
468 | + $prev = prev($this->reg_steps); |
|
469 | + next($this->reg_steps); |
|
470 | 470 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
471 | 471 | } |
472 | 472 | |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | * @return void |
480 | 480 | */ |
481 | 481 | public function sort_reg_steps() { |
482 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
483 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
482 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
483 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -493,17 +493,17 @@ discard block |
||
493 | 493 | * @param EE_SPCO_Reg_Step $reg_step_B |
494 | 494 | * @return array() |
495 | 495 | */ |
496 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
496 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
497 | 497 | // send finalize_registration step to the end of the array |
498 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
498 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
499 | 499 | return 1; |
500 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
500 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
501 | 501 | return -1; |
502 | 502 | } |
503 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
503 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
504 | 504 | return 0; |
505 | 505 | } |
506 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
506 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | * @return void |
516 | 516 | */ |
517 | 517 | public function set_reg_step_JSON_info() { |
518 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
518 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
519 | 519 | // pass basic reg step data to JS |
520 | - foreach ( $this->reg_steps as $reg_step ) { |
|
521 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
520 | + foreach ($this->reg_steps as $reg_step) { |
|
521 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
522 | 522 | } |
523 | 523 | // reset reg step html |
524 | 524 | // $this->json_response->set_reg_step_html( '' ); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | */ |
535 | 535 | public function reset_reg_steps() { |
536 | 536 | $this->sort_reg_steps(); |
537 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
537 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
538 | 538 | $this->set_next_step(); |
539 | 539 | // the text that appears on the reg step form submit button |
540 | 540 | $this->current_step->set_submit_button_text(); |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public function get_registration_time_limit() { |
553 | 553 | |
554 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
554 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
555 | 555 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
556 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
556 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
557 | 557 | return apply_filters( |
558 | 558 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
559 | 559 | $registration_time_limit |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | // overpaid TXN |
574 | 574 | // free TXN ( total = 0.00 ) |
575 | 575 | // then payment required is TRUE |
576 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
576 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | */ |
587 | 587 | public function initialize_txn_reg_steps_array() { |
588 | 588 | $txn_reg_steps_array = array(); |
589 | - foreach ( $this->reg_steps as $reg_step ) { |
|
590 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
589 | + foreach ($this->reg_steps as $reg_step) { |
|
590 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
591 | 591 | } |
592 | 592 | return $txn_reg_steps_array; |
593 | 593 | } |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | public function update_txn_reg_steps_array() { |
604 | 604 | $updated = FALSE; |
605 | 605 | /** @type EE_Transaction_Processor $transaction_processor */ |
606 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
607 | - foreach ( $this->reg_steps as $reg_step ) { |
|
608 | - if ( $reg_step->completed() ) { |
|
609 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
606 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
607 | + foreach ($this->reg_steps as $reg_step) { |
|
608 | + if ($reg_step->completed()) { |
|
609 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
610 | 610 | } |
611 | 611 | } |
612 | - if ( $updated ) { |
|
612 | + if ($updated) { |
|
613 | 613 | $this->transaction->save(); |
614 | 614 | } |
615 | 615 | return $updated; |
@@ -624,14 +624,14 @@ discard block |
||
624 | 624 | * @return void |
625 | 625 | */ |
626 | 626 | public function stash_transaction_and_checkout() { |
627 | - if ( ! $this->revisit ) { |
|
627 | + if ( ! $this->revisit) { |
|
628 | 628 | $this->update_txn_reg_steps_array(); |
629 | 629 | } |
630 | 630 | $this->track_transaction_and_registration_status_updates(); |
631 | 631 | // save all data to the db, but suppress errors |
632 | 632 | //$this->save_all_data( FALSE ); |
633 | 633 | // cache the checkout in the session |
634 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
634 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | |
@@ -647,21 +647,21 @@ discard block |
||
647 | 647 | */ |
648 | 648 | public function track_transaction_and_registration_status_updates() { |
649 | 649 | // verify the transaction |
650 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
650 | + if ($this->transaction instanceof EE_Transaction) { |
|
651 | 651 | /** @type EE_Transaction_Payments $transaction_payments */ |
652 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
652 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
653 | 653 | /** @type EE_Transaction_Processor $transaction_processor */ |
654 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
654 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
655 | 655 | // has there been a TXN status change during this checkout? |
656 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
656 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
657 | 657 | $this->txn_status_updated = true; |
658 | 658 | } |
659 | 659 | /** @type EE_Registration_Processor $registration_processor */ |
660 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
660 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
661 | 661 | // grab the saved registrations from the transaction |
662 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
663 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
664 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
662 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
663 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
664 | + $this->set_reg_status_updated($registration->ID(), true); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | } |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | * @param EE_Registration $registration |
684 | 684 | * @return bool |
685 | 685 | */ |
686 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
687 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
686 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
687 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | |
@@ -709,18 +709,18 @@ discard block |
||
709 | 709 | * @param bool $show_errors |
710 | 710 | * @return bool |
711 | 711 | */ |
712 | - public function save_all_data( $show_errors = TRUE ) { |
|
712 | + public function save_all_data($show_errors = TRUE) { |
|
713 | 713 | // verify the transaction |
714 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
714 | + if ($this->transaction instanceof EE_Transaction) { |
|
715 | 715 | // save to ensure that TXN has ID |
716 | 716 | $this->transaction->save(); |
717 | 717 | // grab the saved registrations from the transaction |
718 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
719 | - $this->_save_registration( $registration, $show_errors ); |
|
718 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
719 | + $this->_save_registration($registration, $show_errors); |
|
720 | 720 | } |
721 | 721 | } else { |
722 | - if ( $show_errors ) { |
|
723 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
722 | + if ($show_errors) { |
|
723 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
724 | 724 | } |
725 | 725 | return FALSE; |
726 | 726 | } |
@@ -735,32 +735,32 @@ discard block |
||
735 | 735 | * @param bool $show_errors |
736 | 736 | * @return void |
737 | 737 | */ |
738 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
738 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
739 | 739 | // verify object |
740 | - if ( $registration instanceof EE_Registration ) { |
|
740 | + if ($registration instanceof EE_Registration) { |
|
741 | 741 | // should this registration be processed during this visit ? |
742 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
742 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
743 | 743 | //set TXN ID |
744 | - if ( ! $registration->transaction_ID() ) { |
|
745 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
744 | + if ( ! $registration->transaction_ID()) { |
|
745 | + $registration->set_transaction_id($this->transaction->ID()); |
|
746 | 746 | } |
747 | 747 | // verify and save the attendee |
748 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
748 | + $this->_save_registration_attendee($registration, $show_errors); |
|
749 | 749 | // save answers to reg form questions |
750 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
750 | + $this->_save_registration_answers($registration, $show_errors); |
|
751 | 751 | // save changes |
752 | 752 | $registration->save(); |
753 | 753 | // update txn cache |
754 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
755 | - if ( $show_errors ) { |
|
756 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
754 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
755 | + if ($show_errors) { |
|
756 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
757 | 757 | } |
758 | 758 | } |
759 | 759 | } |
760 | 760 | } else { |
761 | - if ( $show_errors ) { |
|
761 | + if ($show_errors) { |
|
762 | 762 | EE_Error::add_error( |
763 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
763 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
764 | 764 | __FILE__, __FUNCTION__, __LINE__ |
765 | 765 | ); |
766 | 766 | } |
@@ -776,26 +776,26 @@ discard block |
||
776 | 776 | * @param bool $show_errors |
777 | 777 | * @return void |
778 | 778 | */ |
779 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
780 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
779 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
780 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
781 | 781 | // save so that ATT has ID |
782 | 782 | $registration->attendee()->save(); |
783 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
784 | - if ( $show_errors ) { |
|
783 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
784 | + if ($show_errors) { |
|
785 | 785 | EE_Error::add_error( |
786 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
786 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
787 | 787 | __FILE__, __FUNCTION__, __LINE__ |
788 | 788 | ); |
789 | 789 | } |
790 | 790 | } |
791 | 791 | } else { |
792 | - if ( $show_errors ) { |
|
792 | + if ($show_errors) { |
|
793 | 793 | ob_start(); |
794 | - var_dump( $registration->attendee() ); |
|
794 | + var_dump($registration->attendee()); |
|
795 | 795 | EE_Error::add_error( |
796 | 796 | sprintf( |
797 | 797 | '%1$s||%1$s $attendee = %2$s', |
798 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
798 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
799 | 799 | ob_get_clean() |
800 | 800 | ), |
801 | 801 | __FILE__, __FUNCTION__, __LINE__ |
@@ -813,25 +813,25 @@ discard block |
||
813 | 813 | * @param bool $show_errors |
814 | 814 | * @return void |
815 | 815 | */ |
816 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
816 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
817 | 817 | // now save the answers |
818 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
818 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
819 | 819 | // verify object |
820 | - if ( $answer instanceof EE_Answer ) { |
|
821 | - $answer->set_registration( $registration->ID() ); |
|
820 | + if ($answer instanceof EE_Answer) { |
|
821 | + $answer->set_registration($registration->ID()); |
|
822 | 822 | $answer->save(); |
823 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
824 | - if ( $show_errors ) { |
|
823 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
824 | + if ($show_errors) { |
|
825 | 825 | EE_Error::add_error( |
826 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
826 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
827 | 827 | __FILE__, __FUNCTION__, __LINE__ |
828 | 828 | ); |
829 | 829 | } |
830 | 830 | } |
831 | 831 | } else { |
832 | - if ( $show_errors ) { |
|
832 | + if ($show_errors) { |
|
833 | 833 | EE_Error::add_error( |
834 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
834 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
835 | 835 | __FILE__, __FUNCTION__, __LINE__ |
836 | 836 | ); |
837 | 837 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * @param bool $from_db |
850 | 850 | * @return bool |
851 | 851 | */ |
852 | - public function refresh_all_entities( $from_db = false ) { |
|
852 | + public function refresh_all_entities($from_db = false) { |
|
853 | 853 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
854 | 854 | //$this->log( |
855 | 855 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -870,11 +870,11 @@ discard block |
||
870 | 870 | */ |
871 | 871 | protected function refresh_from_db() { |
872 | 872 | // verify the transaction |
873 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
873 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
874 | 874 | // pull fresh TXN data from the db |
875 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
875 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
876 | 876 | // update EE_Checkout's cached primary_attendee object |
877 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
877 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
878 | 878 | // update EE_Checkout's cached payment object |
879 | 879 | $payment = $this->transaction->last_payment(); |
880 | 880 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -882,15 +882,15 @@ discard block |
||
882 | 882 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
883 | 883 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
884 | 884 | //now refresh the cart, based on the TXN |
885 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
885 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
886 | 886 | // verify and update the cart because inaccurate totals are not so much fun |
887 | - if ( $this->cart instanceof EE_Cart ) { |
|
887 | + if ($this->cart instanceof EE_Cart) { |
|
888 | 888 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
889 | 889 | } else { |
890 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
890 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
891 | 891 | } |
892 | 892 | } else { |
893 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
893 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
894 | 894 | return FALSE; |
895 | 895 | } |
896 | 896 | return TRUE; |
@@ -904,24 +904,24 @@ discard block |
||
904 | 904 | * @param EE_Transaction $transaction |
905 | 905 | * @return EE_Attendee | null |
906 | 906 | */ |
907 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
907 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
908 | 908 | |
909 | 909 | $primary_attendee_obj = null; |
910 | 910 | // grab the saved registrations from the transaction |
911 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
911 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
912 | 912 | // verify object |
913 | - if ( $registration instanceof EE_Registration ) { |
|
913 | + if ($registration instanceof EE_Registration) { |
|
914 | 914 | $attendee = $registration->attendee(); |
915 | 915 | // verify object |
916 | - if ( $attendee instanceof EE_Attendee ) { |
|
916 | + if ($attendee instanceof EE_Attendee) { |
|
917 | 917 | // maybe cache primary_attendee_obj ? |
918 | - if ( $registration->is_primary_registrant() ) { |
|
918 | + if ($registration->is_primary_registrant()) { |
|
919 | 919 | $primary_attendee_obj = $attendee; |
920 | 920 | } |
921 | 921 | } |
922 | 922 | } else { |
923 | 923 | EE_Error::add_error( |
924 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
924 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
925 | 925 | __FILE__, __FUNCTION__, __LINE__ |
926 | 926 | ); |
927 | 927 | } |
@@ -941,43 +941,43 @@ discard block |
||
941 | 941 | */ |
942 | 942 | protected function refresh_entity_map() { |
943 | 943 | // verify the transaction |
944 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
944 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
945 | 945 | // never cache payment info |
946 | - $this->transaction->clear_cache( 'Payment' ); |
|
946 | + $this->transaction->clear_cache('Payment'); |
|
947 | 947 | /** @type EE_Transaction_Processor $transaction_processor */ |
948 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
948 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
949 | 949 | // is the Payment Options Reg Step completed ? |
950 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
950 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
951 | 951 | // then check for payments and update TXN accordingly |
952 | 952 | /** @type EE_Transaction_Payments $transaction_payments */ |
953 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
954 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
953 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
954 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
955 | 955 | } |
956 | 956 | // grab the saved registrations from the transaction |
957 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
958 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
957 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
958 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
959 | 959 | } |
960 | 960 | // make sure our cached TXN is added to the model entity mapper |
961 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
961 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
962 | 962 | |
963 | 963 | } else { |
964 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
964 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
965 | 965 | return FALSE; |
966 | 966 | } |
967 | 967 | // verify and update the cart because inaccurate totals are not so much fun |
968 | - if ( $this->cart instanceof EE_Cart ) { |
|
968 | + if ($this->cart instanceof EE_Cart) { |
|
969 | 969 | $grand_total = $this->cart->get_grand_total(); |
970 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
970 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
971 | 971 | $grand_total->recalculate_total_including_taxes(); |
972 | 972 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
973 | 973 | $this->cart->get_grand_total()->ID(), |
974 | 974 | $this->cart->get_grand_total() |
975 | 975 | ); |
976 | 976 | } |
977 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
978 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
977 | + if ($grand_total instanceof EE_Line_Item) { |
|
978 | + $this->cart = EE_Cart::instance($grand_total); |
|
979 | 979 | } else { |
980 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
980 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
981 | 981 | return false; |
982 | 982 | } |
983 | 983 | } |
@@ -993,19 +993,19 @@ discard block |
||
993 | 993 | * @param EE_Registration $registration |
994 | 994 | * @return void |
995 | 995 | */ |
996 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
996 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
997 | 997 | |
998 | 998 | // verify object |
999 | - if ( $registration instanceof EE_Registration ) { |
|
999 | + if ($registration instanceof EE_Registration) { |
|
1000 | 1000 | // update the entity mapper attendee |
1001 | - $this->_refresh_registration_attendee( $registration ); |
|
1001 | + $this->_refresh_registration_attendee($registration); |
|
1002 | 1002 | // update the entity mapper answers for reg form questions |
1003 | - $this->_refresh_registration_answers( $registration ); |
|
1003 | + $this->_refresh_registration_answers($registration); |
|
1004 | 1004 | // make sure the cached registration is added to the model entity mapper |
1005 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1005 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1006 | 1006 | } else { |
1007 | 1007 | EE_Error::add_error( |
1008 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1008 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1009 | 1009 | __FILE__, __FUNCTION__, __LINE__ |
1010 | 1010 | ); |
1011 | 1011 | } |
@@ -1019,15 +1019,15 @@ discard block |
||
1019 | 1019 | * @param EE_Registration $registration |
1020 | 1020 | * @return void |
1021 | 1021 | */ |
1022 | - protected function _refresh_registration_attendee( $registration ) { |
|
1022 | + protected function _refresh_registration_attendee($registration) { |
|
1023 | 1023 | |
1024 | 1024 | $attendee = $registration->attendee(); |
1025 | 1025 | // verify object |
1026 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1026 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1027 | 1027 | // make sure the cached attendee is added to the model entity mapper |
1028 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1028 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1029 | 1029 | // maybe cache primary_attendee_obj ? |
1030 | - if ( $registration->is_primary_registrant() ) { |
|
1030 | + if ($registration->is_primary_registrant()) { |
|
1031 | 1031 | $this->primary_attendee_obj = $attendee; |
1032 | 1032 | } |
1033 | 1033 | } |
@@ -1041,19 +1041,19 @@ discard block |
||
1041 | 1041 | * @param EE_Registration $registration |
1042 | 1042 | * @return void |
1043 | 1043 | */ |
1044 | - protected function _refresh_registration_answers( $registration ) { |
|
1044 | + protected function _refresh_registration_answers($registration) { |
|
1045 | 1045 | |
1046 | 1046 | // now update the answers |
1047 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1047 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1048 | 1048 | // verify object |
1049 | - if ( $answer instanceof EE_Answer ) { |
|
1050 | - if ( $answer->ID() ) { |
|
1049 | + if ($answer instanceof EE_Answer) { |
|
1050 | + if ($answer->ID()) { |
|
1051 | 1051 | // make sure the cached answer is added to the model entity mapper |
1052 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1052 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1053 | 1053 | } |
1054 | 1054 | } else { |
1055 | 1055 | EE_Error::add_error( |
1056 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1056 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1057 | 1057 | __FILE__, __FUNCTION__, __LINE__ |
1058 | 1058 | ); |
1059 | 1059 | } |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1069 | 1069 | */ |
1070 | 1070 | function __wakeup() { |
1071 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1071 | + foreach ($this->reg_steps as $reg_step) { |
|
1072 | 1072 | $reg_step->checkout = $this; |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1084,11 +1084,11 @@ discard block |
||
1084 | 1084 | * @param array $info |
1085 | 1085 | * @param bool $display_request |
1086 | 1086 | */ |
1087 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1088 | - if ( WP_DEBUG && false ) { |
|
1089 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1087 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1088 | + if (WP_DEBUG && false) { |
|
1089 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1090 | 1090 | $default_data = array( |
1091 | - $class => $func . '() : ' . $line, |
|
1091 | + $class => $func.'() : '.$line, |
|
1092 | 1092 | 'request->step' => $this->step, |
1093 | 1093 | 'request->action' => $this->action, |
1094 | 1094 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1100,24 +1100,24 @@ discard block |
||
1100 | 1100 | 'reg_url_link' => $this->reg_url_link, |
1101 | 1101 | 'REQ' => $display_request ? $_REQUEST : '', |
1102 | 1102 | ); |
1103 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1104 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1105 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1106 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1107 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1103 | + if ($this->transaction instanceof EE_Transaction) { |
|
1104 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1105 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1106 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1107 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1108 | 1108 | } |
1109 | - if ( $this->transaction->ID() ) { |
|
1110 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1109 | + if ($this->transaction->ID()) { |
|
1110 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1111 | 1111 | // don't serialize objects |
1112 | - $info = $this->_strip_objects( $info ); |
|
1113 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1114 | - $debug_data[ $TXN_ID ] = array(); |
|
1112 | + $info = $this->_strip_objects($info); |
|
1113 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1114 | + $debug_data[$TXN_ID] = array(); |
|
1115 | 1115 | } |
1116 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1116 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1117 | 1117 | $default_data, |
1118 | 1118 | $info |
1119 | 1119 | ); |
1120 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1120 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | } |
@@ -1130,23 +1130,23 @@ discard block |
||
1130 | 1130 | * @param array $info |
1131 | 1131 | * @return array |
1132 | 1132 | */ |
1133 | - function _strip_objects( $info = array() ) { |
|
1134 | - foreach ( $info as $key => $value ) { |
|
1135 | - if ( is_array( $value )) { |
|
1136 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1137 | - } else if ( is_object( $value ) ) { |
|
1138 | - $object_class = get_class( $value ); |
|
1139 | - $info[ $object_class ] = array(); |
|
1140 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1141 | - if ( method_exists( $value, 'status' ) ) { |
|
1142 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1143 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1144 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1133 | + function _strip_objects($info = array()) { |
|
1134 | + foreach ($info as $key => $value) { |
|
1135 | + if (is_array($value)) { |
|
1136 | + $info[$key] = $this->_strip_objects($value); |
|
1137 | + } else if (is_object($value)) { |
|
1138 | + $object_class = get_class($value); |
|
1139 | + $info[$object_class] = array(); |
|
1140 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1141 | + if (method_exists($value, 'status')) { |
|
1142 | + $info[$object_class]['status'] = $value->status(); |
|
1143 | + } else if (method_exists($value, 'status_ID')) { |
|
1144 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1145 | 1145 | } |
1146 | - unset( $info[ $key ] ); |
|
1146 | + unset($info[$key]); |
|
1147 | 1147 | } |
1148 | 1148 | } |
1149 | - return (array)$info; |
|
1149 | + return (array) $info; |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 |
@@ -387,7 +387,7 @@ |
||
387 | 387 | |
388 | 388 | /** |
389 | 389 | * creates the default hidden inputs section |
390 | - * @return EE_Form_Input_Base[] |
|
390 | + * @return EE_Form_Section_Proper |
|
391 | 391 | */ |
392 | 392 | public function reg_step_hidden_inputs() { |
393 | 393 | // hidden inputs for admin registrations |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | abstract class EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function set_completed() { |
154 | 154 | // DEBUG LOG |
155 | 155 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
156 | - $this->_completed = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this ); |
|
156 | + $this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -201,18 +201,18 @@ discard block |
||
201 | 201 | * sets the text that appears on the reg step form submit button |
202 | 202 | * @param string $submit_button_text |
203 | 203 | */ |
204 | - public function set_submit_button_text( $submit_button_text = '' ) { |
|
205 | - if ( ! empty( $submit_button_text )) { |
|
204 | + public function set_submit_button_text($submit_button_text = '') { |
|
205 | + if ( ! empty($submit_button_text)) { |
|
206 | 206 | $this->_submit_button_text = $submit_button_text; |
207 | - } else if ( $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
208 | - if ( $this->checkout->revisit ) { |
|
209 | - $this->_submit_button_text = sprintf( __( 'Update %s', 'event_espresso' ), $this->checkout->current_step->name() ); |
|
207 | + } else if ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
208 | + if ($this->checkout->revisit) { |
|
209 | + $this->_submit_button_text = sprintf(__('Update %s', 'event_espresso'), $this->checkout->current_step->name()); |
|
210 | 210 | } else { |
211 | - $this->_submit_button_text = sprintf( __( 'Proceed to %s', 'event_espresso' ), $this->checkout->next_step->name() ); |
|
211 | + $this->_submit_button_text = sprintf(__('Proceed to %s', 'event_espresso'), $this->checkout->next_step->name()); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | // filters the submit button text |
215 | - $this->_submit_button_text = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout ); |
|
215 | + $this->_submit_button_text = apply_filters('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param boolean $is_current_step |
222 | 222 | */ |
223 | - public function set_is_current_step( $is_current_step ) { |
|
223 | + public function set_is_current_step($is_current_step) { |
|
224 | 224 | $this->_is_current_step = $is_current_step; |
225 | 225 | } |
226 | 226 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * @param int $order |
249 | 249 | */ |
250 | - public function set_order( $order ) { |
|
250 | + public function set_order($order) { |
|
251 | 251 | $this->_order = $order; |
252 | 252 | } |
253 | 253 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * _set_success_message |
286 | 286 | * @param string $success_message |
287 | 287 | */ |
288 | - protected function _set_success_message( $success_message ) { |
|
288 | + protected function _set_success_message($success_message) { |
|
289 | 289 | $this->_success_message = $success_message; |
290 | 290 | } |
291 | 291 | |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | /** |
314 | 314 | * @param string $instructions |
315 | 315 | */ |
316 | - public function set_instructions( $instructions ) { |
|
317 | - $this->_instructions = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this ); |
|
316 | + public function set_instructions($instructions) { |
|
317 | + $this->_instructions = apply_filters('FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * @param array $valid_data |
324 | 324 | */ |
325 | - public function set_valid_data( $valid_data ) { |
|
325 | + public function set_valid_data($valid_data) { |
|
326 | 326 | $this->_valid_data = $valid_data; |
327 | 327 | } |
328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @return array |
333 | 333 | */ |
334 | 334 | public function valid_data() { |
335 | - if ( empty( $this->_valid_data )) { |
|
335 | + if (empty($this->_valid_data)) { |
|
336 | 336 | $this->_valid_data = $this->reg_form->valid_data(); |
337 | 337 | } |
338 | 338 | return $this->_valid_data; |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @return string |
344 | 344 | */ |
345 | 345 | public function reg_form_name() { |
346 | - if ( empty( $this->_reg_form_name )) { |
|
347 | - $this->set_reg_form_name( 'ee-spco-' . $this->slug() . '-reg-step-form' ); |
|
346 | + if (empty($this->_reg_form_name)) { |
|
347 | + $this->set_reg_form_name('ee-spco-'.$this->slug().'-reg-step-form'); |
|
348 | 348 | } |
349 | 349 | return $this->_reg_form_name; |
350 | 350 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | /** |
355 | 355 | * @param string $reg_form_name |
356 | 356 | */ |
357 | - protected function set_reg_form_name( $reg_form_name ) { |
|
357 | + protected function set_reg_form_name($reg_form_name) { |
|
358 | 358 | $this->_reg_form_name = $reg_form_name; |
359 | 359 | } |
360 | 360 | |
@@ -365,22 +365,22 @@ discard block |
||
365 | 365 | * @param string $action |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public function reg_step_url( $action = '' ) { |
|
369 | - $query_args = array( 'step' => $this->slug() ); |
|
370 | - if( ! empty( $action )) { |
|
368 | + public function reg_step_url($action = '') { |
|
369 | + $query_args = array('step' => $this->slug()); |
|
370 | + if ( ! empty($action)) { |
|
371 | 371 | $query_args['action'] = $action; |
372 | 372 | } |
373 | 373 | // final step has no display |
374 | - if ( $this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action == 'display_spco_reg_step' ) { |
|
375 | - $query_args[ 'action' ] = 'process_reg_step'; |
|
374 | + if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action == 'display_spco_reg_step') { |
|
375 | + $query_args['action'] = 'process_reg_step'; |
|
376 | 376 | } |
377 | - if( $this->checkout->revisit ) { |
|
377 | + if ($this->checkout->revisit) { |
|
378 | 378 | $query_args['revisit'] = TRUE; |
379 | 379 | } |
380 | - if( $this->checkout->reg_url_link ) { |
|
380 | + if ($this->checkout->reg_url_link) { |
|
381 | 381 | $query_args['e_reg_url_link'] = $this->checkout->reg_url_link; |
382 | 382 | } |
383 | - return add_query_arg( $query_args, $this->checkout->reg_page_base_url ); |
|
383 | + return add_query_arg($query_args, $this->checkout->reg_page_base_url); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -391,16 +391,16 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function reg_step_hidden_inputs() { |
393 | 393 | // hidden inputs for admin registrations |
394 | - if ( $this->checkout->admin_request ) { |
|
394 | + if ($this->checkout->admin_request) { |
|
395 | 395 | return new EE_Form_Section_Proper( |
396 | 396 | array( |
397 | 397 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
398 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
398 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
399 | 399 | 'subsections' => array( |
400 | 400 | 'next_step' => new EE_Fixed_Hidden_Input( |
401 | 401 | array( |
402 | 402 | 'html_name' => 'next_step', |
403 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
403 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
404 | 404 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
405 | 405 | ) |
406 | 406 | ) |
@@ -412,19 +412,19 @@ discard block |
||
412 | 412 | return new EE_Form_Section_Proper( |
413 | 413 | array( |
414 | 414 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
415 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
415 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
416 | 416 | 'subsections' => array( |
417 | 417 | 'action' => new EE_Fixed_Hidden_Input( |
418 | 418 | array( |
419 | 419 | 'html_name' => 'action', |
420 | - 'html_id' => 'spco-' . $this->slug() . '-action', |
|
421 | - 'default' => empty( $this->checkout->reg_url_link ) ? 'process_reg_step' : 'update_reg_step' |
|
420 | + 'html_id' => 'spco-'.$this->slug().'-action', |
|
421 | + 'default' => empty($this->checkout->reg_url_link) ? 'process_reg_step' : 'update_reg_step' |
|
422 | 422 | ) |
423 | 423 | ), |
424 | 424 | 'next_step' => new EE_Fixed_Hidden_Input( |
425 | 425 | array( |
426 | 426 | 'html_name' => 'next_step', |
427 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
427 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
428 | 428 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
429 | 429 | ) |
430 | 430 | ), |
@@ -456,9 +456,9 @@ discard block |
||
456 | 456 | * @param array $actions |
457 | 457 | * @return void |
458 | 458 | */ |
459 | - public function generate_reg_form_for_actions( $actions = array() ) { |
|
460 | - $actions = array_merge( array( 'generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step' ), $actions ); |
|
461 | - $this->checkout->generate_reg_form = in_array( $this->checkout->action, $actions ) ? TRUE : FALSE; |
|
459 | + public function generate_reg_form_for_actions($actions = array()) { |
|
460 | + $actions = array_merge(array('generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step'), $actions); |
|
461 | + $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions) ? TRUE : FALSE; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -468,11 +468,11 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function display_reg_form() { |
470 | 470 | $html = ''; |
471 | - if ( $this->reg_form instanceof EE_Form_Section_Proper ) { |
|
472 | - $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open( $this->reg_step_url() ) : ''; |
|
473 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
471 | + if ($this->reg_form instanceof EE_Form_Section_Proper) { |
|
472 | + $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : ''; |
|
473 | + if (EE_Registry::instance()->REQ->ajax) { |
|
474 | 474 | $this->reg_form->localize_validation_rules(); |
475 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
475 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
476 | 476 | $html .= $this->reg_form->get_html(); |
477 | 477 | } else { |
478 | 478 | $html .= $this->reg_form->get_html_and_js(); |
@@ -490,26 +490,26 @@ discard block |
||
490 | 490 | * @return string |
491 | 491 | */ |
492 | 492 | public function reg_step_submit_button() { |
493 | - if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
493 | + if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
494 | 494 | return ''; |
495 | 495 | } |
496 | 496 | ob_start(); |
497 | - do_action( 'AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout ); |
|
497 | + do_action('AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout); |
|
498 | 498 | $html = ob_get_clean(); |
499 | 499 | // generate submit button |
500 | - $sbmt_btn = new EE_Submit_Input( array( |
|
501 | - 'html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
502 | - 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
500 | + $sbmt_btn = new EE_Submit_Input(array( |
|
501 | + 'html_name' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
502 | + 'html_id' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
503 | 503 | 'html_class' => 'spco-next-step-btn', |
504 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
504 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
505 | 505 | 'default' => $this->submit_button_text() |
506 | 506 | )); |
507 | - $sbmt_btn->set_button_css_attributes( TRUE, 'large' ); |
|
507 | + $sbmt_btn->set_button_css_attributes(TRUE, 'large'); |
|
508 | 508 | $sbmt_btn_html = $sbmt_btn->get_html_for_input(); |
509 | 509 | EE_Registry::instance()->load_helper('HTML'); |
510 | 510 | $html .= EEH_HTML::div( |
511 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this ), |
|
512 | - 'spco-' . $this->slug() . '-whats-next-buttons-dv', |
|
511 | + apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this), |
|
512 | + 'spco-'.$this->slug().'-whats-next-buttons-dv', |
|
513 | 513 | 'spco-whats-next-buttons' |
514 | 514 | ); |
515 | 515 | return $html; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @return string |
533 | 533 | */ |
534 | 534 | public function edit_lnk_url() { |
535 | - return add_query_arg( array( 'step' => $this->slug() ), $this->checkout->reg_page_base_url ); |
|
535 | + return add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url); |
|
536 | 536 | |
537 | 537 | } |
538 | 538 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | */ |
555 | 555 | public function update_checkout() { |
556 | 556 | // grab the cart grand total and reset TXN total |
557 | - $this->checkout->transaction->set_total( $this->checkout->cart->get_cart_grand_total() ); |
|
557 | + $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total()); |
|
558 | 558 | $this->checkout->stash_transaction_and_checkout(); |
559 | 559 | } |
560 | 560 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | function __sleep() { |
571 | 571 | // remove the reg form and the checkout |
572 | - return array_diff( array_keys( get_object_vars( $this )), array( 'reg_form', 'checkout' )); |
|
572 | + return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout')); |
|
573 | 573 | } |
574 | 574 | } |
575 | 575 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | /** |
65 | - * @return boolean |
|
65 | + * @return boolean|null |
|
66 | 66 | */ |
67 | 67 | public function initialize_reg_step() { |
68 | 68 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * _auto_copy_attendee_info |
343 | 343 | * |
344 | 344 | * @access public |
345 | - * @return EE_Form_Section_Proper |
|
345 | + * @return EE_Form_Section_HTML |
|
346 | 346 | */ |
347 | 347 | private function _auto_copy_attendee_info() { |
348 | 348 | return new EE_Form_Section_HTML( |
@@ -456,6 +456,7 @@ discard block |
||
456 | 456 | * @param EE_Registration $registration |
457 | 457 | * @param EE_Question $question |
458 | 458 | * @param mixed EE_Answer|NULL $answer |
459 | + * @param EE_Answer $answer |
|
459 | 460 | * @return EE_Form_Input_Base |
460 | 461 | */ |
461 | 462 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | case EEM_Question::QST_type_text : |
508 | 508 | if( $identifier == 'email' ){ |
509 | 509 | return new EE_Email_Input( $input_constructor_args ); |
510 | - }else{ |
|
510 | + } else{ |
|
511 | 511 | return new EE_Text_Input( $input_constructor_args ); |
512 | 512 | } |
513 | 513 | break; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 794 | |
795 | - } else { |
|
795 | + } else { |
|
796 | 796 | EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
797 | 797 | // remove malformed data |
798 | 798 | unset( $valid_data[ $reg_url_link ] ); |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | * @param EE_Checkout $checkout |
33 | 33 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
34 | 34 | */ |
35 | - public function __construct( EE_Checkout $checkout ) { |
|
35 | + public function __construct(EE_Checkout $checkout) { |
|
36 | 36 | $this->_slug = 'attendee_information'; |
37 | 37 | $this->_name = __('Attendee Information', 'event_espresso'); |
38 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
38 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
39 | 39 | $this->checkout = $checkout; |
40 | 40 | $this->_reset_success_message(); |
41 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
41 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
48 | 48 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
49 | 49 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
50 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
50 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
51 | 51 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
52 | 52 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | EEH_Autoloader::register_line_item_display_autoloaders(); |
80 | 80 | $Line_Item_Display = new EE_Line_Item_Display(); |
81 | 81 | // calculate taxes |
82 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
82 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
83 | 83 | EE_Registry::instance()->load_helper('Line_Item'); |
84 | 84 | /** @var $subsections EE_Form_Section_Proper[] */ |
85 | 85 | $subsections = array( |
@@ -91,33 +91,33 @@ discard block |
||
91 | 91 | 'ticket_count' => array() |
92 | 92 | ); |
93 | 93 | // grab the saved registrations from the transaction |
94 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
95 | - if ( $registrations ) { |
|
96 | - foreach ( $registrations as $registration ) { |
|
97 | - if ( $registration instanceof EE_Registration ) { |
|
94 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
95 | + if ($registrations) { |
|
96 | + foreach ($registrations as $registration) { |
|
97 | + if ($registration instanceof EE_Registration) { |
|
98 | 98 | // can this registration be processed during this visit ? |
99 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
100 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
101 | - if ( ! $this->checkout->admin_request ) { |
|
102 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
103 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
104 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
105 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
106 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
99 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
100 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
101 | + if ( ! $this->checkout->admin_request) { |
|
102 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
103 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
104 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
105 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
106 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
107 | 107 | } |
108 | - if ( $registration->is_primary_registrant() ) { |
|
108 | + if ($registration->is_primary_registrant()) { |
|
109 | 109 | $primary_registrant = $registration->reg_url_link(); |
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
114 | 114 | // print_copy_info ? |
115 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
115 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
116 | 116 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
117 | 117 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
118 | 118 | // generate hidden input |
119 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
120 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
119 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
120 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -129,8 +129,7 @@ discard block |
||
129 | 129 | 'html_id' => $this->reg_form_name(), |
130 | 130 | 'subsections' => $subsections, |
131 | 131 | 'layout_strategy' => $this->checkout->admin_request ? |
132 | - new EE_Div_Per_Section_Layout() : |
|
133 | - new EE_Template_Layout( |
|
132 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
134 | 133 | array( |
135 | 134 | 'layout_template_file' => $this->_template, // layout_template |
136 | 135 | 'template_args' => $template_args |
@@ -147,61 +146,61 @@ discard block |
||
147 | 146 | * @param EE_Registration $registration |
148 | 147 | * @return EE_Form_Section_Proper |
149 | 148 | */ |
150 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
151 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
149 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
150 | + EE_Registry::instance()->load_helper('Template'); |
|
152 | 151 | static $attendee_nmbr = 1; |
153 | 152 | // array of params to pass to parent constructor |
154 | 153 | $form_args = array( |
155 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
154 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
156 | 155 | 'html_class' => 'ee-reg-form-attendee-dv', |
157 | 156 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
158 | 157 | 'subsections' => array(), |
159 | 158 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
160 | 159 | array( |
161 | 160 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
162 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
161 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
163 | 162 | ) |
164 | 163 | ) |
165 | 164 | ); |
166 | 165 | // verify that registration has valid event |
167 | - if ( $registration->event() instanceof EE_Event ) { |
|
166 | + if ($registration->event() instanceof EE_Event) { |
|
168 | 167 | $query_params = array( |
169 | 168 | array( |
170 | 169 | 'Event.EVT_ID' => $registration->event()->ID(), |
171 | 170 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
172 | 171 | ), |
173 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
172 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
174 | 173 | ); |
175 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
176 | - if ( $question_groups ) { |
|
177 | - foreach ( $question_groups as $question_group ) { |
|
178 | - if ( $question_group instanceof EE_Question_Group ) { |
|
179 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
174 | + $question_groups = $registration->event()->question_groups($query_params); |
|
175 | + if ($question_groups) { |
|
176 | + foreach ($question_groups as $question_group) { |
|
177 | + if ($question_group instanceof EE_Question_Group) { |
|
178 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
180 | 179 | // add hidden input |
181 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
180 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
182 | 181 | } |
183 | 182 | } |
184 | 183 | // if we have question groups for additional attendees, then display the copy options |
185 | 184 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
186 | 185 | } else { |
187 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
186 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
188 | 187 | EEH_Template::locate_template( |
189 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
190 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
188 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
189 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
191 | 190 | TRUE, |
192 | 191 | TRUE |
193 | 192 | ) |
194 | 193 | ); |
195 | 194 | // add hidden input |
196 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
195 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
197 | 196 | } |
198 | 197 | } |
199 | - if ( $registration->is_primary_registrant() ) { |
|
198 | + if ($registration->is_primary_registrant()) { |
|
200 | 199 | // generate hidden input |
201 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
200 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
202 | 201 | } |
203 | 202 | $attendee_nmbr++; |
204 | - return new EE_Form_Section_Proper( $form_args ); |
|
203 | + return new EE_Form_Section_Proper($form_args); |
|
205 | 204 | } |
206 | 205 | |
207 | 206 | |
@@ -214,11 +213,11 @@ discard block |
||
214 | 213 | * @param bool $additional_attendee_reg_info |
215 | 214 | * @return EE_Form_Input_Base |
216 | 215 | */ |
217 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
216 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
218 | 217 | // generate hidden input |
219 | 218 | return new EE_Hidden_Input( |
220 | 219 | array( |
221 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
220 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
222 | 221 | 'default' => $additional_attendee_reg_info |
223 | 222 | ) |
224 | 223 | ); |
@@ -231,22 +230,22 @@ discard block |
||
231 | 230 | * @param EE_Question_Group $question_group |
232 | 231 | * @return EE_Form_Section_Proper |
233 | 232 | */ |
234 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
233 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
235 | 234 | // array of params to pass to parent constructor |
236 | 235 | $form_args = array( |
237 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
236 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
238 | 237 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
239 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
238 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
240 | 239 | 'subsections' => array( |
241 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
240 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
242 | 241 | ), |
243 | 242 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
244 | 243 | ); |
245 | 244 | // where params |
246 | - $query_params = array( 'QST_deleted' => 0 ); |
|
245 | + $query_params = array('QST_deleted' => 0); |
|
247 | 246 | // don't load admin only questions on the frontend |
248 | - if ( ! $this->checkout->admin_request ) { |
|
249 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
247 | + if ( ! $this->checkout->admin_request) { |
|
248 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
250 | 249 | } |
251 | 250 | $questions = $question_group->get_many_related( |
252 | 251 | 'Question', |
@@ -258,21 +257,21 @@ discard block |
||
258 | 257 | ) |
259 | 258 | ); |
260 | 259 | // filter for additional content before questions |
261 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
260 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
262 | 261 | // loop thru questions |
263 | - foreach ( $questions as $question ) { |
|
264 | - if( $question instanceof EE_Question ){ |
|
262 | + foreach ($questions as $question) { |
|
263 | + if ($question instanceof EE_Question) { |
|
265 | 264 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
266 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
265 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
267 | 266 | } |
268 | 267 | } |
269 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
268 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
270 | 269 | |
271 | 270 | // filter for additional content after questions |
272 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
271 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
273 | 272 | // d( $form_args ); |
274 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
275 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
273 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
274 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
276 | 275 | } |
277 | 276 | |
278 | 277 | |
@@ -282,12 +281,12 @@ discard block |
||
282 | 281 | * @param EE_Question_Group $question_group |
283 | 282 | * @return EE_Form_Section_HTML |
284 | 283 | */ |
285 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
284 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
286 | 285 | $html = ''; |
287 | 286 | // group_name |
288 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
287 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
289 | 288 | EE_Registry::instance()->load_helper('HTML'); |
290 | - if ( $this->checkout->admin_request ) { |
|
289 | + if ($this->checkout->admin_request) { |
|
291 | 290 | $html .= EEH_HTML::br(); |
292 | 291 | $html .= EEH_HTML::h3( |
293 | 292 | $question_group->name(), |
@@ -301,7 +300,7 @@ discard block |
||
301 | 300 | } |
302 | 301 | } |
303 | 302 | // group_desc |
304 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
303 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
305 | 304 | $html .= EEH_HTML::p( |
306 | 305 | $question_group->desc(), |
307 | 306 | '', |
@@ -309,7 +308,7 @@ discard block |
||
309 | 308 | ); |
310 | 309 | |
311 | 310 | } |
312 | - return new EE_Form_Section_HTML( $html ); |
|
311 | + return new EE_Form_Section_HTML($html); |
|
313 | 312 | } |
314 | 313 | |
315 | 314 | |
@@ -318,14 +317,14 @@ discard block |
||
318 | 317 | * @access public |
319 | 318 | * @return EE_Form_Section_Proper |
320 | 319 | */ |
321 | - private function _copy_attendee_info_form(){ |
|
320 | + private function _copy_attendee_info_form() { |
|
322 | 321 | // array of params to pass to parent constructor |
323 | 322 | return new EE_Form_Section_Proper( |
324 | 323 | array( |
325 | 324 | 'subsections' => $this->_copy_attendee_info_inputs(), |
326 | 325 | 'layout_strategy' => new EE_Template_Layout( |
327 | 326 | array( |
328 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
327 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
329 | 328 | 'begin_template_file' => NULL, |
330 | 329 | 'input_template_file' => NULL, |
331 | 330 | 'subsection_template_file' => NULL, |
@@ -347,8 +346,8 @@ discard block |
||
347 | 346 | private function _auto_copy_attendee_info() { |
348 | 347 | return new EE_Form_Section_HTML( |
349 | 348 | EEH_Template::locate_template( |
350 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
351 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
349 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
350 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
352 | 351 | TRUE, |
353 | 352 | TRUE |
354 | 353 | ) |
@@ -367,25 +366,25 @@ discard block |
||
367 | 366 | $copy_attendee_info_inputs = array(); |
368 | 367 | $prev_ticket = NULL; |
369 | 368 | // grab the saved registrations from the transaction |
370 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
371 | - foreach ( $registrations as $registration ) { |
|
369 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
370 | + foreach ($registrations as $registration) { |
|
372 | 371 | // for all attendees other than the primary attendee |
373 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
372 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
374 | 373 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
375 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
374 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
376 | 375 | $item_name = $registration->ticket()->name(); |
377 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
378 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
379 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
376 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
377 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
378 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
380 | 379 | ); |
381 | 380 | $prev_ticket = $registration->ticket()->ID(); |
382 | 381 | } |
383 | 382 | |
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
385 | 384 | EE_Checkbox_Multi_Input( |
386 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
385 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
387 | 386 | array( |
388 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
387 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
389 | 388 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
390 | 389 | 'display_html_label_text' => FALSE |
391 | 390 | ) |
@@ -404,7 +403,7 @@ discard block |
||
404 | 403 | * @param EE_Registration $registration |
405 | 404 | * @return EE_Form_Input_Base |
406 | 405 | */ |
407 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
406 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
408 | 407 | // generate hidden input |
409 | 408 | return new EE_Hidden_Input( |
410 | 409 | array( |
@@ -422,31 +421,31 @@ discard block |
||
422 | 421 | * @param EE_Question $question |
423 | 422 | * @return EE_Form_Input_Base |
424 | 423 | */ |
425 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
424 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
426 | 425 | |
427 | 426 | // if this question was for an attendee detail, then check for that answer |
428 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
427 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
429 | 428 | $answer = $answer_value === null |
430 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
429 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
431 | 430 | : null; |
432 | 431 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
433 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
432 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
434 | 433 | // create an EE_Answer object for storing everything in |
435 | - $answer = EE_Answer::new_instance ( array( |
|
434 | + $answer = EE_Answer::new_instance(array( |
|
436 | 435 | 'QST_ID'=> $question->ID(), |
437 | 436 | 'REG_ID'=> $registration->ID() |
438 | 437 | )); |
439 | 438 | } |
440 | 439 | // verify instance |
441 | - if( $answer instanceof EE_Answer ){ |
|
442 | - if ( ! empty( $answer_value )) { |
|
443 | - $answer->set( 'ANS_value', $answer_value ); |
|
440 | + if ($answer instanceof EE_Answer) { |
|
441 | + if ( ! empty($answer_value)) { |
|
442 | + $answer->set('ANS_value', $answer_value); |
|
444 | 443 | } |
445 | - $answer->cache( 'Question', $question ); |
|
446 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
447 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
444 | + $answer->cache('Question', $question); |
|
445 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
446 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
448 | 447 | } |
449 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
448 | + return $this->_generate_question_input($registration, $question, $answer); |
|
450 | 449 | |
451 | 450 | } |
452 | 451 | |
@@ -458,7 +457,7 @@ discard block |
||
458 | 457 | * @param mixed EE_Answer|NULL $answer |
459 | 458 | * @return EE_Form_Input_Base |
460 | 459 | */ |
461 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
460 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
462 | 461 | // d( $registration ); |
463 | 462 | // d( $question ); |
464 | 463 | // d( $answer ); |
@@ -481,95 +480,95 @@ discard block |
||
481 | 480 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
482 | 481 | |
483 | 482 | $input_constructor_args = array( |
484 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
485 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
486 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
483 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
484 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
485 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
487 | 486 | 'required' => $question->required() ? TRUE : FALSE, |
488 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
487 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
489 | 488 | 'html_label_class' => 'ee-reg-qstn', |
490 | 489 | 'html_label_text' => $question->display_text(), |
491 | 490 | 'required_validation_error_message' => $question->required_text() |
492 | 491 | ); |
493 | 492 | // has this question been answered ? |
494 | - if ( $answer instanceof EE_Answer ) { |
|
495 | - if ( $answer->ID() ) { |
|
496 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
497 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
498 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
493 | + if ($answer instanceof EE_Answer) { |
|
494 | + if ($answer->ID()) { |
|
495 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
496 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
497 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
499 | 498 | } |
500 | 499 | $input_constructor_args['default'] = $answer->value(); |
501 | 500 | } |
502 | 501 | //add "-lbl" to the end of the label id |
503 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
502 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
504 | 503 | |
505 | - switch ( $question->type() ) { |
|
504 | + switch ($question->type()) { |
|
506 | 505 | // Text |
507 | 506 | case EEM_Question::QST_type_text : |
508 | - if( $identifier == 'email' ){ |
|
509 | - return new EE_Email_Input( $input_constructor_args ); |
|
510 | - }else{ |
|
511 | - return new EE_Text_Input( $input_constructor_args ); |
|
507 | + if ($identifier == 'email') { |
|
508 | + return new EE_Email_Input($input_constructor_args); |
|
509 | + } else { |
|
510 | + return new EE_Text_Input($input_constructor_args); |
|
512 | 511 | } |
513 | 512 | break; |
514 | 513 | // Textarea |
515 | 514 | case EEM_Question::QST_type_textarea : |
516 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
515 | + return new EE_Text_Area_Input($input_constructor_args); |
|
517 | 516 | break; |
518 | 517 | // Radio Buttons |
519 | 518 | case EEM_Question::QST_type_radio : |
520 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
519 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
521 | 520 | break; |
522 | 521 | // Dropdown |
523 | 522 | case EEM_Question::QST_type_dropdown : |
524 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
523 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
525 | 524 | break; |
526 | 525 | // State Dropdown |
527 | 526 | case EEM_Question::QST_type_state : |
528 | - $state_options = array( '' => array( '' => '')); |
|
527 | + $state_options = array('' => array('' => '')); |
|
529 | 528 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
530 | - if ( ! empty( $states )) { |
|
531 | - foreach( $states as $state ){ |
|
532 | - if ( $state instanceof EE_State ) { |
|
533 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
529 | + if ( ! empty($states)) { |
|
530 | + foreach ($states as $state) { |
|
531 | + if ($state instanceof EE_State) { |
|
532 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
534 | 533 | } |
535 | 534 | } |
536 | 535 | } |
537 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
538 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
536 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
537 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
539 | 538 | break; |
540 | 539 | // Country Dropdown |
541 | 540 | case EEM_Question::QST_type_country : |
542 | - $country_options = array( '' => '' ); |
|
541 | + $country_options = array('' => ''); |
|
543 | 542 | // get possibly cached list of countries |
544 | 543 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
545 | - if ( ! empty( $countries )) { |
|
546 | - foreach( $countries as $country ){ |
|
547 | - if ( $country instanceof EE_Country ) { |
|
548 | - $country_options[ $country->ID() ] = $country->name(); |
|
544 | + if ( ! empty($countries)) { |
|
545 | + foreach ($countries as $country) { |
|
546 | + if ($country instanceof EE_Country) { |
|
547 | + $country_options[$country->ID()] = $country->name(); |
|
549 | 548 | } |
550 | 549 | } |
551 | 550 | } |
552 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
553 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
551 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
552 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
554 | 553 | break; |
555 | 554 | // Checkboxes |
556 | 555 | case EEM_Question::QST_type_checkbox : |
557 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
556 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
558 | 557 | break; |
559 | 558 | // Date |
560 | 559 | case EEM_Question::QST_type_date : |
561 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
560 | + return new EE_Datepicker_Input($input_constructor_args); |
|
562 | 561 | break; |
563 | 562 | case EEM_Question::QST_type_html_textarea : |
564 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
565 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
566 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
563 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
564 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
565 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
567 | 566 | return $input; |
568 | 567 | // fallback |
569 | 568 | default : |
570 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
571 | - if( ! $default_input ){ |
|
572 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
569 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
570 | + if ( ! $default_input) { |
|
571 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
573 | 572 | } |
574 | 573 | return $default_input; |
575 | 574 | } |
@@ -594,65 +593,65 @@ discard block |
||
594 | 593 | */ |
595 | 594 | public function process_reg_step() { |
596 | 595 | |
597 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
596 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
598 | 597 | // grab validated data from form |
599 | 598 | $valid_data = $this->checkout->current_step->valid_data(); |
600 | 599 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
601 | 600 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
602 | 601 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
603 | - if ( empty( $valid_data )) { |
|
604 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
602 | + if (empty($valid_data)) { |
|
603 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
605 | 604 | return FALSE; |
606 | 605 | } |
607 | 606 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
608 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
609 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
607 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
608 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
610 | 609 | return FALSE; |
611 | 610 | } |
612 | 611 | // get cached registrations |
613 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
612 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
614 | 613 | // verify we got the goods |
615 | - if ( empty( $registrations )) { |
|
616 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
614 | + if (empty($registrations)) { |
|
615 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
617 | 616 | return FALSE; |
618 | 617 | } |
619 | 618 | // extract attendee info from form data and save to model objects |
620 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
619 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
621 | 620 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
622 | - if ( $registrations_processed === FALSE ) { |
|
621 | + if ($registrations_processed === FALSE) { |
|
623 | 622 | // but return immediately if the previous step exited early due to errors |
624 | 623 | return FALSE; |
625 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
624 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
626 | 625 | // generate a correctly translated string for all possible singular/plural combinations |
627 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
626 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
628 | 627 | $error_msg = sprintf( |
629 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
628 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
630 | 629 | $this->checkout->total_ticket_count, |
631 | 630 | $registrations_processed |
632 | 631 | ); |
633 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
632 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
634 | 633 | $error_msg = sprintf( |
635 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
634 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
636 | 635 | $this->checkout->total_ticket_count, |
637 | 636 | $registrations_processed |
638 | 637 | ); |
639 | 638 | } else { |
640 | 639 | $error_msg = sprintf( |
641 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
640 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
642 | 641 | $this->checkout->total_ticket_count, |
643 | 642 | $registrations_processed |
644 | 643 | ); |
645 | 644 | |
646 | 645 | } |
647 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
646 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
648 | 647 | return FALSE; |
649 | 648 | } |
650 | 649 | // mark this reg step as completed |
651 | 650 | $this->checkout->current_step->set_completed(); |
652 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
651 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
653 | 652 | //do action in case a plugin wants to do something with the data submitted in step 1. |
654 | 653 | //passes EE_Single_Page_Checkout, and it's posted data |
655 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
654 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
656 | 655 | return TRUE; |
657 | 656 | |
658 | 657 | } |
@@ -666,9 +665,9 @@ discard block |
||
666 | 665 | * @param array $valid_data |
667 | 666 | * @return boolean | int |
668 | 667 | */ |
669 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
668 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
670 | 669 | // load resources and set some defaults |
671 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
670 | + EE_Registry::instance()->load_model('Attendee'); |
|
672 | 671 | // holder for primary registrant attendee object |
673 | 672 | $this->checkout->primary_attendee_obj = NULL; |
674 | 673 | // array for tracking reg form data for the primary registrant |
@@ -685,19 +684,19 @@ discard block |
||
685 | 684 | // attendee counter |
686 | 685 | $att_nmbr = 0; |
687 | 686 | // grab the saved registrations from the transaction |
688 | - foreach ( $registrations as $registration ) { |
|
687 | + foreach ($registrations as $registration) { |
|
689 | 688 | // verify EE_Registration object |
690 | - if ( ! $registration instanceof EE_Registration ) { |
|
691 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
689 | + if ( ! $registration instanceof EE_Registration) { |
|
690 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
692 | 691 | return FALSE; |
693 | 692 | } |
694 | 693 | $reg_url_link = $registration->reg_url_link(); |
695 | 694 | // reg_url_link exists ? |
696 | - if ( $reg_url_link ) { |
|
695 | + if ($reg_url_link) { |
|
697 | 696 | // should this registration be processed during this visit ? |
698 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
697 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
699 | 698 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
700 | - if ( ! $this->checkout->revisit ) { |
|
699 | + if ( ! $this->checkout->revisit) { |
|
701 | 700 | $registration->save(); |
702 | 701 | } |
703 | 702 | |
@@ -708,41 +707,41 @@ discard block |
||
708 | 707 | * @var bool if TRUE is returned by the plugin then the |
709 | 708 | * registration processing is halted. |
710 | 709 | */ |
711 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
710 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
712 | 711 | return FALSE; |
713 | 712 | } |
714 | 713 | |
715 | 714 | // Houston, we have a registration! |
716 | 715 | $att_nmbr++; |
717 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
716 | + $this->_attendee_data[$reg_url_link] = array(); |
|
718 | 717 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
719 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
718 | + if (isset($valid_data[$reg_url_link])) { |
|
720 | 719 | // do we need to copy basic info from primary attendee ? |
721 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
720 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
722 | 721 | // filter form input data for this registration |
723 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
722 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
724 | 723 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
725 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
726 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
727 | - unset( $valid_data['primary_attendee'] ); |
|
724 | + if (isset($valid_data['primary_attendee'])) { |
|
725 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
726 | + unset($valid_data['primary_attendee']); |
|
728 | 727 | } |
729 | 728 | // now loop through our array of valid post data && process attendee reg forms |
730 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
731 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
732 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
729 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
730 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
731 | + foreach ($form_inputs as $form_input => $input_value) { |
|
733 | 732 | // check for critical inputs |
734 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
733 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
735 | 734 | return FALSE; |
736 | 735 | } |
737 | 736 | // store a bit of data about the primary attendee |
738 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
739 | - $primary_registrant[ $form_input ] = $input_value; |
|
740 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
741 | - $input_value = $primary_registrant[ $form_input ]; |
|
737 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
738 | + $primary_registrant[$form_input] = $input_value; |
|
739 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
740 | + $input_value = $primary_registrant[$form_input]; |
|
742 | 741 | } |
743 | 742 | // now attempt to save the input data |
744 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
745 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
743 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
744 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
746 | 745 | return FALSE; |
747 | 746 | } |
748 | 747 | } |
@@ -751,51 +750,51 @@ discard block |
||
751 | 750 | } |
752 | 751 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
753 | 752 | // this registration does not require additional attendee information ? |
754 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
753 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
755 | 754 | // just copy the primary registrant |
756 | 755 | $attendee = $this->checkout->primary_attendee_obj; |
757 | 756 | } else { |
758 | 757 | // have we met before? |
759 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
758 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
760 | 759 | // did we find an already existing record for this attendee ? |
761 | - if ( $attendee instanceof EE_Attendee ) { |
|
762 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
760 | + if ($attendee instanceof EE_Attendee) { |
|
761 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
763 | 762 | } else { |
764 | 763 | // ensure critical details are set for additional attendees |
765 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
766 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
764 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
765 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
767 | 766 | } |
768 | 767 | // who's #1 ? |
769 | - if ( $att_nmbr == 1 ) { |
|
768 | + if ($att_nmbr == 1) { |
|
770 | 769 | $this->checkout->primary_attendee_obj = $attendee; |
771 | 770 | } |
772 | 771 | } |
773 | 772 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
774 | 773 | // add relation to registration, set attendee ID, and cache attendee |
775 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
776 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
777 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
774 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
775 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
776 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
778 | 777 | return FALSE; |
779 | 778 | } |
780 | 779 | /** @type EE_Registration_Processor $registration_processor */ |
781 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
780 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
782 | 781 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
783 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
782 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
784 | 783 | /** @type EE_Transaction_Processor $transaction_processor */ |
785 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
784 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
786 | 785 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
787 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
786 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
788 | 787 | // if we've gotten this far, then let's save what we have |
789 | 788 | $registration->save(); |
790 | 789 | // add relation between TXN and registration |
791 | - $this->_associate_registration_with_transaction( $registration ); |
|
790 | + $this->_associate_registration_with_transaction($registration); |
|
792 | 791 | |
793 | 792 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 793 | |
795 | - } else { |
|
796 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
794 | + } else { |
|
795 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 796 | // remove malformed data |
798 | - unset( $valid_data[ $reg_url_link ] ); |
|
797 | + unset($valid_data[$reg_url_link]); |
|
799 | 798 | return FALSE; |
800 | 799 | } |
801 | 800 | |
@@ -813,22 +812,22 @@ discard block |
||
813 | 812 | * @param string $input_value |
814 | 813 | * @return boolean |
815 | 814 | */ |
816 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
815 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
817 | 816 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
818 | 817 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
819 | 818 | // allow for plugins to hook in and do their own processing of the form input. |
820 | 819 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
821 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
820 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
822 | 821 | return TRUE; |
823 | 822 | } |
824 | 823 | |
825 | 824 | // grab related answer objects |
826 | 825 | $answers = $registration->answers(); |
827 | 826 | // $answer_cache_id is the key used to find the EE_Answer we want |
828 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
829 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
827 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
828 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
830 | 829 | //rename form_inputs if they are EE_Attendee properties |
831 | - switch( (string)$form_input ) { |
|
830 | + switch ((string) $form_input) { |
|
832 | 831 | |
833 | 832 | case 'state' : |
834 | 833 | case 'STA_ID' : |
@@ -843,33 +842,33 @@ discard block |
||
843 | 842 | break; |
844 | 843 | |
845 | 844 | default : |
846 | - $ATT_input = 'ATT_' . $form_input; |
|
845 | + $ATT_input = 'ATT_'.$form_input; |
|
847 | 846 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
848 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
849 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
847 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
848 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
850 | 849 | } |
851 | 850 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
852 | 851 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
853 | 852 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
854 | 853 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
855 | 854 | // if this form input has a corresponding attendee property |
856 | - if ( $attendee_property ) { |
|
857 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
858 | - if ( $answer_is_obj ) { |
|
855 | + if ($attendee_property) { |
|
856 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
857 | + if ($answer_is_obj) { |
|
859 | 858 | // and delete the corresponding answer since we won't be storing this data in that object |
860 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
861 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
859 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
860 | + $answers[$answer_cache_id]->delete_permanently(); |
|
862 | 861 | } |
863 | 862 | return TRUE; |
864 | - } elseif ( $answer_is_obj ) { |
|
863 | + } elseif ($answer_is_obj) { |
|
865 | 864 | // save this data to the answer object |
866 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
867 | - $result = $answers[ $answer_cache_id ]->save(); |
|
865 | + $answers[$answer_cache_id]->set_value($input_value); |
|
866 | + $result = $answers[$answer_cache_id]->save(); |
|
868 | 867 | return $result !== false ? true : false; |
869 | 868 | } else { |
870 | - foreach ( $answers as $answer ) { |
|
871 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
872 | - $answer->set_value( $input_value ); |
|
869 | + foreach ($answers as $answer) { |
|
870 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
871 | + $answer->set_value($input_value); |
|
873 | 872 | $result = $answer->save(); |
874 | 873 | return $result !== false ? true : false; |
875 | 874 | } |
@@ -887,29 +886,29 @@ discard block |
||
887 | 886 | * @param string $input_value |
888 | 887 | * @return boolean |
889 | 888 | */ |
890 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
891 | - if ( empty( $input_value )) { |
|
892 | - switch( $form_input ) { |
|
889 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
890 | + if (empty($input_value)) { |
|
891 | + switch ($form_input) { |
|
893 | 892 | case 'fname' : |
894 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
893 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
895 | 894 | return FALSE; |
896 | 895 | break; |
897 | 896 | case 'lname' : |
898 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
897 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
899 | 898 | return FALSE; |
900 | 899 | break; |
901 | 900 | case 'email' : |
902 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
901 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
903 | 902 | return FALSE; |
904 | 903 | break; |
905 | 904 | } |
906 | - } else if ( $form_input === 'email' ) { |
|
905 | + } else if ($form_input === 'email') { |
|
907 | 906 | // clean the email address |
908 | - $valid_email = sanitize_email( $input_value ); |
|
907 | + $valid_email = sanitize_email($input_value); |
|
909 | 908 | // check if it matches |
910 | - if ( $input_value != $valid_email ) { |
|
909 | + if ($input_value != $valid_email) { |
|
911 | 910 | // whoops!!! |
912 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
911 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
913 | 912 | return FALSE; |
914 | 913 | } |
915 | 914 | } |
@@ -937,14 +936,14 @@ discard block |
||
937 | 936 | * @param array $attendee_data |
938 | 937 | * @return boolean |
939 | 938 | */ |
940 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
939 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
941 | 940 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
942 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
943 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
944 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
941 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
942 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
943 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
945 | 944 | // but only if those have values |
946 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
947 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
945 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
946 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
948 | 947 | 'ATT_fname' => $ATT_fname, |
949 | 948 | 'ATT_lname' => $ATT_lname, |
950 | 949 | 'ATT_email' => $ATT_email |
@@ -952,7 +951,7 @@ discard block |
||
952 | 951 | } else { |
953 | 952 | $existing_attendee = NULL; |
954 | 953 | } |
955 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
954 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
956 | 955 | } |
957 | 956 | |
958 | 957 | |
@@ -964,13 +963,13 @@ discard block |
||
964 | 963 | * @param array $attendee_data |
965 | 964 | * @return \EE_Attendee |
966 | 965 | */ |
967 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
966 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
968 | 967 | // first remove fname, lname, and email from attendee data |
969 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
968 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
970 | 969 | // now loop thru what's left and add to attendee CPT |
971 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
972 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
973 | - $existing_attendee->set( $property_name, $property_value ); |
|
970 | + foreach ($attendee_data as $property_name => $property_value) { |
|
971 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
972 | + $existing_attendee->set($property_name, $property_value); |
|
974 | 973 | } |
975 | 974 | } |
976 | 975 | // better save that now |
@@ -987,11 +986,11 @@ discard block |
||
987 | 986 | * @param EE_Attendee $attendee |
988 | 987 | * @return void |
989 | 988 | */ |
990 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
989 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
991 | 990 | // add relation to attendee |
992 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
993 | - $registration->set_attendee_id( $attendee->ID() ); |
|
994 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
991 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
992 | + $registration->set_attendee_id($attendee->ID()); |
|
993 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
995 | 994 | } |
996 | 995 | |
997 | 996 | |
@@ -1002,10 +1001,10 @@ discard block |
||
1002 | 1001 | * @param EE_Registration $registration |
1003 | 1002 | * @return void |
1004 | 1003 | */ |
1005 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1004 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1006 | 1005 | // add relation to attendee |
1007 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1008 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1006 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1007 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1009 | 1008 | } |
1010 | 1009 | |
1011 | 1010 | |
@@ -1017,17 +1016,17 @@ discard block |
||
1017 | 1016 | * @param array $attendee_data |
1018 | 1017 | * @return array |
1019 | 1018 | */ |
1020 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1019 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1021 | 1020 | // bare minimum critical details include first name, last name, email address |
1022 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1021 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1023 | 1022 | // add address info to critical details? |
1024 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1025 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1026 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1023 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1024 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1025 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1027 | 1026 | } |
1028 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1029 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1030 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1027 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1028 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1029 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1031 | 1030 | } |
1032 | 1031 | } |
1033 | 1032 | return $attendee_data; |
@@ -1042,11 +1041,11 @@ discard block |
||
1042 | 1041 | * @param array $attendee_data |
1043 | 1042 | * @return \EE_Attendee |
1044 | 1043 | */ |
1045 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1044 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1046 | 1045 | // create new attendee object |
1047 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1046 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1048 | 1047 | // set author to event creator |
1049 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1048 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1050 | 1049 | $new_attendee->save(); |
1051 | 1050 | return $new_attendee; |
1052 | 1051 | } |
@@ -1062,7 +1061,7 @@ discard block |
||
1062 | 1061 | */ |
1063 | 1062 | public function update_reg_step() { |
1064 | 1063 | // save everything |
1065 | - if ( $this->process_reg_step() ) { |
|
1064 | + if ($this->process_reg_step()) { |
|
1066 | 1065 | $this->checkout->redirect = TRUE; |
1067 | 1066 | $this->checkout->redirect_url = add_query_arg( |
1068 | 1067 | array( |
@@ -1071,7 +1070,7 @@ discard block |
||
1071 | 1070 | ), |
1072 | 1071 | $this->checkout->thank_you_page_url |
1073 | 1072 | ); |
1074 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1073 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1075 | 1074 | return TRUE; |
1076 | 1075 | } |
1077 | 1076 | return FALSE; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | - * @return boolean |
|
45 | + * @return boolean|null |
|
46 | 46 | */ |
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | |
171 | 171 | /** |
172 | - * @return boolean |
|
172 | + * @return boolean|null |
|
173 | 173 | */ |
174 | 174 | public function update_reg_step() { |
175 | 175 | EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'finalize_registration'; |
25 | 25 | $this->_name = __('Finalize Registration', 'event_espresso'); |
26 | 26 | $this->_submit_button_text = $this->_name; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
49 | 49 | // there's actually no reg form to process if this is the final step |
50 | - if ( $this->is_current_step() ) { |
|
50 | + if ($this->is_current_step()) { |
|
51 | 51 | $this->checkout->step = $_REQUEST['step'] = $this->slug(); |
52 | - $this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step'; |
|
52 | + $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
|
53 | 53 | $this->checkout->generate_reg_form = false; |
54 | 54 | } |
55 | 55 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function process_reg_step() { |
74 | 74 | // ensure all data gets refreshed from the db |
75 | - $this->checkout->refresh_all_entities( true ); |
|
75 | + $this->checkout->refresh_all_entities(true); |
|
76 | 76 | // ensures that all details and statuses for transaction, registration, and payments are updated |
77 | 77 | $txn_update_params = $this->_finalize_transaction(); |
78 | 78 | // DEBUG LOG |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | // ) |
87 | 87 | //); |
88 | 88 | // set a hook point |
89 | - do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params ); |
|
89 | + do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params); |
|
90 | 90 | // check if transaction has a primary registrant and that it has a related Attendee object |
91 | - if ( $this->checkout->transaction_has_primary_registrant() ) { |
|
91 | + if ($this->checkout->transaction_has_primary_registrant()) { |
|
92 | 92 | // setup URL for redirect |
93 | 93 | $this->checkout->redirect_url = add_query_arg( |
94 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
94 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
95 | 95 | $this->checkout->thank_you_page_url |
96 | 96 | ); |
97 | 97 | } else { |
98 | - EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
98 | + EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
99 | 99 | $this->checkout->redirect = false; |
100 | 100 | $this->checkout->continue_reg = false; |
101 | 101 | return false; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | // you don't have to go home but you can't stay here ! |
104 | 104 | $this->checkout->redirect = true; |
105 | 105 | $this->checkout->continue_reg = true; |
106 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
107 | - if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) { |
|
106 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
107 | + if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) { |
|
108 | 108 | // mark this reg step as completed |
109 | 109 | $this->checkout->current_step->set_completed(); |
110 | 110 | } |
@@ -121,41 +121,41 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function _finalize_transaction() { |
123 | 123 | /** @type EE_Transaction_Processor $transaction_processor */ |
124 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
124 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
125 | 125 | //set revisit flag in txn processor |
126 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
126 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
127 | 127 | // at this point we'll consider a TXN to not have been abandoned |
128 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
129 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
128 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
129 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
130 | 130 | // save TXN data to the cart |
131 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
131 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
132 | 132 | } |
133 | 133 | /** @type EE_Transaction_Payments $transaction_payments */ |
134 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
134 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
135 | 135 | // maybe update status, but don't save transaction just yet |
136 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
136 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
137 | 137 | // If the selected method of payment used an off-site gateway... |
138 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
139 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) { |
|
140 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
141 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
138 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
139 | + if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) { |
|
140 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
141 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
142 | 142 | // do NOT trigger notifications because it was already done during the IPN |
143 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
144 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
143 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
144 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
145 | 145 | } |
146 | 146 | } else if ( |
147 | 147 | // if SPCO revisit and TXN status has changed due to a payment |
148 | - filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ) && |
|
149 | - ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() ) |
|
148 | + filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN) && |
|
149 | + ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated()) |
|
150 | 150 | ) { |
151 | 151 | // send out notifications |
152 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
152 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
153 | 153 | } else { |
154 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
154 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | // this will result in the base session properties getting saved to the TXN_Session_data field |
158 | - $this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true )); |
|
158 | + $this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true)); |
|
159 | 159 | |
160 | 160 | // update the TXN if payment conditions have changed |
161 | 161 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @return boolean |
173 | 173 | */ |
174 | 174 | public function update_reg_step() { |
175 | - EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
|
175 | + EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0'); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
106 | - * @return null |
|
106 | + * @return EE_Line_Item_Display |
|
107 | 107 | */ |
108 | 108 | public function line_item_display() { |
109 | 109 | return $this->line_item_display; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | |
114 | 114 | /** |
115 | - * @param null $line_item_display |
|
115 | + * @param EE_Line_Item_Display $line_item_display |
|
116 | 116 | */ |
117 | 117 | public function set_line_item_display( $line_item_display ) { |
118 | 118 | $this->line_item_display = $line_item_display; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | |
180 | 180 | /** |
181 | - * @return bool |
|
181 | + * @return EE_Form_Section_Proper |
|
182 | 182 | */ |
183 | 183 | public function generate_reg_form() { |
184 | 184 | EE_Registry::instance()->load_helper( 'HTML' ); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | * get_billing_form_html_for_payment_method |
731 | 731 | * |
732 | 732 | * @access public |
733 | - * @return string |
|
733 | + * @return boolean |
|
734 | 734 | */ |
735 | 735 | public function get_billing_form_html_for_payment_method() { |
736 | 736 | // how have they chosen to pay? |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * switch_payment_method |
851 | 851 | * |
852 | 852 | * @access public |
853 | - * @return string |
|
853 | + * @return boolean |
|
854 | 854 | */ |
855 | 855 | public function switch_payment_method() { |
856 | 856 | if ( ! $this->_verify_payment_method_is_set() ) { |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | |
1016 | 1016 | /** |
1017 | 1017 | * process_reg_step |
1018 | - * @return boolean |
|
1018 | + * @return null|boolean |
|
1019 | 1019 | */ |
1020 | 1020 | public function process_reg_step() { |
1021 | 1021 | // how have they chosen to pay? |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | * update_reg_step |
1092 | 1092 | * this is the final step after a user revisits the site to retry a payment |
1093 | 1093 | * |
1094 | - * @return boolean |
|
1094 | + * @return null|boolean |
|
1095 | 1095 | */ |
1096 | 1096 | public function update_reg_step() { |
1097 | 1097 | $success = TRUE; |
@@ -1373,7 +1373,7 @@ discard block |
||
1373 | 1373 | * |
1374 | 1374 | * @access private |
1375 | 1375 | * @type EE_Payment_Method $payment_method |
1376 | - * @return mixed EE_Payment | boolean |
|
1376 | + * @return EE_Payment|null EE_Payment | boolean |
|
1377 | 1377 | */ |
1378 | 1378 | private function _attempt_payment( EE_Payment_Method $payment_method ) { |
1379 | 1379 | $payment =NULL; |
@@ -1570,6 +1570,7 @@ discard block |
||
1570 | 1570 | * @access private |
1571 | 1571 | * @type EE_Payment $payment |
1572 | 1572 | * @param string $payment_occurs |
1573 | + * @param EE_Payment|null $payment |
|
1573 | 1574 | * @return bool |
1574 | 1575 | * @throws \EE_Error |
1575 | 1576 | */ |
@@ -1675,7 +1676,7 @@ discard block |
||
1675 | 1676 | * or present the payment options again |
1676 | 1677 | * |
1677 | 1678 | * @access private |
1678 | - * @return EE_Payment | FALSE |
|
1679 | + * @return boolean | FALSE |
|
1679 | 1680 | */ |
1680 | 1681 | public function process_gateway_response() { |
1681 | 1682 | $payment = null; |
@@ -1733,7 +1734,7 @@ discard block |
||
1733 | 1734 | * _validate_return |
1734 | 1735 | * |
1735 | 1736 | * @access private |
1736 | - * @return bool |
|
1737 | + * @return boolean|null |
|
1737 | 1738 | */ |
1738 | 1739 | private function _validate_offsite_return() { |
1739 | 1740 | $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
@@ -1800,7 +1801,7 @@ discard block |
||
1800 | 1801 | * |
1801 | 1802 | * @access private |
1802 | 1803 | * @param \EE_Registration $primary_registrant |
1803 | - * @return bool |
|
1804 | + * @return false|null |
|
1804 | 1805 | */ |
1805 | 1806 | private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
1806 | 1807 | if ( ! $primary_registrant instanceof EE_Registration ) { |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Payment_Options |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Payment_Options |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Payment_Options extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | return FALSE; |
741 | 741 | } |
742 | 742 | if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
743 | - EE_Error::add_success( |
|
744 | - apply_filters( |
|
745 | - 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
746 | - sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
747 | - ) |
|
748 | - ); |
|
749 | - } |
|
743 | + EE_Error::add_success( |
|
744 | + apply_filters( |
|
745 | + 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
746 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
747 | + ) |
|
748 | + ); |
|
749 | + } |
|
750 | 750 | // now generate billing form for selected method of payment |
751 | 751 | $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method, FALSE ); |
752 | 752 | // fill form with attendee info if applicable |
@@ -778,14 +778,14 @@ discard block |
||
778 | 778 | $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
779 | 779 | if ( $billing_form instanceof EE_Billing_Info_Form ) { |
780 | 780 | if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
781 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
782 | - EE_Error::add_success( |
|
783 | - apply_filters( |
|
784 | - 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
785 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
786 | - ) |
|
787 | - ); |
|
788 | - } |
|
781 | + if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
782 | + EE_Error::add_success( |
|
783 | + apply_filters( |
|
784 | + 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
785 | + sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
786 | + ) |
|
787 | + ); |
|
788 | + } |
|
789 | 789 | } |
790 | 790 | return apply_filters( |
791 | 791 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
@@ -1214,9 +1214,9 @@ |
||
1214 | 1214 | $form_section = $validation_error->get_form_section(); |
1215 | 1215 | if( $form_section instanceof EE_Form_Input_Base ){ |
1216 | 1216 | $label = $form_section->html_label_text(); |
1217 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1217 | + } elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1218 | 1218 | $label = $form_section->name(); |
1219 | - }else{ |
|
1219 | + } else{ |
|
1220 | 1220 | $label = __( 'Validation Error', 'event_espresso' ); |
1221 | 1221 | } |
1222 | 1222 | $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | */ |
30 | 30 | public static function set_hooks() { |
31 | - add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) ); |
|
32 | - add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
33 | - add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
34 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
35 | - add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
36 | - add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
37 | - add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
31 | + add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')); |
|
32 | + add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
33 | + add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
34 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
35 | + add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
36 | + add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
37 | + add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
38 | 38 | ); |
39 | - add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 ); |
|
39 | + add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * ajax switch_spco_billing_form |
46 | 46 | */ |
47 | 47 | public static function switch_spco_billing_form() { |
48 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
48 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * ajax save_payer_details |
55 | 55 | */ |
56 | 56 | public static function save_payer_details() { |
57 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
57 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * ajax get_transaction_details |
64 | 64 | */ |
65 | 65 | public static function get_transaction_details() { |
66 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
66 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * @param EE_Checkout $checkout |
92 | 92 | * @return \EE_SPCO_Reg_Step_Payment_Options |
93 | 93 | */ |
94 | - public function __construct( EE_Checkout $checkout ) { |
|
94 | + public function __construct(EE_Checkout $checkout) { |
|
95 | 95 | $this->_slug = 'payment_options'; |
96 | 96 | $this->_name = __('Payment Options', 'event_espresso'); |
97 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
97 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
98 | 98 | $this->checkout = $checkout; |
99 | 99 | $this->_reset_success_message(); |
100 | - $this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
100 | + $this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param null $line_item_display |
116 | 116 | */ |
117 | - public function set_line_item_display( $line_item_display ) { |
|
117 | + public function set_line_item_display($line_item_display) { |
|
118 | 118 | $this->line_item_display = $line_item_display; |
119 | 119 | } |
120 | 120 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | public function translate_js_strings() { |
128 | - EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' ); |
|
129 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' ); |
|
130 | - EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' ); |
|
128 | + EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso'); |
|
129 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso'); |
|
130 | + EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | // $ 0.00 transactions (no payment required) |
157 | 157 | ! $this->checkout->payment_required() |
158 | 158 | // but do NOT remove if current action being called belongs to this reg step |
159 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
159 | + && ! is_callable(array($this, $this->checkout->action)) |
|
160 | 160 | && ! $this->completed() |
161 | 161 | ) { |
162 | 162 | // and if so, then we no longer need the Payment Options step |
163 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
163 | + $this->checkout->remove_reg_step($this->_slug); |
|
164 | 164 | $this->checkout->reset_reg_steps(); |
165 | - if ( $this->is_current_step() ) { |
|
165 | + if ($this->is_current_step()) { |
|
166 | 166 | $this->checkout->generate_reg_form = false; |
167 | 167 | } |
168 | 168 | // DEBUG LOG |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | return; |
171 | 171 | } |
172 | 172 | // load EEM_Payment_Method |
173 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
173 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
174 | 174 | // get all active payment methods |
175 | - $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
175 | + $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return bool |
182 | 182 | */ |
183 | 183 | public function generate_reg_form() { |
184 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
184 | + EE_Registry::instance()->load_helper('HTML'); |
|
185 | 185 | // reset in case someone changes their mind |
186 | 186 | $this->_reset_selected_method_of_payment(); |
187 | 187 | // set some defaults |
@@ -192,16 +192,16 @@ discard block |
||
192 | 192 | $sold_out_events = array(); |
193 | 193 | $reg_count = 0; |
194 | 194 | // loop thru registrations to gather info |
195 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
196 | - foreach ( $registrations as $registration ) { |
|
195 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
196 | + foreach ($registrations as $registration) { |
|
197 | 197 | //echo '<h3 style="color:#E76700;line-height:1em;">' . $registration->ID() . '<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h3>'; |
198 | 198 | /** @var $registration EE_Registration */ |
199 | 199 | $reg_count++; |
200 | 200 | // if returning registrant is Approved then do NOT do this |
201 | - if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) { |
|
202 | - if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) { |
|
201 | + if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) { |
|
202 | + if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) { |
|
203 | 203 | // add event to list of events that are sold out |
204 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
204 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
205 | 205 | do_action( |
206 | 206 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
207 | 207 | $registration->event(), |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | ); |
210 | 210 | } |
211 | 211 | // event requires admin approval |
212 | - if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) { |
|
212 | + if ($registration->status_ID() == EEM_Registration::status_id_not_approved) { |
|
213 | 213 | // add event to list of events with pre-approval reg status |
214 | - $registrations_requiring_pre_approval[ $registration->ID() ] = $registration; |
|
214 | + $registrations_requiring_pre_approval[$registration->ID()] = $registration; |
|
215 | 215 | do_action( |
216 | 216 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
217 | 217 | $registration->event(), |
@@ -220,29 +220,29 @@ discard block |
||
220 | 220 | } |
221 | 221 | } |
222 | 222 | // are they allowed to pay now and is there monies owing? |
223 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
224 | - $registrations_requiring_payment[ $registration->ID() ] = $registration; |
|
223 | + if ($registration->owes_monies_and_can_pay()) { |
|
224 | + $registrations_requiring_payment[$registration->ID()] = $registration; |
|
225 | 225 | do_action( |
226 | 226 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
227 | 227 | $registration->event(), |
228 | 228 | $this |
229 | 229 | ); |
230 | - } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free() ) { |
|
231 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
230 | + } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) { |
|
231 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | $subsections = array(); |
235 | 235 | // now decide which template to load |
236 | - if ( ! empty( $sold_out_events )) { |
|
237 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
236 | + if ( ! empty($sold_out_events)) { |
|
237 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
238 | 238 | } |
239 | - if ( ! empty( $registrations_requiring_pre_approval )) { |
|
240 | - $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval ); |
|
239 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
240 | + $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval); |
|
241 | 241 | } |
242 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
243 | - $subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events ); |
|
242 | + if ( ! empty($registrations_for_free_events)) { |
|
243 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
244 | 244 | } |
245 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
245 | + if ( ! empty($registrations_requiring_payment)) { |
|
246 | 246 | //EEH_Debug_Tools::printr( $registrations_requiring_payment, '$registrations_requiring_payment', __FILE__, __LINE__ ); |
247 | 247 | // autoload Line_Item_Display classes |
248 | 248 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | //EEH_Line_Item::visualize( $filtered_line_item_tree ); |
259 | 259 | //EEH_Debug_Tools::printr( $filtered_line_item_tree->total(), '$filtered_line_item_tree->total()', __FILE__, __LINE__ ); |
260 | 260 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
261 | - if ( $this->checkout->amount_owing > 0 ) { |
|
261 | + if ($this->checkout->amount_owing > 0) { |
|
262 | 262 | EEH_Autoloader::register_line_item_display_autoloaders(); |
263 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
264 | - $subsections[ 'payment_options' ] = $this->_display_payment_options( |
|
265 | - $this->line_item_display->display_line_item( $filtered_line_item_tree ) |
|
263 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
264 | + $subsections['payment_options'] = $this->_display_payment_options( |
|
265 | + $this->line_item_display->display_line_item($filtered_line_item_tree) |
|
266 | 266 | ); |
267 | 267 | } |
268 | 268 | } else { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection |
297 | 297 | * @return \EE_Line_Item_Filter_Collection |
298 | 298 | */ |
299 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
299 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
300 | 300 | $line_item_filter_collection->add( |
301 | 301 | new EE_Billable_Line_Item_Filter( |
302 | 302 | EE_Registry::instance()->SSN->checkout()->transaction->registrations( |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | ) |
305 | 305 | ) |
306 | 306 | ); |
307 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
307 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
308 | 308 | return $line_item_filter_collection; |
309 | 309 | } |
310 | 310 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * @return void |
319 | 319 | */ |
320 | 320 | protected function _hide_reg_step_submit_button_if_revisit() { |
321 | - if ( $this->checkout->revisit ) { |
|
322 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
321 | + if ($this->checkout->revisit) { |
|
322 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | * @param \EE_Event[] $sold_out_events_array |
331 | 331 | * @return \EE_Form_Section_Proper |
332 | 332 | */ |
333 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
333 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
334 | 334 | // set some defaults |
335 | 335 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
336 | 336 | $sold_out_events = ''; |
337 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
338 | - $sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )); |
|
337 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
338 | + $sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')); |
|
339 | 339 | } |
340 | 340 | return new EE_Form_Section_Proper( |
341 | 341 | array( |
@@ -347,14 +347,14 @@ discard block |
||
347 | 347 | ), |
348 | 348 | 'layout_strategy' => new EE_Template_Layout( |
349 | 349 | array( |
350 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template |
|
350 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template |
|
351 | 351 | 'template_args' => apply_filters( |
352 | 352 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
353 | 353 | array( |
354 | 354 | 'sold_out_events' => $sold_out_events, |
355 | 355 | 'sold_out_events_msg' => apply_filters( |
356 | 356 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
357 | - __( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ) |
|
357 | + __('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso') |
|
358 | 358 | ) |
359 | 359 | ) |
360 | 360 | ) |
@@ -371,14 +371,14 @@ discard block |
||
371 | 371 | * @param array $registrations_requiring_pre_approval |
372 | 372 | * @return \EE_Form_Section_Proper |
373 | 373 | */ |
374 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) { |
|
374 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
375 | 375 | $events_requiring_pre_approval = ''; |
376 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
377 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
378 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
379 | - EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
376 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
377 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
378 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
379 | + EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
380 | 380 | ) |
381 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
381 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
382 | 382 | ); |
383 | 383 | } |
384 | 384 | } |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | ), |
391 | 391 | 'layout_strategy' => new EE_Template_Layout( |
392 | 392 | array( |
393 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template |
|
393 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template |
|
394 | 394 | 'template_args' => apply_filters( |
395 | 395 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
396 | 396 | array( |
397 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
397 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
398 | 398 | 'events_requiring_pre_approval_msg' => apply_filters( |
399 | 399 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
400 | - __( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
400 | + __('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
401 | 401 | ) |
402 | 402 | ) |
403 | 403 | ), |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @param \EE_Event[] $registrations_for_free_events |
416 | 416 | * @return \EE_Form_Section_Proper |
417 | 417 | */ |
418 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
418 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
419 | 419 | // set some defaults |
420 | 420 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
421 | 421 | // generate no_payment_required form |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | ), |
428 | 428 | 'layout_strategy' => new EE_Template_Layout( |
429 | 429 | array( |
430 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template |
|
430 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template |
|
431 | 431 | 'template_args' => apply_filters( |
432 | 432 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
433 | 433 | array( |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | 'registrations' => array(), |
436 | 436 | 'ticket_count' => array(), |
437 | 437 | 'registrations_for_free_events' => $registrations_for_free_events, |
438 | - 'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' )) |
|
438 | + 'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso')) |
|
439 | 439 | ) |
440 | 440 | ), |
441 | 441 | ) |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * @param string $transaction_details |
453 | 453 | * @return \EE_Form_Section_Proper |
454 | 454 | */ |
455 | - private function _display_payment_options( $transaction_details = '' ) { |
|
455 | + private function _display_payment_options($transaction_details = '') { |
|
456 | 456 | // has method_of_payment been set by no-js user? |
457 | 457 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
458 | 458 | // build payment options form |
@@ -464,20 +464,20 @@ discard block |
||
464 | 464 | 'before_payment_options' => apply_filters( |
465 | 465 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
466 | 466 | new EE_Form_Section_Proper( |
467 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
467 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
468 | 468 | ) |
469 | 469 | ), |
470 | 470 | 'payment_options' => $this->_setup_payment_options(), |
471 | 471 | 'after_payment_options' => apply_filters( |
472 | 472 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
473 | 473 | new EE_Form_Section_Proper( |
474 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
474 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
475 | 475 | ) |
476 | 476 | ), |
477 | 477 | 'default_hidden_inputs' => $this->reg_step_hidden_inputs(), |
478 | - 'extra_hidden_inputs' => $this->_extra_hidden_inputs( FALSE ) |
|
478 | + 'extra_hidden_inputs' => $this->_extra_hidden_inputs(FALSE) |
|
479 | 479 | ), |
480 | - 'layout_strategy' => new EE_Template_Layout( array( |
|
480 | + 'layout_strategy' => new EE_Template_Layout(array( |
|
481 | 481 | 'layout_template_file' => $this->_template, |
482 | 482 | 'template_args' => apply_filters( |
483 | 483 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args', |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | * @param bool $no_payment_required |
502 | 502 | * @return \EE_Form_Section_Proper |
503 | 503 | */ |
504 | - private function _extra_hidden_inputs( $no_payment_required = TRUE ) { |
|
504 | + private function _extra_hidden_inputs($no_payment_required = TRUE) { |
|
505 | 505 | |
506 | 506 | return new EE_Form_Section_Proper( |
507 | 507 | array( |
508 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
508 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
509 | 509 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
510 | 510 | 'subsections' => array( |
511 | 511 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | * @param bool $force_reset |
540 | 540 | * @return void |
541 | 541 | */ |
542 | - private function _reset_selected_method_of_payment( $force_reset = FALSE ) { |
|
543 | - $reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE )); |
|
544 | - if ( $reset_payment_method ) { |
|
542 | + private function _reset_selected_method_of_payment($force_reset = FALSE) { |
|
543 | + $reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE)); |
|
544 | + if ($reset_payment_method) { |
|
545 | 545 | $this->checkout->selected_method_of_payment = NULL; |
546 | 546 | $this->checkout->payment_method = NULL; |
547 | 547 | $this->checkout->billing_form = NULL; |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | * @param string $selected_method_of_payment |
561 | 561 | * @return EE_Billing_Info_Form |
562 | 562 | */ |
563 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
564 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
565 | - EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment )); |
|
563 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
564 | + $selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
565 | + EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment)); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | |
@@ -575,40 +575,40 @@ discard block |
||
575 | 575 | // load payment method classes |
576 | 576 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
577 | 577 | // switch up header depending on number of available payment methods |
578 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
579 | - ? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' )) |
|
580 | - : apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' )); |
|
578 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
579 | + ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) |
|
580 | + : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso')); |
|
581 | 581 | $available_payment_methods = array( |
582 | 582 | // display the "Payment Method" header |
583 | 583 | 'payment_method_header' => new EE_Form_Section_HTML( |
584 | - EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' ) |
|
584 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
585 | 585 | ) |
586 | 586 | ); |
587 | 587 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
588 | 588 | $available_payment_method_options = array(); |
589 | 589 | $default_payment_method_option = array(); |
590 | 590 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
591 | - $payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' ))); |
|
591 | + $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;'))); |
|
592 | 592 | // loop through payment methods |
593 | - foreach( $this->checkout->available_payment_methods as $payment_method ) { |
|
594 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
595 | - $payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' ); |
|
593 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
594 | + if ($payment_method instanceof EE_Payment_Method) { |
|
595 | + $payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img'); |
|
596 | 596 | // check if any payment methods are set as default |
597 | 597 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
598 | - if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) { |
|
598 | + if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) { |
|
599 | 599 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
600 | 600 | $this->_save_selected_method_of_payment(); |
601 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
601 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
602 | 602 | } else { |
603 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
603 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
604 | 604 | } |
605 | - $payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method ); |
|
605 | + $payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method); |
|
606 | 606 | } |
607 | 607 | } |
608 | 608 | // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs |
609 | 609 | $available_payment_method_options = $default_payment_method_option + $available_payment_method_options; |
610 | 610 | // now generate the actual form inputs |
611 | - $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options ); |
|
611 | + $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options); |
|
612 | 612 | $available_payment_methods = $available_payment_methods + $payment_methods_billing_info; |
613 | 613 | |
614 | 614 | // build the available payment methods form |
@@ -628,19 +628,19 @@ discard block |
||
628 | 628 | * @return EE_Payment_Method[] |
629 | 629 | */ |
630 | 630 | protected function _get_available_payment_methods() { |
631 | - if ( ! empty( $this->checkout->available_payment_methods )) { |
|
631 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
632 | 632 | return $this->checkout->available_payment_methods; |
633 | 633 | } |
634 | 634 | $available_payment_methods = array(); |
635 | 635 | // load EEM_Payment_Method |
636 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
636 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
637 | 637 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
638 | 638 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
639 | 639 | // get all active payment methods |
640 | - $payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
641 | - foreach ( $payment_methods as $payment_method ) { |
|
642 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
643 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
640 | + $payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
641 | + foreach ($payment_methods as $payment_method) { |
|
642 | + if ($payment_method instanceof EE_Payment_Method) { |
|
643 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | return $available_payment_methods; |
@@ -656,14 +656,14 @@ discard block |
||
656 | 656 | * @param array $available_payment_method_options |
657 | 657 | * @return \EE_Form_Section_Proper |
658 | 658 | */ |
659 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
659 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
660 | 660 | // generate inputs |
661 | 661 | return new EE_Form_Section_Proper( |
662 | 662 | array( |
663 | 663 | 'html_id' => 'ee-available-payment-method-inputs', |
664 | 664 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
665 | 665 | 'subsections' => array( |
666 | - '' => new EE_Radio_Button_Input ( |
|
666 | + '' => new EE_Radio_Button_Input( |
|
667 | 667 | $available_payment_method_options, |
668 | 668 | array( |
669 | 669 | 'html_name' => 'selected_method_of_payment', |
@@ -687,36 +687,36 @@ discard block |
||
687 | 687 | * @param EE_Payment_Method $payment_method |
688 | 688 | * @return \EE_Form_Section_Proper |
689 | 689 | */ |
690 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
690 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
691 | 691 | $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE; |
692 | 692 | // generate the billing form for payment method |
693 | - $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML(); |
|
693 | + $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML(); |
|
694 | 694 | $this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form; |
695 | 695 | // it's all in the details |
696 | - $info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' ); |
|
696 | + $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr'); |
|
697 | 697 | // add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not |
698 | - if ( $payment_method->description() ) { |
|
698 | + if ($payment_method->description()) { |
|
699 | 699 | $payment_method_info = $payment_method->description(); |
700 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
701 | - $payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
700 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
701 | + $payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
702 | 702 | } else { |
703 | - $payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
703 | + $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
704 | 704 | } |
705 | - $info_html .= EEH_HTML::p ( |
|
706 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ), |
|
705 | + $info_html .= EEH_HTML::p( |
|
706 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), |
|
707 | 707 | '', |
708 | 708 | 'spco-payment-method-desc ee-attention' |
709 | 709 | ); |
710 | 710 | |
711 | 711 | return new EE_Form_Section_Proper( |
712 | 712 | array( |
713 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
713 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
714 | 714 | 'html_class' => 'spco-payment-method-info-dv', |
715 | 715 | // only display the selected or default PM |
716 | 716 | 'html_style' => $currently_selected ? '' : 'display:none;', |
717 | 717 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
718 | 718 | 'subsections' => array( |
719 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
719 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
720 | 720 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
721 | 721 | ) |
722 | 722 | ) |
@@ -734,12 +734,12 @@ discard block |
||
734 | 734 | */ |
735 | 735 | public function get_billing_form_html_for_payment_method() { |
736 | 736 | // how have they chosen to pay? |
737 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
737 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
738 | 738 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
739 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
739 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
740 | 740 | return FALSE; |
741 | 741 | } |
742 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
742 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
743 | 743 | EE_Error::add_success( |
744 | 744 | apply_filters( |
745 | 745 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -748,20 +748,20 @@ discard block |
||
748 | 748 | ); |
749 | 749 | } |
750 | 750 | // now generate billing form for selected method of payment |
751 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method, FALSE ); |
|
751 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method, FALSE); |
|
752 | 752 | // fill form with attendee info if applicable |
753 | - if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
754 | - $payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
753 | + if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
754 | + $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
755 | 755 | } |
756 | 756 | // and debug content |
757 | - if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
758 | - $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form ); |
|
757 | + if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
758 | + $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); |
|
759 | 759 | } |
760 | 760 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; |
761 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info )); |
|
761 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
762 | 762 | // localize validation rules for main form |
763 | 763 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
764 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
764 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
765 | 765 | return TRUE; |
766 | 766 | } |
767 | 767 | |
@@ -774,15 +774,15 @@ discard block |
||
774 | 774 | * @param EE_Payment_Method $payment_method |
775 | 775 | * @return \EE_Billing_Info_Form |
776 | 776 | */ |
777 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
778 | - $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
|
779 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
780 | - if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
|
781 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
777 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
778 | + $billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing)); |
|
779 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
780 | + if (EE_Registry::instance()->REQ->is_set('payment_method')) { |
|
781 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
782 | 782 | EE_Error::add_success( |
783 | 783 | apply_filters( |
784 | 784 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
785 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
785 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name()) |
|
786 | 786 | ) |
787 | 787 | ); |
788 | 788 | } |
@@ -807,27 +807,27 @@ discard block |
||
807 | 807 | * @param string $request_param |
808 | 808 | * @return NULL|string |
809 | 809 | */ |
810 | - private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) { |
|
810 | + private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') { |
|
811 | 811 | // is selected_method_of_payment set in the request ? |
812 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE ); |
|
813 | - if ( $selected_method_of_payment ) { |
|
812 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE); |
|
813 | + if ($selected_method_of_payment) { |
|
814 | 814 | // sanitize it |
815 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment; |
|
816 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
815 | + $selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment; |
|
816 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
817 | 817 | // store it in the session so that it's available for all subsequent requests including AJAX |
818 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
818 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
819 | 819 | } else { |
820 | 820 | // or is is set in the session ? |
821 | - $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' ); |
|
821 | + $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment'); |
|
822 | 822 | } |
823 | 823 | // do ya really really gotta have it? |
824 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
824 | + if (empty($selected_method_of_payment) && $required) { |
|
825 | 825 | EE_Error::add_error( |
826 | 826 | sprintf( |
827 | - __( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ), |
|
827 | + __('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'), |
|
828 | 828 | '<br/>', |
829 | 829 | '<br/>', |
830 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
830 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
831 | 831 | ), |
832 | 832 | __FILE__, __FUNCTION__, __LINE__ |
833 | 833 | ); |
@@ -853,37 +853,37 @@ discard block |
||
853 | 853 | * @return string |
854 | 854 | */ |
855 | 855 | public function switch_payment_method() { |
856 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
856 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
857 | 857 | return FALSE; |
858 | 858 | } |
859 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
859 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
860 | 860 | EE_Error::add_success( |
861 | 861 | apply_filters( |
862 | 862 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
863 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() ) |
|
863 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
864 | 864 | ) |
865 | 865 | ); |
866 | 866 | } |
867 | 867 | // generate billing form for selected method of payment if it hasn't been done already |
868 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
869 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
868 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
869 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
870 | 870 | } |
871 | 871 | // fill form with attendee info if applicable |
872 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
873 | - $this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
872 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
873 | + $this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
874 | 874 | } |
875 | 875 | // and debug content |
876 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
877 | - $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form ); |
|
876 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
877 | + $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form); |
|
878 | 878 | } |
879 | 879 | // get html and validation rules for form |
880 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
881 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() )); |
|
880 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
881 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html())); |
|
882 | 882 | // localize validation rules for main form |
883 | - $this->checkout->billing_form->localize_validation_rules( TRUE ); |
|
884 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
883 | + $this->checkout->billing_form->localize_validation_rules(TRUE); |
|
884 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
885 | 885 | } else { |
886 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' )); |
|
886 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
887 | 887 | } |
888 | 888 | //prevents advancement to next step |
889 | 889 | $this->checkout->continue_reg = FALSE; |
@@ -898,12 +898,12 @@ discard block |
||
898 | 898 | */ |
899 | 899 | protected function _verify_payment_method_is_set() { |
900 | 900 | // generate billing form for selected method of payment if it hasn't been done already |
901 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
901 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
902 | 902 | // how have they chosen to pay? |
903 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
903 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
904 | 904 | } |
905 | 905 | // verify payment method |
906 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
906 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
907 | 907 | // get payment method for selected method of payment |
908 | 908 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
909 | 909 | } |
@@ -923,23 +923,23 @@ discard block |
||
923 | 923 | * @return void |
924 | 924 | */ |
925 | 925 | public function save_payer_details_via_ajax() { |
926 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
926 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
927 | 927 | return; |
928 | 928 | } |
929 | 929 | // generate billing form for selected method of payment if it hasn't been done already |
930 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
931 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
930 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
931 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
932 | 932 | } |
933 | 933 | // generate primary attendee from payer info if applicable |
934 | 934 | if ( ! $this->checkout->transaction_has_primary_registrant()) { |
935 | 935 | $attendee = $this->_create_attendee_from_request_data(); |
936 | - if ( $attendee instanceof EE_Attendee ) { |
|
937 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
938 | - if ( $registration->is_primary_registrant() ) { |
|
936 | + if ($attendee instanceof EE_Attendee) { |
|
937 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
938 | + if ($registration->is_primary_registrant()) { |
|
939 | 939 | $this->checkout->primary_attendee_obj = $attendee; |
940 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
941 | - $registration->set_attendee_id( $attendee->ID() ); |
|
942 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
940 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
941 | + $registration->set_attendee_id($attendee->ID()); |
|
942 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
943 | 943 | } |
944 | 944 | } |
945 | 945 | } |
@@ -952,56 +952,56 @@ discard block |
||
952 | 952 | * uses info from alternate GET or POST data (such as AJAX) to create a new attendee |
953 | 953 | * @return \EE_Attendee |
954 | 954 | */ |
955 | - protected function _create_attendee_from_request_data(){ |
|
955 | + protected function _create_attendee_from_request_data() { |
|
956 | 956 | // get State ID |
957 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
958 | - if ( ! empty( $STA_ID )) { |
|
957 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
958 | + if ( ! empty($STA_ID)) { |
|
959 | 959 | // can we get state object from name ? |
960 | - EE_Registry::instance()->load_model( 'State' ); |
|
961 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' ); |
|
962 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
960 | + EE_Registry::instance()->load_model('State'); |
|
961 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
962 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
963 | 963 | } |
964 | 964 | // get Country ISO |
965 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
966 | - if ( ! empty( $CNT_ISO )) { |
|
965 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
966 | + if ( ! empty($CNT_ISO)) { |
|
967 | 967 | // can we get country object from name ? |
968 | - EE_Registry::instance()->load_model( 'Country' ); |
|
969 | - $country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' ); |
|
970 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
968 | + EE_Registry::instance()->load_model('Country'); |
|
969 | + $country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO'); |
|
970 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
971 | 971 | } |
972 | 972 | // grab attendee data |
973 | 973 | $attendee_data = array( |
974 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
975 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
976 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
977 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
978 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
979 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
974 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
975 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
976 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
977 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
978 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
979 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
980 | 980 | 'STA_ID' => $STA_ID, |
981 | 981 | 'CNT_ISO' => $CNT_ISO, |
982 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
983 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
982 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
983 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
984 | 984 | ); |
985 | 985 | // validate the email address since it is the most important piece of info |
986 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) { |
|
987 | - EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
986 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) { |
|
987 | + EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
988 | 988 | } |
989 | 989 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
990 | - if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) { |
|
991 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
990 | + if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) { |
|
991 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
992 | 992 | 'ATT_fname' => $attendee_data['ATT_fname'], |
993 | 993 | 'ATT_lname' => $attendee_data['ATT_lname'], |
994 | 994 | 'ATT_email' => $attendee_data['ATT_email'] |
995 | 995 | )); |
996 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
996 | + if ($existing_attendee instanceof EE_Attendee) { |
|
997 | 997 | return $existing_attendee; |
998 | 998 | } |
999 | 999 | } |
1000 | 1000 | // no existing attendee? kk let's create a new one |
1001 | 1001 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1002 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1003 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1004 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1002 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1003 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1004 | + return EE_Attendee::new_instance($attendee_data); |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | |
@@ -1021,22 +1021,22 @@ discard block |
||
1021 | 1021 | */ |
1022 | 1022 | public function process_reg_step() { |
1023 | 1023 | // how have they chosen to pay? |
1024 | - $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE ); |
|
1024 | + $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE); |
|
1025 | 1025 | // choose your own adventure based on method_of_payment |
1026 | - switch( $this->checkout->selected_method_of_payment ) { |
|
1026 | + switch ($this->checkout->selected_method_of_payment) { |
|
1027 | 1027 | |
1028 | 1028 | case 'events_sold_out' : |
1029 | 1029 | $this->checkout->redirect = TRUE; |
1030 | 1030 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1031 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1031 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1032 | 1032 | // mark this reg step as completed |
1033 | 1033 | $this->checkout->current_step->set_completed(); |
1034 | 1034 | return FALSE; |
1035 | 1035 | break; |
1036 | 1036 | |
1037 | 1037 | case 'payments_closed' : |
1038 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) { |
|
1039 | - EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1038 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) { |
|
1039 | + EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1040 | 1040 | } |
1041 | 1041 | // mark this reg step as completed |
1042 | 1042 | $this->checkout->current_step->set_completed(); |
@@ -1044,8 +1044,8 @@ discard block |
||
1044 | 1044 | break; |
1045 | 1045 | |
1046 | 1046 | case 'no_payment_required' : |
1047 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) { |
|
1048 | - EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1047 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) { |
|
1048 | + EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1049 | 1049 | } |
1050 | 1050 | // mark this reg step as completed |
1051 | 1051 | $this->checkout->current_step->set_completed(); |
@@ -1054,9 +1054,9 @@ discard block |
||
1054 | 1054 | |
1055 | 1055 | default: |
1056 | 1056 | $payment_successful = $this->_process_payment(); |
1057 | - if ( $payment_successful ) { |
|
1057 | + if ($payment_successful) { |
|
1058 | 1058 | $this->checkout->continue_reg = true; |
1059 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1059 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1060 | 1060 | } else { |
1061 | 1061 | $this->checkout->continue_reg = false; |
1062 | 1062 | } |
@@ -1074,8 +1074,8 @@ discard block |
||
1074 | 1074 | * @param \EE_Payment_Method $payment_method |
1075 | 1075 | * @return void |
1076 | 1076 | */ |
1077 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1078 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1077 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1078 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1079 | 1079 | case EE_PMT_Base::offsite : |
1080 | 1080 | break; |
1081 | 1081 | case EE_PMT_Base::onsite : |
@@ -1098,15 +1098,15 @@ discard block |
||
1098 | 1098 | public function update_reg_step() { |
1099 | 1099 | $success = TRUE; |
1100 | 1100 | // if payment required |
1101 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1102 | - do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction ); |
|
1101 | + if ($this->checkout->transaction->total() > 0) { |
|
1102 | + do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction); |
|
1103 | 1103 | // attempt payment via payment method |
1104 | 1104 | $success = $this->process_reg_step(); |
1105 | 1105 | } |
1106 | - if ( $success && ! $this->checkout->redirect ) { |
|
1107 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
1106 | + if ($success && ! $this->checkout->redirect) { |
|
1107 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
1108 | 1108 | // set return URL |
1109 | - $this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url ); |
|
1109 | + $this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url); |
|
1110 | 1110 | } |
1111 | 1111 | return $success; |
1112 | 1112 | } |
@@ -1126,24 +1126,24 @@ discard block |
||
1126 | 1126 | // clear any previous errors related to not selecting a payment method |
1127 | 1127 | // EE_Error::overwrite_errors(); |
1128 | 1128 | // ya gotta make a choice man |
1129 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
1130 | - $this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' )); |
|
1129 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1130 | + $this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso')); |
|
1131 | 1131 | return FALSE; |
1132 | 1132 | } |
1133 | 1133 | // get EE_Payment_Method object |
1134 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1134 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1135 | 1135 | return FALSE; |
1136 | 1136 | } |
1137 | 1137 | // setup billing form |
1138 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1139 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1138 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1139 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1140 | 1140 | // bad billing form ? |
1141 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1141 | + if ( ! $this->_billing_form_is_valid()) { |
|
1142 | 1142 | return FALSE; |
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | // ensure primary registrant has been fully processed |
1146 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1146 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1147 | 1147 | return FALSE; |
1148 | 1148 | } |
1149 | 1149 | /** @type EE_Transaction_Processor $transaction_processor */ |
@@ -1151,24 +1151,24 @@ discard block |
||
1151 | 1151 | // in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved |
1152 | 1152 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1153 | 1153 | // attempt payment |
1154 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1154 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1155 | 1155 | // process results |
1156 | - $payment = $this->_validate_payment( $payment ); |
|
1157 | - $payment = $this->_post_payment_processing( $payment ); |
|
1156 | + $payment = $this->_validate_payment($payment); |
|
1157 | + $payment = $this->_post_payment_processing($payment); |
|
1158 | 1158 | // verify payment |
1159 | - if ( $payment instanceof EE_Payment ) { |
|
1159 | + if ($payment instanceof EE_Payment) { |
|
1160 | 1160 | // store that for later |
1161 | 1161 | $this->checkout->payment = $payment; |
1162 | 1162 | /** @type EE_Transaction_Processor $transaction_processor */ |
1163 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1163 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1164 | 1164 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1165 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1166 | - if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) { |
|
1165 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1166 | + if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) { |
|
1167 | 1167 | return true; |
1168 | 1168 | } else { |
1169 | 1169 | return false; |
1170 | 1170 | } |
1171 | - } else if ( $payment === true ) { |
|
1171 | + } else if ($payment === true) { |
|
1172 | 1172 | // please note that offline payment methods will NOT make a payment, |
1173 | 1173 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1174 | 1174 | $this->checkout->payment = $payment; |
@@ -1187,10 +1187,10 @@ discard block |
||
1187 | 1187 | * @return bool |
1188 | 1188 | */ |
1189 | 1189 | public function redirect_form() { |
1190 | - $payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() ); |
|
1190 | + $payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment()); |
|
1191 | 1191 | $html = $payment_method_billing_info->get_html_and_js(); |
1192 | 1192 | $html .= $this->checkout->redirect_form; |
1193 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1193 | + EE_Registry::instance()->REQ->add_output($html); |
|
1194 | 1194 | return TRUE; |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1203,33 +1203,33 @@ discard block |
||
1203 | 1203 | * @return bool |
1204 | 1204 | */ |
1205 | 1205 | private function _billing_form_is_valid() { |
1206 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1207 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1206 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1207 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1208 | 1208 | $this->checkout->billing_form->receive_form_submission(); |
1209 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1209 | + if ($this->checkout->billing_form->is_valid()) { |
|
1210 | 1210 | return TRUE; |
1211 | 1211 | } |
1212 | 1212 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1213 | 1213 | $error_strings = array(); |
1214 | - foreach( $validation_errors as $validation_error ){ |
|
1215 | - if( $validation_error instanceof EE_Validation_Error ){ |
|
1214 | + foreach ($validation_errors as $validation_error) { |
|
1215 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1216 | 1216 | $form_section = $validation_error->get_form_section(); |
1217 | - if( $form_section instanceof EE_Form_Input_Base ){ |
|
1217 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1218 | 1218 | $label = $form_section->html_label_text(); |
1219 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1219 | + }elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1220 | 1220 | $label = $form_section->name(); |
1221 | - }else{ |
|
1222 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1221 | + } else { |
|
1222 | + $label = __('Validation Error', 'event_espresso'); |
|
1223 | 1223 | } |
1224 | - $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1224 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | - EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings ) ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1227 | + EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__); |
|
1228 | 1228 | } else { |
1229 | - EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1229 | + EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1230 | 1230 | } |
1231 | 1231 | } else { |
1232 | - EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1232 | + EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1233 | 1233 | } |
1234 | 1234 | return FALSE; |
1235 | 1235 | } |
@@ -1247,9 +1247,9 @@ discard block |
||
1247 | 1247 | */ |
1248 | 1248 | private function _setup_primary_registrant_prior_to_payment() { |
1249 | 1249 | // check if transaction has a primary registrant and that it has a related Attendee object |
1250 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1250 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1251 | 1251 | // need to at least gather some primary registrant data before attempting payment |
1252 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) { |
|
1252 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) { |
|
1253 | 1253 | return FALSE; |
1254 | 1254 | } |
1255 | 1255 | } |
@@ -1257,13 +1257,13 @@ discard block |
||
1257 | 1257 | // grab the primary_registration object |
1258 | 1258 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1259 | 1259 | /** @type EE_Transaction_Processor $transaction_processor */ |
1260 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1260 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1261 | 1261 | // at this point we'll consider a TXN to not have been failed |
1262 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1262 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1263 | 1263 | // save the TXN ( which clears cached copy of primary_registration) |
1264 | 1264 | $this->checkout->transaction->save(); |
1265 | 1265 | // grab TXN ID and save it to the primary_registration |
1266 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1266 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1267 | 1267 | // save what we have so far |
1268 | 1268 | $primary_registration->save(); |
1269 | 1269 | return TRUE; |
@@ -1280,41 +1280,41 @@ discard block |
||
1280 | 1280 | private function _capture_primary_registration_data_from_billing_form() { |
1281 | 1281 | // convert billing form data into an attendee |
1282 | 1282 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1283 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1283 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1284 | 1284 | EE_Error::add_error( |
1285 | 1285 | sprintf( |
1286 | - __( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1286 | + __('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1287 | 1287 | '<br/>', |
1288 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1288 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1289 | 1289 | ), __FILE__, __FUNCTION__, __LINE__ |
1290 | 1290 | ); |
1291 | 1291 | return FALSE; |
1292 | 1292 | } |
1293 | 1293 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1294 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1294 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1295 | 1295 | EE_Error::add_error( |
1296 | 1296 | sprintf( |
1297 | - __( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1297 | + __('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1298 | 1298 | '<br/>', |
1299 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1299 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1300 | 1300 | ), __FILE__, __FUNCTION__, __LINE__ |
1301 | 1301 | ); |
1302 | 1302 | return FALSE; |
1303 | 1303 | } |
1304 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) { |
|
1304 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) { |
|
1305 | 1305 | EE_Error::add_error( |
1306 | 1306 | sprintf( |
1307 | - __( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1307 | + __('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1308 | 1308 | '<br/>', |
1309 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1309 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1310 | 1310 | ), __FILE__, __FUNCTION__, __LINE__ |
1311 | 1311 | ); |
1312 | 1312 | return FALSE; |
1313 | 1313 | } |
1314 | 1314 | /** @type EE_Registration_Processor $registration_processor */ |
1315 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1315 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1316 | 1316 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1317 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1317 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1318 | 1318 | |
1319 | 1319 | return TRUE; |
1320 | 1320 | } |
@@ -1330,35 +1330,35 @@ discard block |
||
1330 | 1330 | */ |
1331 | 1331 | private function _get_payment_method_for_selected_method_of_payment() { |
1332 | 1332 | // get EE_Payment_Method object |
1333 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) { |
|
1334 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1333 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1334 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1335 | 1335 | } else { |
1336 | 1336 | // load EEM_Payment_Method |
1337 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1337 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1338 | 1338 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1339 | 1339 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1340 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1340 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1341 | 1341 | } |
1342 | 1342 | // verify $payment_method |
1343 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1343 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1344 | 1344 | // not a payment |
1345 | 1345 | EE_Error::add_error( |
1346 | 1346 | sprintf( |
1347 | - __( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1347 | + __('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1348 | 1348 | '<br/>', |
1349 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1349 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1350 | 1350 | ), __FILE__, __FUNCTION__, __LINE__ |
1351 | 1351 | ); |
1352 | 1352 | return NULL; |
1353 | 1353 | } |
1354 | 1354 | // and verify it has a valid Payment_Method Type object |
1355 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1355 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1356 | 1356 | // not a payment |
1357 | 1357 | EE_Error::add_error( |
1358 | 1358 | sprintf( |
1359 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1359 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1360 | 1360 | '<br/>', |
1361 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1361 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1362 | 1362 | ), __FILE__, __FUNCTION__, __LINE__ |
1363 | 1363 | ); |
1364 | 1364 | return NULL; |
@@ -1377,30 +1377,30 @@ discard block |
||
1377 | 1377 | * @type EE_Payment_Method $payment_method |
1378 | 1378 | * @return mixed EE_Payment | boolean |
1379 | 1379 | */ |
1380 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1381 | - $payment =NULL; |
|
1380 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1381 | + $payment = NULL; |
|
1382 | 1382 | $this->checkout->transaction->save(); |
1383 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1384 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1383 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1384 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1385 | 1385 | return FALSE; |
1386 | 1386 | } |
1387 | 1387 | try { |
1388 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1388 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1389 | 1389 | // generate payment object |
1390 | 1390 | $payment = $payment_processor->process_payment( |
1391 | 1391 | $payment_method, |
1392 | 1392 | $this->checkout->transaction, |
1393 | 1393 | $this->checkout->amount_owing, |
1394 | 1394 | $this->checkout->billing_form, |
1395 | - $this->_get_return_url( $payment_method ), |
|
1395 | + $this->_get_return_url($payment_method), |
|
1396 | 1396 | 'CART', |
1397 | 1397 | $this->checkout->admin_request, |
1398 | 1398 | TRUE, |
1399 | 1399 | $this->reg_step_url() |
1400 | 1400 | ); |
1401 | 1401 | |
1402 | - } catch( Exception $e ) { |
|
1403 | - $this->_handle_payment_processor_exception( $e ); |
|
1402 | + } catch (Exception $e) { |
|
1403 | + $this->_handle_payment_processor_exception($e); |
|
1404 | 1404 | } |
1405 | 1405 | return $payment; |
1406 | 1406 | } |
@@ -1414,12 +1414,12 @@ discard block |
||
1414 | 1414 | * @param \Exception $e |
1415 | 1415 | * @return void |
1416 | 1416 | */ |
1417 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
1417 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
1418 | 1418 | EE_Error::add_error( |
1419 | 1419 | sprintf( |
1420 | - __( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ), |
|
1420 | + __('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'), |
|
1421 | 1421 | '<br/>', |
1422 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
1422 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
1423 | 1423 | $e->getMessage(), |
1424 | 1424 | $e->getFile(), |
1425 | 1425 | $e->getLine() |
@@ -1436,9 +1436,9 @@ discard block |
||
1436 | 1436 | * @param \EE_Payment_Method $payment_method |
1437 | 1437 | * @return string |
1438 | 1438 | */ |
1439 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
1439 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
1440 | 1440 | $return_url = ''; |
1441 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1441 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1442 | 1442 | |
1443 | 1443 | case EE_PMT_Base::offsite : |
1444 | 1444 | $return_url = add_query_arg( |
@@ -1469,27 +1469,27 @@ discard block |
||
1469 | 1469 | * @param EE_Payment $payment |
1470 | 1470 | * @return EE_Payment | FALSE |
1471 | 1471 | */ |
1472 | - private function _validate_payment( $payment = NULL ) { |
|
1473 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
1472 | + private function _validate_payment($payment = NULL) { |
|
1473 | + if ($this->checkout->payment_method->is_off_line()) { |
|
1474 | 1474 | return TRUE; |
1475 | 1475 | } |
1476 | 1476 | // verify payment object |
1477 | - if ( $payment instanceof EE_Payment ) { |
|
1477 | + if ($payment instanceof EE_Payment) { |
|
1478 | 1478 | if ( |
1479 | 1479 | $payment->status() != EEM_Payment::status_id_approved |
1480 | 1480 | && $payment->status() != EEM_Payment::status_id_pending |
1481 | 1481 | && $payment->status() != EEM_Payment::status_id_cancelled |
1482 | 1482 | && $payment->gateway_response() != '' |
1483 | 1483 | ) { |
1484 | - EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1484 | + EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__); |
|
1485 | 1485 | } |
1486 | 1486 | } else { |
1487 | 1487 | // not a payment |
1488 | 1488 | EE_Error::add_error( |
1489 | 1489 | sprintf( |
1490 | - __( 'A valid payment was not generated due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1490 | + __('A valid payment was not generated due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1491 | 1491 | '<br/>', |
1492 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1492 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1493 | 1493 | ), __FILE__, __FUNCTION__, __LINE__ |
1494 | 1494 | ); |
1495 | 1495 | return FALSE; |
@@ -1506,23 +1506,23 @@ discard block |
||
1506 | 1506 | * @param EE_Payment $payment |
1507 | 1507 | * @return bool |
1508 | 1508 | */ |
1509 | - private function _post_payment_processing( $payment = NULL ) { |
|
1509 | + private function _post_payment_processing($payment = NULL) { |
|
1510 | 1510 | // On-Site payment? |
1511 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1512 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) { |
|
1511 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1512 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
1513 | 1513 | //$this->_setup_redirect_for_next_step(); |
1514 | 1514 | $this->checkout->continue_reg = false; |
1515 | 1515 | } |
1516 | 1516 | // Off-Site payment? |
1517 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
1517 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
1518 | 1518 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
1519 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ){ |
|
1520 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
1519 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
1520 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
1521 | 1521 | $this->checkout->redirect = TRUE; |
1522 | 1522 | $this->checkout->redirect_form = $payment->redirect_form(); |
1523 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
1523 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
1524 | 1524 | // set JSON response |
1525 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
1525 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
1526 | 1526 | // set cron job for finalizing the TXN |
1527 | 1527 | // in case the user does not return from the off-site gateway |
1528 | 1528 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -1530,21 +1530,21 @@ discard block |
||
1530 | 1530 | $this->checkout->transaction->ID() |
1531 | 1531 | ); |
1532 | 1532 | // and lastly, let's bump the payment status to pending |
1533 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
1533 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
1534 | 1534 | $payment->save(); |
1535 | 1535 | } else { |
1536 | 1536 | // not a payment |
1537 | 1537 | $this->checkout->continue_reg = false; |
1538 | 1538 | EE_Error::add_error( |
1539 | 1539 | sprintf( |
1540 | - __( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1540 | + __('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1541 | 1541 | '<br/>', |
1542 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1542 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1543 | 1543 | ), __FILE__, __FUNCTION__, __LINE__ |
1544 | 1544 | ); |
1545 | 1545 | } |
1546 | 1546 | // Off-Line payment? |
1547 | - } else if ( $payment === TRUE ) { |
|
1547 | + } else if ($payment === TRUE) { |
|
1548 | 1548 | //$this->_setup_redirect_for_next_step(); |
1549 | 1549 | return TRUE; |
1550 | 1550 | } else { |
@@ -1580,65 +1580,65 @@ discard block |
||
1580 | 1580 | * @return bool |
1581 | 1581 | * @throws \EE_Error |
1582 | 1582 | */ |
1583 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
1583 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
1584 | 1584 | // off-line payment? carry on |
1585 | - if ( $payment_occurs == EE_PMT_Base::offline ) { |
|
1585 | + if ($payment_occurs == EE_PMT_Base::offline) { |
|
1586 | 1586 | return true; |
1587 | 1587 | } |
1588 | 1588 | // verify payment validity |
1589 | - if ( $payment instanceof EE_Payment ) { |
|
1590 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
1589 | + if ($payment instanceof EE_Payment) { |
|
1590 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
1591 | 1591 | $msg = $payment->gateway_response(); |
1592 | 1592 | // check results |
1593 | - switch ( $payment->status() ) { |
|
1593 | + switch ($payment->status()) { |
|
1594 | 1594 | |
1595 | 1595 | // good payment |
1596 | 1596 | case EEM_Payment::status_id_approved : |
1597 | - EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1597 | + EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1598 | 1598 | return TRUE; |
1599 | 1599 | break; |
1600 | 1600 | |
1601 | 1601 | // slow payment |
1602 | 1602 | case EEM_Payment::status_id_pending : |
1603 | - if ( empty( $msg )) { |
|
1604 | - $msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' ); |
|
1603 | + if (empty($msg)) { |
|
1604 | + $msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso'); |
|
1605 | 1605 | } |
1606 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1606 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1607 | 1607 | return TRUE; |
1608 | 1608 | break; |
1609 | 1609 | |
1610 | 1610 | // don't wanna payment |
1611 | 1611 | case EEM_Payment::status_id_cancelled : |
1612 | - if ( empty( $msg )) { |
|
1612 | + if (empty($msg)) { |
|
1613 | 1613 | $msg = _n( |
1614 | 1614 | 'Payment cancelled. Please try again.', |
1615 | 1615 | 'Payment cancelled. Please try again or select another method of payment.', |
1616 | - count( $this->checkout->available_payment_methods ), |
|
1616 | + count($this->checkout->available_payment_methods), |
|
1617 | 1617 | 'event_espresso' |
1618 | 1618 | ); |
1619 | 1619 | } |
1620 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1620 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1621 | 1621 | return FALSE; |
1622 | 1622 | break; |
1623 | 1623 | |
1624 | 1624 | // not enough payment |
1625 | 1625 | case EEM_Payment::status_id_declined : |
1626 | - if ( empty( $msg )) { |
|
1626 | + if (empty($msg)) { |
|
1627 | 1627 | $msg = _n( |
1628 | 1628 | 'We\'re sorry but your payment was declined. Please try again.', |
1629 | 1629 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
1630 | - count( $this->checkout->available_payment_methods ), |
|
1630 | + count($this->checkout->available_payment_methods), |
|
1631 | 1631 | 'event_espresso' |
1632 | 1632 | ); |
1633 | 1633 | } |
1634 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1634 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1635 | 1635 | return FALSE; |
1636 | 1636 | break; |
1637 | 1637 | |
1638 | 1638 | // bad payment |
1639 | 1639 | case EEM_Payment::status_id_failed : |
1640 | - if ( ! empty( $msg ) ) { |
|
1641 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1640 | + if ( ! empty($msg)) { |
|
1641 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1642 | 1642 | return false; |
1643 | 1643 | } |
1644 | 1644 | // default to error below |
@@ -1648,14 +1648,14 @@ discard block |
||
1648 | 1648 | } |
1649 | 1649 | // off-site payment gateway responses are too unreliable, so let's just assume that |
1650 | 1650 | // the payment processing is just running slower than the registrant's request |
1651 | - if ( $payment_occurs == EE_PMT_Base::offsite ) { |
|
1651 | + if ($payment_occurs == EE_PMT_Base::offsite) { |
|
1652 | 1652 | return true; |
1653 | 1653 | } |
1654 | 1654 | EE_Error::add_error( |
1655 | 1655 | sprintf( |
1656 | - __( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1656 | + __('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1657 | 1657 | '<br/>', |
1658 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1658 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1659 | 1659 | ), |
1660 | 1660 | __FILE__, __FUNCTION__, __LINE__ |
1661 | 1661 | ); |
@@ -1688,13 +1688,13 @@ discard block |
||
1688 | 1688 | public function process_gateway_response() { |
1689 | 1689 | $payment = null; |
1690 | 1690 | // how have they chosen to pay? |
1691 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1691 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1692 | 1692 | // get EE_Payment_Method object |
1693 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1693 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1694 | 1694 | $this->checkout->continue_reg = false; |
1695 | 1695 | return false; |
1696 | 1696 | } |
1697 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
1697 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
1698 | 1698 | return false; |
1699 | 1699 | } |
1700 | 1700 | $this->_validate_offsite_return(); |
@@ -1708,17 +1708,17 @@ discard block |
||
1708 | 1708 | // true |
1709 | 1709 | //); |
1710 | 1710 | // verify TXN |
1711 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1711 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1712 | 1712 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
1713 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
1713 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
1714 | 1714 | $this->checkout->continue_reg = false; |
1715 | 1715 | return false; |
1716 | 1716 | } |
1717 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
1718 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
1719 | - $payment = $this->_validate_payment( $payment ); |
|
1717 | + $payment = $this->_process_off_site_payment($gateway); |
|
1718 | + $payment = $this->_process_cancelled_payments($payment); |
|
1719 | + $payment = $this->_validate_payment($payment); |
|
1720 | 1720 | // if payment was not declined by the payment gateway or cancelled by the registrant |
1721 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
1721 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
1722 | 1722 | //$this->_setup_redirect_for_next_step(); |
1723 | 1723 | // store that for later |
1724 | 1724 | $this->checkout->payment = $payment; |
@@ -1744,19 +1744,19 @@ discard block |
||
1744 | 1744 | * @return bool |
1745 | 1745 | */ |
1746 | 1746 | private function _validate_offsite_return() { |
1747 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
1748 | - if ( $TXN_ID != $this->checkout->transaction->ID() ) { |
|
1747 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
1748 | + if ($TXN_ID != $this->checkout->transaction->ID()) { |
|
1749 | 1749 | // Houston... we might have a problem |
1750 | 1750 | $invalid_TXN = false; |
1751 | 1751 | // first gather some info |
1752 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1752 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1753 | 1753 | $primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null; |
1754 | 1754 | // let's start by retrieving the cart for this TXN |
1755 | - $cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction ); |
|
1756 | - if ( $cart instanceof EE_Cart ) { |
|
1755 | + $cart = EE_Cart::get_cart_from_txn($this->checkout->transaction); |
|
1756 | + if ($cart instanceof EE_Cart) { |
|
1757 | 1757 | // verify that the current cart has tickets |
1758 | 1758 | $tickets = $cart->get_tickets(); |
1759 | - if ( empty( $tickets ) ) { |
|
1759 | + if (empty($tickets)) { |
|
1760 | 1760 | $invalid_TXN = true; |
1761 | 1761 | } |
1762 | 1762 | } else { |
@@ -1764,39 +1764,39 @@ discard block |
||
1764 | 1764 | } |
1765 | 1765 | $valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null; |
1766 | 1766 | // validate current Session ID and compare against valid TXN session ID |
1767 | - if ( EE_Session::instance()->id() === null ) { |
|
1767 | + if (EE_Session::instance()->id() === null) { |
|
1768 | 1768 | $invalid_TXN = true; |
1769 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
1769 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
1770 | 1770 | // WARNING !!! |
1771 | 1771 | // this could be PayPal sending back duplicate requests (ya they do that) |
1772 | 1772 | // or it **could** mean someone is simply registering AGAIN after having just done so |
1773 | 1773 | // so now we need to determine if this current TXN looks valid or not |
1774 | 1774 | /** @type EE_Transaction_Processor $transaction_processor */ |
1775 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1775 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1776 | 1776 | // has this step even been started ? |
1777 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
1777 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
1778 | 1778 | ) { |
1779 | 1779 | // really? you're half way through this reg step, but you never started it ? |
1780 | 1780 | $invalid_TXN = true; |
1781 | 1781 | } |
1782 | 1782 | } |
1783 | - if ( $invalid_TXN ) { |
|
1783 | + if ($invalid_TXN) { |
|
1784 | 1784 | // is the valid TXN completed ? |
1785 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
1785 | + if ($valid_TXN instanceof EE_Transaction) { |
|
1786 | 1786 | /** @type EE_Transaction_Processor $transaction_processor */ |
1787 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1787 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1788 | 1788 | // has this step even been started ? |
1789 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
1790 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
1789 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
1790 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
1791 | 1791 | // so it **looks** like this is a double request from PayPal |
1792 | 1792 | // so let's try to pick up where we left off |
1793 | 1793 | $this->checkout->transaction = $valid_TXN; |
1794 | - $this->checkout->refresh_all_entities( true ); |
|
1794 | + $this->checkout->refresh_all_entities(true); |
|
1795 | 1795 | return; |
1796 | 1796 | } |
1797 | 1797 | } |
1798 | 1798 | // you appear to be lost? |
1799 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
1799 | + $this->_redirect_wayward_request($primary_registrant); |
|
1800 | 1800 | } |
1801 | 1801 | } |
1802 | 1802 | } |
@@ -1810,18 +1810,18 @@ discard block |
||
1810 | 1810 | * @param \EE_Registration $primary_registrant |
1811 | 1811 | * @return bool |
1812 | 1812 | */ |
1813 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
1814 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1813 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
1814 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1815 | 1815 | // try redirecting based on the current TXN |
1816 | 1816 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null; |
1817 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1817 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1818 | 1818 | EE_Error::add_error( |
1819 | 1819 | sprintf( |
1820 | - __( 'Invalid information was received from the Off-Site Payment Processor and your |
|
1820 | + __('Invalid information was received from the Off-Site Payment Processor and your |
|
1821 | 1821 | Transaction details could not be retrieved from the database.%1$sPlease try again or contact |
1822 | - %2$s for assistance.', 'event_espresso' ), |
|
1822 | + %2$s for assistance.', 'event_espresso'), |
|
1823 | 1823 | '<br/>', |
1824 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1824 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1825 | 1825 | ), |
1826 | 1826 | __FILE__, __FUNCTION__, __LINE__ |
1827 | 1827 | ); |
@@ -1849,16 +1849,16 @@ discard block |
||
1849 | 1849 | * @param \EE_Offsite_Gateway $gateway |
1850 | 1850 | * @return \EE_Payment |
1851 | 1851 | */ |
1852 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
1852 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
1853 | 1853 | try { |
1854 | 1854 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
1855 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
1855 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
1856 | 1856 | $payment = $this->checkout->transaction->last_payment(); |
1857 | 1857 | //$payment_source = 'last_payment'; |
1858 | 1858 | } else { |
1859 | 1859 | // get payment details and process results |
1860 | 1860 | /** @type EE_Payment_Processor $payment_processor */ |
1861 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1861 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1862 | 1862 | $payment = $payment_processor->process_ipn( |
1863 | 1863 | $_REQUEST, |
1864 | 1864 | $this->checkout->transaction, |
@@ -1868,14 +1868,14 @@ discard block |
||
1868 | 1868 | ); |
1869 | 1869 | //$payment_source = 'process_ipn'; |
1870 | 1870 | } |
1871 | - } catch ( Exception $e ) { |
|
1871 | + } catch (Exception $e) { |
|
1872 | 1872 | // let's just eat the exception and try to move on using any previously set payment info |
1873 | 1873 | $payment = $this->checkout->transaction->last_payment(); |
1874 | 1874 | //$payment_source = 'last_payment after Exception'; |
1875 | 1875 | // but if we STILL don't have a payment object |
1876 | - if ( ! $payment instanceof EE_Payment ) { |
|
1876 | + if ( ! $payment instanceof EE_Payment) { |
|
1877 | 1877 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
1878 | - $this->_handle_payment_processor_exception( $e ); |
|
1878 | + $this->_handle_payment_processor_exception($e); |
|
1879 | 1879 | } |
1880 | 1880 | } |
1881 | 1881 | // DEBUG LOG |
@@ -1899,13 +1899,13 @@ discard block |
||
1899 | 1899 | * @param EE_Payment $payment |
1900 | 1900 | * @return EE_Payment | FALSE |
1901 | 1901 | */ |
1902 | - private function _process_cancelled_payments( $payment = NULL ) { |
|
1902 | + private function _process_cancelled_payments($payment = NULL) { |
|
1903 | 1903 | if ( |
1904 | - isset( $_REQUEST[ 'ee_cancel_payment' ] ) |
|
1904 | + isset($_REQUEST['ee_cancel_payment']) |
|
1905 | 1905 | && $payment instanceof EE_Payment |
1906 | 1906 | && $payment->status() == EEM_Payment::status_id_failed |
1907 | 1907 | ) { |
1908 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
1908 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
1909 | 1909 | } |
1910 | 1910 | return $payment; |
1911 | 1911 | } |
@@ -1922,23 +1922,23 @@ discard block |
||
1922 | 1922 | public function get_transaction_details_for_gateways() { |
1923 | 1923 | $txn_details = array(); |
1924 | 1924 | // ya gotta make a choice man |
1925 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1925 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1926 | 1926 | $txn_details = array( |
1927 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
1927 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
1928 | 1928 | ); |
1929 | 1929 | } |
1930 | 1930 | // get EE_Payment_Method object |
1931 | 1931 | if ( |
1932 | - empty( $txn_details ) && |
|
1932 | + empty($txn_details) && |
|
1933 | 1933 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
1934 | 1934 | ) { |
1935 | 1935 | $txn_details = array( |
1936 | 1936 | 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, |
1937 | - 'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' ) |
|
1937 | + 'error' => __('A valid Payment Method could not be determined.', 'event_espresso') |
|
1938 | 1938 | ); |
1939 | 1939 | } |
1940 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
1941 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
1940 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
1941 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
1942 | 1942 | $txn_details = array( |
1943 | 1943 | 'TXN_ID' => $this->checkout->transaction->ID(), |
1944 | 1944 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | 'STS_ID' => $this->checkout->transaction->status_ID(), |
1949 | 1949 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
1950 | 1950 | 'return_url' => $return_url, |
1951 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
1951 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
1952 | 1952 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
1953 | 1953 | array( |
1954 | 1954 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -1957,7 +1957,7 @@ discard block |
||
1957 | 1957 | ) |
1958 | 1958 | ); |
1959 | 1959 | } |
1960 | - echo json_encode( $txn_details ); |
|
1960 | + echo json_encode($txn_details); |
|
1961 | 1961 | exit(); |
1962 | 1962 | } |
1963 | 1963 |