@@ -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( __( 'events', 'event_espresso' ), '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(__('events', 'event_espresso'), '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,27 +96,27 @@ 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 ); |
|
| 119 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
| 118 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
| 119 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -148,28 +148,28 @@ discard block |
||
| 148 | 148 | * @param string $template |
| 149 | 149 | * @return string |
| 150 | 150 | */ |
| 151 | - public function template_include( $template = '' ) { |
|
| 151 | + public function template_include($template = '') { |
|
| 152 | 152 | // ensure valid EE_Events_Archive_Config() object exists |
| 153 | 153 | // EED_Events_Archive::_set_config(); |
| 154 | 154 | // don't add content filter for dedicated EE child themes or private posts |
| 155 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 156 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
| 155 | + EE_Registry::instance()->load_helper('Template'); |
|
| 156 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
| 157 | 157 | // add status banner ? |
| 158 | - if ( $this->config()->display_status_banner ) { |
|
| 159 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
| 158 | + if ($this->config()->display_status_banner) { |
|
| 159 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
| 160 | 160 | } |
| 161 | 161 | // if NOT a custom template |
| 162 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
| 162 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
| 163 | 163 | // load functions.php file for the theme (loaded by WP if using child theme) |
| 164 | 164 | EEH_Template::load_espresso_theme_functions(); |
| 165 | 165 | // because we don't know if the theme is using the_excerpt() |
| 166 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 166 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 167 | 167 | // or the_content |
| 168 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 168 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 169 | 169 | // and just in case they are running get_the_excerpt() which DESTROYS things |
| 170 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
| 170 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
| 171 | 171 | // don't display entry meta because the existing theme will take care of that |
| 172 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
| 172 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | * @param string $excerpt |
| 186 | 186 | * @return string |
| 187 | 187 | */ |
| 188 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
| 189 | - if ( post_password_required() ) { |
|
| 188 | + public static function get_the_excerpt($excerpt = '') { |
|
| 189 | + if (post_password_required()) { |
|
| 190 | 190 | return $excerpt; |
| 191 | 191 | } |
| 192 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 193 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 194 | - return EED_Events_Archive::event_details( $excerpt ); |
|
| 192 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 193 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 194 | + return EED_Events_Archive::event_details($excerpt); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | * @param string $id |
| 205 | 205 | * @return string |
| 206 | 206 | */ |
| 207 | - public static function the_title( $title = '', $id = '' ) { |
|
| 207 | + public static function the_title($title = '', $id = '') { |
|
| 208 | 208 | global $post; |
| 209 | - if ( $post instanceof WP_Post ) { |
|
| 210 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
| 209 | + if ($post instanceof WP_Post) { |
|
| 210 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
| 211 | 211 | } |
| 212 | 212 | return $title; |
| 213 | 213 | } |
@@ -221,33 +221,33 @@ discard block |
||
| 221 | 221 | * @param string $content |
| 222 | 222 | * @return string |
| 223 | 223 | */ |
| 224 | - public static function event_details( $content ) { |
|
| 224 | + public static function event_details($content) { |
|
| 225 | 225 | |
| 226 | 226 | global $post; |
| 227 | 227 | $template = ''; |
| 228 | 228 | if ( |
| 229 | 229 | $post->post_type == 'espresso_events' |
| 230 | - && ! apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', FALSE ) |
|
| 230 | + && ! apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', FALSE) |
|
| 231 | 231 | && ! post_password_required() |
| 232 | 232 | ) { |
| 233 | 233 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
| 234 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 235 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 236 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
| 234 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 235 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 236 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
| 237 | 237 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
| 238 | 238 | EED_Events_Archive::_add_additional_excerpt_filters(); |
| 239 | 239 | EED_Events_Archive::_add_additional_content_filters(); |
| 240 | 240 | // now load our template |
| 241 | - $template = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
| 241 | + $template = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
| 242 | 242 | // re-add our main filters (or else the next event won't have them) |
| 243 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 244 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 245 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
| 243 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 244 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 245 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
| 246 | 246 | // but remove the other filters so that they don't get applied to the next post |
| 247 | 247 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
| 248 | 248 | } |
| 249 | 249 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
| 250 | - return ! empty( $template ) ? $template : $content; |
|
| 250 | + return ! empty($template) ? $template : $content; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | * @return void |
| 260 | 260 | */ |
| 261 | 261 | private static function _add_additional_excerpt_filters() { |
| 262 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
| 263 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
| 264 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
| 262 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
| 263 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
| 264 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | |
@@ -273,9 +273,9 @@ discard block |
||
| 273 | 273 | * @return void |
| 274 | 274 | */ |
| 275 | 275 | private static function _add_additional_content_filters() { |
| 276 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
| 277 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
| 278 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
| 276 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
| 277 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
| 278 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
@@ -287,11 +287,11 @@ discard block |
||
| 287 | 287 | * @param string $content |
| 288 | 288 | * @return string |
| 289 | 289 | */ |
| 290 | - public static function event_datetimes( $content ) { |
|
| 291 | - if ( post_password_required() ) { |
|
| 290 | + public static function event_datetimes($content) { |
|
| 291 | + if (post_password_required()) { |
|
| 292 | 292 | return $content; |
| 293 | 293 | } |
| 294 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
| 294 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -301,11 +301,11 @@ discard block |
||
| 301 | 301 | * @param string $content |
| 302 | 302 | * @return string |
| 303 | 303 | */ |
| 304 | - public static function event_tickets( $content ) { |
|
| 305 | - if ( post_password_required() ) { |
|
| 304 | + public static function event_tickets($content) { |
|
| 305 | + if (post_password_required()) { |
|
| 306 | 306 | return $content; |
| 307 | 307 | } |
| 308 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
| 308 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -315,11 +315,11 @@ discard block |
||
| 315 | 315 | * @param string $content |
| 316 | 316 | * @return string |
| 317 | 317 | */ |
| 318 | - public static function event_venues( $content ) { |
|
| 319 | - if ( post_password_required() ) { |
|
| 318 | + public static function event_venues($content) { |
|
| 319 | + if (post_password_required()) { |
|
| 320 | 320 | return $content; |
| 321 | 321 | } |
| 322 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
| 322 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -329,12 +329,12 @@ discard block |
||
| 329 | 329 | * @return void |
| 330 | 330 | */ |
| 331 | 331 | private static function _remove_additional_events_archive_filters() { |
| 332 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
| 333 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
| 334 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
| 335 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
| 336 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
| 337 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
| 332 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
| 333 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
| 334 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
| 335 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
| 336 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
| 337 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
| 338 | 338 | } |
| 339 | 339 | /** |
| 340 | 340 | * remove_all_events_archive_filters |
@@ -343,18 +343,18 @@ discard block |
||
| 343 | 343 | * @return void |
| 344 | 344 | */ |
| 345 | 345 | public static function remove_all_events_archive_filters() { |
| 346 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
| 347 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
| 348 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 349 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
| 350 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
| 351 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
| 352 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
| 353 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
| 354 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
| 355 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
| 346 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
| 347 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
| 348 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 349 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
| 350 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
| 351 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
| 352 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
| 353 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
| 354 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
| 355 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
| 356 | 356 | // don't display entry meta because the existing theme will take care of that |
| 357 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
| 357 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | |
@@ -369,14 +369,14 @@ discard block |
||
| 369 | 369 | * @return void |
| 370 | 370 | */ |
| 371 | 371 | public function load_event_list_assets() { |
| 372 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
| 373 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
| 374 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
| 375 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
| 376 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
| 377 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
| 378 | - } |
|
| 379 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
| 372 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
| 373 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
| 374 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
| 375 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
| 376 | + EE_Registry::instance()->load_helper('Maps'); |
|
| 377 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
| 378 | + } |
|
| 379 | + EE_Registry::instance()->load_helper('Event_View'); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | |
@@ -392,14 +392,14 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | public function wp_enqueue_scripts() { |
| 394 | 394 | // get some style |
| 395 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
| 395 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
| 396 | 396 | // first check uploads folder |
| 397 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 398 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
| 399 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
| 397 | + EE_Registry::instance()->load_helper('File'); |
|
| 398 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
| 399 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
| 400 | 400 | } else { |
| 401 | 401 | } |
| 402 | - wp_enqueue_style( $this->theme ); |
|
| 402 | + wp_enqueue_style($this->theme); |
|
| 403 | 403 | |
| 404 | 404 | } |
| 405 | 405 | } |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | */ |
| 418 | 418 | public static function template_settings_form() { |
| 419 | 419 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
| 420 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
| 421 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
| 420 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
| 421 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
| 422 | 422 | $events_archive_settings = array( |
| 423 | 423 | 'display_status_banner' => 0, |
| 424 | 424 | 'display_description' => 1, |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | 'display_venue' => 0, |
| 428 | 428 | 'display_expired_events' => 0 |
| 429 | 429 | ); |
| 430 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
| 431 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
| 430 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
| 431 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | |
@@ -444,16 +444,16 @@ discard block |
||
| 444 | 444 | * @param EE_Request_Handler $REQ |
| 445 | 445 | * @return EE_Template_Config |
| 446 | 446 | */ |
| 447 | - public static function update_template_settings( $CFG, $REQ ) { |
|
| 447 | + public static function update_template_settings($CFG, $REQ) { |
|
| 448 | 448 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
| 449 | 449 | // unless we are resetting the config... |
| 450 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
| 451 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
| 452 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
| 453 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
| 454 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
| 455 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
| 456 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
| 450 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
| 451 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
| 452 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
| 453 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
| 454 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
| 455 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
| 456 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
| 457 | 457 | return $CFG; |
| 458 | 458 | } |
| 459 | 459 | |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | * @param string $extra_class |
| 467 | 467 | * @return string |
| 468 | 468 | */ |
| 469 | - public static function event_list_css( $extra_class = '' ) { |
|
| 470 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
| 469 | + public static function event_list_css($extra_class = '') { |
|
| 470 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
| 471 | 471 | $event_list_css[] = 'espresso-event-list-event'; |
| 472 | - return implode( ' ', $event_list_css ); |
|
| 472 | + return implode(' ', $event_list_css); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | |
@@ -496,9 +496,9 @@ discard block |
||
| 496 | 496 | * @param $value |
| 497 | 497 | * @return bool |
| 498 | 498 | */ |
| 499 | - public static function display_description( $value ) { |
|
| 499 | + public static function display_description($value) { |
|
| 500 | 500 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
| 501 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
| 501 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
| 502 | 502 | return $display_description === $value ? TRUE : FALSE; |
| 503 | 503 | } |
| 504 | 504 | |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | */ |
| 512 | 512 | public static function display_ticket_selector() { |
| 513 | 513 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
| 514 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
| 514 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | |
@@ -523,9 +523,9 @@ discard block |
||
| 523 | 523 | * @return bool |
| 524 | 524 | */ |
| 525 | 525 | public static function display_venue() { |
| 526 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
| 526 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
| 527 | 527 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
| 528 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
| 528 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | */ |
| 538 | 538 | public static function display_datetimes() { |
| 539 | 539 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
| 540 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
| 540 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | * @return string |
| 553 | 553 | */ |
| 554 | 554 | public static function event_list_title() { |
| 555 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
| 555 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | |
@@ -561,11 +561,11 @@ discard block |
||
| 561 | 561 | /** |
| 562 | 562 | * @since 4.4.0 |
| 563 | 563 | */ |
| 564 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
| 564 | + public static function _doing_it_wrong_notice($function = '') { |
|
| 565 | 565 | EE_Error::doing_it_wrong( |
| 566 | 566 | __FUNCTION__, |
| 567 | 567 | sprintf( |
| 568 | - __( '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' ), |
|
| 568 | + __('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'), |
|
| 569 | 569 | $function, |
| 570 | 570 | '<br />', |
| 571 | 571 | '4.6.0' |
@@ -581,107 +581,107 @@ discard block |
||
| 581 | 581 | * @since 4.4.0 |
| 582 | 582 | */ |
| 583 | 583 | public function get_post_data() { |
| 584 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 584 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 585 | 585 | EEH_Event_Query::set_query_params(); |
| 586 | 586 | } |
| 587 | 587 | /** |
| 588 | 588 | * @deprecated |
| 589 | 589 | * @since 4.4.0 |
| 590 | 590 | */ |
| 591 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
| 592 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 593 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 594 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
| 591 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
| 592 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 593 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 594 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
| 595 | 595 | } |
| 596 | 596 | /** |
| 597 | 597 | * @deprecated |
| 598 | 598 | * @since 4.4.0 |
| 599 | 599 | */ |
| 600 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
| 601 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 602 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 603 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
| 600 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
| 601 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 602 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 603 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
| 604 | 604 | } |
| 605 | 605 | /** |
| 606 | 606 | * @deprecated |
| 607 | 607 | * @since 4.4.0 |
| 608 | 608 | */ |
| 609 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
| 610 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 611 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 612 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
| 609 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
| 610 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 611 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 612 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
| 613 | 613 | } |
| 614 | 614 | /** |
| 615 | 615 | * @deprecated |
| 616 | 616 | * @since 4.4.0 |
| 617 | 617 | */ |
| 618 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
| 619 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 620 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 621 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
| 618 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
| 619 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 620 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 621 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
| 622 | 622 | } |
| 623 | 623 | /** |
| 624 | 624 | * @deprecated |
| 625 | 625 | * @since 4.4.0 |
| 626 | 626 | */ |
| 627 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
| 628 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 629 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 630 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
| 627 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
| 628 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 629 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 630 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
| 631 | 631 | } |
| 632 | 632 | /** |
| 633 | 633 | * @deprecated |
| 634 | 634 | * @since 4.4.0 |
| 635 | 635 | */ |
| 636 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
| 637 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 638 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 639 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
| 636 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
| 637 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 638 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 639 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
| 640 | 640 | } |
| 641 | 641 | /** |
| 642 | 642 | * @deprecated |
| 643 | 643 | * @since 4.4.0 |
| 644 | 644 | */ |
| 645 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
| 646 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 647 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 648 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
| 645 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
| 646 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 647 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 648 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
| 649 | 649 | } |
| 650 | 650 | /** |
| 651 | 651 | * @deprecated |
| 652 | 652 | * @since 4.4.0 |
| 653 | 653 | */ |
| 654 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
| 655 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 656 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 657 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
| 654 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
| 655 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 656 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 657 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
| 658 | 658 | } |
| 659 | 659 | /** |
| 660 | 660 | * @deprecated |
| 661 | 661 | * @since 4.4.0 |
| 662 | 662 | */ |
| 663 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
| 664 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 665 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 666 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
| 663 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
| 664 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 665 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 666 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
| 667 | 667 | } |
| 668 | 668 | /** |
| 669 | 669 | * @deprecated |
| 670 | 670 | * @since 4.4.0 |
| 671 | 671 | */ |
| 672 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
| 673 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 674 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 675 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
| 672 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
| 673 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 674 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 675 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
| 676 | 676 | } |
| 677 | 677 | /** |
| 678 | 678 | * @deprecated |
| 679 | 679 | * @since 4.4.0 |
| 680 | 680 | */ |
| 681 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
| 682 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
| 683 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
| 684 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
| 681 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
| 682 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
| 683 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
| 684 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | |
@@ -712,8 +712,8 @@ discard block |
||
| 712 | 712 | * @param string $extra_class |
| 713 | 713 | * @return string |
| 714 | 714 | */ |
| 715 | -function espresso_event_list_css( $extra_class = '' ) { |
|
| 716 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
| 715 | +function espresso_event_list_css($extra_class = '') { |
|
| 716 | + return EED_Events_Archive::event_list_css($extra_class); |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /** |
@@ -727,14 +727,14 @@ discard block |
||
| 727 | 727 | * @return bool |
| 728 | 728 | */ |
| 729 | 729 | function espresso_display_full_description_in_event_list() { |
| 730 | - return EED_Events_Archive::display_description( 2 ); |
|
| 730 | + return EED_Events_Archive::display_description(2); |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | /** |
| 734 | 734 | * @return bool |
| 735 | 735 | */ |
| 736 | 736 | function espresso_display_excerpt_in_event_list() { |
| 737 | - return EED_Events_Archive::display_description( 1 ); |
|
| 737 | + return EED_Events_Archive::display_description(1); |
|
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | /** |
@@ -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 | * |
@@ -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_TEMPLATES_PATH . $this->slug() . DS . 'attendee_info_main.template.php'; |
|
| 38 | + $this->_template = SPCO_TEMPLATES_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'); |
@@ -85,30 +85,30 @@ discard block |
||
| 85 | 85 | 'ticket_count' => array() |
| 86 | 86 | ); |
| 87 | 87 | // grab the saved registrations from the transaction |
| 88 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
| 89 | - if ( $registrations ) { |
|
| 90 | - foreach ( $registrations as $registration ) { |
|
| 91 | - if ( $registration instanceof EE_Registration ) { |
|
| 88 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
| 89 | + if ($registrations) { |
|
| 90 | + foreach ($registrations as $registration) { |
|
| 91 | + if ($registration instanceof EE_Registration) { |
|
| 92 | 92 | // can this registration be processed during this visit ? |
| 93 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
| 94 | - $subsections[ $registration->reg_url_link() ] = $this->registrations_reg_form( $registration ); |
|
| 95 | - if ( ! $this->checkout->admin_request ) { |
|
| 96 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
| 97 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
| 93 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
| 94 | + $subsections[$registration->reg_url_link()] = $this->registrations_reg_form($registration); |
|
| 95 | + if ( ! $this->checkout->admin_request) { |
|
| 96 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
| 97 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
| 98 | 98 | } |
| 99 | - if ( $registration->is_primary_registrant() ) { |
|
| 99 | + if ($registration->is_primary_registrant()) { |
|
| 100 | 100 | $primary_registrant = $registration->reg_url_link(); |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | // print_copy_info ? |
| 106 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
| 106 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
| 107 | 107 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
| 108 | 108 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->copy_attendee_info_form() : $this->auto_copy_attendee_info(); |
| 109 | 109 | // generate hidden input |
| 110 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
| 111 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options ); |
|
| 110 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
| 111 | + $subsections[$primary_registrant]->add_subsections($copy_options); |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
@@ -120,8 +120,7 @@ discard block |
||
| 120 | 120 | 'html_id' => $this->reg_form_name(), |
| 121 | 121 | 'subsections' => $subsections, |
| 122 | 122 | 'layout_strategy' => $this->checkout->admin_request ? |
| 123 | - new EE_Div_Per_Section_Layout() : |
|
| 124 | - new EE_Template_Layout( |
|
| 123 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
| 125 | 124 | array( |
| 126 | 125 | 'layout_template_file' => $this->_template, // layout_template |
| 127 | 126 | 'template_args' => $template_args |
@@ -138,61 +137,61 @@ discard block |
||
| 138 | 137 | * @param EE_Registration $registration |
| 139 | 138 | * @return EE_Form_Section_Proper |
| 140 | 139 | */ |
| 141 | - public function registrations_reg_form( EE_Registration $registration ) { |
|
| 142 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 140 | + public function registrations_reg_form(EE_Registration $registration) { |
|
| 141 | + EE_Registry::instance()->load_helper('Template'); |
|
| 143 | 142 | static $attendee_nmbr = 1; |
| 144 | 143 | // array of params to pass to parent constructor |
| 145 | 144 | $form_args = array( |
| 146 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
| 145 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
| 147 | 146 | 'html_class' => 'ee-reg-form-attendee-dv', |
| 148 | 147 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
| 149 | 148 | 'subsections' => array(), |
| 150 | 149 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
| 151 | 150 | array( |
| 152 | 151 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
| 153 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
| 152 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
| 154 | 153 | ) |
| 155 | 154 | ) |
| 156 | 155 | ); |
| 157 | 156 | // verify that registration has valid event |
| 158 | - if ( $registration->event() instanceof EE_Event ) { |
|
| 157 | + if ($registration->event() instanceof EE_Event) { |
|
| 159 | 158 | $query_params = array( |
| 160 | 159 | array( |
| 161 | 160 | 'Event.EVT_ID' => $registration->event()->ID(), |
| 162 | 161 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
| 163 | 162 | ), |
| 164 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
| 163 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
| 165 | 164 | ); |
| 166 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
| 167 | - if ( $question_groups ) { |
|
| 168 | - foreach ( $question_groups as $question_group ) { |
|
| 169 | - if ( $question_group instanceof EE_Question_Group ) { |
|
| 170 | - $form_args['subsections'][ $question_group->identifier() ] = $this->question_group_reg_form( $registration, $question_group ); |
|
| 165 | + $question_groups = $registration->event()->question_groups($query_params); |
|
| 166 | + if ($question_groups) { |
|
| 167 | + foreach ($question_groups as $question_group) { |
|
| 168 | + if ($question_group instanceof EE_Question_Group) { |
|
| 169 | + $form_args['subsections'][$question_group->identifier()] = $this->question_group_reg_form($registration, $question_group); |
|
| 171 | 170 | // add hidden input |
| 172 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->additional_attendee_reg_info_input( $registration ); |
|
| 171 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->additional_attendee_reg_info_input($registration); |
|
| 173 | 172 | } |
| 174 | 173 | } |
| 175 | 174 | // if we have question groups for additional attendees, then display the copy options |
| 176 | 175 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
| 177 | 176 | } else { |
| 178 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
| 177 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
| 179 | 178 | EEH_Template::locate_template( |
| 180 | - SPCO_TEMPLATES_PATH . 'attendee_information' . DS . 'attendee_info_not_required.template.php', |
|
| 181 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
| 179 | + SPCO_TEMPLATES_PATH.'attendee_information'.DS.'attendee_info_not_required.template.php', |
|
| 180 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
| 182 | 181 | TRUE, |
| 183 | 182 | TRUE |
| 184 | 183 | ) |
| 185 | 184 | ); |
| 186 | 185 | // add hidden input |
| 187 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->additional_attendee_reg_info_input( $registration, FALSE ); |
|
| 186 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->additional_attendee_reg_info_input($registration, FALSE); |
|
| 188 | 187 | } |
| 189 | 188 | } |
| 190 | - if ( $registration->is_primary_registrant() ) { |
|
| 189 | + if ($registration->is_primary_registrant()) { |
|
| 191 | 190 | // generate hidden input |
| 192 | - $form_args['subsections']['primary_registrant'] = $this->additional_primary_registrant_inputs( $registration ); |
|
| 191 | + $form_args['subsections']['primary_registrant'] = $this->additional_primary_registrant_inputs($registration); |
|
| 193 | 192 | } |
| 194 | 193 | $attendee_nmbr++; |
| 195 | - return new EE_Form_Section_Proper( $form_args ); |
|
| 194 | + return new EE_Form_Section_Proper($form_args); |
|
| 196 | 195 | } |
| 197 | 196 | |
| 198 | 197 | |
@@ -205,11 +204,11 @@ discard block |
||
| 205 | 204 | * @param bool $additional_attendee_reg_info |
| 206 | 205 | * @return EE_Form_Input_Base |
| 207 | 206 | */ |
| 208 | - public function additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
| 207 | + public function additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
| 209 | 208 | // generate hidden input |
| 210 | 209 | return new EE_Hidden_Input( |
| 211 | 210 | array( |
| 212 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
| 211 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
| 213 | 212 | 'default' => $additional_attendee_reg_info |
| 214 | 213 | ) |
| 215 | 214 | ); |
@@ -222,22 +221,22 @@ discard block |
||
| 222 | 221 | * @param EE_Question_Group $question_group |
| 223 | 222 | * @return EE_Form_Section_Proper |
| 224 | 223 | */ |
| 225 | - public function question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
| 224 | + public function question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
| 226 | 225 | // array of params to pass to parent constructor |
| 227 | 226 | $form_args = array( |
| 228 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
| 227 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
| 229 | 228 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
| 230 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
| 229 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
| 231 | 230 | 'subsections' => array( |
| 232 | - 'reg_form_qstn_grp_hdr' => $this->question_group_header( $question_group ) |
|
| 231 | + 'reg_form_qstn_grp_hdr' => $this->question_group_header($question_group) |
|
| 233 | 232 | ), |
| 234 | 233 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
| 235 | 234 | ); |
| 236 | 235 | // where params |
| 237 | - $query_params = array( 'QST_deleted' => 0 ); |
|
| 236 | + $query_params = array('QST_deleted' => 0); |
|
| 238 | 237 | // don't load admin only questions on the frontend |
| 239 | - if ( ! $this->checkout->admin_request ) { |
|
| 240 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
| 238 | + if ( ! $this->checkout->admin_request) { |
|
| 239 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
| 241 | 240 | } |
| 242 | 241 | $questions = $question_group->get_many_related( |
| 243 | 242 | 'Question', |
@@ -249,21 +248,21 @@ discard block |
||
| 249 | 248 | ) |
| 250 | 249 | ); |
| 251 | 250 | // filter for additional content before questions |
| 252 | - $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 )); |
|
| 251 | + $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)); |
|
| 253 | 252 | // loop thru questions |
| 254 | - foreach ( $questions as $question ) { |
|
| 255 | - if( $question instanceof EE_Question ){ |
|
| 253 | + foreach ($questions as $question) { |
|
| 254 | + if ($question instanceof EE_Question) { |
|
| 256 | 255 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
| 257 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
| 256 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
| 258 | 257 | } |
| 259 | 258 | } |
| 260 | - $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 ); |
|
| 259 | + $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); |
|
| 261 | 260 | |
| 262 | 261 | // filter for additional content after questions |
| 263 | - $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 )); |
|
| 262 | + $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)); |
|
| 264 | 263 | // d( $form_args ); |
| 265 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
| 266 | - 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 ); |
|
| 264 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
| 265 | + 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); |
|
| 267 | 266 | } |
| 268 | 267 | |
| 269 | 268 | |
@@ -273,12 +272,12 @@ discard block |
||
| 273 | 272 | * @param EE_Question_Group $question_group |
| 274 | 273 | * @return EE_Form_Section_HTML |
| 275 | 274 | */ |
| 276 | - public function question_group_header( EE_Question_Group $question_group ){ |
|
| 275 | + public function question_group_header(EE_Question_Group $question_group) { |
|
| 277 | 276 | $html = ''; |
| 278 | 277 | // group_name |
| 279 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
| 278 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
| 280 | 279 | EE_Registry::instance()->load_helper('HTML'); |
| 281 | - if ( $this->checkout->admin_request ) { |
|
| 280 | + if ($this->checkout->admin_request) { |
|
| 282 | 281 | $html .= EEH_HTML::br(); |
| 283 | 282 | $html .= EEH_HTML::h3( |
| 284 | 283 | $question_group->name(), |
@@ -292,7 +291,7 @@ discard block |
||
| 292 | 291 | } |
| 293 | 292 | } |
| 294 | 293 | // group_desc |
| 295 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
| 294 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
| 296 | 295 | $html .= EEH_HTML::p( |
| 297 | 296 | $question_group->desc(), |
| 298 | 297 | '', |
@@ -300,7 +299,7 @@ discard block |
||
| 300 | 299 | ); |
| 301 | 300 | |
| 302 | 301 | } |
| 303 | - return new EE_Form_Section_HTML( $html ); |
|
| 302 | + return new EE_Form_Section_HTML($html); |
|
| 304 | 303 | } |
| 305 | 304 | |
| 306 | 305 | |
@@ -309,14 +308,14 @@ discard block |
||
| 309 | 308 | * @access public |
| 310 | 309 | * @return EE_Form_Section_Proper |
| 311 | 310 | */ |
| 312 | - public function copy_attendee_info_form(){ |
|
| 311 | + public function copy_attendee_info_form() { |
|
| 313 | 312 | // array of params to pass to parent constructor |
| 314 | 313 | return new EE_Form_Section_Proper( |
| 315 | 314 | array( |
| 316 | 315 | 'subsections' => $this->copy_attendee_info_inputs(), |
| 317 | 316 | 'layout_strategy' => new EE_Template_Layout( |
| 318 | 317 | array( |
| 319 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'attendee_information' . DS . 'copy_attendee_info.template.php', // layout_template |
|
| 318 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'attendee_information'.DS.'copy_attendee_info.template.php', // layout_template |
|
| 320 | 319 | 'begin_template_file' => NULL, |
| 321 | 320 | 'input_template_file' => NULL, |
| 322 | 321 | 'subsection_template_file' => NULL, |
@@ -338,8 +337,8 @@ discard block |
||
| 338 | 337 | public function auto_copy_attendee_info() { |
| 339 | 338 | return new EE_Form_Section_HTML( |
| 340 | 339 | EEH_Template::locate_template( |
| 341 | - SPCO_TEMPLATES_PATH . 'attendee_information' . DS . 'auto_copy_attendee_info.template.php', |
|
| 342 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
| 340 | + SPCO_TEMPLATES_PATH.'attendee_information'.DS.'auto_copy_attendee_info.template.php', |
|
| 341 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
| 343 | 342 | TRUE, |
| 344 | 343 | TRUE |
| 345 | 344 | ) |
@@ -358,25 +357,25 @@ discard block |
||
| 358 | 357 | $copy_attendee_info_inputs = array(); |
| 359 | 358 | $prev_ticket = NULL; |
| 360 | 359 | // grab the saved registrations from the transaction |
| 361 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
| 362 | - foreach ( $registrations as $registration ) { |
|
| 360 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
| 361 | + foreach ($registrations as $registration) { |
|
| 363 | 362 | // for all attendees other than the primary attendee |
| 364 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
| 363 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
| 365 | 364 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
| 366 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
| 365 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
| 367 | 366 | $item_name = $registration->ticket()->name(); |
| 368 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
| 369 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
| 370 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
| 367 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
| 368 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
| 369 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
| 371 | 370 | ); |
| 372 | 371 | $prev_ticket = $registration->ticket()->ID(); |
| 373 | 372 | } |
| 374 | 373 | |
| 375 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
| 374 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
| 376 | 375 | EE_Checkbox_Multi_Input( |
| 377 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
| 376 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
| 378 | 377 | array( |
| 379 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
| 378 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
| 380 | 379 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
| 381 | 380 | 'display_html_label_text' => FALSE |
| 382 | 381 | ) |
@@ -395,7 +394,7 @@ discard block |
||
| 395 | 394 | * @param EE_Registration $registration |
| 396 | 395 | * @return EE_Form_Input_Base |
| 397 | 396 | */ |
| 398 | - public function additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
| 397 | + public function additional_primary_registrant_inputs(EE_Registration $registration) { |
|
| 399 | 398 | // generate hidden input |
| 400 | 399 | return new EE_Hidden_Input( |
| 401 | 400 | array( |
@@ -413,31 +412,31 @@ discard block |
||
| 413 | 412 | * @param EE_Question $question |
| 414 | 413 | * @return EE_Form_Input_Base |
| 415 | 414 | */ |
| 416 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
| 415 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
| 417 | 416 | |
| 418 | 417 | // if this question was for an attendee detail, then check for that answer |
| 419 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
| 418 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
| 420 | 419 | $answer = $answer_value === null |
| 421 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
| 420 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
| 422 | 421 | : null; |
| 423 | 422 | // 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 |
| 424 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
| 423 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
| 425 | 424 | // create an EE_Answer object for storing everything in |
| 426 | - $answer = EE_Answer::new_instance ( array( |
|
| 425 | + $answer = EE_Answer::new_instance(array( |
|
| 427 | 426 | 'QST_ID'=> $question->ID(), |
| 428 | 427 | 'REG_ID'=> $registration->ID() |
| 429 | 428 | )); |
| 430 | 429 | } |
| 431 | 430 | // verify instance |
| 432 | - if( $answer instanceof EE_Answer ){ |
|
| 433 | - if ( ! empty( $answer_value )) { |
|
| 434 | - $answer->set( 'ANS_value', $answer_value ); |
|
| 431 | + if ($answer instanceof EE_Answer) { |
|
| 432 | + if ( ! empty($answer_value)) { |
|
| 433 | + $answer->set('ANS_value', $answer_value); |
|
| 435 | 434 | } |
| 436 | - $answer->cache( 'Question', $question ); |
|
| 437 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
| 438 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
| 435 | + $answer->cache('Question', $question); |
|
| 436 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
| 437 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
| 439 | 438 | } |
| 440 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
| 439 | + return $this->_generate_question_input($registration, $question, $answer); |
|
| 441 | 440 | |
| 442 | 441 | } |
| 443 | 442 | |
@@ -449,7 +448,7 @@ discard block |
||
| 449 | 448 | * @param mixed EE_Answer|NULL $answer |
| 450 | 449 | * @return EE_Form_Input_Base |
| 451 | 450 | */ |
| 452 | - public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
| 451 | + public function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
| 453 | 452 | // d( $registration ); |
| 454 | 453 | // d( $question ); |
| 455 | 454 | // d( $answer ); |
@@ -472,88 +471,88 @@ discard block |
||
| 472 | 471 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
| 473 | 472 | |
| 474 | 473 | $input_constructor_args = array( |
| 475 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
| 476 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
| 477 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
| 474 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
| 475 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
| 476 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
| 478 | 477 | 'required' => $question->required() ? TRUE : FALSE, |
| 479 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
| 478 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
| 480 | 479 | 'html_label_class' => 'ee-reg-qstn', |
| 481 | 480 | 'html_label_text' => $question->display_text(), |
| 482 | 481 | 'required_validation_error_message' => $question->required_text() |
| 483 | 482 | ); |
| 484 | 483 | // has this question been answered ? |
| 485 | - if ( $answer instanceof EE_Answer ) { |
|
| 486 | - if ( $answer->ID() ) { |
|
| 487 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
| 488 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
| 489 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
| 484 | + if ($answer instanceof EE_Answer) { |
|
| 485 | + if ($answer->ID()) { |
|
| 486 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
| 487 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
| 488 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
| 490 | 489 | } |
| 491 | 490 | $input_constructor_args['default'] = $answer->value(); |
| 492 | 491 | } |
| 493 | 492 | //add "-lbl" to the end of the label id |
| 494 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
| 493 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
| 495 | 494 | |
| 496 | - switch ( $question->type() ) { |
|
| 495 | + switch ($question->type()) { |
|
| 497 | 496 | // Text |
| 498 | 497 | case EEM_Question::QST_type_text : |
| 499 | - if( $identifier == 'email' ){ |
|
| 500 | - return new EE_Email_Input( $input_constructor_args ); |
|
| 501 | - }else{ |
|
| 502 | - return new EE_Text_Input( $input_constructor_args ); |
|
| 498 | + if ($identifier == 'email') { |
|
| 499 | + return new EE_Email_Input($input_constructor_args); |
|
| 500 | + } else { |
|
| 501 | + return new EE_Text_Input($input_constructor_args); |
|
| 503 | 502 | } |
| 504 | 503 | break; |
| 505 | 504 | // Textarea |
| 506 | 505 | case EEM_Question::QST_type_textarea : |
| 507 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
| 506 | + return new EE_Text_Area_Input($input_constructor_args); |
|
| 508 | 507 | break; |
| 509 | 508 | // Radio Buttons |
| 510 | 509 | case EEM_Question::QST_type_radio : |
| 511 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
| 510 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
| 512 | 511 | break; |
| 513 | 512 | // Dropdown |
| 514 | 513 | case EEM_Question::QST_type_dropdown : |
| 515 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
| 514 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
| 516 | 515 | break; |
| 517 | 516 | // State Dropdown |
| 518 | 517 | case EEM_Question::QST_type_state : |
| 519 | - $state_options = array( '' => array( '' => '')); |
|
| 518 | + $state_options = array('' => array('' => '')); |
|
| 520 | 519 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
| 521 | - if ( ! empty( $states )) { |
|
| 522 | - foreach( $states as $state ){ |
|
| 523 | - if ( $state instanceof EE_State ) { |
|
| 524 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
| 520 | + if ( ! empty($states)) { |
|
| 521 | + foreach ($states as $state) { |
|
| 522 | + if ($state instanceof EE_State) { |
|
| 523 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
| 525 | 524 | } |
| 526 | 525 | } |
| 527 | 526 | } |
| 528 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this ); |
|
| 529 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
| 527 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this); |
|
| 528 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
| 530 | 529 | break; |
| 531 | 530 | // Country Dropdown |
| 532 | 531 | case EEM_Question::QST_type_country : |
| 533 | - $country_options = array( '' => '' ); |
|
| 532 | + $country_options = array('' => ''); |
|
| 534 | 533 | // get possibly cached list of countries |
| 535 | 534 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
| 536 | - if ( ! empty( $countries )) { |
|
| 537 | - foreach( $countries as $country ){ |
|
| 538 | - if ( $country instanceof EE_Country ) { |
|
| 539 | - $country_options[ $country->ID() ] = $country->name(); |
|
| 535 | + if ( ! empty($countries)) { |
|
| 536 | + foreach ($countries as $country) { |
|
| 537 | + if ($country instanceof EE_Country) { |
|
| 538 | + $country_options[$country->ID()] = $country->name(); |
|
| 540 | 539 | } |
| 541 | 540 | } |
| 542 | 541 | } |
| 543 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this ); |
|
| 544 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
| 542 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this); |
|
| 543 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
| 545 | 544 | break; |
| 546 | 545 | // Checkboxes |
| 547 | 546 | case EEM_Question::QST_type_checkbox : |
| 548 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
| 547 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
| 549 | 548 | break; |
| 550 | 549 | // Date |
| 551 | 550 | case EEM_Question::QST_type_date : |
| 552 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
| 551 | + return new EE_Datepicker_Input($input_constructor_args); |
|
| 553 | 552 | break; |
| 554 | 553 | // fallback |
| 555 | 554 | default : |
| 556 | - return new EE_Text_Input( $input_constructor_args ); |
|
| 555 | + return new EE_Text_Input($input_constructor_args); |
|
| 557 | 556 | } |
| 558 | 557 | } |
| 559 | 558 | |
@@ -576,65 +575,65 @@ discard block |
||
| 576 | 575 | */ |
| 577 | 576 | public function process_reg_step() { |
| 578 | 577 | |
| 579 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 578 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 580 | 579 | // grab validated data from form |
| 581 | 580 | $valid_data = $this->checkout->current_step->valid_data(); |
| 582 | 581 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
| 583 | 582 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
| 584 | 583 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
| 585 | - if ( empty( $valid_data )) { |
|
| 586 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 584 | + if (empty($valid_data)) { |
|
| 585 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 587 | 586 | return FALSE; |
| 588 | 587 | } |
| 589 | 588 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
| 590 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
| 591 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 589 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
| 590 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 592 | 591 | return FALSE; |
| 593 | 592 | } |
| 594 | 593 | // get cached registrations |
| 595 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
| 594 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
| 596 | 595 | // verify we got the goods |
| 597 | - if ( empty( $registrations )) { |
|
| 598 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 596 | + if (empty($registrations)) { |
|
| 597 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 599 | 598 | return FALSE; |
| 600 | 599 | } |
| 601 | 600 | // extract attendee info from form data and save to model objects |
| 602 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
| 601 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
| 603 | 602 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
| 604 | - if ( $registrations_processed === FALSE ) { |
|
| 603 | + if ($registrations_processed === FALSE) { |
|
| 605 | 604 | // but return immediately if the previous step exited early due to errors |
| 606 | 605 | return FALSE; |
| 607 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
| 606 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
| 608 | 607 | // generate a correctly translated string for all possible singular/plural combinations |
| 609 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
| 608 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
| 610 | 609 | $error_msg = sprintf( |
| 611 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
| 610 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
| 612 | 611 | $this->checkout->total_ticket_count, |
| 613 | 612 | $registrations_processed |
| 614 | 613 | ); |
| 615 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
| 614 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
| 616 | 615 | $error_msg = sprintf( |
| 617 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
| 616 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
| 618 | 617 | $this->checkout->total_ticket_count, |
| 619 | 618 | $registrations_processed |
| 620 | 619 | ); |
| 621 | 620 | } else { |
| 622 | 621 | $error_msg = sprintf( |
| 623 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
| 622 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
| 624 | 623 | $this->checkout->total_ticket_count, |
| 625 | 624 | $registrations_processed |
| 626 | 625 | ); |
| 627 | 626 | |
| 628 | 627 | } |
| 629 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 628 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 630 | 629 | return FALSE; |
| 631 | 630 | } |
| 632 | 631 | // mark this reg step as completed |
| 633 | 632 | $this->checkout->current_step->set_completed(); |
| 634 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
| 633 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
| 635 | 634 | //do action in case a plugin wants to do something with the data submitted in step 1. |
| 636 | 635 | //passes EE_Single_Page_Checkout, and it's posted data |
| 637 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
| 636 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
| 638 | 637 | return TRUE; |
| 639 | 638 | |
| 640 | 639 | } |
@@ -648,9 +647,9 @@ discard block |
||
| 648 | 647 | * @param array $valid_data |
| 649 | 648 | * @return boolean | int |
| 650 | 649 | */ |
| 651 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
| 650 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
| 652 | 651 | // load resources and set some defaults |
| 653 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
| 652 | + EE_Registry::instance()->load_model('Attendee'); |
|
| 654 | 653 | // holder for primary registrant attendee object |
| 655 | 654 | $this->checkout->primary_attendee_obj = NULL; |
| 656 | 655 | // array for tracking reg form data for the primary registrant |
@@ -667,19 +666,19 @@ discard block |
||
| 667 | 666 | // attendee counter |
| 668 | 667 | $att_nmbr = 0; |
| 669 | 668 | // grab the saved registrations from the transaction |
| 670 | - foreach ( $registrations as $registration ) { |
|
| 669 | + foreach ($registrations as $registration) { |
|
| 671 | 670 | // verify EE_Registration object |
| 672 | - if ( ! $registration instanceof EE_Registration ) { |
|
| 673 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
| 671 | + if ( ! $registration instanceof EE_Registration) { |
|
| 672 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 674 | 673 | return FALSE; |
| 675 | 674 | } |
| 676 | 675 | $reg_url_link = $registration->reg_url_link(); |
| 677 | 676 | // reg_url_link exists ? |
| 678 | - if ( $reg_url_link ) { |
|
| 677 | + if ($reg_url_link) { |
|
| 679 | 678 | // should this registration be processed during this visit ? |
| 680 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
| 679 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
| 681 | 680 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
| 682 | - if ( ! $this->checkout->revisit ) { |
|
| 681 | + if ( ! $this->checkout->revisit) { |
|
| 683 | 682 | $registration->save(); |
| 684 | 683 | } |
| 685 | 684 | |
@@ -690,41 +689,41 @@ discard block |
||
| 690 | 689 | * @var bool if TRUE is returned by the plugin then the |
| 691 | 690 | * registration processing is halted. |
| 692 | 691 | */ |
| 693 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
| 692 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
| 694 | 693 | return FALSE; |
| 695 | 694 | } |
| 696 | 695 | |
| 697 | 696 | // Houston, we have a registration! |
| 698 | 697 | $att_nmbr++; |
| 699 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
| 698 | + $this->_attendee_data[$reg_url_link] = array(); |
|
| 700 | 699 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
| 701 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
| 700 | + if (isset($valid_data[$reg_url_link])) { |
|
| 702 | 701 | // do we need to copy basic info from primary attendee ? |
| 703 | - $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; |
|
| 702 | + $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; |
|
| 704 | 703 | // filter form input data for this registration |
| 705 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
| 704 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
| 706 | 705 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
| 707 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
| 708 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
| 709 | - unset( $valid_data['primary_attendee'] ); |
|
| 706 | + if (isset($valid_data['primary_attendee'])) { |
|
| 707 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
| 708 | + unset($valid_data['primary_attendee']); |
|
| 710 | 709 | } |
| 711 | 710 | // now loop through our array of valid post data && process attendee reg forms |
| 712 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
| 713 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
| 714 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
| 711 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
| 712 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
| 713 | + foreach ($form_inputs as $form_input => $input_value) { |
|
| 715 | 714 | // check for critical inputs |
| 716 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
| 715 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
| 717 | 716 | return FALSE; |
| 718 | 717 | } |
| 719 | 718 | // store a bit of data about the primary attendee |
| 720 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
| 721 | - $primary_registrant[ $form_input ] = $input_value; |
|
| 722 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
| 723 | - $input_value = $primary_registrant[ $form_input ]; |
|
| 719 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
| 720 | + $primary_registrant[$form_input] = $input_value; |
|
| 721 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
| 722 | + $input_value = $primary_registrant[$form_input]; |
|
| 724 | 723 | } |
| 725 | 724 | // now attempt to save the input data |
| 726 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
| 727 | - 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__ ); |
|
| 725 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
| 726 | + 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__); |
|
| 728 | 727 | return FALSE; |
| 729 | 728 | } |
| 730 | 729 | } |
@@ -733,51 +732,51 @@ discard block |
||
| 733 | 732 | } |
| 734 | 733 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
| 735 | 734 | // this registration does not require additional attendee information ? |
| 736 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
| 735 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
| 737 | 736 | // just copy the primary registrant |
| 738 | 737 | $attendee = $this->checkout->primary_attendee_obj; |
| 739 | 738 | } else { |
| 740 | 739 | // have we met before? |
| 741 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
| 740 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
| 742 | 741 | // did we find an already existing record for this attendee ? |
| 743 | - if ( $attendee instanceof EE_Attendee ) { |
|
| 744 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
| 742 | + if ($attendee instanceof EE_Attendee) { |
|
| 743 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
| 745 | 744 | } else { |
| 746 | 745 | // ensure critical details are set for additional attendees |
| 747 | - $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 ]; |
|
| 748 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
| 746 | + $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]; |
|
| 747 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
| 749 | 748 | } |
| 750 | 749 | // who's #1 ? |
| 751 | - if ( $att_nmbr == 1 ) { |
|
| 750 | + if ($att_nmbr == 1) { |
|
| 752 | 751 | $this->checkout->primary_attendee_obj = $attendee; |
| 753 | 752 | } |
| 754 | 753 | } |
| 755 | 754 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
| 756 | 755 | // add relation to registration, set attendee ID, and cache attendee |
| 757 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
| 758 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
| 759 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 756 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
| 757 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
| 758 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
| 760 | 759 | return FALSE; |
| 761 | 760 | } |
| 762 | 761 | /** @type EE_Registration_Processor $registration_processor */ |
| 763 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
| 762 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 764 | 763 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
| 765 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
| 764 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
| 766 | 765 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 767 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 766 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 768 | 767 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
| 769 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
| 768 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
| 770 | 769 | // if we've gotten this far, then let's save what we have |
| 771 | 770 | $registration->save(); |
| 772 | 771 | // add relation between TXN and registration |
| 773 | - $this->_associate_registration_with_transaction( $registration ); |
|
| 772 | + $this->_associate_registration_with_transaction($registration); |
|
| 774 | 773 | |
| 775 | 774 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
| 776 | 775 | |
| 777 | - } else { |
|
| 778 | - 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__ ); |
|
| 776 | + } else { |
|
| 777 | + 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__); |
|
| 779 | 778 | // remove malformed data |
| 780 | - unset( $valid_data[ $reg_url_link ] ); |
|
| 779 | + unset($valid_data[$reg_url_link]); |
|
| 781 | 780 | return FALSE; |
| 782 | 781 | } |
| 783 | 782 | |
@@ -795,22 +794,22 @@ discard block |
||
| 795 | 794 | * @param string $input_value |
| 796 | 795 | * @return boolean |
| 797 | 796 | */ |
| 798 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
| 797 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
| 799 | 798 | //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>'; |
| 800 | 799 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
| 801 | 800 | // allow for plugins to hook in and do their own processing of the form input. |
| 802 | 801 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
| 803 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
| 802 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
| 804 | 803 | return TRUE; |
| 805 | 804 | } |
| 806 | 805 | |
| 807 | 806 | // grab related answer objects |
| 808 | 807 | $answers = $registration->answers(); |
| 809 | 808 | // $answer_cache_id is the key used to find the EE_Answer we want |
| 810 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
| 811 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
| 809 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
| 810 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
| 812 | 811 | //rename form_inputs if they are EE_Attendee properties |
| 813 | - switch( (string)$form_input ) { |
|
| 812 | + switch ((string) $form_input) { |
|
| 814 | 813 | |
| 815 | 814 | case 'state' : |
| 816 | 815 | case 'STA_ID' : |
@@ -825,31 +824,31 @@ discard block |
||
| 825 | 824 | break; |
| 826 | 825 | |
| 827 | 826 | default : |
| 828 | - $ATT_input = 'ATT_' . $form_input; |
|
| 827 | + $ATT_input = 'ATT_'.$form_input; |
|
| 829 | 828 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
| 830 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
| 831 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
| 829 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
| 830 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
| 832 | 831 | } |
| 833 | 832 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
| 834 | 833 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
| 835 | 834 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
| 836 | 835 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
| 837 | 836 | // if this form input has a corresponding attendee property |
| 838 | - if ( $attendee_property ) { |
|
| 839 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
| 840 | - if ( $answer_is_obj ) { |
|
| 837 | + if ($attendee_property) { |
|
| 838 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
| 839 | + if ($answer_is_obj) { |
|
| 841 | 840 | // and delete the corresponding answer since we won't be storing this data in that object |
| 842 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
| 841 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
| 843 | 842 | } |
| 844 | 843 | return TRUE; |
| 845 | - } elseif ( $answer_is_obj ) { |
|
| 844 | + } elseif ($answer_is_obj) { |
|
| 846 | 845 | // save this data to the answer object |
| 847 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
| 848 | - return $answers[ $answer_cache_id ]->save(); |
|
| 846 | + $answers[$answer_cache_id]->set_value($input_value); |
|
| 847 | + return $answers[$answer_cache_id]->save(); |
|
| 849 | 848 | } else { |
| 850 | - foreach ( $answers as $answer ) { |
|
| 851 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
| 852 | - $answer->set_value( $input_value ); |
|
| 849 | + foreach ($answers as $answer) { |
|
| 850 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
| 851 | + $answer->set_value($input_value); |
|
| 853 | 852 | return $answer->save() !== FALSE ? TRUE : FALSE; |
| 854 | 853 | } |
| 855 | 854 | } |
@@ -866,29 +865,29 @@ discard block |
||
| 866 | 865 | * @param string $input_value |
| 867 | 866 | * @return boolean |
| 868 | 867 | */ |
| 869 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
| 870 | - if ( empty( $input_value )) { |
|
| 871 | - switch( $form_input ) { |
|
| 868 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
| 869 | + if (empty($input_value)) { |
|
| 870 | + switch ($form_input) { |
|
| 872 | 871 | case 'fname' : |
| 873 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 872 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 874 | 873 | return FALSE; |
| 875 | 874 | break; |
| 876 | 875 | case 'lname' : |
| 877 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 876 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 878 | 877 | return FALSE; |
| 879 | 878 | break; |
| 880 | 879 | case 'email' : |
| 881 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 880 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 882 | 881 | return FALSE; |
| 883 | 882 | break; |
| 884 | 883 | } |
| 885 | - } else if ( $form_input === 'email' ) { |
|
| 884 | + } else if ($form_input === 'email') { |
|
| 886 | 885 | // clean the email address |
| 887 | - $valid_email = sanitize_email( $input_value ); |
|
| 886 | + $valid_email = sanitize_email($input_value); |
|
| 888 | 887 | // check if it matches |
| 889 | - if ( $input_value != $valid_email ) { |
|
| 888 | + if ($input_value != $valid_email) { |
|
| 890 | 889 | // whoops!!! |
| 891 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 890 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 892 | 891 | return FALSE; |
| 893 | 892 | } |
| 894 | 893 | } |
@@ -916,14 +915,14 @@ discard block |
||
| 916 | 915 | * @param array $attendee_data |
| 917 | 916 | * @return boolean |
| 918 | 917 | */ |
| 919 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
| 918 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
| 920 | 919 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
| 921 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
| 922 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
| 923 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
| 920 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
| 921 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
| 922 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
| 924 | 923 | // but only if those have values |
| 925 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
| 926 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
| 924 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
| 925 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
| 927 | 926 | 'ATT_fname' => $ATT_fname, |
| 928 | 927 | 'ATT_lname' => $ATT_lname, |
| 929 | 928 | 'ATT_email' => $ATT_email |
@@ -931,7 +930,7 @@ discard block |
||
| 931 | 930 | } else { |
| 932 | 931 | $existing_attendee = NULL; |
| 933 | 932 | } |
| 934 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
| 933 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
| 935 | 934 | } |
| 936 | 935 | |
| 937 | 936 | |
@@ -943,13 +942,13 @@ discard block |
||
| 943 | 942 | * @param array $attendee_data |
| 944 | 943 | * @return \EE_Attendee |
| 945 | 944 | */ |
| 946 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
| 945 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
| 947 | 946 | // first remove fname, lname, and email from attendee data |
| 948 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
| 947 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
| 949 | 948 | // now loop thru what's left and add to attendee CPT |
| 950 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
| 951 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
| 952 | - $existing_attendee->set( $property_name, $property_value ); |
|
| 949 | + foreach ($attendee_data as $property_name => $property_value) { |
|
| 950 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
| 951 | + $existing_attendee->set($property_name, $property_value); |
|
| 953 | 952 | } |
| 954 | 953 | } |
| 955 | 954 | // better save that now |
@@ -966,11 +965,11 @@ discard block |
||
| 966 | 965 | * @param EE_Attendee $attendee |
| 967 | 966 | * @return void |
| 968 | 967 | */ |
| 969 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
| 968 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
| 970 | 969 | // add relation to attendee |
| 971 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
| 972 | - $registration->set_attendee_id( $attendee->ID() ); |
|
| 973 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
| 970 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
| 971 | + $registration->set_attendee_id($attendee->ID()); |
|
| 972 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
| 974 | 973 | } |
| 975 | 974 | |
| 976 | 975 | |
@@ -981,10 +980,10 @@ discard block |
||
| 981 | 980 | * @param EE_Registration $registration |
| 982 | 981 | * @return void |
| 983 | 982 | */ |
| 984 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
| 983 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
| 985 | 984 | // add relation to attendee |
| 986 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
| 987 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
| 985 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
| 986 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
| 988 | 987 | } |
| 989 | 988 | |
| 990 | 989 | |
@@ -996,17 +995,17 @@ discard block |
||
| 996 | 995 | * @param array $attendee_data |
| 997 | 996 | * @return array |
| 998 | 997 | */ |
| 999 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
| 998 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
| 1000 | 999 | // bare minimum critical details include first name, last name, email address |
| 1001 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
| 1000 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
| 1002 | 1001 | // add address info to critical details? |
| 1003 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
| 1004 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
| 1005 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
| 1002 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
| 1003 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
| 1004 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
| 1006 | 1005 | } |
| 1007 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
| 1008 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
| 1009 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
| 1006 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
| 1007 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
| 1008 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
| 1010 | 1009 | } |
| 1011 | 1010 | } |
| 1012 | 1011 | return $attendee_data; |
@@ -1021,11 +1020,11 @@ discard block |
||
| 1021 | 1020 | * @param array $attendee_data |
| 1022 | 1021 | * @return \EE_Attendee |
| 1023 | 1022 | */ |
| 1024 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
| 1023 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
| 1025 | 1024 | // create new attendee object |
| 1026 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
| 1025 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
| 1027 | 1026 | // set author to event creator |
| 1028 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
| 1027 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
| 1029 | 1028 | $new_attendee->save(); |
| 1030 | 1029 | return $new_attendee; |
| 1031 | 1030 | } |
@@ -1041,7 +1040,7 @@ discard block |
||
| 1041 | 1040 | */ |
| 1042 | 1041 | public function update_reg_step() { |
| 1043 | 1042 | // save everything |
| 1044 | - if ( $this->process_reg_step() ) { |
|
| 1043 | + if ($this->process_reg_step()) { |
|
| 1045 | 1044 | $this->checkout->redirect = TRUE; |
| 1046 | 1045 | $this->checkout->redirect_url = add_query_arg( |
| 1047 | 1046 | array( |
@@ -1050,7 +1049,7 @@ discard block |
||
| 1050 | 1049 | ), |
| 1051 | 1050 | $this->checkout->thank_you_page_url |
| 1052 | 1051 | ); |
| 1053 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
| 1052 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
| 1054 | 1053 | return TRUE; |
| 1055 | 1054 | } |
| 1056 | 1055 | return FALSE; |
@@ -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 |
@@ -87,16 +87,16 @@ discard block |
||
| 87 | 87 | // ) |
| 88 | 88 | //); |
| 89 | 89 | // set a hook point |
| 90 | - do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params ); |
|
| 90 | + do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params); |
|
| 91 | 91 | // check if transaction has a primary registrant and that it has a related Attendee object |
| 92 | - if ( $this->checkout->transaction_has_primary_registrant() ) { |
|
| 92 | + if ($this->checkout->transaction_has_primary_registrant()) { |
|
| 93 | 93 | // setup URL for redirect |
| 94 | 94 | $this->checkout->redirect_url = add_query_arg( |
| 95 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
| 95 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
| 96 | 96 | $this->checkout->thank_you_page_url |
| 97 | 97 | ); |
| 98 | 98 | } else { |
| 99 | - EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 99 | + EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 100 | 100 | $this->checkout->redirect = false; |
| 101 | 101 | $this->checkout->continue_reg = false; |
| 102 | 102 | return false; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | // you don't have to go home but you can't stay here ! |
| 105 | 105 | $this->checkout->redirect = true; |
| 106 | 106 | $this->checkout->continue_reg = true; |
| 107 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
| 107 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
| 108 | 108 | // mark this reg step as completed |
| 109 | 109 | $this->checkout->current_step->set_completed(); |
| 110 | 110 | $this->checkout->set_exit_spco(); |
@@ -120,21 +120,21 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | protected function _finalize_transaction() { |
| 122 | 122 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 123 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 123 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 124 | 124 | //set revisit flag in txn processor |
| 125 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
| 125 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
| 126 | 126 | // at this point we'll consider a TXN to not have been abandoned |
| 127 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
| 128 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
| 127 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
| 128 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
| 129 | 129 | // save TXN data to the cart |
| 130 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
| 130 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
| 131 | 131 | } |
| 132 | 132 | /** @type EE_Transaction_Payments $transaction_payments */ |
| 133 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
| 133 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
| 134 | 134 | // maybe update status, but don't save transaction just yet |
| 135 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
| 135 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
| 136 | 136 | // If the selected method of payment used an off-site gateway... |
| 137 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
| 137 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
| 138 | 138 | // if SPCO revisit and TXN status has changed due to a payment |
| 139 | 139 | //if ( |
| 140 | 140 | // filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ) && |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | // // send out notifications |
| 144 | 144 | // add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
| 145 | 145 | //} |
| 146 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) { |
|
| 146 | + if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) { |
|
| 147 | 147 | // do NOT trigger notifications because it was already done during the IPN |
| 148 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
| 149 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
| 148 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
| 149 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | // this will result in the base session properties getting saved to the TXN_Session_data field |
| 153 | - $this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true )); |
|
| 153 | + $this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true)); |
|
| 154 | 154 | // update the TXN if payment conditions have changed |
| 155 | 155 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
| 156 | 156 | $this->checkout->transaction, |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @return boolean |
| 166 | 166 | */ |
| 167 | 167 | public function update_reg_step() { |
| 168 | - EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
|
| 168 | + EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0'); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
@@ -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() ); |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | 25 | public static function set_hooks() { |
| 26 | - add_action( 'wp_ajax_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'spco_billing_form' )); |
|
| 27 | - add_action( 'wp_ajax_nopriv_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'spco_billing_form' )); |
|
| 28 | - add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
| 29 | - add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
| 30 | - 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 ); |
|
| 26 | + add_action('wp_ajax_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'spco_billing_form')); |
|
| 27 | + add_action('wp_ajax_nopriv_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'spco_billing_form')); |
|
| 28 | + add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
| 29 | + add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
| 30 | + 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); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * ajax spco_billing_form |
| 38 | 38 | */ |
| 39 | 39 | public static function spco_billing_form() { |
| 40 | - EED_Single_Page_Checkout::process_ajax_request( 'get_billing_form_html_for_payment_method' ); |
|
| 40 | + EED_Single_Page_Checkout::process_ajax_request('get_billing_form_html_for_payment_method'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * ajax get_transaction_details |
| 48 | 48 | */ |
| 49 | 49 | public static function get_transaction_details() { |
| 50 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
| 50 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | * @param EE_Checkout $checkout |
| 62 | 62 | * @return \EE_SPCO_Reg_Step_Payment_Options |
| 63 | 63 | */ |
| 64 | - public function __construct( EE_Checkout $checkout ) { |
|
| 64 | + public function __construct(EE_Checkout $checkout) { |
|
| 65 | 65 | $this->_slug = 'payment_options'; |
| 66 | 66 | $this->_name = __('Payment Options', 'event_espresso'); |
| 67 | - $this->_template = SPCO_TEMPLATES_PATH . 'payment_options_main.template.php'; |
|
| 67 | + $this->_template = SPCO_TEMPLATES_PATH.'payment_options_main.template.php'; |
|
| 68 | 68 | $this->checkout = $checkout; |
| 69 | 69 | $this->_reset_success_message(); |
| 70 | - $this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
| 70 | + $this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | * @return void |
| 78 | 78 | */ |
| 79 | 79 | public function translate_js_strings() { |
| 80 | - EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' ); |
|
| 81 | - 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' ); |
|
| 82 | - EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' ); |
|
| 80 | + EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso'); |
|
| 81 | + 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'); |
|
| 82 | + EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -108,19 +108,19 @@ discard block |
||
| 108 | 108 | // $ 0.00 transactions (no payment required) |
| 109 | 109 | ! $this->checkout->payment_required() |
| 110 | 110 | // but do NOT remove if current action being called belongs to this reg step |
| 111 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
| 111 | + && ! is_callable(array($this, $this->checkout->action)) |
|
| 112 | 112 | ) { |
| 113 | 113 | // and if so, then we no longer need the Payment Options step |
| 114 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
| 114 | + $this->checkout->remove_reg_step($this->_slug); |
|
| 115 | 115 | $this->checkout->reset_reg_steps(); |
| 116 | 116 | // DEBUG LOG |
| 117 | 117 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
| 118 | 118 | return; |
| 119 | 119 | } |
| 120 | 120 | // load EEM_Payment_Method |
| 121 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
| 121 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
| 122 | 122 | // get all active payment methods |
| 123 | - $this->checkout->available_payment_methods = EE_Registry::instance()->LIB->EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
| 123 | + $this->checkout->available_payment_methods = EE_Registry::instance()->LIB->EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @return bool |
| 130 | 130 | */ |
| 131 | 131 | public function generate_reg_form() { |
| 132 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
| 132 | + EE_Registry::instance()->load_helper('HTML'); |
|
| 133 | 133 | // set some defaults |
| 134 | 134 | $this->checkout->selected_method_of_payment = 'payments_closed'; |
| 135 | 135 | $payment_required = array(); |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | EEM_Registration::status_id_approved |
| 144 | 144 | ); |
| 145 | 145 | // loop thru registrations to gather info |
| 146 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
| 146 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
| 147 | 147 | /** @var $registration EE_Registration */ |
| 148 | 148 | $reg_count++; |
| 149 | 149 | // if returning registrant is Approved then do NOT do this |
| 150 | - if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) { |
|
| 151 | - if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) { |
|
| 150 | + if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) { |
|
| 151 | + if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) { |
|
| 152 | 152 | // add event to list of events that are sold out |
| 153 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
| 153 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
| 154 | 154 | do_action( |
| 155 | 155 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
| 156 | 156 | $registration->event(), |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | ); |
| 159 | 159 | } |
| 160 | 160 | // event requires admin approval |
| 161 | - if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) { |
|
| 161 | + if ($registration->status_ID() == EEM_Registration::status_id_not_approved) { |
|
| 162 | 162 | // add event to list of events with pre-approval reg status |
| 163 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = $registration->event(); |
|
| 163 | + $events_requiring_pre_approval[$registration->event()->ID()] = $registration->event(); |
|
| 164 | 164 | do_action( |
| 165 | 165 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
| 166 | 166 | $registration->event(), |
@@ -168,29 +168,29 @@ discard block |
||
| 168 | 168 | ); |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | - if ( in_array( $registration->status_ID(), $requires_payment ) && ! $registration->ticket()->is_free() ) { |
|
| 172 | - $payment_required[ $registration->event()->ID() ] = $registration->event(); |
|
| 171 | + if (in_array($registration->status_ID(), $requires_payment) && ! $registration->ticket()->is_free()) { |
|
| 172 | + $payment_required[$registration->event()->ID()] = $registration->event(); |
|
| 173 | 173 | do_action( |
| 174 | 174 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
| 175 | 175 | $registration->event(), |
| 176 | 176 | $this |
| 177 | 177 | ); |
| 178 | - } else if ( $registration->status_ID() != EEM_Registration::status_id_not_approved ) { |
|
| 179 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
| 178 | + } else if ($registration->status_ID() != EEM_Registration::status_id_not_approved) { |
|
| 179 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | $subsections = array(); |
| 183 | 183 | // now decide which template to load |
| 184 | - if ( ! empty( $sold_out_events )) { |
|
| 185 | - $subsections['events_requiring_pre_approval'] = $this->_sold_out_events( $sold_out_events ); |
|
| 184 | + if ( ! empty($sold_out_events)) { |
|
| 185 | + $subsections['events_requiring_pre_approval'] = $this->_sold_out_events($sold_out_events); |
|
| 186 | 186 | } |
| 187 | - if ( ! empty( $events_requiring_pre_approval )) { |
|
| 188 | - $subsections['events_requiring_pre_approval'] = $this->_events_requiring_pre_approval( $events_requiring_pre_approval ); |
|
| 187 | + if ( ! empty($events_requiring_pre_approval)) { |
|
| 188 | + $subsections['events_requiring_pre_approval'] = $this->_events_requiring_pre_approval($events_requiring_pre_approval); |
|
| 189 | 189 | } |
| 190 | - if ( ! empty( $payment_required )) { |
|
| 191 | - $subsections[ 'payment_options' ] = $this->_display_payment_options( $reg_count ); |
|
| 190 | + if ( ! empty($payment_required)) { |
|
| 191 | + $subsections['payment_options'] = $this->_display_payment_options($reg_count); |
|
| 192 | 192 | } else { |
| 193 | - $subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events ); |
|
| 193 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
| 194 | 194 | } |
| 195 | 195 | return new EE_Form_Section_Proper( |
| 196 | 196 | array( |
@@ -210,13 +210,13 @@ discard block |
||
| 210 | 210 | * @param \EE_Event[] $sold_out_events_array |
| 211 | 211 | * @return \EE_Form_Section_Proper |
| 212 | 212 | */ |
| 213 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
| 213 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
| 214 | 214 | // set some defaults |
| 215 | 215 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
| 216 | 216 | |
| 217 | 217 | $sold_out_events = ''; |
| 218 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
| 219 | - $sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )); |
|
| 218 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
| 219 | + $sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')); |
|
| 220 | 220 | } |
| 221 | 221 | return new EE_Form_Section_Proper( |
| 222 | 222 | array( |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | ), |
| 229 | 229 | 'layout_strategy' => new EE_Template_Layout( |
| 230 | 230 | array( |
| 231 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . $this->slug() . DS . 'sold_out_events.template.php', // layout_template |
|
| 231 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.$this->slug().DS.'sold_out_events.template.php', // layout_template |
|
| 232 | 232 | 'template_args' => apply_filters( |
| 233 | 233 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
| 234 | 234 | array( |
| 235 | 235 | 'sold_out_events' => $sold_out_events, |
| 236 | 236 | 'sold_out_events_msg' => apply_filters( |
| 237 | 237 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
| 238 | - __( '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' ) |
|
| 238 | + __('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') |
|
| 239 | 239 | ) |
| 240 | 240 | ) |
| 241 | 241 | ) |
@@ -252,13 +252,13 @@ discard block |
||
| 252 | 252 | * @param \EE_Event[] $events_requiring_pre_approval_array |
| 253 | 253 | * @return \EE_Form_Section_Proper |
| 254 | 254 | */ |
| 255 | - private function _events_requiring_pre_approval( $events_requiring_pre_approval_array = array()) { |
|
| 255 | + private function _events_requiring_pre_approval($events_requiring_pre_approval_array = array()) { |
|
| 256 | 256 | |
| 257 | 257 | $events_requiring_pre_approval = ''; |
| 258 | - foreach ( $events_requiring_pre_approval_array as $event_requiring_pre_approval ) { |
|
| 258 | + foreach ($events_requiring_pre_approval_array as $event_requiring_pre_approval) { |
|
| 259 | 259 | $events_requiring_pre_approval .= EEH_HTML::li( |
| 260 | 260 | EEH_HTML::span( |
| 261 | - EEH_HTML::nbsp(1) . $event_requiring_pre_approval->name(), |
|
| 261 | + EEH_HTML::nbsp(1).$event_requiring_pre_approval->name(), |
|
| 262 | 262 | '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
| 263 | 263 | ) |
| 264 | 264 | ); |
@@ -273,14 +273,14 @@ discard block |
||
| 273 | 273 | ), |
| 274 | 274 | 'layout_strategy' => new EE_Template_Layout( |
| 275 | 275 | array( |
| 276 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . $this->slug() . DS . 'events_requiring_pre_approval.template.php', // layout_template |
|
| 276 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.$this->slug().DS.'events_requiring_pre_approval.template.php', // layout_template |
|
| 277 | 277 | 'template_args' => apply_filters( |
| 278 | 278 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
| 279 | 279 | array( |
| 280 | 280 | 'events_requiring_pre_approval' => $events_requiring_pre_approval, |
| 281 | 281 | 'events_requiring_pre_approval_msg' => apply_filters( |
| 282 | 282 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
| 283 | - __( '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' ) |
|
| 283 | + __('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') |
|
| 284 | 284 | ) |
| 285 | 285 | ) |
| 286 | 286 | ), |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | * @param \EE_Event[] $registrations_for_free_events |
| 299 | 299 | * @return \EE_Form_Section_Proper |
| 300 | 300 | */ |
| 301 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
| 301 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
| 302 | 302 | // set some defaults |
| 303 | 303 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
| 304 | 304 | // generate no_payment_required form |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | ), |
| 311 | 311 | 'layout_strategy' => new EE_Template_Layout( |
| 312 | 312 | array( |
| 313 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . $this->slug() . DS . 'no_payment_required.template.php', // layout_template |
|
| 313 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.$this->slug().DS.'no_payment_required.template.php', // layout_template |
|
| 314 | 314 | 'template_args' => apply_filters( |
| 315 | 315 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
| 316 | 316 | array( |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | 'registrations' => array(), |
| 319 | 319 | 'ticket_count' => array(), |
| 320 | 320 | 'registrations_for_free_events' => $registrations_for_free_events, |
| 321 | - 'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' )) |
|
| 321 | + 'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso')) |
|
| 322 | 322 | ) |
| 323 | 323 | ), |
| 324 | 324 | ) |
@@ -334,14 +334,14 @@ discard block |
||
| 334 | 334 | * @param int $reg_count |
| 335 | 335 | * @return \EE_Form_Section_Proper |
| 336 | 336 | */ |
| 337 | - private function _display_payment_options( $reg_count = 0 ) { |
|
| 337 | + private function _display_payment_options($reg_count = 0) { |
|
| 338 | 338 | // reset in case someone changes their mind |
| 339 | 339 | $this->_reset_selected_method_of_payment(); |
| 340 | 340 | // has method_of_payment been set by no-js user? |
| 341 | 341 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
| 342 | 342 | // autoload Line_Item_Display classes |
| 343 | 343 | EEH_Autoloader::register_line_item_display_autoloaders(); |
| 344 | - $Line_Item_Display = new EE_Line_Item_Display( 'spco' ); |
|
| 344 | + $Line_Item_Display = new EE_Line_Item_Display('spco'); |
|
| 345 | 345 | // build payment options form |
| 346 | 346 | return new EE_Form_Section_Proper( |
| 347 | 347 | array( |
@@ -350,15 +350,15 @@ discard block |
||
| 350 | 350 | 'subsections' => array( |
| 351 | 351 | 'payment_options' => $this->_setup_payment_options(), |
| 352 | 352 | 'default_hidden_inputs' => $this->reg_step_hidden_inputs(), |
| 353 | - 'extra_hidden_inputs' => $this->_extra_hidden_inputs( FALSE ) |
|
| 353 | + 'extra_hidden_inputs' => $this->_extra_hidden_inputs(FALSE) |
|
| 354 | 354 | ), |
| 355 | - 'layout_strategy' => new EE_Template_Layout( array( |
|
| 356 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . $this->slug() . DS . 'payment_options_main.template.php', // layout_template |
|
| 355 | + 'layout_strategy' => new EE_Template_Layout(array( |
|
| 356 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.$this->slug().DS.'payment_options_main.template.php', // layout_template |
|
| 357 | 357 | 'template_args' => apply_filters( |
| 358 | 358 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_options__template_args', |
| 359 | 359 | array( |
| 360 | 360 | 'reg_count' => $reg_count, |
| 361 | - 'transaction_details' => $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total() ), |
|
| 361 | + 'transaction_details' => $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total()), |
|
| 362 | 362 | 'available_payment_methods' => array() |
| 363 | 363 | ) |
| 364 | 364 | ), |
@@ -375,11 +375,11 @@ discard block |
||
| 375 | 375 | * @param bool $no_payment_required |
| 376 | 376 | * @return \EE_Form_Section_Proper |
| 377 | 377 | */ |
| 378 | - private function _extra_hidden_inputs( $no_payment_required = TRUE ) { |
|
| 378 | + private function _extra_hidden_inputs($no_payment_required = TRUE) { |
|
| 379 | 379 | |
| 380 | 380 | return new EE_Form_Section_Proper( |
| 381 | 381 | array( |
| 382 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
| 382 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
| 383 | 383 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 384 | 384 | 'subsections' => array( |
| 385 | 385 | 'selected_method_of_payment_input' => new EE_Hidden_Input( |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | * @param bool $force_reset |
| 414 | 414 | * @return void |
| 415 | 415 | */ |
| 416 | - private function _reset_selected_method_of_payment( $force_reset = FALSE ) { |
|
| 417 | - $reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE )); |
|
| 418 | - if ( $reset_payment_method ) { |
|
| 416 | + private function _reset_selected_method_of_payment($force_reset = FALSE) { |
|
| 417 | + $reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE)); |
|
| 418 | + if ($reset_payment_method) { |
|
| 419 | 419 | $this->checkout->selected_method_of_payment = NULL; |
| 420 | 420 | $this->_save_selected_method_of_payment(); |
| 421 | 421 | } |
@@ -432,9 +432,9 @@ discard block |
||
| 432 | 432 | * @param string $selected_method_of_payment |
| 433 | 433 | * @return EE_Billing_Info_Form |
| 434 | 434 | */ |
| 435 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
| 436 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
| 437 | - EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment )); |
|
| 435 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
| 436 | + $selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
| 437 | + EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment)); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | |
@@ -445,41 +445,41 @@ discard block |
||
| 445 | 445 | */ |
| 446 | 446 | public function _setup_payment_options() { |
| 447 | 447 | // switch up header depending on number of available payment methods |
| 448 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
| 449 | - ? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' )) |
|
| 450 | - : apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' )); |
|
| 448 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
| 449 | + ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) |
|
| 450 | + : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso')); |
|
| 451 | 451 | $available_payment_methods = array( |
| 452 | 452 | // display the "Payment Method" header |
| 453 | 453 | 'payment_method_header' => new EE_Form_Section_HTML( |
| 454 | - EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' ) |
|
| 454 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
| 455 | 455 | ) |
| 456 | 456 | ); |
| 457 | 457 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
| 458 | 458 | $available_payment_method_options = array(); |
| 459 | 459 | $default_payment_method_option = array(); |
| 460 | 460 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
| 461 | - $payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' ))); |
|
| 461 | + $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;'))); |
|
| 462 | 462 | // loop through payment methods |
| 463 | - foreach( $this->checkout->available_payment_methods as $payment_method ) { |
|
| 464 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
| 463 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
| 464 | + if ($payment_method instanceof EE_Payment_Method) { |
|
| 465 | 465 | |
| 466 | - $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' ); |
|
| 466 | + $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'); |
|
| 467 | 467 | // check if any payment methods are set as default |
| 468 | 468 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
| 469 | - if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) { |
|
| 469 | + if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) { |
|
| 470 | 470 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
| 471 | 471 | $this->_save_selected_method_of_payment(); |
| 472 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
| 472 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
| 473 | 473 | } else { |
| 474 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
| 474 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
| 475 | 475 | } |
| 476 | - $payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method ); |
|
| 476 | + $payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method); |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs |
| 480 | 480 | $available_payment_method_options = $default_payment_method_option + $available_payment_method_options; |
| 481 | 481 | // now generate the actual form inputs |
| 482 | - $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options ); |
|
| 482 | + $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options); |
|
| 483 | 483 | $available_payment_methods = $available_payment_methods + $payment_methods_billing_info; |
| 484 | 484 | |
| 485 | 485 | // build the available payment methods form |
@@ -502,14 +502,14 @@ discard block |
||
| 502 | 502 | * @param array $available_payment_method_options |
| 503 | 503 | * @return \EE_Form_Section_Proper |
| 504 | 504 | */ |
| 505 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
| 505 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
| 506 | 506 | // generate inputs |
| 507 | 507 | return new EE_Form_Section_Proper( |
| 508 | 508 | array( |
| 509 | 509 | 'html_id' => 'ee-available-payment-method-inputs', |
| 510 | 510 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 511 | 511 | 'subsections' => array( |
| 512 | - '' => new EE_Radio_Button_Input ( |
|
| 512 | + '' => new EE_Radio_Button_Input( |
|
| 513 | 513 | $available_payment_method_options, |
| 514 | 514 | array( |
| 515 | 515 | 'html_name' => 'selected_method_of_payment', |
@@ -533,35 +533,35 @@ discard block |
||
| 533 | 533 | * @param EE_Payment_Method $payment_method |
| 534 | 534 | * @return \EE_Form_Section_Proper |
| 535 | 535 | */ |
| 536 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
| 536 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
| 537 | 537 | $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE; |
| 538 | 538 | // generate the billing form for payment method |
| 539 | - $billing_form = $this->_get_billing_form_for_payment_method( $payment_method, $currently_selected ); |
|
| 539 | + $billing_form = $this->_get_billing_form_for_payment_method($payment_method, $currently_selected); |
|
| 540 | 540 | // it's all in the details |
| 541 | - $info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' ); |
|
| 541 | + $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr'); |
|
| 542 | 542 | // 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 |
| 543 | - if ( $payment_method->description() ) { |
|
| 543 | + if ($payment_method->description()) { |
|
| 544 | 544 | $payment_method_info = $payment_method->description(); |
| 545 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
| 546 | - $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() ); |
|
| 545 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
| 546 | + $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()); |
|
| 547 | 547 | } else { |
| 548 | - $payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
| 548 | + $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
| 549 | 549 | } |
| 550 | - $info_html .= EEH_HTML::p ( |
|
| 551 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ), |
|
| 550 | + $info_html .= EEH_HTML::p( |
|
| 551 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), |
|
| 552 | 552 | '', |
| 553 | 553 | 'spco-payment-method-desc ee-attention' |
| 554 | 554 | ); |
| 555 | 555 | |
| 556 | 556 | return new EE_Form_Section_Proper( |
| 557 | 557 | array( |
| 558 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
| 558 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
| 559 | 559 | 'html_class' => 'spco-payment-method-info-dv', |
| 560 | 560 | // only display the selected or default PM |
| 561 | 561 | 'html_style' => $this->checkout->selected_method_of_payment == $payment_method->slug() ? '' : 'display:none;', |
| 562 | 562 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 563 | 563 | 'subsections' => array( |
| 564 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
| 564 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
| 565 | 565 | 'billing_form' => $this->checkout->selected_method_of_payment == $payment_method->slug() ? $billing_form : new EE_Form_Section_HTML() |
| 566 | 566 | ) |
| 567 | 567 | ) |
@@ -595,12 +595,12 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | public function get_billing_form_html_for_payment_method() { |
| 597 | 597 | // how have they chosen to pay? |
| 598 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
| 598 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
| 599 | 599 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
| 600 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
| 600 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
| 601 | 601 | return FALSE; |
| 602 | 602 | } |
| 603 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
| 603 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
| 604 | 604 | EE_Error::add_success( |
| 605 | 605 | apply_filters( |
| 606 | 606 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -609,20 +609,20 @@ discard block |
||
| 609 | 609 | ); |
| 610 | 610 | } |
| 611 | 611 | // now generate billing form for selected method of payment |
| 612 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method, FALSE ); |
|
| 612 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method, FALSE); |
|
| 613 | 613 | // fill form with attendee info if applicable |
| 614 | - if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
| 615 | - $payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
| 614 | + if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
| 615 | + $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
| 616 | 616 | } |
| 617 | 617 | // and debug content |
| 618 | - if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
| 619 | - $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form ); |
|
| 618 | + if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
| 619 | + $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); |
|
| 620 | 620 | } |
| 621 | 621 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; |
| 622 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info )); |
|
| 622 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
| 623 | 623 | // localize validation rules for main form |
| 624 | 624 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
| 625 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
| 625 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
| 626 | 626 | return TRUE; |
| 627 | 627 | } |
| 628 | 628 | |
@@ -635,15 +635,15 @@ discard block |
||
| 635 | 635 | * @param EE_Payment_Method $payment_method |
| 636 | 636 | * @return \EE_Billing_Info_Form |
| 637 | 637 | */ |
| 638 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
| 639 | - $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction ); |
|
| 640 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
| 641 | - if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
|
| 642 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
| 638 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
| 639 | + $billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction); |
|
| 640 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
| 641 | + if (EE_Registry::instance()->REQ->is_set('payment_method')) { |
|
| 642 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
| 643 | 643 | EE_Error::add_success( |
| 644 | 644 | apply_filters( |
| 645 | 645 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
| 646 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
| 646 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name()) |
|
| 647 | 647 | ) |
| 648 | 648 | ); |
| 649 | 649 | } |
@@ -667,27 +667,27 @@ discard block |
||
| 667 | 667 | * @param string $request_param |
| 668 | 668 | * @return NULL|string |
| 669 | 669 | */ |
| 670 | - private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) { |
|
| 670 | + private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') { |
|
| 671 | 671 | // is selected_method_of_payment set in the request ? |
| 672 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE ); |
|
| 673 | - if ( $selected_method_of_payment ) { |
|
| 672 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE); |
|
| 673 | + if ($selected_method_of_payment) { |
|
| 674 | 674 | // sanitize it |
| 675 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment; |
|
| 676 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
| 675 | + $selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment; |
|
| 676 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
| 677 | 677 | // store it in the session so that it's available for all subsequent requests including AJAX |
| 678 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
| 678 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
| 679 | 679 | } else { |
| 680 | 680 | // or is is set in the session ? |
| 681 | - $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' ); |
|
| 681 | + $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment'); |
|
| 682 | 682 | } |
| 683 | 683 | // do ya really really gotta have it? |
| 684 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
| 684 | + if (empty($selected_method_of_payment) && $required) { |
|
| 685 | 685 | EE_Error::add_error( |
| 686 | 686 | sprintf( |
| 687 | - __( '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' ), |
|
| 687 | + __('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'), |
|
| 688 | 688 | '<br/>', |
| 689 | 689 | '<br/>', |
| 690 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 690 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 691 | 691 | ), |
| 692 | 692 | __FILE__, __FUNCTION__, __LINE__ |
| 693 | 693 | ); |
@@ -716,22 +716,22 @@ discard block |
||
| 716 | 716 | */ |
| 717 | 717 | public function process_reg_step() { |
| 718 | 718 | // how have they chosen to pay? |
| 719 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
| 719 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
| 720 | 720 | // choose your own adventure based on method_of_payment |
| 721 | - switch( $this->checkout->selected_method_of_payment ) { |
|
| 721 | + switch ($this->checkout->selected_method_of_payment) { |
|
| 722 | 722 | |
| 723 | 723 | case 'events_sold_out' : |
| 724 | 724 | $this->checkout->redirect = TRUE; |
| 725 | 725 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
| 726 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
| 726 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
| 727 | 727 | // mark this reg step as completed |
| 728 | 728 | $this->checkout->current_step->set_completed(); |
| 729 | 729 | return FALSE; |
| 730 | 730 | break; |
| 731 | 731 | |
| 732 | 732 | case 'payments_closed' : |
| 733 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) { |
|
| 734 | - EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 733 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) { |
|
| 734 | + EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 735 | 735 | } |
| 736 | 736 | // mark this reg step as completed |
| 737 | 737 | $this->checkout->current_step->set_completed(); |
@@ -739,8 +739,8 @@ discard block |
||
| 739 | 739 | break; |
| 740 | 740 | |
| 741 | 741 | case 'no_payment_required' : |
| 742 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) { |
|
| 743 | - EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 742 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) { |
|
| 743 | + EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 744 | 744 | } |
| 745 | 745 | // mark this reg step as completed |
| 746 | 746 | $this->checkout->current_step->set_completed(); |
@@ -749,9 +749,9 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | default: |
| 751 | 751 | $payment_successful = $this->_process_payment(); |
| 752 | - if ( $payment_successful ) { |
|
| 752 | + if ($payment_successful) { |
|
| 753 | 753 | $this->checkout->continue_reg = true; |
| 754 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
| 754 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
| 755 | 755 | } else { |
| 756 | 756 | $this->checkout->continue_reg = false; |
| 757 | 757 | } |
@@ -769,8 +769,8 @@ discard block |
||
| 769 | 769 | * @param \EE_Payment_Method $payment_method |
| 770 | 770 | * @return void |
| 771 | 771 | */ |
| 772 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
| 773 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
| 772 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
| 773 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
| 774 | 774 | case EE_PMT_Base::offsite : |
| 775 | 775 | break; |
| 776 | 776 | case EE_PMT_Base::onsite : |
@@ -793,15 +793,15 @@ discard block |
||
| 793 | 793 | public function update_reg_step() { |
| 794 | 794 | $success = TRUE; |
| 795 | 795 | // if payment required |
| 796 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
| 797 | - do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction ); |
|
| 796 | + if ($this->checkout->transaction->total() > 0) { |
|
| 797 | + do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction); |
|
| 798 | 798 | // attempt payment via payment method |
| 799 | 799 | $success = $this->process_reg_step(); |
| 800 | 800 | } |
| 801 | - if ( $success && ! $this->checkout->redirect ) { |
|
| 802 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
| 801 | + if ($success && ! $this->checkout->redirect) { |
|
| 802 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
| 803 | 803 | // set return URL |
| 804 | - $this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url ); |
|
| 804 | + $this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url); |
|
| 805 | 805 | } |
| 806 | 806 | return $success; |
| 807 | 807 | } |
@@ -821,24 +821,24 @@ discard block |
||
| 821 | 821 | // clear any previous errors related to not selecting a payment method |
| 822 | 822 | // EE_Error::overwrite_errors(); |
| 823 | 823 | // ya gotta make a choice man |
| 824 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
| 825 | - $this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' )); |
|
| 824 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
| 825 | + $this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso')); |
|
| 826 | 826 | return FALSE; |
| 827 | 827 | } |
| 828 | 828 | // get EE_Payment_Method object |
| 829 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
| 829 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
| 830 | 830 | return FALSE; |
| 831 | 831 | } |
| 832 | 832 | // setup billing form |
| 833 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
| 834 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
| 833 | + if ($this->checkout->payment_method->is_on_site()) { |
|
| 834 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
| 835 | 835 | // bad billing form ? |
| 836 | - if ( ! $this->_billing_form_is_valid() ) { |
|
| 836 | + if ( ! $this->_billing_form_is_valid()) { |
|
| 837 | 837 | return FALSE; |
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | // ensure primary registrant has been fully processed |
| 841 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
| 841 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
| 842 | 842 | return FALSE; |
| 843 | 843 | } |
| 844 | 844 | /** @type EE_Transaction_Processor $transaction_processor */ |
@@ -846,20 +846,20 @@ discard block |
||
| 846 | 846 | // 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 |
| 847 | 847 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
| 848 | 848 | // attempt payment |
| 849 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
| 849 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
| 850 | 850 | // process results |
| 851 | - $payment = $this->_validate_payment( $payment ); |
|
| 852 | - $payment = $this->_post_payment_processing( $payment ); |
|
| 851 | + $payment = $this->_validate_payment($payment); |
|
| 852 | + $payment = $this->_post_payment_processing($payment); |
|
| 853 | 853 | // verify payment |
| 854 | - if ( $payment instanceof EE_Payment ) { |
|
| 854 | + if ($payment instanceof EE_Payment) { |
|
| 855 | 855 | // store that for later |
| 856 | 856 | $this->checkout->payment = $payment; |
| 857 | 857 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 858 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 858 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 859 | 859 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
| 860 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
| 860 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
| 861 | 861 | return true; |
| 862 | - } else if ( $payment === true ) { |
|
| 862 | + } else if ($payment === true) { |
|
| 863 | 863 | // please note that offline payment methods will NOT make a payment, |
| 864 | 864 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
| 865 | 865 | $this->checkout->payment = $payment; |
@@ -878,10 +878,10 @@ discard block |
||
| 878 | 878 | * @return bool |
| 879 | 879 | */ |
| 880 | 880 | public function redirect_form() { |
| 881 | - $payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() ); |
|
| 881 | + $payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment()); |
|
| 882 | 882 | $html = $payment_method_billing_info->get_html_and_js(); |
| 883 | 883 | $html .= $this->checkout->redirect_form; |
| 884 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
| 884 | + EE_Registry::instance()->REQ->add_output($html); |
|
| 885 | 885 | return TRUE; |
| 886 | 886 | } |
| 887 | 887 | |
@@ -894,33 +894,33 @@ discard block |
||
| 894 | 894 | * @return bool |
| 895 | 895 | */ |
| 896 | 896 | private function _billing_form_is_valid() { |
| 897 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
| 898 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
| 897 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
| 898 | + if ($this->checkout->billing_form->was_submitted()) { |
|
| 899 | 899 | $this->checkout->billing_form->receive_form_submission(); |
| 900 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
| 900 | + if ($this->checkout->billing_form->is_valid()) { |
|
| 901 | 901 | return TRUE; |
| 902 | 902 | } |
| 903 | 903 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
| 904 | 904 | $error_strings = array(); |
| 905 | - foreach( $validation_errors as $validation_error ){ |
|
| 906 | - if( $validation_error instanceof EE_Validation_Error ){ |
|
| 905 | + foreach ($validation_errors as $validation_error) { |
|
| 906 | + if ($validation_error instanceof EE_Validation_Error) { |
|
| 907 | 907 | $form_section = $validation_error->get_form_section(); |
| 908 | - if( $form_section instanceof EE_Form_Input_Base ){ |
|
| 908 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
| 909 | 909 | $label = $form_section->html_label_text(); |
| 910 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
| 910 | + }elseif ($form_section instanceof EE_Form_Section_Base) { |
|
| 911 | 911 | $label = $form_section->name(); |
| 912 | - }else{ |
|
| 913 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
| 912 | + } else { |
|
| 913 | + $label = __('Validation Error', 'event_espresso'); |
|
| 914 | 914 | } |
| 915 | - $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
| 915 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
| 916 | 916 | } |
| 917 | 917 | } |
| 918 | - 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__ ); |
|
| 918 | + 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__); |
|
| 919 | 919 | } else { |
| 920 | - EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 920 | + EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 921 | 921 | } |
| 922 | 922 | } else { |
| 923 | - EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 923 | + EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 924 | 924 | } |
| 925 | 925 | return FALSE; |
| 926 | 926 | } |
@@ -938,9 +938,9 @@ discard block |
||
| 938 | 938 | */ |
| 939 | 939 | private function _setup_primary_registrant_prior_to_payment() { |
| 940 | 940 | // check if transaction has a primary registrant and that it has a related Attendee object |
| 941 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
| 941 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
| 942 | 942 | // need to at least gather some primary registrant data before attempting payment |
| 943 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) { |
|
| 943 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) { |
|
| 944 | 944 | return FALSE; |
| 945 | 945 | } |
| 946 | 946 | } |
@@ -948,13 +948,13 @@ discard block |
||
| 948 | 948 | // grab the primary_registration object |
| 949 | 949 | $primary_registration = $this->checkout->transaction->primary_registration(); |
| 950 | 950 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 951 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 951 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 952 | 952 | // at this point we'll consider a TXN to not have been failed |
| 953 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
| 953 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
| 954 | 954 | // save the TXN ( which clears cached copy of primary_registration) |
| 955 | 955 | $this->checkout->transaction->save(); |
| 956 | 956 | // grab TXN ID and save it to the primary_registration |
| 957 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
| 957 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
| 958 | 958 | // save what we have so far |
| 959 | 959 | $primary_registration->save(); |
| 960 | 960 | return TRUE; |
@@ -971,41 +971,41 @@ discard block |
||
| 971 | 971 | private function _capture_primary_registration_data_from_billing_form() { |
| 972 | 972 | // convert billing form data into an attendee |
| 973 | 973 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
| 974 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
| 974 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
| 975 | 975 | EE_Error::add_error( |
| 976 | 976 | sprintf( |
| 977 | - __( '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' ), |
|
| 977 | + __('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'), |
|
| 978 | 978 | '<br/>', |
| 979 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 979 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 980 | 980 | ), __FILE__, __FUNCTION__, __LINE__ |
| 981 | 981 | ); |
| 982 | 982 | return FALSE; |
| 983 | 983 | } |
| 984 | 984 | $primary_registration = $this->checkout->transaction->primary_registration(); |
| 985 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
| 985 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
| 986 | 986 | EE_Error::add_error( |
| 987 | 987 | sprintf( |
| 988 | - __( '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' ), |
|
| 988 | + __('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'), |
|
| 989 | 989 | '<br/>', |
| 990 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 990 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 991 | 991 | ), __FILE__, __FUNCTION__, __LINE__ |
| 992 | 992 | ); |
| 993 | 993 | return FALSE; |
| 994 | 994 | } |
| 995 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) { |
|
| 995 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) { |
|
| 996 | 996 | EE_Error::add_error( |
| 997 | 997 | sprintf( |
| 998 | - __( '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' ), |
|
| 998 | + __('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'), |
|
| 999 | 999 | '<br/>', |
| 1000 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 1000 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 1001 | 1001 | ), __FILE__, __FUNCTION__, __LINE__ |
| 1002 | 1002 | ); |
| 1003 | 1003 | return FALSE; |
| 1004 | 1004 | } |
| 1005 | 1005 | /** @type EE_Registration_Processor $registration_processor */ |
| 1006 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
| 1006 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 1007 | 1007 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
| 1008 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
| 1008 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
| 1009 | 1009 | |
| 1010 | 1010 | return TRUE; |
| 1011 | 1011 | } |
@@ -1021,27 +1021,27 @@ discard block |
||
| 1021 | 1021 | */ |
| 1022 | 1022 | private function _get_payment_method_for_selected_method_of_payment() { |
| 1023 | 1023 | // get EE_Payment_Method object |
| 1024 | - $payment_method = EE_Registry::instance()->LIB->EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
| 1024 | + $payment_method = EE_Registry::instance()->LIB->EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
| 1025 | 1025 | // verify $payment_method |
| 1026 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
| 1026 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
| 1027 | 1027 | // not a payment |
| 1028 | 1028 | EE_Error::add_error( |
| 1029 | 1029 | sprintf( |
| 1030 | - __( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
| 1030 | + __('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
| 1031 | 1031 | '<br/>', |
| 1032 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 1032 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 1033 | 1033 | ), __FILE__, __FUNCTION__, __LINE__ |
| 1034 | 1034 | ); |
| 1035 | 1035 | return NULL; |
| 1036 | 1036 | } |
| 1037 | 1037 | // and verify it has a valid Payment_Method Type object |
| 1038 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
| 1038 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
| 1039 | 1039 | // not a payment |
| 1040 | 1040 | EE_Error::add_error( |
| 1041 | 1041 | sprintf( |
| 1042 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
| 1042 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
| 1043 | 1043 | '<br/>', |
| 1044 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 1044 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 1045 | 1045 | ), __FILE__, __FUNCTION__, __LINE__ |
| 1046 | 1046 | ); |
| 1047 | 1047 | return NULL; |
@@ -1060,25 +1060,25 @@ discard block |
||
| 1060 | 1060 | * @type EE_Payment_Method $payment_method |
| 1061 | 1061 | * @return mixed EE_Payment | boolean |
| 1062 | 1062 | */ |
| 1063 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
| 1064 | - $payment =NULL; |
|
| 1063 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
| 1064 | + $payment = NULL; |
|
| 1065 | 1065 | $this->checkout->transaction->save(); |
| 1066 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
| 1067 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
| 1066 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
| 1067 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
| 1068 | 1068 | return FALSE; |
| 1069 | 1069 | } |
| 1070 | 1070 | try { |
| 1071 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
| 1071 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
| 1072 | 1072 | // generate payment object |
| 1073 | 1073 | $payment = $payment_processor->process_payment( |
| 1074 | 1074 | $payment_method, |
| 1075 | 1075 | $this->checkout->transaction, |
| 1076 | 1076 | $this->checkout->amount_owing, |
| 1077 | 1077 | $this->checkout->billing_form, |
| 1078 | - $this->_get_return_url( $payment_method ) |
|
| 1078 | + $this->_get_return_url($payment_method) |
|
| 1079 | 1079 | ); |
| 1080 | - } catch( Exception $e ) { |
|
| 1081 | - $this->_handle_payment_processor_exception( $e ); |
|
| 1080 | + } catch (Exception $e) { |
|
| 1081 | + $this->_handle_payment_processor_exception($e); |
|
| 1082 | 1082 | } |
| 1083 | 1083 | return $payment; |
| 1084 | 1084 | } |
@@ -1092,12 +1092,12 @@ discard block |
||
| 1092 | 1092 | * @param \Exception $e |
| 1093 | 1093 | * @return void |
| 1094 | 1094 | */ |
| 1095 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
| 1095 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
| 1096 | 1096 | EE_Error::add_error( |
| 1097 | 1097 | sprintf( |
| 1098 | - __( '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' ), |
|
| 1098 | + __('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'), |
|
| 1099 | 1099 | '<br/>', |
| 1100 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
| 1100 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
| 1101 | 1101 | $e->getMessage(), |
| 1102 | 1102 | $e->getFile(), |
| 1103 | 1103 | $e->getLine() |
@@ -1114,9 +1114,9 @@ discard block |
||
| 1114 | 1114 | * @param \EE_Payment_Method $payment_method |
| 1115 | 1115 | * @return string |
| 1116 | 1116 | */ |
| 1117 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
| 1117 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
| 1118 | 1118 | $return_url = ''; |
| 1119 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
| 1119 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
| 1120 | 1120 | |
| 1121 | 1121 | case EE_PMT_Base::offsite : |
| 1122 | 1122 | $return_url = add_query_arg( |
@@ -1155,13 +1155,13 @@ discard block |
||
| 1155 | 1155 | public function process_gateway_response() { |
| 1156 | 1156 | $payment = null; |
| 1157 | 1157 | // how have they chosen to pay? |
| 1158 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
| 1158 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
| 1159 | 1159 | // get EE_Payment_Method object |
| 1160 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
| 1160 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
| 1161 | 1161 | $this->checkout->continue_reg = false; |
| 1162 | 1162 | return false; |
| 1163 | 1163 | } |
| 1164 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
| 1164 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
| 1165 | 1165 | return false; |
| 1166 | 1166 | } |
| 1167 | 1167 | $this->_validate_offsite_return(); |
@@ -1175,17 +1175,17 @@ discard block |
||
| 1175 | 1175 | // true |
| 1176 | 1176 | //); |
| 1177 | 1177 | // verify TXN |
| 1178 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
| 1178 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
| 1179 | 1179 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
| 1180 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
| 1180 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
| 1181 | 1181 | $this->checkout->continue_reg = false; |
| 1182 | 1182 | return false; |
| 1183 | 1183 | } |
| 1184 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
| 1185 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
| 1186 | - $payment = $this->_validate_payment( $payment ); |
|
| 1184 | + $payment = $this->_process_off_site_payment($gateway); |
|
| 1185 | + $payment = $this->_process_cancelled_payments($payment); |
|
| 1186 | + $payment = $this->_validate_payment($payment); |
|
| 1187 | 1187 | // if payment was not declined by the payment gateway or cancelled by the registrant |
| 1188 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
| 1188 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
| 1189 | 1189 | //$this->_setup_redirect_for_next_step(); |
| 1190 | 1190 | // store that for later |
| 1191 | 1191 | $this->checkout->payment = $payment; |
@@ -1211,19 +1211,19 @@ discard block |
||
| 1211 | 1211 | * @return bool |
| 1212 | 1212 | */ |
| 1213 | 1213 | private function _validate_offsite_return() { |
| 1214 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
| 1215 | - if ( $TXN_ID != $this->checkout->transaction->ID() ) { |
|
| 1214 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
| 1215 | + if ($TXN_ID != $this->checkout->transaction->ID()) { |
|
| 1216 | 1216 | // Houston... we might have a problem |
| 1217 | 1217 | $invalid_TXN = false; |
| 1218 | 1218 | // first gather some info |
| 1219 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
| 1219 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
| 1220 | 1220 | $primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null; |
| 1221 | 1221 | // let's start by retrieving the cart for this TXN |
| 1222 | - $cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction ); |
|
| 1223 | - if ( $cart instanceof EE_Cart ) { |
|
| 1222 | + $cart = EE_Cart::get_cart_from_txn($this->checkout->transaction); |
|
| 1223 | + if ($cart instanceof EE_Cart) { |
|
| 1224 | 1224 | // verify that the current cart has tickets |
| 1225 | 1225 | $tickets = $cart->get_tickets(); |
| 1226 | - if ( empty( $tickets ) ) { |
|
| 1226 | + if (empty($tickets)) { |
|
| 1227 | 1227 | $invalid_TXN = true; |
| 1228 | 1228 | } |
| 1229 | 1229 | } else { |
@@ -1231,39 +1231,39 @@ discard block |
||
| 1231 | 1231 | } |
| 1232 | 1232 | $valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null; |
| 1233 | 1233 | // validate current Session ID and compare against valid TXN session ID |
| 1234 | - if ( EE_Session::instance()->id() === null ) { |
|
| 1234 | + if (EE_Session::instance()->id() === null) { |
|
| 1235 | 1235 | $invalid_TXN = true; |
| 1236 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
| 1236 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
| 1237 | 1237 | // WARNING !!! |
| 1238 | 1238 | // this could be PayPal sending back duplicate requests (ya they do that) |
| 1239 | 1239 | // or it **could** mean someone is simply registering AGAIN after having just done so |
| 1240 | 1240 | // so now we need to determine if this current TXN looks valid or not |
| 1241 | 1241 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 1242 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 1242 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 1243 | 1243 | // has this step even been started ? |
| 1244 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
| 1244 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
| 1245 | 1245 | ) { |
| 1246 | 1246 | // really? you're half way through this reg step, but you never started it ? |
| 1247 | 1247 | $invalid_TXN = true; |
| 1248 | 1248 | } |
| 1249 | 1249 | } |
| 1250 | - if ( $invalid_TXN ) { |
|
| 1250 | + if ($invalid_TXN) { |
|
| 1251 | 1251 | // is the valid TXN completed ? |
| 1252 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
| 1252 | + if ($valid_TXN instanceof EE_Transaction) { |
|
| 1253 | 1253 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 1254 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 1254 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 1255 | 1255 | // has this step even been started ? |
| 1256 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
| 1257 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
| 1256 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
| 1257 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
| 1258 | 1258 | // so it **looks** like this is a double request from PayPal |
| 1259 | 1259 | // so let's try to pick up where we left off |
| 1260 | 1260 | $this->checkout->transaction = $valid_TXN; |
| 1261 | - $this->checkout->refresh_all_entities( true ); |
|
| 1261 | + $this->checkout->refresh_all_entities(true); |
|
| 1262 | 1262 | return; |
| 1263 | 1263 | } |
| 1264 | 1264 | } |
| 1265 | 1265 | // you appear to be lost? |
| 1266 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
| 1266 | + $this->_redirect_wayward_request($primary_registrant); |
|
| 1267 | 1267 | } |
| 1268 | 1268 | } |
| 1269 | 1269 | } |
@@ -1277,18 +1277,18 @@ discard block |
||
| 1277 | 1277 | * @param \EE_Registration $primary_registrant |
| 1278 | 1278 | * @return bool |
| 1279 | 1279 | */ |
| 1280 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
| 1281 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
| 1280 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
| 1281 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
| 1282 | 1282 | // try redirecting based on the current TXN |
| 1283 | 1283 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null; |
| 1284 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
| 1284 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
| 1285 | 1285 | EE_Error::add_error( |
| 1286 | 1286 | sprintf( |
| 1287 | - __( 'Invalid information was received from the Off-Site Payment Processor and your |
|
| 1287 | + __('Invalid information was received from the Off-Site Payment Processor and your |
|
| 1288 | 1288 | Transaction details could not be retrieved from the database.%1$sPlease try again or contact |
| 1289 | - %2$s for assistance.', 'event_espresso' ), |
|
| 1289 | + %2$s for assistance.', 'event_espresso'), |
|
| 1290 | 1290 | '<br/>', |
| 1291 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 1291 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 1292 | 1292 | ), |
| 1293 | 1293 | __FILE__, __FUNCTION__, __LINE__ |
| 1294 | 1294 | ); |
@@ -1316,12 +1316,12 @@ discard block |
||
| 1316 | 1316 | * @param \EE_Offsite_Gateway $gateway |
| 1317 | 1317 | * @return \EE_Payment |
| 1318 | 1318 | */ |
| 1319 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
| 1319 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
| 1320 | 1320 | try { |
| 1321 | 1321 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
| 1322 | - if ( ! ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() )) { |
|
| 1322 | + if ( ! ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request())) { |
|
| 1323 | 1323 | // get payment details and process results |
| 1324 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
| 1324 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
| 1325 | 1325 | $payment = $payment_processor->process_ipn( |
| 1326 | 1326 | $_REQUEST, |
| 1327 | 1327 | $this->checkout->transaction, |
@@ -1332,14 +1332,14 @@ discard block |
||
| 1332 | 1332 | $payment = $this->checkout->transaction->last_payment(); |
| 1333 | 1333 | //$payment_source = 'last_payment'; |
| 1334 | 1334 | } |
| 1335 | - } catch ( Exception $e ) { |
|
| 1335 | + } catch (Exception $e) { |
|
| 1336 | 1336 | // let's just eat the exception and try to move on using any previously set payment info |
| 1337 | 1337 | $payment = $this->checkout->transaction->last_payment(); |
| 1338 | 1338 | //$payment_source = 'last_payment after Exception'; |
| 1339 | 1339 | // but if we STILL don't have a payment object |
| 1340 | - if ( ! $payment instanceof EE_Payment ) { |
|
| 1340 | + if ( ! $payment instanceof EE_Payment) { |
|
| 1341 | 1341 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
| 1342 | - $this->_handle_payment_processor_exception( $e ); |
|
| 1342 | + $this->_handle_payment_processor_exception($e); |
|
| 1343 | 1343 | } |
| 1344 | 1344 | } |
| 1345 | 1345 | // DEBUG LOG |
@@ -1363,13 +1363,13 @@ discard block |
||
| 1363 | 1363 | * @param EE_Payment $payment |
| 1364 | 1364 | * @return EE_Payment | FALSE |
| 1365 | 1365 | */ |
| 1366 | - private function _process_cancelled_payments( $payment = NULL ) { |
|
| 1366 | + private function _process_cancelled_payments($payment = NULL) { |
|
| 1367 | 1367 | if ( |
| 1368 | - isset( $_REQUEST[ 'ee_cancel_payment' ] ) |
|
| 1368 | + isset($_REQUEST['ee_cancel_payment']) |
|
| 1369 | 1369 | && $payment instanceof EE_Payment |
| 1370 | 1370 | && $payment->status() == EEM_Payment::status_id_failed |
| 1371 | 1371 | ) { |
| 1372 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
| 1372 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
| 1373 | 1373 | } |
| 1374 | 1374 | return $payment; |
| 1375 | 1375 | } |
@@ -1383,27 +1383,27 @@ discard block |
||
| 1383 | 1383 | * @param EE_Payment $payment |
| 1384 | 1384 | * @return EE_Payment | FALSE |
| 1385 | 1385 | */ |
| 1386 | - private function _validate_payment( $payment = NULL ) { |
|
| 1387 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
| 1386 | + private function _validate_payment($payment = NULL) { |
|
| 1387 | + if ($this->checkout->payment_method->is_off_line()) { |
|
| 1388 | 1388 | return TRUE; |
| 1389 | 1389 | } |
| 1390 | 1390 | // verify payment object |
| 1391 | - if ( $payment instanceof EE_Payment ) { |
|
| 1391 | + if ($payment instanceof EE_Payment) { |
|
| 1392 | 1392 | if ( |
| 1393 | 1393 | $payment->status() != EEM_Payment::status_id_approved |
| 1394 | 1394 | && $payment->status() != EEM_Payment::status_id_pending |
| 1395 | 1395 | && $payment->status() != EEM_Payment::status_id_cancelled |
| 1396 | 1396 | && $payment->gateway_response() != '' |
| 1397 | 1397 | ) { |
| 1398 | - EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1398 | + EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__); |
|
| 1399 | 1399 | } |
| 1400 | 1400 | } else { |
| 1401 | 1401 | // not a payment |
| 1402 | 1402 | EE_Error::add_error( |
| 1403 | 1403 | sprintf( |
| 1404 | - __( 'A valid payment was not generated due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
| 1404 | + __('A valid payment was not generated due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
| 1405 | 1405 | '<br/>', |
| 1406 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 1406 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 1407 | 1407 | ), __FILE__, __FUNCTION__, __LINE__ |
| 1408 | 1408 | ); |
| 1409 | 1409 | return FALSE; |
@@ -1420,22 +1420,22 @@ discard block |
||
| 1420 | 1420 | * @param EE_Payment $payment |
| 1421 | 1421 | * @return bool |
| 1422 | 1422 | */ |
| 1423 | - private function _post_payment_processing( $payment = NULL ) { |
|
| 1423 | + private function _post_payment_processing($payment = NULL) { |
|
| 1424 | 1424 | // On-Site payment? |
| 1425 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
| 1426 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) { |
|
| 1425 | + if ($this->checkout->payment_method->is_on_site()) { |
|
| 1426 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
| 1427 | 1427 | //$this->_setup_redirect_for_next_step(); |
| 1428 | 1428 | $this->checkout->continue_reg = false; |
| 1429 | 1429 | } |
| 1430 | 1430 | // Off-Site payment? |
| 1431 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
| 1431 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
| 1432 | 1432 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
| 1433 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ){ |
|
| 1433 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
| 1434 | 1434 | $this->checkout->redirect = TRUE; |
| 1435 | 1435 | $this->checkout->redirect_form = $payment->redirect_form(); |
| 1436 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
| 1436 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
| 1437 | 1437 | // set JSON response |
| 1438 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
| 1438 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
| 1439 | 1439 | // set cron job for finalizing the TXN |
| 1440 | 1440 | // in case the user does not return from the off-site gateway |
| 1441 | 1441 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -1447,14 +1447,14 @@ discard block |
||
| 1447 | 1447 | $this->checkout->continue_reg = false; |
| 1448 | 1448 | EE_Error::add_error( |
| 1449 | 1449 | sprintf( |
| 1450 | - __( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
| 1450 | + __('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
| 1451 | 1451 | '<br/>', |
| 1452 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 1452 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 1453 | 1453 | ), __FILE__, __FUNCTION__, __LINE__ |
| 1454 | 1454 | ); |
| 1455 | 1455 | } |
| 1456 | 1456 | // Off-Line payment? |
| 1457 | - } else if ( $payment === TRUE ) { |
|
| 1457 | + } else if ($payment === TRUE) { |
|
| 1458 | 1458 | //$this->_setup_redirect_for_next_step(); |
| 1459 | 1459 | return TRUE; |
| 1460 | 1460 | } else { |
@@ -1490,57 +1490,57 @@ discard block |
||
| 1490 | 1490 | * @return bool |
| 1491 | 1491 | * @throws \EE_Error |
| 1492 | 1492 | */ |
| 1493 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
| 1493 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
| 1494 | 1494 | // off-line payment? carry on |
| 1495 | - if ( $payment_occurs == EE_PMT_Base::offline ) { |
|
| 1495 | + if ($payment_occurs == EE_PMT_Base::offline) { |
|
| 1496 | 1496 | return true; |
| 1497 | 1497 | } |
| 1498 | 1498 | // verify payment validity |
| 1499 | - if ( $payment instanceof EE_Payment ) { |
|
| 1499 | + if ($payment instanceof EE_Payment) { |
|
| 1500 | 1500 | $msg = $payment->gateway_response(); |
| 1501 | 1501 | // check results |
| 1502 | - switch ( $payment->status() ) { |
|
| 1502 | + switch ($payment->status()) { |
|
| 1503 | 1503 | |
| 1504 | 1504 | // good payment |
| 1505 | 1505 | case EEM_Payment::status_id_approved : |
| 1506 | - EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1506 | + EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 1507 | 1507 | return TRUE; |
| 1508 | 1508 | break; |
| 1509 | 1509 | |
| 1510 | 1510 | // slow payment |
| 1511 | 1511 | case EEM_Payment::status_id_pending : |
| 1512 | - if ( empty( $msg )) { |
|
| 1513 | - $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' ); |
|
| 1512 | + if (empty($msg)) { |
|
| 1513 | + $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'); |
|
| 1514 | 1514 | } |
| 1515 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1515 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1516 | 1516 | return TRUE; |
| 1517 | 1517 | break; |
| 1518 | 1518 | |
| 1519 | 1519 | // don't wanna payment |
| 1520 | 1520 | case EEM_Payment::status_id_cancelled : |
| 1521 | - if ( empty( $msg )) { |
|
| 1521 | + if (empty($msg)) { |
|
| 1522 | 1522 | $msg = _n( |
| 1523 | 1523 | 'Payment cancelled. Please try again.', |
| 1524 | 1524 | 'Payment cancelled. Please try again or select another method of payment.', |
| 1525 | - count( $this->checkout->available_payment_methods ), |
|
| 1525 | + count($this->checkout->available_payment_methods), |
|
| 1526 | 1526 | 'event_espresso' |
| 1527 | 1527 | ); |
| 1528 | 1528 | } |
| 1529 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1529 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1530 | 1530 | return FALSE; |
| 1531 | 1531 | break; |
| 1532 | 1532 | |
| 1533 | 1533 | // not enough payment |
| 1534 | 1534 | case EEM_Payment::status_id_declined : |
| 1535 | - if ( empty( $msg )) { |
|
| 1535 | + if (empty($msg)) { |
|
| 1536 | 1536 | $msg = _n( |
| 1537 | 1537 | 'We\'re sorry but your payment was declined. Please try again.', |
| 1538 | 1538 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
| 1539 | - count( $this->checkout->available_payment_methods ), |
|
| 1539 | + count($this->checkout->available_payment_methods), |
|
| 1540 | 1540 | 'event_espresso' |
| 1541 | 1541 | ); |
| 1542 | 1542 | } |
| 1543 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1543 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1544 | 1544 | return FALSE; |
| 1545 | 1545 | break; |
| 1546 | 1546 | |
@@ -1553,14 +1553,14 @@ discard block |
||
| 1553 | 1553 | } |
| 1554 | 1554 | // off-site payment gateway responses are too unreliable, so let's just assume that |
| 1555 | 1555 | // the payment processing is just running slower than the registrant's request |
| 1556 | - if ( $payment_occurs == EE_PMT_Base::offsite ) { |
|
| 1556 | + if ($payment_occurs == EE_PMT_Base::offsite) { |
|
| 1557 | 1557 | return true; |
| 1558 | 1558 | } |
| 1559 | 1559 | EE_Error::add_error( |
| 1560 | 1560 | sprintf( |
| 1561 | - __( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
| 1561 | + __('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
| 1562 | 1562 | '<br/>', |
| 1563 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 1563 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 1564 | 1564 | ), |
| 1565 | 1565 | __FILE__, __FUNCTION__, __LINE__ |
| 1566 | 1566 | ); |
@@ -1578,23 +1578,23 @@ discard block |
||
| 1578 | 1578 | public function get_transaction_details_for_gateways() { |
| 1579 | 1579 | $txn_details = array(); |
| 1580 | 1580 | // ya gotta make a choice man |
| 1581 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
| 1581 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
| 1582 | 1582 | $txn_details = array( |
| 1583 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
| 1583 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
| 1584 | 1584 | ); |
| 1585 | 1585 | } |
| 1586 | 1586 | // get EE_Payment_Method object |
| 1587 | 1587 | if ( |
| 1588 | - empty( $txn_details ) && |
|
| 1588 | + empty($txn_details) && |
|
| 1589 | 1589 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
| 1590 | 1590 | ) { |
| 1591 | 1591 | $txn_details = array( |
| 1592 | 1592 | 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, |
| 1593 | - 'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' ) |
|
| 1593 | + 'error' => __('A valid Payment Method could not be determined.', 'event_espresso') |
|
| 1594 | 1594 | ); |
| 1595 | 1595 | } |
| 1596 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
| 1597 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
| 1596 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
| 1597 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
| 1598 | 1598 | $txn_details = array( |
| 1599 | 1599 | 'TXN_ID' => $this->checkout->transaction->ID(), |
| 1600 | 1600 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -1604,7 +1604,7 @@ discard block |
||
| 1604 | 1604 | 'STS_ID' => $this->checkout->transaction->status_ID(), |
| 1605 | 1605 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
| 1606 | 1606 | 'return_url' => $return_url, |
| 1607 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
| 1607 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
| 1608 | 1608 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
| 1609 | 1609 | array( |
| 1610 | 1610 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | ) |
| 1614 | 1614 | ); |
| 1615 | 1615 | } |
| 1616 | - echo json_encode( $txn_details ); |
|
| 1616 | + echo json_encode($txn_details); |
|
| 1617 | 1617 | exit(); |
| 1618 | 1618 | } |
| 1619 | 1619 | |
@@ -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 | |
@@ -601,13 +601,13 @@ discard block |
||
| 601 | 601 | return FALSE; |
| 602 | 602 | } |
| 603 | 603 | if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
| 604 | - EE_Error::add_success( |
|
| 605 | - apply_filters( |
|
| 606 | - 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
| 607 | - sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
| 608 | - ) |
|
| 609 | - ); |
|
| 610 | - } |
|
| 604 | + EE_Error::add_success( |
|
| 605 | + apply_filters( |
|
| 606 | + 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
| 607 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
| 608 | + ) |
|
| 609 | + ); |
|
| 610 | + } |
|
| 611 | 611 | // now generate billing form for selected method of payment |
| 612 | 612 | $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method, FALSE ); |
| 613 | 613 | // fill form with attendee info if applicable |
@@ -639,14 +639,14 @@ discard block |
||
| 639 | 639 | $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction ); |
| 640 | 640 | if ( $billing_form instanceof EE_Billing_Info_Form ) { |
| 641 | 641 | if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
| 642 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
| 643 | - EE_Error::add_success( |
|
| 644 | - apply_filters( |
|
| 645 | - 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
| 646 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
| 647 | - ) |
|
| 648 | - ); |
|
| 649 | - } |
|
| 642 | + if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
| 643 | + EE_Error::add_success( |
|
| 644 | + apply_filters( |
|
| 645 | + 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
| 646 | + sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
| 647 | + ) |
|
| 648 | + ); |
|
| 649 | + } |
|
| 650 | 650 | } |
| 651 | 651 | return apply_filters( |
| 652 | 652 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text"> |
| 2 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_information_pg', sprintf( __('In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', 'event_espresso'), '<br />', '<span class="asterisk">*</span>' )); ?> |
|
| 2 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_information_pg', sprintf(__('In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', 'event_espresso'), '<br />', '<span class="asterisk">*</span>')); ?> |
|
| 3 | 3 | </p> |
| 4 | 4 | |
| 5 | 5 | <?php |
@@ -7,40 +7,40 @@ discard block |
||
| 7 | 7 | $prev_event = ''; |
| 8 | 8 | $prev_ticket = ''; |
| 9 | 9 | |
| 10 | -if ( count( $registrations ) > 0 ) { |
|
| 11 | - foreach ( $registrations as $registration ) { |
|
| 12 | - if ( $registration instanceof EE_Registration ) { |
|
| 10 | +if (count($registrations) > 0) { |
|
| 11 | + foreach ($registrations as $registration) { |
|
| 12 | + if ($registration instanceof EE_Registration) { |
|
| 13 | 13 | $att_nmbr++; |
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | - <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link();?>" class="spco-attendee-panel-dv"> |
|
| 16 | + <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link(); ?>" class="spco-attendee-panel-dv"> |
|
| 17 | 17 | |
| 18 | - <?php if ( $registration->event()->ID() != $prev_event ) { ?> |
|
| 18 | + <?php if ($registration->event()->ID() != $prev_event) { ?> |
|
| 19 | 19 | <h4 id="event_title-<?php echo $registration->event()->ID() ?>" class="big-event-title-hdr"> |
| 20 | 20 | <?php echo $registration->event()->name(); ?> |
| 21 | 21 | </h4> |
| 22 | 22 | <?php } ?> |
| 23 | - <?php if ( $registration->ticket()->ID() != $prev_ticket ) { ?> |
|
| 24 | - <?php if ( ! $revisit ) { ?> |
|
| 23 | + <?php if ($registration->ticket()->ID() != $prev_ticket) { ?> |
|
| 24 | + <?php if ( ! $revisit) { ?> |
|
| 25 | 25 | <div class="spco-ticket-info-dv small-text"> |
| 26 | - <h5><?php _e('Ticket Details', 'event_espresso');?></h5> |
|
| 26 | + <h5><?php _e('Ticket Details', 'event_espresso'); ?></h5> |
|
| 27 | 27 | <table> |
| 28 | 28 | <tr> |
| 29 | - <th scope="col" width=""><?php _e('Ticket Name and Description', 'event_espresso');?></th> |
|
| 30 | - <th scope="col" width="7.5%" class="jst-cntr"><?php _e('Qty', 'event_espresso');?></th> |
|
| 31 | - <th scope="col" width="17.5%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th> |
|
| 32 | - <th scope="col" width="17.5%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th> |
|
| 29 | + <th scope="col" width=""><?php _e('Ticket Name and Description', 'event_espresso'); ?></th> |
|
| 30 | + <th scope="col" width="7.5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th> |
|
| 31 | + <th scope="col" width="17.5%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th> |
|
| 32 | + <th scope="col" width="17.5%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th> |
|
| 33 | 33 | </tr> |
| 34 | 34 | <tr> |
| 35 | 35 | <td> |
| 36 | 36 | <?php |
| 37 | - echo '<span class="spco-ticket-info-name">' . $registration->ticket()->name() . '</span>'; |
|
| 38 | - echo $registration->ticket()->description() ? '<br/><span class="spco-ticket-info-description">' . $registration->ticket()->description() . '</span>' : ''; |
|
| 37 | + echo '<span class="spco-ticket-info-name">'.$registration->ticket()->name().'</span>'; |
|
| 38 | + echo $registration->ticket()->description() ? '<br/><span class="spco-ticket-info-description">'.$registration->ticket()->description().'</span>' : ''; |
|
| 39 | 39 | ?> |
| 40 | 40 | </td> |
| 41 | - <td class="jst-cntr"><?php echo $ticket_count[ $registration->ticket()->ID() ];?></td> |
|
| 42 | - <td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->ticket()->price() );?></td> |
|
| 43 | - <td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->ticket()->price() * $ticket_count[ $registration->ticket()->ID() ] );?></td> |
|
| 41 | + <td class="jst-cntr"><?php echo $ticket_count[$registration->ticket()->ID()]; ?></td> |
|
| 42 | + <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->ticket()->price()); ?></td> |
|
| 43 | + <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->ticket()->price() * $ticket_count[$registration->ticket()->ID()]); ?></td> |
|
| 44 | 44 | </tr> |
| 45 | 45 | </table> |
| 46 | 46 | </div> |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | <?php |
| 51 | 51 | // ATTENDEE QUESTIONS |
| 52 | - $reg_form = EE_Template_Layout::get_subform_name( $registration->reg_url_link() ); |
|
| 52 | + $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link()); |
|
| 53 | 53 | echo ${$reg_form}; |
| 54 | 54 | ?> |
| 55 | 55 | |
@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <p class="spco-attendee-info-not-required-pg smaller-text lt-grey-text"> |
| 2 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __( 'This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso' ));?> |
|
| 2 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __('This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso')); ?> |
|
| 3 | 3 | </p> |
@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <p id="spco-auto-copy-attendee-pg" class="smaller-text lt-grey-text"> |
| 2 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', __('The above information will be used for any additional tickets/attendees.', 'event_espresso' ));?> |
|
| 2 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__auto_copy_attendee_pg', __('The above information will be used for any additional tickets/attendees.', 'event_espresso')); ?> |
|
| 3 | 3 | </p> |
| 4 | 4 | \ No newline at end of file |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <div id="spco-copy-attendee-dv" class="hide-if-no-js"> |
| 2 | 2 | |
| 3 | 3 | <p class="spco-copy-all-attendee-pg"> |
| 4 | - <label class="ee-checkbox-label-before ee-checkbox-label-wide"><?php _e('Use Attendee #1\'s information for ALL attendees', 'event_espresso');?> |
|
| 4 | + <label class="ee-checkbox-label-before ee-checkbox-label-wide"><?php _e('Use Attendee #1\'s information for ALL attendees', 'event_espresso'); ?> |
|
| 5 | 5 | <input id="spco-copy-all-attendee-chk" class="spco-copy-all-attendee-chk ee-do-not-validate" type="checkbox" value="copy-all"> |
| 6 | 6 | </label> |
| 7 | 7 | </p> |
| 8 | 8 | |
| 9 | - <p class="spco-copy-attendee-pg"><?php echo apply_filters( 'FHEE__registration_page_attendee_information__copy_attendee_pg', sprintf( __('This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.', 'event_espresso'), '<strong>', '</strong>' )); ?></p> |
|
| 9 | + <p class="spco-copy-attendee-pg"><?php echo apply_filters('FHEE__registration_page_attendee_information__copy_attendee_pg', sprintf(__('This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.', 'event_espresso'), '<strong>', '</strong>')); ?></p> |
|
| 10 | 10 | |
| 11 | - <a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right" rel="more-attendee-copy-options" ><span class="dashicons dashicons-arrow-right"></span><?php _e('advanced copy options', 'event_espresso');?></a> |
|
| 12 | - <a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right" rel="more-attendee-copy-options" style="display: none;"><span class="dashicons dashicons-arrow-down"></span><?php _e('basic copy options', 'event_espresso');?></a> |
|
| 11 | + <a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right" rel="more-attendee-copy-options" ><span class="dashicons dashicons-arrow-right"></span><?php _e('advanced copy options', 'event_espresso'); ?></a> |
|
| 12 | + <a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right" rel="more-attendee-copy-options" style="display: none;"><span class="dashicons dashicons-arrow-down"></span><?php _e('basic copy options', 'event_espresso'); ?></a> |
|
| 13 | 13 | |
| 14 | 14 | <div id="more-attendee-copy-options-dv" class="" style="display: none;"> |
| 15 | 15 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <?php _e('Only copy the above information to the following selected additional attendees.', 'event_espresso'); ?> |
| 18 | 18 | </p> |
| 19 | 19 | |
| 20 | - <?php foreach ( $spco_copy_attendee_chk as $spco_copy_chk ) { echo $spco_copy_chk; } ?> |
|
| 20 | + <?php foreach ($spco_copy_attendee_chk as $spco_copy_chk) { echo $spco_copy_chk; } ?> |
|
| 21 | 21 | |
| 22 | 22 | </div> |
| 23 | 23 | <div class="clear-float"></div> |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | |
| 2 | - <h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso');?></b></h4> |
|
| 2 | + <h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso'); ?></b></h4> |
|
| 3 | 3 | <ul id="spco-sold-out-events-ul"><?php echo $sold_out_events; ?></ul> |
| 4 | - <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso');?></h6> |
|
| 4 | + <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso'); ?></h6> |
|
| 5 | 5 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
| 6 | 6 | <?php echo $sold_out_events_msg; ?> |
| 7 | 7 | </p> |
| 8 | 8 | |
| 9 | - <?php echo $default_hidden_inputs; ?> |
|
| 10 | - <?php echo $extra_hidden_inputs; ?> |
|
| 9 | + <?php echo $default_hidden_inputs; ?> |
|
| 10 | + <?php echo $extra_hidden_inputs; ?> |
|