@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @access public |
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | - * @return void |
|
128 | + * @return string |
|
129 | 129 | */ |
130 | 130 | public static function comment_feed_join( $SQL ) { |
131 | 131 | global $wpdb; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @access public |
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | - * @return void |
|
149 | + * @return string |
|
150 | 150 | */ |
151 | 151 | public static function comment_feed_where( $SQL ) { |
152 | 152 | global $wp_query, $wpdb; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @access public |
166 | 166 | * @param string $content |
167 | - * @return void |
|
167 | + * @return string |
|
168 | 168 | */ |
169 | 169 | public static function the_event_feed( $content ) { |
170 | 170 | if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @access public |
207 | 207 | * @param string $content |
208 | - * @return void |
|
208 | + * @return string |
|
209 | 209 | */ |
210 | 210 | public static function the_venue_feed( $content ) { |
211 | 211 | if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Feeds |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | public static function set_hooks() { |
44 | - add_action( 'parse_request', array( 'EED_Feeds', 'parse_request' ), 10 ); |
|
45 | - add_filter( 'default_feed', array( 'EED_Feeds', 'default_feed' ), 10, 1 ); |
|
46 | - add_filter( 'comment_feed_join', array( 'EED_Feeds', 'comment_feed_join' ), 10, 2 ); |
|
47 | - add_filter( 'comment_feed_where', array( 'EED_Feeds', 'comment_feed_where' ), 10, 2 ); |
|
44 | + add_action('parse_request', array('EED_Feeds', 'parse_request'), 10); |
|
45 | + add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1); |
|
46 | + add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2); |
|
47 | + add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access public |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param type rss2, atom, rss, rdf, rssjs |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - public static function default_feed( $type = 'rss2' ) { |
|
79 | + public static function default_feed($type = 'rss2') { |
|
80 | 80 | //rss2, atom, rss, rdf, rssjs |
81 | 81 | $type = 'rss2'; |
82 | 82 | return $type; |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | public static function parse_request() { |
95 | - if ( EE_Registry::instance()->REQ->is_set( 'post_type' )) { |
|
95 | + if (EE_Registry::instance()->REQ->is_set('post_type')) { |
|
96 | 96 | // define path to templates |
97 | - define( 'RSS_FEEDS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
97 | + define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
98 | 98 | // what kinda post_type are we dealing with ? |
99 | - switch( EE_Registry::instance()->REQ->get( 'post_type' )) { |
|
99 | + switch (EE_Registry::instance()->REQ->get('post_type')) { |
|
100 | 100 | case 'espresso_events' : |
101 | 101 | // for rss2, atom, rss, rdf |
102 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
103 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
102 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
103 | + add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
104 | 104 | // for json ( also uses the above filter ) |
105 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_event_rssjs_feed' ), 10, 1 ); |
|
105 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1); |
|
106 | 106 | break; |
107 | 107 | case 'espresso_venues' : |
108 | 108 | // for rss2, atom, rss, rdf |
109 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
110 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
109 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
110 | + add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
111 | 111 | // for json ( also uses the above filter ) |
112 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_venue_rssjs_feed' ), 10, 1 ); |
|
112 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1); |
|
113 | 113 | break; |
114 | 114 | } |
115 | 115 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public static function comment_feed_join( $SQL ) { |
|
130 | + public static function comment_feed_join($SQL) { |
|
131 | 131 | global $wpdb; |
132 | 132 | // check for wp_posts table in JOIN clause |
133 | - if ( strpos( $SQL, $wpdb->posts ) !== FALSE ) { |
|
134 | - add_filter( 'EED_Feeds__comment_feed_where__espresso_attendees', '__return_true' ); |
|
133 | + if (strpos($SQL, $wpdb->posts) !== FALSE) { |
|
134 | + add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true'); |
|
135 | 135 | } |
136 | 136 | return $SQL; |
137 | 137 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public static function comment_feed_where( $SQL ) { |
|
151 | + public static function comment_feed_where($SQL) { |
|
152 | 152 | global $wp_query, $wpdb; |
153 | - if ( $wp_query->is_comment_feed && apply_filters( 'EED_Feeds__comment_feed_where__espresso_attendees', FALSE )) { |
|
153 | + if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', FALSE)) { |
|
154 | 154 | $SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'"; |
155 | 155 | } |
156 | 156 | return $SQL; |
@@ -166,16 +166,16 @@ discard block |
||
166 | 166 | * @param string $content |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function the_event_feed( $content ) { |
|
170 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
|
171 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
172 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
169 | + public static function the_event_feed($content) { |
|
170 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) { |
|
171 | + EE_Registry::instance()->load_helper('Event_View'); |
|
172 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
173 | 173 | global $post; |
174 | 174 | $template_args = array( |
175 | 175 | 'EVT_ID' => $post->ID, |
176 | 176 | 'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
177 | 177 | ); |
178 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php', $template_args, TRUE ); |
|
178 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php', $template_args, TRUE); |
|
179 | 179 | } |
180 | 180 | return $content; |
181 | 181 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * @param object $item |
191 | 191 | * @return void |
192 | 192 | */ |
193 | - public static function the_event_rssjs_feed( $item ) { |
|
194 | - if ( is_feed() && isset( $item->description )) { |
|
195 | - $item->description = EED_Feeds::the_event_feed( $item->description ); |
|
193 | + public static function the_event_rssjs_feed($item) { |
|
194 | + if (is_feed() && isset($item->description)) { |
|
195 | + $item->description = EED_Feeds::the_event_feed($item->description); |
|
196 | 196 | } |
197 | 197 | return $item; |
198 | 198 | } |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | * @param string $content |
208 | 208 | * @return void |
209 | 209 | */ |
210 | - public static function the_venue_feed( $content ) { |
|
211 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
|
212 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
213 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
210 | + public static function the_venue_feed($content) { |
|
211 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) { |
|
212 | + EE_Registry::instance()->load_helper('Event_View'); |
|
213 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
214 | 214 | global $post; |
215 | 215 | $template_args = array( |
216 | 216 | 'VNU_ID' => $post->ID, |
217 | 217 | 'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
218 | 218 | ); |
219 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php', $template_args, TRUE ); |
|
219 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php', $template_args, TRUE); |
|
220 | 220 | } |
221 | 221 | return $content; |
222 | 222 | } |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param object $item |
232 | 232 | * @return void |
233 | 233 | */ |
234 | - public static function the_venue_rssjs_feed( $item ) { |
|
235 | - if ( is_feed() && isset( $item->description )) { |
|
236 | - $item->description = EED_Feeds::the_venue_feed( $item->description ); |
|
234 | + public static function the_venue_rssjs_feed($item) { |
|
235 | + if (is_feed() && isset($item->description)) { |
|
236 | + $item->description = EED_Feeds::the_venue_feed($item->description); |
|
237 | 237 | } |
238 | 238 | return $item; |
239 | 239 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -558,7 +558,7 @@ |
||
558 | 558 | * |
559 | 559 | * @param string $payment_status The payment status being matched. |
560 | 560 | * |
561 | - * @return string|bool The payment message type slug matching the status or false if no match. |
|
561 | + * @return string|false The payment message type slug matching the status or false if no match. |
|
562 | 562 | */ |
563 | 563 | protected static function _get_payment_message_type( $payment_status ) { |
564 | 564 | $matches = array( |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return EED_Module |
59 | 59 | */ |
60 | 60 | public static function instance() { |
61 | - return parent::get_instance( __CLASS__ ); |
|
61 | + return parent::get_instance(__CLASS__); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function set_hooks() { |
75 | 75 | //actions |
76 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
77 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 ); |
|
76 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
77 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2); |
|
78 | 78 | //filters |
79 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
80 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
79 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
80 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
81 | 81 | //register routes |
82 | 82 | self::_register_routes(); |
83 | 83 | } |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function set_hooks_admin() { |
92 | 92 | //actions |
93 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
94 | - add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder'), 10 ); |
|
95 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 ); |
|
96 | - add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', array( 'EED_Messages', 'send_newsletter_message'), 10, 2 ); |
|
97 | - add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 ); |
|
93 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
94 | + add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10); |
|
95 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3); |
|
96 | + add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', array('EED_Messages', 'send_newsletter_message'), 10, 2); |
|
97 | + add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10); |
|
98 | 98 | //filters |
99 | - add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 ); |
|
100 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', array( 'EED_Messages', 'process_admin_payment'), 10, 2 ); |
|
101 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
102 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
99 | + add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2); |
|
100 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', array('EED_Messages', 'process_admin_payment'), 10, 2); |
|
101 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
102 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | * @return void |
114 | 114 | */ |
115 | 115 | protected static function _register_routes() { |
116 | - EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' ); |
|
117 | - do_action( 'AHEE__EED_Messages___register_routes' ); |
|
116 | + EE_Config::register_route('msg_url_trigger', 'Messages', 'run'); |
|
117 | + do_action('AHEE__EED_Messages___register_routes'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @throws EE_Error |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function run( $WP ) { |
|
130 | + public function run($WP) { |
|
131 | 131 | |
132 | 132 | $sending_messenger = EE_Registry::instance()->REQ->is_set('snd_msgr') ? EE_Registry::instance()->REQ->get('snd_msgr') : ''; |
133 | 133 | $generating_messenger = EE_Registry::instance()->REQ->is_set('gen_msgr') ? EE_Registry::instance()->REQ->get('gen_msgr') : ''; |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | $data_id = EE_Registry::instance()->REQ->is_set('id') ? (int) EE_Registry::instance()->REQ->get('id') : 0; |
138 | 138 | |
139 | 139 | //verify the needed params are present. |
140 | - if ( empty( $sending_messenger ) || empty( $generating_messenger ) || empty( $message_type ) || empty( $context ) || empty( $token ) ) { |
|
141 | - EE_Error::add_error( __( 'The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
140 | + if (empty($sending_messenger) || empty($generating_messenger) || empty($message_type) || empty($context) || empty($token)) { |
|
141 | + EE_Error::add_error(__('The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | //get the registration: the token will always be the unique REG_url_link saved with a registration. We use that to make sure we retrieve the correct data for the given registration. |
145 | - $registration = EEM_Registration::instance()->get_one( array( array( 'REG_url_link' => $token ) ) ); |
|
145 | + $registration = EEM_Registration::instance()->get_one(array(array('REG_url_link' => $token))); |
|
146 | 146 | //if no registration then bail early. |
147 | - if ( ! $registration instanceof EE_Registration ) { |
|
148 | - EE_Error::add_error( __( 'Unable to complete the request because the token is invalid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
147 | + if ( ! $registration instanceof EE_Registration) { |
|
148 | + EE_Error::add_error(__('Unable to complete the request because the token is invalid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | //ensure controller is loaded |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | // retrieve the data via the handler |
156 | 156 | // Depending on the context and the message type data handler, the data_id will correspond to the specific data handler item we need to retrieve for specific messages |
157 | 157 | // (i.e. a specific payment or specific refund). |
158 | - $data = $this->_get_messages_data_from_url( $generating_messenger, $message_type, $registration, $data_id, $context ); |
|
158 | + $data = $this->_get_messages_data_from_url($generating_messenger, $message_type, $registration, $data_id, $context); |
|
159 | 159 | //make sure we drop generating messenger if both sending and generating are the same. |
160 | 160 | $generating_messenger = $sending_messenger != $generating_messenger ? $generating_messenger : NULL; |
161 | 161 | //now we can trigger the actual sending of the message via the message type. |
162 | - self::$_EEMSG->send_message( $message_type, $data, $sending_messenger, $generating_messenger, $context ); |
|
163 | - } catch ( EE_Error $e ) { |
|
164 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
162 | + self::$_EEMSG->send_message($message_type, $data, $sending_messenger, $generating_messenger, $context); |
|
163 | + } catch (EE_Error $e) { |
|
164 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
165 | 165 | // add specific message for developers if WP_DEBUG in on |
166 | - $error_msg .= '||' . $e->getMessage(); |
|
167 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
166 | + $error_msg .= '||'.$e->getMessage(); |
|
167 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return EE_Messages_Template_Pack |
181 | 181 | */ |
182 | - public static function get_template_pack( $template_pack_name ) { |
|
183 | - if ( isset( self::$_TMP_PACKS[$template_pack_name] ) ) { |
|
182 | + public static function get_template_pack($template_pack_name) { |
|
183 | + if (isset(self::$_TMP_PACKS[$template_pack_name])) { |
|
184 | 184 | return self::$_TMP_PACKS[$template_pack_name]; |
185 | 185 | } |
186 | 186 | |
187 | 187 | //not set yet so let's attempt to get it. |
188 | - $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template_pack_name ) ) ); |
|
188 | + $pack_class = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template_pack_name))); |
|
189 | 189 | |
190 | - if ( ! class_exists( $pack_class ) ) { |
|
190 | + if ( ! class_exists($pack_class)) { |
|
191 | 191 | $pack_class = 'EE_Messages_Template_Pack_Default'; |
192 | - self::$_TMP_PACKS['default'] = empty( self::$_TMP_PACKS['default'] ) ? new $pack_class : self::$_TMP_PACKS['default']; |
|
192 | + self::$_TMP_PACKS['default'] = empty(self::$_TMP_PACKS['default']) ? new $pack_class : self::$_TMP_PACKS['default']; |
|
193 | 193 | return self::$_TMP_PACKS['default']; |
194 | 194 | } else { |
195 | 195 | $pack = new $pack_class; |
@@ -209,27 +209,27 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public static function get_template_packs() { |
211 | 211 | //glob the defaults directory for messages |
212 | - $templates = glob( EE_LIBRARIES . 'messages/defaults/*', GLOB_ONLYDIR ); |
|
212 | + $templates = glob(EE_LIBRARIES.'messages/defaults/*', GLOB_ONLYDIR); |
|
213 | 213 | $template_packs = array(); |
214 | - foreach( $templates as $template_path ) { |
|
214 | + foreach ($templates as $template_path) { |
|
215 | 215 | //grab folder name |
216 | - $template = basename( $template_path ); |
|
216 | + $template = basename($template_path); |
|
217 | 217 | |
218 | 218 | //is this already set? |
219 | - if ( isset( self::$_TMP_PACKS[$template] ) ) |
|
219 | + if (isset(self::$_TMP_PACKS[$template])) |
|
220 | 220 | continue; |
221 | 221 | |
222 | 222 | //setup classname. |
223 | - $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template ) ) ); |
|
223 | + $pack_class = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template))); |
|
224 | 224 | |
225 | - if ( ! class_exists( $pack_class ) ) |
|
225 | + if ( ! class_exists($pack_class)) |
|
226 | 226 | continue; |
227 | 227 | |
228 | 228 | $template_packs[$template] = new $pack_class; |
229 | 229 | } |
230 | 230 | |
231 | - $template_packs = apply_filters( 'FHEE__EED_Messages__get_template_packs__template_packs', $template_packs ); |
|
232 | - self::$_TMP_PACKS = array_merge( self::$_TMP_PACKS, $template_packs ); |
|
231 | + $template_packs = apply_filters('FHEE__EED_Messages__get_template_packs__template_packs', $template_packs); |
|
232 | + self::$_TMP_PACKS = array_merge(self::$_TMP_PACKS, $template_packs); |
|
233 | 233 | return self::$_TMP_PACKS; |
234 | 234 | } |
235 | 235 | |
@@ -251,15 +251,15 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
253 | 253 | */ |
254 | - protected function _get_messages_data_from_url( $generating_messenger, $message_type, EE_Registration $registration, $data_id, $context ) { |
|
254 | + protected function _get_messages_data_from_url($generating_messenger, $message_type, EE_Registration $registration, $data_id, $context) { |
|
255 | 255 | //get message type object then get the correct data setup for that message type. |
256 | - $message_type = self::$_EEMSG->get_active_message_type( $generating_messenger, $message_type ); |
|
256 | + $message_type = self::$_EEMSG->get_active_message_type($generating_messenger, $message_type); |
|
257 | 257 | //if no message type then it likely isn't active for this messenger. |
258 | - if ( ! $message_type instanceof EE_message_type ) { |
|
259 | - throw new EE_Error( sprintf( __('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger ) ); |
|
258 | + if ( ! $message_type instanceof EE_message_type) { |
|
259 | + throw new EE_Error(sprintf(__('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger)); |
|
260 | 260 | } |
261 | 261 | //get data according to data handler requirements |
262 | - return $message_type->get_data_for_context( $context, $registration, $data_id ); |
|
262 | + return $message_type->get_data_for_context($context, $registration, $data_id); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | * @return void |
273 | 273 | */ |
274 | 274 | public static function set_autoloaders() { |
275 | - if ( empty( self::$_MSG_PATHS ) ) { |
|
275 | + if (empty(self::$_MSG_PATHS)) { |
|
276 | 276 | self::_set_messages_paths(); |
277 | 277 | EE_Registry::instance()->load_helper('Autoloader'); |
278 | - foreach ( self::$_MSG_PATHS as $path ) { |
|
279 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path ); |
|
278 | + foreach (self::$_MSG_PATHS as $path) { |
|
279 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | 'shortcodes' |
307 | 307 | ); |
308 | 308 | $paths = array(); |
309 | - foreach ( $dir_ref as $index => $dir ) { |
|
310 | - $paths[$index] = EE_LIBRARIES . $dir; |
|
309 | + foreach ($dir_ref as $index => $dir) { |
|
310 | + $paths[$index] = EE_LIBRARIES.$dir; |
|
311 | 311 | } |
312 | - self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths ); |
|
312 | + self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @return void |
322 | 322 | */ |
323 | 323 | protected static function _load_controller() { |
324 | - if ( ! self::$_EEMSG instanceof EE_messages ) { |
|
324 | + if ( ! self::$_EEMSG instanceof EE_messages) { |
|
325 | 325 | self::set_autoloaders(); |
326 | 326 | self::$_EEMSG = new EE_messages(); |
327 | 327 | } |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | /** |
333 | 333 | * @param EE_Transaction $transaction |
334 | 334 | */ |
335 | - public static function payment_reminder( EE_Transaction $transaction ) { |
|
335 | + public static function payment_reminder(EE_Transaction $transaction) { |
|
336 | 336 | self::_load_controller(); |
337 | - $data = array( $transaction, null ); |
|
338 | - if ( self::$_EEMSG->send_message( 'payment_reminder', $data ) ) { |
|
337 | + $data = array($transaction, null); |
|
338 | + if (self::$_EEMSG->send_message('payment_reminder', $data)) { |
|
339 | 339 | //self::log( |
340 | 340 | // __CLASS__, __FUNCTION__, __LINE__, |
341 | 341 | // $transaction, |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | * @param EE_Payment object |
357 | 357 | * @return void |
358 | 358 | */ |
359 | - public static function payment( EE_Transaction $transaction, EE_Payment $payment ) { |
|
359 | + public static function payment(EE_Transaction $transaction, EE_Payment $payment) { |
|
360 | 360 | self::_load_controller(); |
361 | - $data = array( $transaction, $payment ); |
|
361 | + $data = array($transaction, $payment); |
|
362 | 362 | |
363 | - $message_type = self::_get_payment_message_type( $payment->STS_ID() ); |
|
363 | + $message_type = self::_get_payment_message_type($payment->STS_ID()); |
|
364 | 364 | |
365 | 365 | //if payment amount is less than 0 then switch to payment_refund message type. |
366 | 366 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | //verify this message type is present and active. If it isn't then no message is sent. |
369 | 369 | $active_mts = self::$_EEMSG->get_active_message_types(); |
370 | 370 | |
371 | - $message_type = in_array( $message_type, $active_mts ) ? $message_type : false; |
|
371 | + $message_type = in_array($message_type, $active_mts) ? $message_type : false; |
|
372 | 372 | |
373 | - if ( $message_type ) { |
|
374 | - if ( self::$_EEMSG->send_message( $message_type, $data ) ) { |
|
373 | + if ($message_type) { |
|
374 | + if (self::$_EEMSG->send_message($message_type, $data)) { |
|
375 | 375 | //self::log( |
376 | 376 | // __CLASS__, __FUNCTION__, __LINE__, |
377 | 377 | // $transaction, |
@@ -391,15 +391,15 @@ discard block |
||
391 | 391 | /** |
392 | 392 | * @param EE_Transaction $transaction |
393 | 393 | */ |
394 | - public static function cancelled_registration( EE_Transaction $transaction ) { |
|
394 | + public static function cancelled_registration(EE_Transaction $transaction) { |
|
395 | 395 | self::_load_controller(); |
396 | 396 | |
397 | - $data = array( $transaction, NULL ); |
|
397 | + $data = array($transaction, NULL); |
|
398 | 398 | |
399 | 399 | $active_mts = self::$_EEMSG->get_active_message_types(); |
400 | 400 | |
401 | - if ( in_array( 'cancelled_registration', $active_mts ) ) { |
|
402 | - self::$_EEMSG->send_message( 'cancelled_registration', $data ); |
|
401 | + if (in_array('cancelled_registration', $active_mts)) { |
|
402 | + self::$_EEMSG->send_message('cancelled_registration', $data); |
|
403 | 403 | } |
404 | 404 | return; |
405 | 405 | } |
@@ -414,15 +414,15 @@ discard block |
||
414 | 414 | * @param array $extra_details |
415 | 415 | * @return void |
416 | 416 | */ |
417 | - public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) { |
|
417 | + public static function maybe_registration(EE_Registration $registration, $extra_details = array()) { |
|
418 | 418 | |
419 | - if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) { |
|
419 | + if ( ! self::_verify_registration_notification_send($registration, $extra_details)) { |
|
420 | 420 | //no messages please |
421 | 421 | return; |
422 | 422 | } |
423 | 423 | |
424 | 424 | |
425 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
425 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
426 | 426 | |
427 | 427 | //get all registrations so we make sure we send messages for the right status. |
428 | 428 | $all_registrations = $registration->transaction()->registrations(); |
@@ -431,19 +431,19 @@ discard block |
||
431 | 431 | $statuses_sent = array(); |
432 | 432 | |
433 | 433 | //loop through registrations and trigger messages once per status. |
434 | - foreach ( $all_registrations as $reg ) { |
|
434 | + foreach ($all_registrations as $reg) { |
|
435 | 435 | |
436 | 436 | //already triggered? |
437 | - if ( in_array( $reg->status_ID(), $statuses_sent ) ) { |
|
437 | + if (in_array($reg->status_ID(), $statuses_sent)) { |
|
438 | 438 | continue; |
439 | 439 | } |
440 | 440 | |
441 | - $message_type = self::_get_reg_status_array( $reg->status_ID() ); |
|
442 | - if ( EEH_MSG_Template::is_mt_active( $message_type ) ) { |
|
441 | + $message_type = self::_get_reg_status_array($reg->status_ID()); |
|
442 | + if (EEH_MSG_Template::is_mt_active($message_type)) { |
|
443 | 443 | self::_load_controller(); |
444 | 444 | |
445 | 445 | //send away, send away, uhhuh |
446 | - if ( self::$_EEMSG->send_message( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) ) ) { |
|
446 | + if (self::$_EEMSG->send_message($message_type, array($registration->transaction(), null, $reg->status_ID()))) { |
|
447 | 447 | // DEBUG LOG |
448 | 448 | // self::log( |
449 | 449 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -462,9 +462,9 @@ discard block |
||
462 | 462 | } |
463 | 463 | |
464 | 464 | //now send summary (registration_summary) if active |
465 | - if ( EEH_MSG_Template::is_mt_active( 'registration_summary' ) ) { |
|
465 | + if (EEH_MSG_Template::is_mt_active('registration_summary')) { |
|
466 | 466 | self::_load_controller(); |
467 | - if ( self::$_EEMSG->send_message( 'registration_summary', array( $registration->transaction(), null ) ) ) { |
|
467 | + if (self::$_EEMSG->send_message('registration_summary', array($registration->transaction(), null))) { |
|
468 | 468 | // DEBUG LOG |
469 | 469 | // self::log( |
470 | 470 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -490,39 +490,39 @@ discard block |
||
490 | 490 | * |
491 | 491 | * @return bool true = send away, false = nope halt the presses. |
492 | 492 | */ |
493 | - protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) { |
|
493 | + protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { |
|
494 | 494 | //self::log( |
495 | 495 | // __CLASS__, __FUNCTION__, __LINE__, |
496 | 496 | // $registration->transaction(), |
497 | 497 | // array( '$extra_details' => $extra_details ) |
498 | 498 | //); |
499 | 499 | // currently only using this to send messages for the primary registrant |
500 | - if ( ! $registration->is_primary_registrant() ) { |
|
500 | + if ( ! $registration->is_primary_registrant()) { |
|
501 | 501 | return false; |
502 | 502 | } |
503 | 503 | // first we check if we're in admin and not doing front ajax |
504 | - if ( is_admin() && ! EE_FRONT_AJAX ) { |
|
504 | + if (is_admin() && ! EE_FRONT_AJAX) { |
|
505 | 505 | //make sure appropriate admin params are set for sending messages |
506 | - if ( empty( $_REQUEST[ 'txn_reg_status_change' ][ 'send_notifications' ] ) || ! absint( $_REQUEST[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
506 | + if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) { |
|
507 | 507 | //no messages sent please. |
508 | 508 | return false; |
509 | 509 | } |
510 | 510 | } else { |
511 | 511 | // frontend request (either regular or via AJAX) |
512 | 512 | // TXN is NOT finalized ? |
513 | - if ( ! isset( $extra_details[ 'finalized' ] ) || $extra_details[ 'finalized' ] === false ) { |
|
513 | + if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) { |
|
514 | 514 | return false; |
515 | 515 | } |
516 | 516 | // return visit but nothing changed ??? |
517 | 517 | if ( |
518 | - isset( $extra_details[ 'revisit' ], $extra_details[ 'status_updates' ] ) && |
|
519 | - $extra_details[ 'revisit' ] && ! $extra_details[ 'status_updates' ] |
|
518 | + isset($extra_details['revisit'], $extra_details['status_updates']) && |
|
519 | + $extra_details['revisit'] && ! $extra_details['status_updates'] |
|
520 | 520 | ) { |
521 | 521 | return false; |
522 | 522 | } |
523 | 523 | // NOT sending messages && reg status is something other than "Not-Approved" |
524 | 524 | if ( |
525 | - ! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) && |
|
525 | + ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && |
|
526 | 526 | $registration->status_ID() !== EEM_Registration::status_id_not_approved |
527 | 527 | ) { |
528 | 528 | return false; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * @param string $reg_status |
541 | 541 | * @return array |
542 | 542 | */ |
543 | - protected static function _get_reg_status_array( $reg_status = '' ) { |
|
543 | + protected static function _get_reg_status_array($reg_status = '') { |
|
544 | 544 | $reg_status_array = array( |
545 | 545 | EEM_Registration::status_id_approved => 'registration', |
546 | 546 | EEM_Registration::status_id_pending_payment => 'pending_approval', |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | EEM_Registration::status_id_cancelled => 'cancelled_registration', |
549 | 549 | EEM_Registration::status_id_declined => 'declined_registration' |
550 | 550 | ); |
551 | - return isset( $reg_status_array[ $reg_status ] ) ? $reg_status_array[ $reg_status ] : $reg_status_array; |
|
551 | + return isset($reg_status_array[$reg_status]) ? $reg_status_array[$reg_status] : $reg_status_array; |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @return string|bool The payment message type slug matching the status or false if no match. |
562 | 562 | */ |
563 | - protected static function _get_payment_message_type( $payment_status ) { |
|
563 | + protected static function _get_payment_message_type($payment_status) { |
|
564 | 564 | $matches = array( |
565 | 565 | EEM_Payment::status_id_approved => 'payment', |
566 | 566 | EEM_Payment::status_id_pending => 'payment_pending', |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | EEM_Payment::status_id_failed => 'payment_failed' |
570 | 570 | ); |
571 | 571 | |
572 | - return isset( $matches[$payment_status] ) ? $matches[$payment_status] : false; |
|
572 | + return isset($matches[$payment_status]) ? $matches[$payment_status] : false; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -582,22 +582,22 @@ discard block |
||
582 | 582 | * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages |
583 | 583 | * @return bool success/fail |
584 | 584 | */ |
585 | - public static function process_resend( $req_data ) { |
|
585 | + public static function process_resend($req_data) { |
|
586 | 586 | $regs_to_send = array(); |
587 | 587 | |
588 | 588 | //first let's make sure we have the reg id (needed for resending!); |
589 | - if ( ! isset( $req_data['_REG_ID'] ) ) { |
|
590 | - EE_Error::add_error( __('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
589 | + if ( ! isset($req_data['_REG_ID'])) { |
|
590 | + EE_Error::add_error(__('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
591 | 591 | return false; |
592 | 592 | } |
593 | 593 | |
594 | 594 | //if $req_data['_REG_ID'] is an array then let's group the registrations by transaction and reg status |
595 | 595 | // so we can only trigger messages per group. |
596 | - if ( is_array( $req_data['_REG_ID'] ) ) { |
|
597 | - foreach ( $req_data['_REG_ID'] as $reg_id ) { |
|
598 | - $reg = EE_Registry::instance()->load_model( 'Registration' )->get_one_by_ID( $reg_id ); |
|
599 | - if ( ! $reg instanceof EE_Registration ) { |
|
600 | - EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) ); |
|
596 | + if (is_array($req_data['_REG_ID'])) { |
|
597 | + foreach ($req_data['_REG_ID'] as $reg_id) { |
|
598 | + $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($reg_id); |
|
599 | + if ( ! $reg instanceof EE_Registration) { |
|
600 | + EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'])); |
|
601 | 601 | return false; |
602 | 602 | } |
603 | 603 | $regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg; |
@@ -605,11 +605,11 @@ discard block |
||
605 | 605 | } else { |
606 | 606 | //we have a single registration id, so let's see if we can get a EE_Registration from it, and if so set it up for sending. |
607 | 607 | //get reg object from reg_id |
608 | - $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID( $req_data['_REG_ID'] ); |
|
608 | + $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($req_data['_REG_ID']); |
|
609 | 609 | |
610 | 610 | //if no reg object then send error |
611 | - if ( ! $reg instanceof EE_Registration ) { |
|
612 | - EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) ); |
|
611 | + if ( ! $reg instanceof EE_Registration) { |
|
612 | + EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'])); |
|
613 | 613 | return false; |
614 | 614 | } |
615 | 615 | |
@@ -621,26 +621,26 @@ discard block |
||
621 | 621 | $active_mts = self::$_EEMSG->get_active_message_types(); |
622 | 622 | $success = false; |
623 | 623 | //loop through and send! |
624 | - foreach( $regs_to_send as $status_group ) { |
|
625 | - foreach ( $status_group as $status_id => $registrations ) { |
|
626 | - if ( ! in_array( $status_match_array[ $status_id ], $active_mts ) ) { |
|
624 | + foreach ($regs_to_send as $status_group) { |
|
625 | + foreach ($status_group as $status_id => $registrations) { |
|
626 | + if ( ! in_array($status_match_array[$status_id], $active_mts)) { |
|
627 | 627 | EE_Error::add_error( |
628 | 628 | sprintf( |
629 | 629 | __('Cannot resend the message for this registration because the corresponding message type (%1$s) is not active. If you wish to send messages for this message type then please activate it by visiting the %2$sMessages Admin Page%3$s.', 'event_espresso'), |
630 | - $status_match_array[ $reg->status_ID() ], |
|
631 | - '<a href="' . admin_url('admin.php?page=espresso_messages&action=settings') . '">', |
|
630 | + $status_match_array[$reg->status_ID()], |
|
631 | + '<a href="'.admin_url('admin.php?page=espresso_messages&action=settings').'">', |
|
632 | 632 | '</a>' |
633 | 633 | ) |
634 | 634 | ); |
635 | 635 | return false; |
636 | 636 | } |
637 | 637 | |
638 | - if ( self::$_EEMSG->send_message( $status_match_array[$status_id], array( $registrations, $status_id ) ) ) { |
|
638 | + if (self::$_EEMSG->send_message($status_match_array[$status_id], array($registrations, $status_id))) { |
|
639 | 639 | EE_Error::overwrite_success(); |
640 | - EE_Error::add_success( __('The message for this registration has been re-sent', 'event_espresso') ); |
|
640 | + EE_Error::add_success(__('The message for this registration has been re-sent', 'event_espresso')); |
|
641 | 641 | $success = true; |
642 | 642 | } else { |
643 | - EE_Error::add_error( __('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
643 | + EE_Error::add_error(__('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | } |
@@ -662,12 +662,12 @@ discard block |
||
662 | 662 | * @param EE_Payment $payment EE_payment object |
663 | 663 | * @return bool success/fail |
664 | 664 | */ |
665 | - public static function process_admin_payment( $success = TRUE, EE_Payment $payment ) { |
|
665 | + public static function process_admin_payment($success = TRUE, EE_Payment $payment) { |
|
666 | 666 | //we need to get the transaction object |
667 | 667 | $transaction = $payment->transaction(); |
668 | - if ( $transaction instanceof EE_Transaction ) { |
|
669 | - $data = array( $transaction, $payment ); |
|
670 | - $message_type = self::_get_payment_message_type( $payment->STS_ID() ); |
|
668 | + if ($transaction instanceof EE_Transaction) { |
|
669 | + $data = array($transaction, $payment); |
|
670 | + $message_type = self::_get_payment_message_type($payment->STS_ID()); |
|
671 | 671 | |
672 | 672 | //if payment amount is less than 0 then switch to payment_refund message type. |
673 | 673 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -678,18 +678,18 @@ discard block |
||
678 | 678 | self::_load_controller(); |
679 | 679 | //verify this message type is present and active. If it isn't then no message is sent. |
680 | 680 | $active_mts = self::$_EEMSG->get_active_message_types(); |
681 | - $message_type = in_array( $message_type, $active_mts ) ? $message_type : false; |
|
681 | + $message_type = in_array($message_type, $active_mts) ? $message_type : false; |
|
682 | 682 | |
683 | 683 | |
684 | - if ( $message_type ) { |
|
684 | + if ($message_type) { |
|
685 | 685 | |
686 | - $success = self::$_EEMSG->send_message( $message_type, $data ); |
|
687 | - if ( ! $success ) { |
|
688 | - EE_Error::add_error( __('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
686 | + $success = self::$_EEMSG->send_message($message_type, $data); |
|
687 | + if ( ! $success) { |
|
688 | + EE_Error::add_error(__('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | } else { |
692 | - EE_Error::add_error( __('The message type for the status of this payment is not active or does not exist, so no notification was sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
692 | + EE_Error::add_error(__('The message type for the status of this payment is not active or does not exist, so no notification was sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | } |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | * @param int $grp_id a specific message template group id. |
708 | 708 | * @return void |
709 | 709 | */ |
710 | - public static function send_newsletter_message( $contacts, $grp_id ) { |
|
710 | + public static function send_newsletter_message($contacts, $grp_id) { |
|
711 | 711 | //make sure mtp is id and set it in the EE_Request Handler later messages setup. |
712 | - EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id ); |
|
712 | + EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id); |
|
713 | 713 | |
714 | 714 | self::_load_controller(); |
715 | 715 | self::$_EEMSG->send_message('newsletter', $contacts); |
@@ -727,10 +727,10 @@ discard block |
||
727 | 727 | * @param string $message_type |
728 | 728 | * @return string |
729 | 729 | */ |
730 | - public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) { |
|
730 | + public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { |
|
731 | 731 | EE_Registry::instance()->load_helper('MSG_Template'); |
732 | 732 | // whitelist $messenger |
733 | - switch ( $messenger ) { |
|
733 | + switch ($messenger) { |
|
734 | 734 | case 'pdf' : |
735 | 735 | $sending_messenger = 'pdf'; |
736 | 736 | $generating_messenger = 'html'; |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | break; |
743 | 743 | } |
744 | 744 | // whitelist $message_type |
745 | - switch ( $message_type ) { |
|
745 | + switch ($message_type) { |
|
746 | 746 | case 'receipt' : |
747 | 747 | $message_type = 'receipt'; |
748 | 748 | break; |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | break; |
753 | 753 | } |
754 | 754 | // verify that both the messenger AND the message type are active |
755 | - if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type )) { |
|
755 | + if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { |
|
756 | 756 | //need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?) |
757 | 757 | $template_query_params = array( |
758 | 758 | 'MTP_is_active' => TRUE, |
@@ -761,16 +761,16 @@ discard block |
||
761 | 761 | 'Event.EVT_ID' => $registration->event_ID() |
762 | 762 | ); |
763 | 763 | //get the message template group. |
764 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params )); |
|
764 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
765 | 765 | //if we don't have an EE_Message_Template_Group then return |
766 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
766 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
767 | 767 | // remove EVT_ID from query params so that global templates get picked up |
768 | - unset( $template_query_params[ 'Event.EVT_ID' ] ); |
|
768 | + unset($template_query_params['Event.EVT_ID']); |
|
769 | 769 | //get global template as the fallback |
770 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params )); |
|
770 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
771 | 771 | } |
772 | 772 | //if we don't have an EE_Message_Template_Group then return |
773 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
773 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
774 | 774 | return ''; |
775 | 775 | } |
776 | 776 | // generate the URL |
@@ -800,17 +800,17 @@ discard block |
||
800 | 800 | * @param array $info |
801 | 801 | * @param bool $display_request |
802 | 802 | */ |
803 | - protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) { |
|
803 | + protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { |
|
804 | 804 | EE_Registry::instance()->load_helper('Debug_Tools'); |
805 | - if ( WP_DEBUG && false ) { |
|
806 | - if ( $transaction instanceof EE_Transaction ) { |
|
805 | + if (WP_DEBUG && false) { |
|
806 | + if ($transaction instanceof EE_Transaction) { |
|
807 | 807 | // don't serialize objects |
808 | - $info = EEH_Debug_Tools::strip_objects( $info ); |
|
809 | - $info[ 'TXN_status' ] = $transaction->status_ID(); |
|
810 | - $info[ 'TXN_reg_steps' ] = $transaction->reg_steps(); |
|
811 | - if ( $transaction->ID() ) { |
|
812 | - $index = 'EE_Transaction: ' . $transaction->ID(); |
|
813 | - EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index ); |
|
808 | + $info = EEH_Debug_Tools::strip_objects($info); |
|
809 | + $info['TXN_status'] = $transaction->status_ID(); |
|
810 | + $info['TXN_reg_steps'] = $transaction->reg_steps(); |
|
811 | + if ($transaction->ID()) { |
|
812 | + $index = 'EE_Transaction: '.$transaction->ID(); |
|
813 | + EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); |
|
814 | 814 | } |
815 | 815 | } |
816 | 816 | } |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage modules, messages |
8 | 8 | */ |
9 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
10 | + exit('No direct script access allowed'); |
|
11 | +} |
|
10 | 12 | /** |
11 | 13 | * |
12 | 14 | * Messages module. Takes care of registering all the triggers for messages. |
@@ -216,14 +218,16 @@ discard block |
||
216 | 218 | $template = basename( $template_path ); |
217 | 219 | |
218 | 220 | //is this already set? |
219 | - if ( isset( self::$_TMP_PACKS[$template] ) ) |
|
220 | - continue; |
|
221 | + if ( isset( self::$_TMP_PACKS[$template] ) ) { |
|
222 | + continue; |
|
223 | + } |
|
221 | 224 | |
222 | 225 | //setup classname. |
223 | 226 | $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template ) ) ); |
224 | 227 | |
225 | - if ( ! class_exists( $pack_class ) ) |
|
226 | - continue; |
|
228 | + if ( ! class_exists( $pack_class ) ) { |
|
229 | + continue; |
|
230 | + } |
|
227 | 231 | |
228 | 232 | $template_packs[$template] = new $pack_class; |
229 | 233 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * process_registration_from_admin |
297 | 297 | * |
298 | 298 | * @access public |
299 | - * @return int |
|
299 | + * @return EE_Transaction |
|
300 | 300 | */ |
301 | 301 | public static function process_registration_from_admin() { |
302 | 302 | EED_Single_Page_Checkout::load_reg_steps(); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | * _get_transaction_and_cart_for_previous_visit |
631 | 631 | * |
632 | 632 | * @access private |
633 | - * @return mixed EE_Transaction|NULL |
|
633 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
634 | 634 | */ |
635 | 635 | private function _get_transaction_and_cart_for_previous_visit() { |
636 | 636 | /** @var $TXN_model EEM_Transaction */ |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
688 | 688 | * |
689 | 689 | * @access private |
690 | - * @return EE_Transaction |
|
690 | + * @return EE_Attendee|null |
|
691 | 691 | */ |
692 | 692 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
693 | 693 | // if there's no transaction, then this is the FIRST visit to SPCO |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
714 | 714 | * |
715 | 715 | * @access private |
716 | - * @return mixed EE_Transaction|NULL |
|
716 | + * @return EE_Attendee|null EE_Transaction|NULL |
|
717 | 717 | */ |
718 | 718 | private function _initialize_transaction() { |
719 | 719 | try { |
@@ -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 | * Single Page Checkout (SPCO) |
4 | 6 | * |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -198,31 +198,31 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function load_reg_steps() { |
200 | 200 | static $reg_steps_loaded = FALSE; |
201 | - if ( $reg_steps_loaded ) { |
|
201 | + if ($reg_steps_loaded) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | // load EE_SPCO_Reg_Step base class |
205 | 205 | // EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class' ); |
206 | 206 | // filter list of reg_steps |
207 | - $reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() ); |
|
207 | + $reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps()); |
|
208 | 208 | // sort by key (order) |
209 | - ksort( $reg_steps_to_load ); |
|
209 | + ksort($reg_steps_to_load); |
|
210 | 210 | // loop through folders |
211 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
211 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
212 | 212 | // we need a |
213 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
213 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
214 | 214 | // copy over to the reg_steps_array |
215 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
215 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
216 | 216 | // register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now ) |
217 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
217 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
218 | 218 | // add AJAX or other hooks |
219 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
219 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
220 | 220 | // setup autoloaders if necessary |
221 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
221 | + if ( ! class_exists($reg_step['class_name'])) { |
|
222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
223 | 223 | } |
224 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
225 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
224 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
225 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | } |
@@ -241,28 +241,28 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public static function get_reg_steps() { |
243 | 243 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
244 | - if ( empty( $reg_steps )) { |
|
244 | + if (empty($reg_steps)) { |
|
245 | 245 | $reg_steps = array( |
246 | 246 | 10 => array( |
247 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
247 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
248 | 248 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
249 | 249 | 'slug' => 'attendee_information', |
250 | 250 | 'has_hooks' => FALSE |
251 | 251 | ), |
252 | 252 | 20 => array( |
253 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
253 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
254 | 254 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
255 | 255 | 'slug' => 'registration_confirmation', |
256 | 256 | 'has_hooks' => FALSE |
257 | 257 | ), |
258 | 258 | 30 => array( |
259 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
259 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
260 | 260 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
261 | 261 | 'slug' => 'payment_options', |
262 | 262 | 'has_hooks' => TRUE |
263 | 263 | ), |
264 | 264 | 999 => array( |
265 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
265 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
266 | 266 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
267 | 267 | 'slug' => 'finalize_registration', |
268 | 268 | 'has_hooks' => FALSE |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public static function registration_checkout_for_admin() { |
284 | 284 | EED_Single_Page_Checkout::load_reg_steps(); |
285 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
286 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
287 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
285 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
286 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
287 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
288 | 288 | EED_Single_Page_Checkout::instance()->_initialize(); |
289 | 289 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
290 | 290 | return EE_Registry::instance()->REQ->get_output(); |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public static function process_registration_from_admin() { |
302 | 302 | EED_Single_Page_Checkout::load_reg_steps(); |
303 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
304 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
305 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
303 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
304 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
305 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
306 | 306 | EED_Single_Page_Checkout::instance()->_initialize(); |
307 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
308 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
309 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
310 | - if ( $final_reg_step->process_reg_step() ) { |
|
307 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
308 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
309 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
310 | + if ($final_reg_step->process_reg_step()) { |
|
311 | 311 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
312 | 312 | } |
313 | 313 | } |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | * @param WP_Query $WP_Query |
325 | 325 | * @return void |
326 | 326 | */ |
327 | - public function run( $WP_Query ) { |
|
328 | - if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) { |
|
327 | + public function run($WP_Query) { |
|
328 | + if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) { |
|
329 | 329 | $this->_initialize(); |
330 | 330 | } |
331 | 331 | } |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * @param WP_Query $WP_Query |
341 | 341 | * @return void |
342 | 342 | */ |
343 | - public static function init( $WP_Query ) { |
|
344 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
343 | + public static function init($WP_Query) { |
|
344 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -355,32 +355,32 @@ discard block |
||
355 | 355 | */ |
356 | 356 | private function _initialize() { |
357 | 357 | // ensure SPCO doesn't run twice |
358 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
358 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
359 | 359 | return; |
360 | 360 | } |
361 | 361 | // setup the EE_Checkout object |
362 | 362 | $this->checkout = $this->_initialize_checkout(); |
363 | 363 | // filter checkout |
364 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
364 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
365 | 365 | // get the $_GET |
366 | 366 | $this->_get_request_vars(); |
367 | 367 | // filter continue_reg |
368 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
368 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
369 | 369 | // load the reg steps array |
370 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
370 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
371 | 371 | EED_Single_Page_Checkout::$_initialized = true; |
372 | 372 | return; |
373 | 373 | } |
374 | 374 | // set the current step |
375 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
375 | + $this->checkout->set_current_step($this->checkout->step); |
|
376 | 376 | // and the next step |
377 | 377 | $this->checkout->set_next_step(); |
378 | 378 | // was there already a valid transaction in the checkout from the session ? |
379 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
379 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
380 | 380 | // get transaction from db or session |
381 | 381 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
382 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
383 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
382 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
383 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
384 | 384 | // add some style and make it dance |
385 | 385 | $this->checkout->transaction = EE_Transaction::new_instance(); |
386 | 386 | $this->add_styles_and_scripts(); |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | return; |
389 | 389 | } |
390 | 390 | // and the registrations for the transaction |
391 | - $this->_get_registrations( $this->checkout->transaction ); |
|
391 | + $this->_get_registrations($this->checkout->transaction); |
|
392 | 392 | } |
393 | 393 | // verify that everything has been setup correctly |
394 | - if ( ! $this->_final_verifications() ) { |
|
394 | + if ( ! $this->_final_verifications()) { |
|
395 | 395 | EED_Single_Page_Checkout::$_initialized = true; |
396 | 396 | return; |
397 | 397 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | // set no cache headers and constants |
417 | 417 | EE_System::do_not_cache(); |
418 | 418 | // remove transaction lock |
419 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
419 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
@@ -433,20 +433,20 @@ discard block |
||
433 | 433 | // look in session for existing checkout |
434 | 434 | $checkout = EE_Registry::instance()->SSN->checkout(); |
435 | 435 | // verify |
436 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
436 | + if ( ! $checkout instanceof EE_Checkout) { |
|
437 | 437 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
438 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
438 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
439 | 439 | // verify again |
440 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
441 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
440 | + if ( ! $checkout instanceof EE_Checkout) { |
|
441 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
442 | 442 | } |
443 | 443 | } else { |
444 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
445 | - wp_safe_redirect( $checkout->redirect_url ); |
|
444 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
445 | + wp_safe_redirect($checkout->redirect_url); |
|
446 | 446 | exit(); |
447 | 447 | } |
448 | 448 | } |
449 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
449 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
450 | 450 | // reset anything that needs a clean slate for each request |
451 | 451 | $checkout->reset_for_current_request(); |
452 | 452 | return $checkout; |
@@ -464,22 +464,22 @@ discard block |
||
464 | 464 | // load classes |
465 | 465 | EED_Single_Page_Checkout::load_request_handler(); |
466 | 466 | //make sure this request is marked as belonging to EE |
467 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
467 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
468 | 468 | // which step is being requested ? |
469 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
469 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
470 | 470 | // which step is being edited ? |
471 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
471 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
472 | 472 | // and what we're doing on the current step |
473 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
473 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
474 | 474 | // returning to edit ? |
475 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
475 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
476 | 476 | // or some other kind of revisit ? |
477 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
477 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
478 | 478 | // and whether or not to generate a reg form for this request |
479 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
479 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
480 | 480 | // and whether or not to process a reg form submission for this request |
481 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
482 | - $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
481 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
482 | + $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
483 | 483 | //$this->_display_request_vars(); |
484 | 484 | } |
485 | 485 | |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | * @return array |
495 | 495 | */ |
496 | 496 | protected function _display_request_vars() { |
497 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
498 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
499 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
500 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
501 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
502 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
503 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
504 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
497 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
498 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
499 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
500 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
501 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
502 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
503 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
504 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | * @return array |
516 | 516 | */ |
517 | 517 | private function _get_first_step() { |
518 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
519 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
518 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
519 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -532,37 +532,37 @@ discard block |
||
532 | 532 | private function _load_and_instantiate_reg_steps() { |
533 | 533 | // have reg_steps already been instantiated ? |
534 | 534 | if ( |
535 | - empty( $this->checkout->reg_steps ) || |
|
536 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
535 | + empty($this->checkout->reg_steps) || |
|
536 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
537 | 537 | ) { |
538 | 538 | // if not, then loop through raw reg steps array |
539 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
540 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
539 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
540 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
541 | 541 | return false; |
542 | 542 | } |
543 | 543 | } |
544 | 544 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
545 | 545 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
546 | 546 | // skip the registration_confirmation page ? |
547 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
547 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
548 | 548 | // just remove it from the reg steps array |
549 | - $this->checkout->remove_reg_step( 'registration_confirmation' ); |
|
550 | - } else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( $this->checkout->reg_steps['registration_confirmation'] )) { |
|
549 | + $this->checkout->remove_reg_step('registration_confirmation'); |
|
550 | + } else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) { |
|
551 | 551 | // set the order to something big like 100 |
552 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
552 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
553 | 553 | } |
554 | 554 | // filter the array for good luck |
555 | - $this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps ); |
|
555 | + $this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps); |
|
556 | 556 | // finally re-sort based on the reg step class order properties |
557 | 557 | $this->checkout->sort_reg_steps(); |
558 | 558 | } else { |
559 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
559 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
560 | 560 | // set all current step stati to FALSE |
561 | - $reg_step->set_is_current_step( FALSE ); |
|
561 | + $reg_step->set_is_current_step(FALSE); |
|
562 | 562 | } |
563 | 563 | } |
564 | - if ( empty( $this->checkout->reg_steps )) { |
|
565 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
564 | + if (empty($this->checkout->reg_steps)) { |
|
565 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
566 | 566 | return false; |
567 | 567 | } |
568 | 568 | // make reg step details available to JS |
@@ -580,34 +580,34 @@ discard block |
||
580 | 580 | * @param int $order |
581 | 581 | * @return bool |
582 | 582 | */ |
583 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
583 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
584 | 584 | |
585 | 585 | // we need a file_path, class_name, and slug to add a reg step |
586 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
586 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
587 | 587 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
588 | - if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) { |
|
588 | + if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') { |
|
589 | 589 | return true; |
590 | 590 | } |
591 | 591 | // instantiate step class using file path and class name |
592 | - $reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE ); |
|
592 | + $reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE); |
|
593 | 593 | // did we gets the goods ? |
594 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
594 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
595 | 595 | // set reg step order based on config |
596 | - $reg_step_obj->set_order( $order ); |
|
596 | + $reg_step_obj->set_order($order); |
|
597 | 597 | // add instantiated reg step object to the master reg steps array |
598 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
598 | + $this->checkout->add_reg_step($reg_step_obj); |
|
599 | 599 | } else { |
600 | - EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
600 | + EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
601 | 601 | return false; |
602 | 602 | } |
603 | 603 | } else { |
604 | - if ( WP_DEBUG ) { |
|
604 | + if (WP_DEBUG) { |
|
605 | 605 | EE_Error::add_error( |
606 | 606 | sprintf( |
607 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
608 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
609 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
610 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
607 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
608 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
609 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
610 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
611 | 611 | '<ul>', |
612 | 612 | '<li>', |
613 | 613 | '</li>', |
@@ -631,16 +631,16 @@ discard block |
||
631 | 631 | */ |
632 | 632 | private function _get_transaction_and_cart_for_previous_visit() { |
633 | 633 | /** @var $TXN_model EEM_Transaction */ |
634 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
634 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
635 | 635 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
636 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
636 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
637 | 637 | // verify transaction |
638 | - if ( $transaction instanceof EE_Transaction ) { |
|
638 | + if ($transaction instanceof EE_Transaction) { |
|
639 | 639 | // and get the cart that was used for that transaction |
640 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
640 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
641 | 641 | return $transaction; |
642 | 642 | } else { |
643 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
643 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
644 | 644 | return NULL; |
645 | 645 | } |
646 | 646 | } |
@@ -654,11 +654,11 @@ discard block |
||
654 | 654 | * @param EE_Transaction $transaction |
655 | 655 | * @return EE_Cart |
656 | 656 | */ |
657 | - private function _get_cart_for_transaction( $transaction ) { |
|
658 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
657 | + private function _get_cart_for_transaction($transaction) { |
|
658 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
659 | 659 | // verify cart |
660 | - if ( ! $cart instanceof EE_Cart ) { |
|
661 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
660 | + if ( ! $cart instanceof EE_Cart) { |
|
661 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
662 | 662 | } |
663 | 663 | return $cart; |
664 | 664 | } |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | * @param EE_Transaction $transaction |
674 | 674 | * @return EE_Cart |
675 | 675 | */ |
676 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
677 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
676 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
677 | + return EE_Cart::get_cart_from_txn($transaction); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | |
@@ -689,17 +689,17 @@ discard block |
||
689 | 689 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
690 | 690 | // if there's no transaction, then this is the FIRST visit to SPCO |
691 | 691 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
692 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
692 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
693 | 693 | // and then create a new transaction |
694 | 694 | $transaction = $this->_initialize_transaction(); |
695 | 695 | // verify transaction |
696 | - if ( $transaction instanceof EE_Transaction ) { |
|
696 | + if ($transaction instanceof EE_Transaction) { |
|
697 | 697 | // save it so that we have an ID for other objects to use |
698 | 698 | $transaction->save(); |
699 | 699 | // and save TXN data to the cart |
700 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
700 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
701 | 701 | } else { |
702 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
702 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
703 | 703 | } |
704 | 704 | return $transaction; |
705 | 705 | } |
@@ -719,15 +719,15 @@ discard block |
||
719 | 719 | // grab the cart grand total |
720 | 720 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
721 | 721 | // create new TXN |
722 | - return EE_Transaction::new_instance( array( |
|
722 | + return EE_Transaction::new_instance(array( |
|
723 | 723 | 'TXN_timestamp' => time(), |
724 | 724 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
725 | 725 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
726 | 726 | 'TXN_paid' => 0, |
727 | 727 | 'STS_ID' => EEM_Transaction::failed_status_code, |
728 | 728 | )); |
729 | - } catch( Exception $e ) { |
|
730 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
729 | + } catch (Exception $e) { |
|
730 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
731 | 731 | } |
732 | 732 | return NULL; |
733 | 733 | } |
@@ -741,34 +741,34 @@ discard block |
||
741 | 741 | * @param EE_Transaction $transaction |
742 | 742 | * @return EE_Cart |
743 | 743 | */ |
744 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
744 | + private function _get_registrations(EE_Transaction $transaction) { |
|
745 | 745 | // first step: grab the registrants { : o |
746 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
746 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
747 | 747 | // verify registrations have been set |
748 | - if ( empty( $registrations )) { |
|
748 | + if (empty($registrations)) { |
|
749 | 749 | // if no cached registrations, then check the db |
750 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
750 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
751 | 751 | // still nothing ? well as long as this isn't a revisit |
752 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
752 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
753 | 753 | // generate new registrations from scratch |
754 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
754 | + $registrations = $this->_initialize_registrations($transaction); |
|
755 | 755 | } |
756 | 756 | } |
757 | 757 | // sort by their original registration order |
758 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
758 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
759 | 759 | // then loop thru the array |
760 | - foreach ( $registrations as $registration ) { |
|
760 | + foreach ($registrations as $registration) { |
|
761 | 761 | // verify each registration |
762 | - if ( $registration instanceof EE_Registration ) { |
|
762 | + if ($registration instanceof EE_Registration) { |
|
763 | 763 | // we display all attendee info for the primary registrant |
764 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
764 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
765 | 765 | $this->checkout->primary_revisit = TRUE; |
766 | 766 | break; |
767 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
767 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
768 | 768 | // but hide info if it doesn't belong to you |
769 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
769 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
770 | 770 | } |
771 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
771 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
772 | 772 | } |
773 | 773 | } |
774 | 774 | } |
@@ -782,17 +782,17 @@ discard block |
||
782 | 782 | * @param EE_Transaction $transaction |
783 | 783 | * @return array |
784 | 784 | */ |
785 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
785 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
786 | 786 | $att_nmbr = 0; |
787 | 787 | $registrations = array(); |
788 | - if ( $transaction instanceof EE_Transaction ) { |
|
788 | + if ($transaction instanceof EE_Transaction) { |
|
789 | 789 | /** @type EE_Registration_Processor $registration_processor */ |
790 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
790 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
791 | 791 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
792 | 792 | // now let's add the cart items to the $transaction |
793 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
793 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
794 | 794 | //do the following for each ticket of this type they selected |
795 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
795 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
796 | 796 | $att_nmbr++; |
797 | 797 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
798 | 798 | $line_item, |
@@ -800,8 +800,8 @@ discard block |
||
800 | 800 | $att_nmbr, |
801 | 801 | $this->checkout->total_ticket_count |
802 | 802 | ); |
803 | - if ( $registration instanceof EE_Registration ) { |
|
804 | - $registrations[ $registration->ID() ] = $registration; |
|
803 | + if ($registration instanceof EE_Registration) { |
|
804 | + $registrations[$registration->ID()] = $registration; |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 | } |
@@ -819,12 +819,12 @@ discard block |
||
819 | 819 | * @param EE_Registration $reg_B |
820 | 820 | * @return array() |
821 | 821 | */ |
822 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
822 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
823 | 823 | // this shouldn't ever happen within the same TXN, but oh well |
824 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
824 | + if ($reg_A->count() == $reg_B->count()) { |
|
825 | 825 | return 0; |
826 | 826 | } |
827 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
827 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | |
@@ -839,29 +839,29 @@ discard block |
||
839 | 839 | */ |
840 | 840 | private function _final_verifications() { |
841 | 841 | // filter checkout |
842 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
842 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
843 | 843 | //verify that current step is still set correctly |
844 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
845 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
844 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
845 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
846 | 846 | return false; |
847 | 847 | } |
848 | 848 | // if returning to SPCO, then verify that primary registrant is set |
849 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
849 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
850 | 850 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
851 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
852 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
851 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
852 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
853 | 853 | return false; |
854 | 854 | } |
855 | 855 | $valid_registrant = null; |
856 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
857 | - if ( $registration instanceof EE_Registration ) { |
|
858 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
856 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
857 | + if ($registration instanceof EE_Registration) { |
|
858 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
859 | 859 | $valid_registrant = $registration; |
860 | 860 | } |
861 | 861 | } |
862 | 862 | } |
863 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
864 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
863 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
864 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
865 | 865 | return false; |
866 | 866 | } |
867 | 867 | } |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | */ |
882 | 882 | private function _initialize_reg_steps() { |
883 | 883 | /** @type EE_Transaction_Processor $transaction_processor */ |
884 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
884 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
885 | 885 | // call set_reg_step_initiated ??? |
886 | 886 | if ( |
887 | 887 | // first time visiting SPCO ? |
@@ -890,24 +890,24 @@ discard block |
||
890 | 890 | && $this->checkout->action === 'display_spco_reg_step' |
891 | 891 | ) { |
892 | 892 | // set the start time for this reg step |
893 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->checkout->transaction, $this->checkout->current_step->slug() ) ) { |
|
894 | - if ( WP_DEBUG ) { |
|
895 | - EE_Error::add_error( sprintf(__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), $this->checkout->current_step->name() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
893 | + if ( ! $transaction_processor->set_reg_step_initiated($this->checkout->transaction, $this->checkout->current_step->slug())) { |
|
894 | + if (WP_DEBUG) { |
|
895 | + EE_Error::add_error(sprintf(__('The "%1$s" registration step was not initialized properly.', 'event_espresso'), $this->checkout->current_step->name()), __FILE__, __FUNCTION__, __LINE__); |
|
896 | 896 | } |
897 | 897 | }; |
898 | 898 | } |
899 | 899 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
900 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
900 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
901 | 901 | $reg_step->initialize_reg_step(); |
902 | 902 | // i18n |
903 | 903 | $reg_step->translate_js_strings(); |
904 | - if ( $reg_step->is_current_step() ) { |
|
904 | + if ($reg_step->is_current_step()) { |
|
905 | 905 | // the text that appears on the reg step form submit button |
906 | 906 | $reg_step->set_submit_button_text(); |
907 | 907 | } |
908 | 908 | } |
909 | 909 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
910 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
910 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | |
@@ -920,39 +920,39 @@ discard block |
||
920 | 920 | */ |
921 | 921 | private function _check_form_submission() { |
922 | 922 | //does this request require the reg form to be generated ? |
923 | - if ( $this->checkout->generate_reg_form ) { |
|
923 | + if ($this->checkout->generate_reg_form) { |
|
924 | 924 | // ever heard that song by Blue Rodeo ? |
925 | 925 | try { |
926 | 926 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
927 | 927 | // if not displaying a form, then check for form submission |
928 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
928 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
929 | 929 | // clear out any old data in case this step is being run again |
930 | - $this->checkout->current_step->set_valid_data( array() ); |
|
930 | + $this->checkout->current_step->set_valid_data(array()); |
|
931 | 931 | // capture submitted form data |
932 | 932 | $this->checkout->current_step->reg_form->receive_form_submission( |
933 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
933 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
934 | 934 | ); |
935 | 935 | // validate submitted form data |
936 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
936 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
937 | 937 | // thou shall not pass !!! |
938 | 938 | $this->checkout->continue_reg = FALSE; |
939 | 939 | // any form validation errors? |
940 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
940 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
941 | 941 | $submission_error_messages = array(); |
942 | 942 | // bad, bad, bad registrant |
943 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
944 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
945 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
943 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
944 | + if ($validation_error instanceof EE_Validation_Error) { |
|
945 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
946 | 946 | } |
947 | 947 | } |
948 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
948 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
949 | 949 | } |
950 | 950 | // well not really... what will happen is we'll just get redirected back to redo the current step |
951 | 951 | $this->go_to_next_step(); |
952 | 952 | return; |
953 | 953 | } |
954 | 954 | } |
955 | - } catch( EE_Error $e ) { |
|
955 | + } catch (EE_Error $e) { |
|
956 | 956 | $e->get_error(); |
957 | 957 | } |
958 | 958 | } |
@@ -968,38 +968,38 @@ discard block |
||
968 | 968 | */ |
969 | 969 | private function _process_form_action() { |
970 | 970 | // what cha wanna do? |
971 | - switch( $this->checkout->action ) { |
|
971 | + switch ($this->checkout->action) { |
|
972 | 972 | // AJAX next step reg form |
973 | 973 | case 'display_spco_reg_step' : |
974 | 974 | $this->checkout->redirect = FALSE; |
975 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
976 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
975 | + if (EE_Registry::instance()->REQ->ajax) { |
|
976 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
977 | 977 | } |
978 | 978 | break; |
979 | 979 | |
980 | 980 | default : |
981 | 981 | // meh... do one of those other steps first |
982 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
982 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
983 | 983 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
984 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
984 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
985 | 985 | // call action on current step |
986 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
986 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
987 | 987 | // good registrant, you get to proceed |
988 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
989 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
990 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
988 | + if ($this->checkout->current_step->success_message() != '') { |
|
989 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
990 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
991 | 991 | } |
992 | 992 | } |
993 | 993 | // pack it up, pack it in... |
994 | 994 | $this->_setup_redirect(); |
995 | 995 | } |
996 | 996 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
997 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
997 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
998 | 998 | |
999 | 999 | } else { |
1000 | 1000 | EE_Error::add_error( |
1001 | 1001 | sprintf( |
1002 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1002 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1003 | 1003 | $this->checkout->action, |
1004 | 1004 | $this->checkout->current_step->name() |
1005 | 1005 | ), |
@@ -1023,10 +1023,10 @@ discard block |
||
1023 | 1023 | * @return void |
1024 | 1024 | */ |
1025 | 1025 | public function add_styles_and_scripts() { |
1026 | - if ( $this->checkout->admin_request ) { |
|
1027 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1026 | + if ($this->checkout->admin_request) { |
|
1027 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1028 | 1028 | } else { |
1029 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1029 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1030 | 1030 | } |
1031 | 1031 | } |
1032 | 1032 | |
@@ -1042,45 +1042,45 @@ discard block |
||
1042 | 1042 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1043 | 1043 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1044 | 1044 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1045 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1046 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1047 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1045 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1046 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1047 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1048 | 1048 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1049 | 1049 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1050 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1051 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1050 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1051 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1052 | 1052 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1053 | 1053 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1054 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1055 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1056 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1057 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1058 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1059 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1060 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1061 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1062 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1063 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1064 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1065 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1066 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1067 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1054 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1055 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1056 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1057 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1058 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1059 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1060 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1061 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1062 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1063 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1064 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1065 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1066 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1067 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1068 | 1068 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1069 | - __( '%1$sWe\'re sorry, but you\'re registration time has expired |
|
1069 | + __('%1$sWe\'re sorry, but you\'re registration time has expired |
|
1070 | 1070 | .%2$s%3$s%4$sIf you still wish to complete your registration, please |
1071 | 1071 | return to the %5$sEvent List%6$sEvent List%7$s and reselect your |
1072 | 1072 | tickets if available. Please except our apologies for any inconvenience this |
1073 | - may have caused.%8$s', 'event_espresso' ), |
|
1073 | + may have caused.%8$s', 'event_espresso'), |
|
1074 | 1074 | '<h4 class="important-notice">', |
1075 | 1075 | '</h4>', |
1076 | 1076 | '<br />', |
1077 | 1077 | '<p>', |
1078 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1078 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1079 | 1079 | '">', |
1080 | 1080 | '</a>', |
1081 | 1081 | '</p>' |
1082 | 1082 | ); |
1083 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1083 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | |
@@ -1093,28 +1093,28 @@ discard block |
||
1093 | 1093 | */ |
1094 | 1094 | public function enqueue_styles_and_scripts() { |
1095 | 1095 | // load css |
1096 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1097 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1096 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1097 | + wp_enqueue_style('single_page_checkout'); |
|
1098 | 1098 | // i18n |
1099 | 1099 | $this->translate_js_strings(); |
1100 | 1100 | // load JS |
1101 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1102 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1103 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1104 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1105 | - wp_localize_script( 'single_page_checkout', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1101 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1102 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1103 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1104 | + wp_enqueue_script('single_page_checkout'); |
|
1105 | + wp_localize_script('single_page_checkout', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1106 | 1106 | |
1107 | 1107 | /** |
1108 | 1108 | * global action hook for enqueueing styles and scripts with |
1109 | 1109 | * spco calls. |
1110 | 1110 | */ |
1111 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1111 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1112 | 1112 | |
1113 | 1113 | /** |
1114 | 1114 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1115 | 1115 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1116 | 1116 | */ |
1117 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1117 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1118 | 1118 | |
1119 | 1119 | // add css and JS for current step |
1120 | 1120 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1130,11 +1130,11 @@ discard block |
||
1130 | 1130 | */ |
1131 | 1131 | private function _display_spco_reg_form() { |
1132 | 1132 | // if registering via the admin, just display the reg form for the current step |
1133 | - if ( $this->checkout->admin_request ) { |
|
1134 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1133 | + if ($this->checkout->admin_request) { |
|
1134 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1135 | 1135 | } else { |
1136 | 1136 | // add powered by EE msg |
1137 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1137 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1138 | 1138 | $this->checkout->registration_form = new EE_Form_Section_Proper( |
1139 | 1139 | array( |
1140 | 1140 | 'name' => 'single-page-checkout', |
@@ -1142,17 +1142,17 @@ discard block |
||
1142 | 1142 | 'layout_strategy' => |
1143 | 1143 | new EE_Template_Layout( |
1144 | 1144 | array( |
1145 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1145 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1146 | 1146 | 'template_args' => array( |
1147 | - 'empty_cart' => count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params )) < 1 ? TRUE : FALSE, |
|
1147 | + 'empty_cart' => count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? TRUE : FALSE, |
|
1148 | 1148 | 'revisit' => $this->checkout->revisit, |
1149 | 1149 | 'reg_steps' => $this->checkout->reg_steps, |
1150 | 1150 | 'next_step' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '', |
1151 | 1151 | 'empty_msg' => apply_filters( |
1152 | 1152 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1153 | 1153 | sprintf( |
1154 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1155 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1154 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1155 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1156 | 1156 | '">', |
1157 | 1157 | '</a>' |
1158 | 1158 | ) |
@@ -1160,16 +1160,16 @@ discard block |
||
1160 | 1160 | 'registration_time_limit' => |
1161 | 1161 | $this->checkout->get_registration_time_limit(), |
1162 | 1162 | 'session_expiration' => |
1163 | - gmdate( 'M d, Y H:i:s', |
|
1163 | + gmdate('M d, Y H:i:s', |
|
1164 | 1164 | EE_Registry::instance() |
1165 | - ->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1165 | + ->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1166 | 1166 | ) |
1167 | 1167 | ) |
1168 | 1168 | ) |
1169 | 1169 | ) |
1170 | 1170 | ); |
1171 | 1171 | // load template and add to output sent that gets filtered into the_content() |
1172 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1172 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1173 | 1173 | } |
1174 | 1174 | } |
1175 | 1175 | |
@@ -1183,8 +1183,8 @@ discard block |
||
1183 | 1183 | * @internal param string $label |
1184 | 1184 | * @return string |
1185 | 1185 | */ |
1186 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1187 | - if ( $next_step == 'finalize_registration' ) { |
|
1186 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1187 | + if ($next_step == 'finalize_registration') { |
|
1188 | 1188 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1189 | 1189 | } |
1190 | 1190 | } |
@@ -1198,18 +1198,18 @@ discard block |
||
1198 | 1198 | * @return string |
1199 | 1199 | */ |
1200 | 1200 | public static function display_registration_footer() { |
1201 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1202 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1203 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' ); |
|
1204 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1201 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1202 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1203 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/'); |
|
1204 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1205 | 1205 | echo apply_filters( |
1206 | 1206 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1207 | 1207 | sprintf( |
1208 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1209 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1208 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1209 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1210 | 1210 | '" target="_blank">', |
1211 | 1211 | '</a>', |
1212 | - '<a href="' . $url . '" title="', |
|
1212 | + '<a href="'.$url.'" title="', |
|
1213 | 1213 | '" target="_blank">', |
1214 | 1214 | '</a></div>' |
1215 | 1215 | ) |
@@ -1240,12 +1240,12 @@ discard block |
||
1240 | 1240 | * @return array |
1241 | 1241 | */ |
1242 | 1242 | private function _setup_redirect() { |
1243 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1243 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1244 | 1244 | $this->checkout->redirect = TRUE; |
1245 | - if ( empty( $this->checkout->redirect_url )) { |
|
1245 | + if (empty($this->checkout->redirect_url)) { |
|
1246 | 1246 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1247 | 1247 | } |
1248 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1248 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1249 | 1249 | } |
1250 | 1250 | } |
1251 | 1251 | |
@@ -1258,12 +1258,12 @@ discard block |
||
1258 | 1258 | * @return void |
1259 | 1259 | */ |
1260 | 1260 | public function go_to_next_step() { |
1261 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1261 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1262 | 1262 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1263 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1263 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1264 | 1264 | } |
1265 | 1265 | // just return for these conditions |
1266 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1266 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1267 | 1267 | return; |
1268 | 1268 | } |
1269 | 1269 | // AJAX response |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | */ |
1285 | 1285 | protected function _handle_json_response() { |
1286 | 1286 | // if this is an ajax request |
1287 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1287 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1288 | 1288 | // DEBUG LOG |
1289 | 1289 | //$this->checkout->log( |
1290 | 1290 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1294,9 +1294,9 @@ discard block |
||
1294 | 1294 | // 'continue_reg' => $this->checkout->continue_reg, |
1295 | 1295 | // ) |
1296 | 1296 | //); |
1297 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1297 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1298 | 1298 | // just send the ajax ( |
1299 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1299 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1300 | 1300 | $this->unlock_transaction(); |
1301 | 1301 | echo $json_response; |
1302 | 1302 | exit(); |
@@ -1313,9 +1313,9 @@ discard block |
||
1313 | 1313 | */ |
1314 | 1314 | protected function _handle_html_redirects() { |
1315 | 1315 | // going somewhere ? |
1316 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1316 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1317 | 1317 | // store notices in a transient |
1318 | - EE_Error::get_notices( false, true, true ); |
|
1318 | + EE_Error::get_notices(false, true, true); |
|
1319 | 1319 | $this->unlock_transaction(); |
1320 | 1320 | // DEBUG LOG |
1321 | 1321 | //$this->checkout->log( |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | // 'headers_list' => headers_list(), |
1327 | 1327 | // ) |
1328 | 1328 | //); |
1329 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1329 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1330 | 1330 | exit(); |
1331 | 1331 | } |
1332 | 1332 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | /** |
253 | 253 | * returns true if ANY reg status was updated during checkout |
254 | - * @return array |
|
254 | + * @return boolean|null |
|
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | 257 | foreach ( $this->reg_status_updated as $reg_status ) { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | /** |
277 | 277 | * @param $REG_ID |
278 | - * @param $reg_status |
|
278 | + * @param boolean $reg_status |
|
279 | 279 | */ |
280 | 280 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
281 | 281 | $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * reset_reg_steps |
531 | 531 | * |
532 | 532 | * @access public |
533 | - * @return bool |
|
533 | + * @return boolean|null |
|
534 | 534 | */ |
535 | 535 | public function reset_reg_steps() { |
536 | 536 | $this->sort_reg_steps(); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | * stores whether any updates were made to the TXN or it's related registrations |
644 | 644 | * |
645 | 645 | * @access public |
646 | - * @return bool |
|
646 | + * @return boolean|null |
|
647 | 647 | */ |
648 | 648 | public function track_transaction_and_registration_status_updates() { |
649 | 649 | // verify the transaction |
@@ -991,6 +991,7 @@ discard block |
||
991 | 991 | * |
992 | 992 | * @param string | int $reg_cache_ID |
993 | 993 | * @param EE_Registration $registration |
994 | + * @param integer $reg_cache_ID |
|
994 | 995 | * @return void |
995 | 996 | */ |
996 | 997 | protected function _refresh_registration( $reg_cache_ID, $registration ) { |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Checkout |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Checkout |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Checkout { |
15 | 15 | |
16 | 16 | /** |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
243 | 243 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
244 | 244 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
245 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
245 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
246 | 246 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
247 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
247 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | * @return array |
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
258 | - if ( $reg_status ) { |
|
257 | + foreach ($this->reg_status_updated as $reg_status) { |
|
258 | + if ($reg_status) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @param $REG_ID |
268 | 268 | * @return array |
269 | 269 | */ |
270 | - public function reg_status_updated( $REG_ID ) { |
|
271 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
270 | + public function reg_status_updated($REG_ID) { |
|
271 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | * @param $REG_ID |
278 | 278 | * @param $reg_status |
279 | 279 | */ |
280 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
281 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
280 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
281 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * can ONLY be set by the Finalize_Registration reg step |
300 | 300 | */ |
301 | 301 | public function set_exit_spco() { |
302 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
302 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
303 | 303 | $this->exit_spco = true; |
304 | 304 | } |
305 | 305 | } |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function reset_for_current_request() { |
318 | 318 | $this->process_form_submission = FALSE; |
319 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
319 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
320 | 320 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
321 | 321 | $this->continue_reg = true; |
322 | 322 | $this->redirect = false; |
323 | 323 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
324 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
324 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
325 | 325 | $this->redirect_form = ''; |
326 | 326 | } |
327 | 327 | $this->redirect_url = ''; |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | * @param EE_SPCO_Reg_Step $reg_step_obj |
339 | 339 | * @return void |
340 | 340 | */ |
341 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
342 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
341 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
342 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | * @param string $reg_step_slug |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public function remove_reg_step( $reg_step_slug = '' ) { |
|
355 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
356 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
354 | + public function remove_reg_step($reg_step_slug = '') { |
|
355 | + unset($this->reg_steps[$reg_step_slug]); |
|
356 | + if ($this->transaction instanceof EE_Transaction) { |
|
357 | 357 | /** @type EE_Transaction_Processor $transaction_processor */ |
358 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
358 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
359 | 359 | // now remove reg step from TXN and save |
360 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
360 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
361 | 361 | $this->transaction->save(); |
362 | 362 | } |
363 | 363 | } |
@@ -372,9 +372,9 @@ discard block |
||
372 | 372 | * @param int $order |
373 | 373 | * @return void |
374 | 374 | */ |
375 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
376 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
377 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
375 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
376 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
377 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
@@ -387,25 +387,25 @@ discard block |
||
387 | 387 | * @param string $current_step |
388 | 388 | * @return void |
389 | 389 | */ |
390 | - public function set_current_step( $current_step ) { |
|
390 | + public function set_current_step($current_step) { |
|
391 | 391 | // grab what step we're on |
392 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
392 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
393 | 393 | // verify instance |
394 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
394 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
395 | 395 | // we don't want to repeat completed steps if this is the first time through SPCO |
396 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
396 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
397 | 397 | // so advance to the next step |
398 | 398 | $this->set_next_step(); |
399 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
399 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
400 | 400 | // and attempt to set it as the current step |
401 | - $this->set_current_step( $this->next_step->slug() ); |
|
401 | + $this->set_current_step($this->next_step->slug()); |
|
402 | 402 | } |
403 | 403 | return; |
404 | 404 | } |
405 | - $this->current_step->set_is_current_step( TRUE ); |
|
405 | + $this->current_step->set_is_current_step(TRUE); |
|
406 | 406 | } else { |
407 | 407 | EE_Error::add_error( |
408 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
408 | + __('The current step could not be set.', 'event_espresso'), |
|
409 | 409 | __FILE__, __FUNCTION__, __LINE__ |
410 | 410 | ); |
411 | 411 | } |
@@ -422,20 +422,20 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function set_next_step() { |
424 | 424 | // set pointer to start of array |
425 | - reset( $this->reg_steps ); |
|
425 | + reset($this->reg_steps); |
|
426 | 426 | // if there is more than one step |
427 | - if ( count( $this->reg_steps ) > 1 ) { |
|
427 | + if (count($this->reg_steps) > 1) { |
|
428 | 428 | // advance to the current step and set pointer |
429 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
430 | - next( $this->reg_steps ); |
|
429 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
430 | + next($this->reg_steps); |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | // advance one more spot ( if it exists ) |
434 | - $this->next_step = next( $this->reg_steps ); |
|
434 | + $this->next_step = next($this->reg_steps); |
|
435 | 435 | // verify instance |
436 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
436 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
437 | 437 | // then back to current step to reset |
438 | - prev( $this->reg_steps ); |
|
438 | + prev($this->reg_steps); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * @return EE_SPCO_Reg_Step | null |
450 | 450 | */ |
451 | 451 | public function get_next_reg_step() { |
452 | - $next = next( $this->reg_steps ); |
|
453 | - prev( $this->reg_steps ); |
|
452 | + $next = next($this->reg_steps); |
|
453 | + prev($this->reg_steps); |
|
454 | 454 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
455 | 455 | } |
456 | 456 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * @return EE_SPCO_Reg_Step | null |
466 | 466 | */ |
467 | 467 | public function get_prev_reg_step() { |
468 | - $prev = prev( $this->reg_steps ); |
|
469 | - next( $this->reg_steps ); |
|
468 | + $prev = prev($this->reg_steps); |
|
469 | + next($this->reg_steps); |
|
470 | 470 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
471 | 471 | } |
472 | 472 | |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | * @return void |
480 | 480 | */ |
481 | 481 | public function sort_reg_steps() { |
482 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
483 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
482 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
483 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -493,17 +493,17 @@ discard block |
||
493 | 493 | * @param EE_SPCO_Reg_Step $reg_step_B |
494 | 494 | * @return array() |
495 | 495 | */ |
496 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
496 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
497 | 497 | // send finalize_registration step to the end of the array |
498 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
498 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
499 | 499 | return 1; |
500 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
500 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
501 | 501 | return -1; |
502 | 502 | } |
503 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
503 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
504 | 504 | return 0; |
505 | 505 | } |
506 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
506 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | * @return void |
516 | 516 | */ |
517 | 517 | public function set_reg_step_JSON_info() { |
518 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
518 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
519 | 519 | // pass basic reg step data to JS |
520 | - foreach ( $this->reg_steps as $reg_step ) { |
|
521 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
520 | + foreach ($this->reg_steps as $reg_step) { |
|
521 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
522 | 522 | } |
523 | 523 | // reset reg step html |
524 | 524 | // $this->json_response->set_reg_step_html( '' ); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | */ |
535 | 535 | public function reset_reg_steps() { |
536 | 536 | $this->sort_reg_steps(); |
537 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
537 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
538 | 538 | $this->set_next_step(); |
539 | 539 | // the text that appears on the reg step form submit button |
540 | 540 | $this->current_step->set_submit_button_text(); |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public function get_registration_time_limit() { |
553 | 553 | |
554 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
554 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
555 | 555 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
556 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
556 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
557 | 557 | return apply_filters( |
558 | 558 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
559 | 559 | $registration_time_limit |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | // overpaid TXN |
574 | 574 | // free TXN ( total = 0.00 ) |
575 | 575 | // then payment required is TRUE |
576 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
576 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | */ |
587 | 587 | public function initialize_txn_reg_steps_array() { |
588 | 588 | $txn_reg_steps_array = array(); |
589 | - foreach ( $this->reg_steps as $reg_step ) { |
|
590 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
589 | + foreach ($this->reg_steps as $reg_step) { |
|
590 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
591 | 591 | } |
592 | 592 | return $txn_reg_steps_array; |
593 | 593 | } |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | public function update_txn_reg_steps_array() { |
604 | 604 | $updated = FALSE; |
605 | 605 | /** @type EE_Transaction_Processor $transaction_processor */ |
606 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
607 | - foreach ( $this->reg_steps as $reg_step ) { |
|
608 | - if ( $reg_step->completed() ) { |
|
609 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
606 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
607 | + foreach ($this->reg_steps as $reg_step) { |
|
608 | + if ($reg_step->completed()) { |
|
609 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
610 | 610 | } |
611 | 611 | } |
612 | - if ( $updated ) { |
|
612 | + if ($updated) { |
|
613 | 613 | $this->transaction->save(); |
614 | 614 | } |
615 | 615 | return $updated; |
@@ -624,14 +624,14 @@ discard block |
||
624 | 624 | * @return void |
625 | 625 | */ |
626 | 626 | public function stash_transaction_and_checkout() { |
627 | - if ( ! $this->revisit ) { |
|
627 | + if ( ! $this->revisit) { |
|
628 | 628 | $this->update_txn_reg_steps_array(); |
629 | 629 | } |
630 | 630 | $this->track_transaction_and_registration_status_updates(); |
631 | 631 | // save all data to the db, but suppress errors |
632 | 632 | //$this->save_all_data( FALSE ); |
633 | 633 | // cache the checkout in the session |
634 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
634 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | |
@@ -647,21 +647,21 @@ discard block |
||
647 | 647 | */ |
648 | 648 | public function track_transaction_and_registration_status_updates() { |
649 | 649 | // verify the transaction |
650 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
650 | + if ($this->transaction instanceof EE_Transaction) { |
|
651 | 651 | /** @type EE_Transaction_Payments $transaction_payments */ |
652 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
652 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
653 | 653 | /** @type EE_Transaction_Processor $transaction_processor */ |
654 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
654 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
655 | 655 | // has there been a TXN status change during this checkout? |
656 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
656 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
657 | 657 | $this->txn_status_updated = true; |
658 | 658 | } |
659 | 659 | /** @type EE_Registration_Processor $registration_processor */ |
660 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
660 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
661 | 661 | // grab the saved registrations from the transaction |
662 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
663 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
664 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
662 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
663 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
664 | + $this->set_reg_status_updated($registration->ID(), true); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | } |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | * @param EE_Registration $registration |
684 | 684 | * @return bool |
685 | 685 | */ |
686 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
687 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
686 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
687 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | |
@@ -709,18 +709,18 @@ discard block |
||
709 | 709 | * @param bool $show_errors |
710 | 710 | * @return bool |
711 | 711 | */ |
712 | - public function save_all_data( $show_errors = TRUE ) { |
|
712 | + public function save_all_data($show_errors = TRUE) { |
|
713 | 713 | // verify the transaction |
714 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
714 | + if ($this->transaction instanceof EE_Transaction) { |
|
715 | 715 | // save to ensure that TXN has ID |
716 | 716 | $this->transaction->save(); |
717 | 717 | // grab the saved registrations from the transaction |
718 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
719 | - $this->_save_registration( $registration, $show_errors ); |
|
718 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
719 | + $this->_save_registration($registration, $show_errors); |
|
720 | 720 | } |
721 | 721 | } else { |
722 | - if ( $show_errors ) { |
|
723 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
722 | + if ($show_errors) { |
|
723 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
724 | 724 | } |
725 | 725 | return FALSE; |
726 | 726 | } |
@@ -735,32 +735,32 @@ discard block |
||
735 | 735 | * @param bool $show_errors |
736 | 736 | * @return void |
737 | 737 | */ |
738 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
738 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
739 | 739 | // verify object |
740 | - if ( $registration instanceof EE_Registration ) { |
|
740 | + if ($registration instanceof EE_Registration) { |
|
741 | 741 | // should this registration be processed during this visit ? |
742 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
742 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
743 | 743 | //set TXN ID |
744 | - if ( ! $registration->transaction_ID() ) { |
|
745 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
744 | + if ( ! $registration->transaction_ID()) { |
|
745 | + $registration->set_transaction_id($this->transaction->ID()); |
|
746 | 746 | } |
747 | 747 | // verify and save the attendee |
748 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
748 | + $this->_save_registration_attendee($registration, $show_errors); |
|
749 | 749 | // save answers to reg form questions |
750 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
750 | + $this->_save_registration_answers($registration, $show_errors); |
|
751 | 751 | // save changes |
752 | 752 | $registration->save(); |
753 | 753 | // update txn cache |
754 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
755 | - if ( $show_errors ) { |
|
756 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
754 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
755 | + if ($show_errors) { |
|
756 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
757 | 757 | } |
758 | 758 | } |
759 | 759 | } |
760 | 760 | } else { |
761 | - if ( $show_errors ) { |
|
761 | + if ($show_errors) { |
|
762 | 762 | EE_Error::add_error( |
763 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
763 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
764 | 764 | __FILE__, __FUNCTION__, __LINE__ |
765 | 765 | ); |
766 | 766 | } |
@@ -776,26 +776,26 @@ discard block |
||
776 | 776 | * @param bool $show_errors |
777 | 777 | * @return void |
778 | 778 | */ |
779 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
780 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
779 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
780 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
781 | 781 | // save so that ATT has ID |
782 | 782 | $registration->attendee()->save(); |
783 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
784 | - if ( $show_errors ) { |
|
783 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
784 | + if ($show_errors) { |
|
785 | 785 | EE_Error::add_error( |
786 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
786 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
787 | 787 | __FILE__, __FUNCTION__, __LINE__ |
788 | 788 | ); |
789 | 789 | } |
790 | 790 | } |
791 | 791 | } else { |
792 | - if ( $show_errors ) { |
|
792 | + if ($show_errors) { |
|
793 | 793 | ob_start(); |
794 | - var_dump( $registration->attendee() ); |
|
794 | + var_dump($registration->attendee()); |
|
795 | 795 | EE_Error::add_error( |
796 | 796 | sprintf( |
797 | 797 | '%1$s||%1$s $attendee = %2$s', |
798 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
798 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
799 | 799 | ob_get_clean() |
800 | 800 | ), |
801 | 801 | __FILE__, __FUNCTION__, __LINE__ |
@@ -813,25 +813,25 @@ discard block |
||
813 | 813 | * @param bool $show_errors |
814 | 814 | * @return void |
815 | 815 | */ |
816 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
816 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
817 | 817 | // now save the answers |
818 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
818 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
819 | 819 | // verify object |
820 | - if ( $answer instanceof EE_Answer ) { |
|
821 | - $answer->set_registration( $registration->ID() ); |
|
820 | + if ($answer instanceof EE_Answer) { |
|
821 | + $answer->set_registration($registration->ID()); |
|
822 | 822 | $answer->save(); |
823 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
824 | - if ( $show_errors ) { |
|
823 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
824 | + if ($show_errors) { |
|
825 | 825 | EE_Error::add_error( |
826 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
826 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
827 | 827 | __FILE__, __FUNCTION__, __LINE__ |
828 | 828 | ); |
829 | 829 | } |
830 | 830 | } |
831 | 831 | } else { |
832 | - if ( $show_errors ) { |
|
832 | + if ($show_errors) { |
|
833 | 833 | EE_Error::add_error( |
834 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
834 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
835 | 835 | __FILE__, __FUNCTION__, __LINE__ |
836 | 836 | ); |
837 | 837 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * @param bool $from_db |
850 | 850 | * @return bool |
851 | 851 | */ |
852 | - public function refresh_all_entities( $from_db = false ) { |
|
852 | + public function refresh_all_entities($from_db = false) { |
|
853 | 853 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
854 | 854 | //$this->log( |
855 | 855 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -870,11 +870,11 @@ discard block |
||
870 | 870 | */ |
871 | 871 | protected function refresh_from_db() { |
872 | 872 | // verify the transaction |
873 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
873 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
874 | 874 | // pull fresh TXN data from the db |
875 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
875 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
876 | 876 | // update EE_Checkout's cached primary_attendee object |
877 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
877 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
878 | 878 | // update EE_Checkout's cached payment object |
879 | 879 | $payment = $this->transaction->last_payment(); |
880 | 880 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -882,15 +882,15 @@ discard block |
||
882 | 882 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
883 | 883 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
884 | 884 | //now refresh the cart, based on the TXN |
885 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
885 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
886 | 886 | // verify and update the cart because inaccurate totals are not so much fun |
887 | - if ( $this->cart instanceof EE_Cart ) { |
|
887 | + if ($this->cart instanceof EE_Cart) { |
|
888 | 888 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
889 | 889 | } else { |
890 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
890 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
891 | 891 | } |
892 | 892 | } else { |
893 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
893 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
894 | 894 | return FALSE; |
895 | 895 | } |
896 | 896 | return TRUE; |
@@ -904,24 +904,24 @@ discard block |
||
904 | 904 | * @param EE_Transaction $transaction |
905 | 905 | * @return EE_Attendee | null |
906 | 906 | */ |
907 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
907 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
908 | 908 | |
909 | 909 | $primary_attendee_obj = null; |
910 | 910 | // grab the saved registrations from the transaction |
911 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
911 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
912 | 912 | // verify object |
913 | - if ( $registration instanceof EE_Registration ) { |
|
913 | + if ($registration instanceof EE_Registration) { |
|
914 | 914 | $attendee = $registration->attendee(); |
915 | 915 | // verify object |
916 | - if ( $attendee instanceof EE_Attendee ) { |
|
916 | + if ($attendee instanceof EE_Attendee) { |
|
917 | 917 | // maybe cache primary_attendee_obj ? |
918 | - if ( $registration->is_primary_registrant() ) { |
|
918 | + if ($registration->is_primary_registrant()) { |
|
919 | 919 | $primary_attendee_obj = $attendee; |
920 | 920 | } |
921 | 921 | } |
922 | 922 | } else { |
923 | 923 | EE_Error::add_error( |
924 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
924 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
925 | 925 | __FILE__, __FUNCTION__, __LINE__ |
926 | 926 | ); |
927 | 927 | } |
@@ -941,43 +941,43 @@ discard block |
||
941 | 941 | */ |
942 | 942 | protected function refresh_entity_map() { |
943 | 943 | // verify the transaction |
944 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
944 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
945 | 945 | // never cache payment info |
946 | - $this->transaction->clear_cache( 'Payment' ); |
|
946 | + $this->transaction->clear_cache('Payment'); |
|
947 | 947 | /** @type EE_Transaction_Processor $transaction_processor */ |
948 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
948 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
949 | 949 | // is the Payment Options Reg Step completed ? |
950 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
950 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
951 | 951 | // then check for payments and update TXN accordingly |
952 | 952 | /** @type EE_Transaction_Payments $transaction_payments */ |
953 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
954 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
953 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
954 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
955 | 955 | } |
956 | 956 | // grab the saved registrations from the transaction |
957 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
958 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
957 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
958 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
959 | 959 | } |
960 | 960 | // make sure our cached TXN is added to the model entity mapper |
961 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
961 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
962 | 962 | |
963 | 963 | } else { |
964 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
964 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
965 | 965 | return FALSE; |
966 | 966 | } |
967 | 967 | // verify and update the cart because inaccurate totals are not so much fun |
968 | - if ( $this->cart instanceof EE_Cart ) { |
|
968 | + if ($this->cart instanceof EE_Cart) { |
|
969 | 969 | $grand_total = $this->cart->get_grand_total(); |
970 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
970 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
971 | 971 | $grand_total->recalculate_total_including_taxes(); |
972 | 972 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
973 | 973 | $this->cart->get_grand_total()->ID(), |
974 | 974 | $this->cart->get_grand_total() |
975 | 975 | ); |
976 | 976 | } |
977 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
978 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
977 | + if ($grand_total instanceof EE_Line_Item) { |
|
978 | + $this->cart = EE_Cart::instance($grand_total); |
|
979 | 979 | } else { |
980 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
980 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
981 | 981 | return false; |
982 | 982 | } |
983 | 983 | } |
@@ -993,19 +993,19 @@ discard block |
||
993 | 993 | * @param EE_Registration $registration |
994 | 994 | * @return void |
995 | 995 | */ |
996 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
996 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
997 | 997 | |
998 | 998 | // verify object |
999 | - if ( $registration instanceof EE_Registration ) { |
|
999 | + if ($registration instanceof EE_Registration) { |
|
1000 | 1000 | // update the entity mapper attendee |
1001 | - $this->_refresh_registration_attendee( $registration ); |
|
1001 | + $this->_refresh_registration_attendee($registration); |
|
1002 | 1002 | // update the entity mapper answers for reg form questions |
1003 | - $this->_refresh_registration_answers( $registration ); |
|
1003 | + $this->_refresh_registration_answers($registration); |
|
1004 | 1004 | // make sure the cached registration is added to the model entity mapper |
1005 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1005 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1006 | 1006 | } else { |
1007 | 1007 | EE_Error::add_error( |
1008 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1008 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1009 | 1009 | __FILE__, __FUNCTION__, __LINE__ |
1010 | 1010 | ); |
1011 | 1011 | } |
@@ -1019,15 +1019,15 @@ discard block |
||
1019 | 1019 | * @param EE_Registration $registration |
1020 | 1020 | * @return void |
1021 | 1021 | */ |
1022 | - protected function _refresh_registration_attendee( $registration ) { |
|
1022 | + protected function _refresh_registration_attendee($registration) { |
|
1023 | 1023 | |
1024 | 1024 | $attendee = $registration->attendee(); |
1025 | 1025 | // verify object |
1026 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1026 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1027 | 1027 | // make sure the cached attendee is added to the model entity mapper |
1028 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1028 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1029 | 1029 | // maybe cache primary_attendee_obj ? |
1030 | - if ( $registration->is_primary_registrant() ) { |
|
1030 | + if ($registration->is_primary_registrant()) { |
|
1031 | 1031 | $this->primary_attendee_obj = $attendee; |
1032 | 1032 | } |
1033 | 1033 | } |
@@ -1041,19 +1041,19 @@ discard block |
||
1041 | 1041 | * @param EE_Registration $registration |
1042 | 1042 | * @return void |
1043 | 1043 | */ |
1044 | - protected function _refresh_registration_answers( $registration ) { |
|
1044 | + protected function _refresh_registration_answers($registration) { |
|
1045 | 1045 | |
1046 | 1046 | // now update the answers |
1047 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1047 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1048 | 1048 | // verify object |
1049 | - if ( $answer instanceof EE_Answer ) { |
|
1050 | - if ( $answer->ID() ) { |
|
1049 | + if ($answer instanceof EE_Answer) { |
|
1050 | + if ($answer->ID()) { |
|
1051 | 1051 | // make sure the cached answer is added to the model entity mapper |
1052 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1052 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1053 | 1053 | } |
1054 | 1054 | } else { |
1055 | 1055 | EE_Error::add_error( |
1056 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1056 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1057 | 1057 | __FILE__, __FUNCTION__, __LINE__ |
1058 | 1058 | ); |
1059 | 1059 | } |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1069 | 1069 | */ |
1070 | 1070 | function __wakeup() { |
1071 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1071 | + foreach ($this->reg_steps as $reg_step) { |
|
1072 | 1072 | $reg_step->checkout = $this; |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1084,11 +1084,11 @@ discard block |
||
1084 | 1084 | * @param array $info |
1085 | 1085 | * @param bool $display_request |
1086 | 1086 | */ |
1087 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1088 | - if ( WP_DEBUG && false ) { |
|
1089 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1087 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1088 | + if (WP_DEBUG && false) { |
|
1089 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1090 | 1090 | $default_data = array( |
1091 | - $class => $func . '() : ' . $line, |
|
1091 | + $class => $func.'() : '.$line, |
|
1092 | 1092 | 'request->step' => $this->step, |
1093 | 1093 | 'request->action' => $this->action, |
1094 | 1094 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1100,24 +1100,24 @@ discard block |
||
1100 | 1100 | 'reg_url_link' => $this->reg_url_link, |
1101 | 1101 | 'REQ' => $display_request ? $_REQUEST : '', |
1102 | 1102 | ); |
1103 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1104 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1105 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1106 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1107 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1103 | + if ($this->transaction instanceof EE_Transaction) { |
|
1104 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1105 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1106 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1107 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1108 | 1108 | } |
1109 | - if ( $this->transaction->ID() ) { |
|
1110 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1109 | + if ($this->transaction->ID()) { |
|
1110 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1111 | 1111 | // don't serialize objects |
1112 | - $info = $this->_strip_objects( $info ); |
|
1113 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1114 | - $debug_data[ $TXN_ID ] = array(); |
|
1112 | + $info = $this->_strip_objects($info); |
|
1113 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1114 | + $debug_data[$TXN_ID] = array(); |
|
1115 | 1115 | } |
1116 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1116 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1117 | 1117 | $default_data, |
1118 | 1118 | $info |
1119 | 1119 | ); |
1120 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1120 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | } |
@@ -1130,23 +1130,23 @@ discard block |
||
1130 | 1130 | * @param array $info |
1131 | 1131 | * @return array |
1132 | 1132 | */ |
1133 | - function _strip_objects( $info = array() ) { |
|
1134 | - foreach ( $info as $key => $value ) { |
|
1135 | - if ( is_array( $value )) { |
|
1136 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1137 | - } else if ( is_object( $value ) ) { |
|
1138 | - $object_class = get_class( $value ); |
|
1139 | - $info[ $object_class ] = array(); |
|
1140 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1141 | - if ( method_exists( $value, 'status' ) ) { |
|
1142 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1143 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1144 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1133 | + function _strip_objects($info = array()) { |
|
1134 | + foreach ($info as $key => $value) { |
|
1135 | + if (is_array($value)) { |
|
1136 | + $info[$key] = $this->_strip_objects($value); |
|
1137 | + } else if (is_object($value)) { |
|
1138 | + $object_class = get_class($value); |
|
1139 | + $info[$object_class] = array(); |
|
1140 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1141 | + if (method_exists($value, 'status')) { |
|
1142 | + $info[$object_class]['status'] = $value->status(); |
|
1143 | + } else if (method_exists($value, 'status_ID')) { |
|
1144 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1145 | 1145 | } |
1146 | - unset( $info[ $key ] ); |
|
1146 | + unset($info[$key]); |
|
1147 | 1147 | } |
1148 | 1148 | } |
1149 | - return (array)$info; |
|
1149 | + return (array) $info; |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 |
@@ -387,7 +387,7 @@ |
||
387 | 387 | |
388 | 388 | /** |
389 | 389 | * creates the default hidden inputs section |
390 | - * @return EE_Form_Input_Base[] |
|
390 | + * @return EE_Form_Section_Proper |
|
391 | 391 | */ |
392 | 392 | public function reg_step_hidden_inputs() { |
393 | 393 | // hidden inputs for admin registrations |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | abstract class EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function set_completed() { |
154 | 154 | // DEBUG LOG |
155 | 155 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
156 | - $this->_completed = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this ); |
|
156 | + $this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -201,18 +201,18 @@ discard block |
||
201 | 201 | * sets the text that appears on the reg step form submit button |
202 | 202 | * @param string $submit_button_text |
203 | 203 | */ |
204 | - public function set_submit_button_text( $submit_button_text = '' ) { |
|
205 | - if ( ! empty( $submit_button_text )) { |
|
204 | + public function set_submit_button_text($submit_button_text = '') { |
|
205 | + if ( ! empty($submit_button_text)) { |
|
206 | 206 | $this->_submit_button_text = $submit_button_text; |
207 | - } else if ( $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
208 | - if ( $this->checkout->revisit ) { |
|
209 | - $this->_submit_button_text = sprintf( __( 'Update %s', 'event_espresso' ), $this->checkout->current_step->name() ); |
|
207 | + } else if ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
208 | + if ($this->checkout->revisit) { |
|
209 | + $this->_submit_button_text = sprintf(__('Update %s', 'event_espresso'), $this->checkout->current_step->name()); |
|
210 | 210 | } else { |
211 | - $this->_submit_button_text = sprintf( __( 'Proceed to %s', 'event_espresso' ), $this->checkout->next_step->name() ); |
|
211 | + $this->_submit_button_text = sprintf(__('Proceed to %s', 'event_espresso'), $this->checkout->next_step->name()); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | // filters the submit button text |
215 | - $this->_submit_button_text = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout ); |
|
215 | + $this->_submit_button_text = apply_filters('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param boolean $is_current_step |
222 | 222 | */ |
223 | - public function set_is_current_step( $is_current_step ) { |
|
223 | + public function set_is_current_step($is_current_step) { |
|
224 | 224 | $this->_is_current_step = $is_current_step; |
225 | 225 | } |
226 | 226 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * @param int $order |
249 | 249 | */ |
250 | - public function set_order( $order ) { |
|
250 | + public function set_order($order) { |
|
251 | 251 | $this->_order = $order; |
252 | 252 | } |
253 | 253 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * _set_success_message |
286 | 286 | * @param string $success_message |
287 | 287 | */ |
288 | - protected function _set_success_message( $success_message ) { |
|
288 | + protected function _set_success_message($success_message) { |
|
289 | 289 | $this->_success_message = $success_message; |
290 | 290 | } |
291 | 291 | |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | /** |
314 | 314 | * @param string $instructions |
315 | 315 | */ |
316 | - public function set_instructions( $instructions ) { |
|
317 | - $this->_instructions = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this ); |
|
316 | + public function set_instructions($instructions) { |
|
317 | + $this->_instructions = apply_filters('FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * @param array $valid_data |
324 | 324 | */ |
325 | - public function set_valid_data( $valid_data ) { |
|
325 | + public function set_valid_data($valid_data) { |
|
326 | 326 | $this->_valid_data = $valid_data; |
327 | 327 | } |
328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @return array |
333 | 333 | */ |
334 | 334 | public function valid_data() { |
335 | - if ( empty( $this->_valid_data )) { |
|
335 | + if (empty($this->_valid_data)) { |
|
336 | 336 | $this->_valid_data = $this->reg_form->valid_data(); |
337 | 337 | } |
338 | 338 | return $this->_valid_data; |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @return string |
344 | 344 | */ |
345 | 345 | public function reg_form_name() { |
346 | - if ( empty( $this->_reg_form_name )) { |
|
347 | - $this->set_reg_form_name( 'ee-spco-' . $this->slug() . '-reg-step-form' ); |
|
346 | + if (empty($this->_reg_form_name)) { |
|
347 | + $this->set_reg_form_name('ee-spco-'.$this->slug().'-reg-step-form'); |
|
348 | 348 | } |
349 | 349 | return $this->_reg_form_name; |
350 | 350 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | /** |
355 | 355 | * @param string $reg_form_name |
356 | 356 | */ |
357 | - protected function set_reg_form_name( $reg_form_name ) { |
|
357 | + protected function set_reg_form_name($reg_form_name) { |
|
358 | 358 | $this->_reg_form_name = $reg_form_name; |
359 | 359 | } |
360 | 360 | |
@@ -365,22 +365,22 @@ discard block |
||
365 | 365 | * @param string $action |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public function reg_step_url( $action = '' ) { |
|
369 | - $query_args = array( 'step' => $this->slug() ); |
|
370 | - if( ! empty( $action )) { |
|
368 | + public function reg_step_url($action = '') { |
|
369 | + $query_args = array('step' => $this->slug()); |
|
370 | + if ( ! empty($action)) { |
|
371 | 371 | $query_args['action'] = $action; |
372 | 372 | } |
373 | 373 | // final step has no display |
374 | - if ( $this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action == 'display_spco_reg_step' ) { |
|
375 | - $query_args[ 'action' ] = 'process_reg_step'; |
|
374 | + if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action == 'display_spco_reg_step') { |
|
375 | + $query_args['action'] = 'process_reg_step'; |
|
376 | 376 | } |
377 | - if( $this->checkout->revisit ) { |
|
377 | + if ($this->checkout->revisit) { |
|
378 | 378 | $query_args['revisit'] = TRUE; |
379 | 379 | } |
380 | - if( $this->checkout->reg_url_link ) { |
|
380 | + if ($this->checkout->reg_url_link) { |
|
381 | 381 | $query_args['e_reg_url_link'] = $this->checkout->reg_url_link; |
382 | 382 | } |
383 | - return add_query_arg( $query_args, $this->checkout->reg_page_base_url ); |
|
383 | + return add_query_arg($query_args, $this->checkout->reg_page_base_url); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -391,16 +391,16 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function reg_step_hidden_inputs() { |
393 | 393 | // hidden inputs for admin registrations |
394 | - if ( $this->checkout->admin_request ) { |
|
394 | + if ($this->checkout->admin_request) { |
|
395 | 395 | return new EE_Form_Section_Proper( |
396 | 396 | array( |
397 | 397 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
398 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
398 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
399 | 399 | 'subsections' => array( |
400 | 400 | 'next_step' => new EE_Fixed_Hidden_Input( |
401 | 401 | array( |
402 | 402 | 'html_name' => 'next_step', |
403 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
403 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
404 | 404 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
405 | 405 | ) |
406 | 406 | ) |
@@ -412,19 +412,19 @@ discard block |
||
412 | 412 | return new EE_Form_Section_Proper( |
413 | 413 | array( |
414 | 414 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
415 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
415 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
416 | 416 | 'subsections' => array( |
417 | 417 | 'action' => new EE_Fixed_Hidden_Input( |
418 | 418 | array( |
419 | 419 | 'html_name' => 'action', |
420 | - 'html_id' => 'spco-' . $this->slug() . '-action', |
|
421 | - 'default' => empty( $this->checkout->reg_url_link ) ? 'process_reg_step' : 'update_reg_step' |
|
420 | + 'html_id' => 'spco-'.$this->slug().'-action', |
|
421 | + 'default' => empty($this->checkout->reg_url_link) ? 'process_reg_step' : 'update_reg_step' |
|
422 | 422 | ) |
423 | 423 | ), |
424 | 424 | 'next_step' => new EE_Fixed_Hidden_Input( |
425 | 425 | array( |
426 | 426 | 'html_name' => 'next_step', |
427 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
427 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
428 | 428 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
429 | 429 | ) |
430 | 430 | ), |
@@ -456,9 +456,9 @@ discard block |
||
456 | 456 | * @param array $actions |
457 | 457 | * @return void |
458 | 458 | */ |
459 | - public function generate_reg_form_for_actions( $actions = array() ) { |
|
460 | - $actions = array_merge( array( 'generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step' ), $actions ); |
|
461 | - $this->checkout->generate_reg_form = in_array( $this->checkout->action, $actions ) ? TRUE : FALSE; |
|
459 | + public function generate_reg_form_for_actions($actions = array()) { |
|
460 | + $actions = array_merge(array('generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step'), $actions); |
|
461 | + $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions) ? TRUE : FALSE; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -468,11 +468,11 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function display_reg_form() { |
470 | 470 | $html = ''; |
471 | - if ( $this->reg_form instanceof EE_Form_Section_Proper ) { |
|
472 | - $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open( $this->reg_step_url() ) : ''; |
|
473 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
471 | + if ($this->reg_form instanceof EE_Form_Section_Proper) { |
|
472 | + $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : ''; |
|
473 | + if (EE_Registry::instance()->REQ->ajax) { |
|
474 | 474 | $this->reg_form->localize_validation_rules(); |
475 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
475 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
476 | 476 | $html .= $this->reg_form->get_html(); |
477 | 477 | } else { |
478 | 478 | $html .= $this->reg_form->get_html_and_js(); |
@@ -490,26 +490,26 @@ discard block |
||
490 | 490 | * @return string |
491 | 491 | */ |
492 | 492 | public function reg_step_submit_button() { |
493 | - if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
493 | + if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
494 | 494 | return ''; |
495 | 495 | } |
496 | 496 | ob_start(); |
497 | - do_action( 'AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout ); |
|
497 | + do_action('AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout); |
|
498 | 498 | $html = ob_get_clean(); |
499 | 499 | // generate submit button |
500 | - $sbmt_btn = new EE_Submit_Input( array( |
|
501 | - 'html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
502 | - 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
500 | + $sbmt_btn = new EE_Submit_Input(array( |
|
501 | + 'html_name' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
502 | + 'html_id' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
503 | 503 | 'html_class' => 'spco-next-step-btn', |
504 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
504 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
505 | 505 | 'default' => $this->submit_button_text() |
506 | 506 | )); |
507 | - $sbmt_btn->set_button_css_attributes( TRUE, 'large' ); |
|
507 | + $sbmt_btn->set_button_css_attributes(TRUE, 'large'); |
|
508 | 508 | $sbmt_btn_html = $sbmt_btn->get_html_for_input(); |
509 | 509 | EE_Registry::instance()->load_helper('HTML'); |
510 | 510 | $html .= EEH_HTML::div( |
511 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this ), |
|
512 | - 'spco-' . $this->slug() . '-whats-next-buttons-dv', |
|
511 | + apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this), |
|
512 | + 'spco-'.$this->slug().'-whats-next-buttons-dv', |
|
513 | 513 | 'spco-whats-next-buttons' |
514 | 514 | ); |
515 | 515 | return $html; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @return string |
533 | 533 | */ |
534 | 534 | public function edit_lnk_url() { |
535 | - return add_query_arg( array( 'step' => $this->slug() ), $this->checkout->reg_page_base_url ); |
|
535 | + return add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url); |
|
536 | 536 | |
537 | 537 | } |
538 | 538 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | */ |
555 | 555 | public function update_checkout() { |
556 | 556 | // grab the cart grand total and reset TXN total |
557 | - $this->checkout->transaction->set_total( $this->checkout->cart->get_cart_grand_total() ); |
|
557 | + $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total()); |
|
558 | 558 | $this->checkout->stash_transaction_and_checkout(); |
559 | 559 | } |
560 | 560 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | function __sleep() { |
571 | 571 | // remove the reg form and the checkout |
572 | - return array_diff( array_keys( get_object_vars( $this )), array( 'reg_form', 'checkout' )); |
|
572 | + return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout')); |
|
573 | 573 | } |
574 | 574 | } |
575 | 575 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
41 | - * @return boolean |
|
41 | + * @return boolean|null |
|
42 | 42 | */ |
43 | 43 | public function initialize_reg_step() { |
44 | 44 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | /** |
58 | - * @return boolean |
|
58 | + * @return boolean|null |
|
59 | 59 | */ |
60 | 60 | public function process_reg_step() { |
61 | 61 | return true; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | /** |
67 | - * @return boolean |
|
67 | + * @return boolean|null |
|
68 | 68 | */ |
69 | 69 | public function update_reg_step() { |
70 | 70 | return true; |
@@ -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_Registration_Confirmation |
|
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_Registration_Confirmation |
|
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_Registration_Confirmation extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Registration_Confirmation |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'registration_confirmation'; |
25 | 25 | $this->_name = __('Registration Confirmation', 'event_espresso'); |
26 | - $this->_template = SPCO_TEMPLATES_PATH . 'registration_page_confirmation.template.php'; |
|
26 | + $this->_template = SPCO_TEMPLATES_PATH.'registration_page_confirmation.template.php'; |
|
27 | 27 | $this->checkout = $checkout; |
28 | 28 | } |
29 | 29 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return string |
50 | 50 | */ |
51 | 51 | public function generate_reg_form() { |
52 | - EE_Registry::instance()->REQ->add_output( 'generate_reg_form' ); |
|
52 | + EE_Registry::instance()->REQ->add_output('generate_reg_form'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | /** |
65 | - * @return boolean |
|
65 | + * @return boolean|null |
|
66 | 66 | */ |
67 | 67 | public function initialize_reg_step() { |
68 | 68 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * _auto_copy_attendee_info |
343 | 343 | * |
344 | 344 | * @access public |
345 | - * @return EE_Form_Section_Proper |
|
345 | + * @return EE_Form_Section_HTML |
|
346 | 346 | */ |
347 | 347 | private function _auto_copy_attendee_info() { |
348 | 348 | return new EE_Form_Section_HTML( |
@@ -456,6 +456,7 @@ discard block |
||
456 | 456 | * @param EE_Registration $registration |
457 | 457 | * @param EE_Question $question |
458 | 458 | * @param mixed EE_Answer|NULL $answer |
459 | + * @param EE_Answer $answer |
|
459 | 460 | * @return EE_Form_Input_Base |
460 | 461 | */ |
461 | 462 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | case EEM_Question::QST_type_text : |
508 | 508 | if( $identifier == 'email' ){ |
509 | 509 | return new EE_Email_Input( $input_constructor_args ); |
510 | - }else{ |
|
510 | + } else{ |
|
511 | 511 | return new EE_Text_Input( $input_constructor_args ); |
512 | 512 | } |
513 | 513 | break; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 794 | |
795 | - } else { |
|
795 | + } else { |
|
796 | 796 | EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
797 | 797 | // remove malformed data |
798 | 798 | unset( $valid_data[ $reg_url_link ] ); |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | * @param EE_Checkout $checkout |
33 | 33 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
34 | 34 | */ |
35 | - public function __construct( EE_Checkout $checkout ) { |
|
35 | + public function __construct(EE_Checkout $checkout) { |
|
36 | 36 | $this->_slug = 'attendee_information'; |
37 | 37 | $this->_name = __('Attendee Information', 'event_espresso'); |
38 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
38 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
39 | 39 | $this->checkout = $checkout; |
40 | 40 | $this->_reset_success_message(); |
41 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
41 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
48 | 48 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
49 | 49 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
50 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
50 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
51 | 51 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
52 | 52 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | EEH_Autoloader::register_line_item_display_autoloaders(); |
80 | 80 | $Line_Item_Display = new EE_Line_Item_Display(); |
81 | 81 | // calculate taxes |
82 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
82 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
83 | 83 | EE_Registry::instance()->load_helper('Line_Item'); |
84 | 84 | /** @var $subsections EE_Form_Section_Proper[] */ |
85 | 85 | $subsections = array( |
@@ -91,33 +91,33 @@ discard block |
||
91 | 91 | 'ticket_count' => array() |
92 | 92 | ); |
93 | 93 | // grab the saved registrations from the transaction |
94 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
95 | - if ( $registrations ) { |
|
96 | - foreach ( $registrations as $registration ) { |
|
97 | - if ( $registration instanceof EE_Registration ) { |
|
94 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
95 | + if ($registrations) { |
|
96 | + foreach ($registrations as $registration) { |
|
97 | + if ($registration instanceof EE_Registration) { |
|
98 | 98 | // can this registration be processed during this visit ? |
99 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
100 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
101 | - if ( ! $this->checkout->admin_request ) { |
|
102 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
103 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
104 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
105 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
106 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
99 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
100 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
101 | + if ( ! $this->checkout->admin_request) { |
|
102 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
103 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
104 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
105 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
106 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
107 | 107 | } |
108 | - if ( $registration->is_primary_registrant() ) { |
|
108 | + if ($registration->is_primary_registrant()) { |
|
109 | 109 | $primary_registrant = $registration->reg_url_link(); |
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
114 | 114 | // print_copy_info ? |
115 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
115 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
116 | 116 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
117 | 117 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
118 | 118 | // generate hidden input |
119 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
120 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options ); |
|
119 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
120 | + $subsections[$primary_registrant]->add_subsections($copy_options); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -129,8 +129,7 @@ discard block |
||
129 | 129 | 'html_id' => $this->reg_form_name(), |
130 | 130 | 'subsections' => $subsections, |
131 | 131 | 'layout_strategy' => $this->checkout->admin_request ? |
132 | - new EE_Div_Per_Section_Layout() : |
|
133 | - new EE_Template_Layout( |
|
132 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
134 | 133 | array( |
135 | 134 | 'layout_template_file' => $this->_template, // layout_template |
136 | 135 | 'template_args' => $template_args |
@@ -147,61 +146,61 @@ discard block |
||
147 | 146 | * @param EE_Registration $registration |
148 | 147 | * @return EE_Form_Section_Proper |
149 | 148 | */ |
150 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
151 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
149 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
150 | + EE_Registry::instance()->load_helper('Template'); |
|
152 | 151 | static $attendee_nmbr = 1; |
153 | 152 | // array of params to pass to parent constructor |
154 | 153 | $form_args = array( |
155 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
154 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
156 | 155 | 'html_class' => 'ee-reg-form-attendee-dv', |
157 | 156 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
158 | 157 | 'subsections' => array(), |
159 | 158 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
160 | 159 | array( |
161 | 160 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
162 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
161 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
163 | 162 | ) |
164 | 163 | ) |
165 | 164 | ); |
166 | 165 | // verify that registration has valid event |
167 | - if ( $registration->event() instanceof EE_Event ) { |
|
166 | + if ($registration->event() instanceof EE_Event) { |
|
168 | 167 | $query_params = array( |
169 | 168 | array( |
170 | 169 | 'Event.EVT_ID' => $registration->event()->ID(), |
171 | 170 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
172 | 171 | ), |
173 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
172 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
174 | 173 | ); |
175 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
176 | - if ( $question_groups ) { |
|
177 | - foreach ( $question_groups as $question_group ) { |
|
178 | - if ( $question_group instanceof EE_Question_Group ) { |
|
179 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
174 | + $question_groups = $registration->event()->question_groups($query_params); |
|
175 | + if ($question_groups) { |
|
176 | + foreach ($question_groups as $question_group) { |
|
177 | + if ($question_group instanceof EE_Question_Group) { |
|
178 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
180 | 179 | // add hidden input |
181 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
180 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
182 | 181 | } |
183 | 182 | } |
184 | 183 | // if we have question groups for additional attendees, then display the copy options |
185 | 184 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
186 | 185 | } else { |
187 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
186 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
188 | 187 | EEH_Template::locate_template( |
189 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
190 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
188 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
189 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
191 | 190 | TRUE, |
192 | 191 | TRUE |
193 | 192 | ) |
194 | 193 | ); |
195 | 194 | // add hidden input |
196 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
195 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
197 | 196 | } |
198 | 197 | } |
199 | - if ( $registration->is_primary_registrant() ) { |
|
198 | + if ($registration->is_primary_registrant()) { |
|
200 | 199 | // generate hidden input |
201 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
200 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
202 | 201 | } |
203 | 202 | $attendee_nmbr++; |
204 | - return new EE_Form_Section_Proper( $form_args ); |
|
203 | + return new EE_Form_Section_Proper($form_args); |
|
205 | 204 | } |
206 | 205 | |
207 | 206 | |
@@ -214,11 +213,11 @@ discard block |
||
214 | 213 | * @param bool $additional_attendee_reg_info |
215 | 214 | * @return EE_Form_Input_Base |
216 | 215 | */ |
217 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
216 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
218 | 217 | // generate hidden input |
219 | 218 | return new EE_Hidden_Input( |
220 | 219 | array( |
221 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
220 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
222 | 221 | 'default' => $additional_attendee_reg_info |
223 | 222 | ) |
224 | 223 | ); |
@@ -231,22 +230,22 @@ discard block |
||
231 | 230 | * @param EE_Question_Group $question_group |
232 | 231 | * @return EE_Form_Section_Proper |
233 | 232 | */ |
234 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
233 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
235 | 234 | // array of params to pass to parent constructor |
236 | 235 | $form_args = array( |
237 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
236 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
238 | 237 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
239 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
238 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
240 | 239 | 'subsections' => array( |
241 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
240 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
242 | 241 | ), |
243 | 242 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
244 | 243 | ); |
245 | 244 | // where params |
246 | - $query_params = array( 'QST_deleted' => 0 ); |
|
245 | + $query_params = array('QST_deleted' => 0); |
|
247 | 246 | // don't load admin only questions on the frontend |
248 | - if ( ! $this->checkout->admin_request ) { |
|
249 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
247 | + if ( ! $this->checkout->admin_request) { |
|
248 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
250 | 249 | } |
251 | 250 | $questions = $question_group->get_many_related( |
252 | 251 | 'Question', |
@@ -258,21 +257,21 @@ discard block |
||
258 | 257 | ) |
259 | 258 | ); |
260 | 259 | // filter for additional content before questions |
261 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
260 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
262 | 261 | // loop thru questions |
263 | - foreach ( $questions as $question ) { |
|
264 | - if( $question instanceof EE_Question ){ |
|
262 | + foreach ($questions as $question) { |
|
263 | + if ($question instanceof EE_Question) { |
|
265 | 264 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
266 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
265 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
267 | 266 | } |
268 | 267 | } |
269 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
268 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
270 | 269 | |
271 | 270 | // filter for additional content after questions |
272 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
271 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
273 | 272 | // d( $form_args ); |
274 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
275 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
273 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
274 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
276 | 275 | } |
277 | 276 | |
278 | 277 | |
@@ -282,12 +281,12 @@ discard block |
||
282 | 281 | * @param EE_Question_Group $question_group |
283 | 282 | * @return EE_Form_Section_HTML |
284 | 283 | */ |
285 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
284 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
286 | 285 | $html = ''; |
287 | 286 | // group_name |
288 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
287 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
289 | 288 | EE_Registry::instance()->load_helper('HTML'); |
290 | - if ( $this->checkout->admin_request ) { |
|
289 | + if ($this->checkout->admin_request) { |
|
291 | 290 | $html .= EEH_HTML::br(); |
292 | 291 | $html .= EEH_HTML::h3( |
293 | 292 | $question_group->name(), |
@@ -301,7 +300,7 @@ discard block |
||
301 | 300 | } |
302 | 301 | } |
303 | 302 | // group_desc |
304 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
303 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
305 | 304 | $html .= EEH_HTML::p( |
306 | 305 | $question_group->desc(), |
307 | 306 | '', |
@@ -309,7 +308,7 @@ discard block |
||
309 | 308 | ); |
310 | 309 | |
311 | 310 | } |
312 | - return new EE_Form_Section_HTML( $html ); |
|
311 | + return new EE_Form_Section_HTML($html); |
|
313 | 312 | } |
314 | 313 | |
315 | 314 | |
@@ -318,14 +317,14 @@ discard block |
||
318 | 317 | * @access public |
319 | 318 | * @return EE_Form_Section_Proper |
320 | 319 | */ |
321 | - private function _copy_attendee_info_form(){ |
|
320 | + private function _copy_attendee_info_form() { |
|
322 | 321 | // array of params to pass to parent constructor |
323 | 322 | return new EE_Form_Section_Proper( |
324 | 323 | array( |
325 | 324 | 'subsections' => $this->_copy_attendee_info_inputs(), |
326 | 325 | 'layout_strategy' => new EE_Template_Layout( |
327 | 326 | array( |
328 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
327 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
329 | 328 | 'begin_template_file' => NULL, |
330 | 329 | 'input_template_file' => NULL, |
331 | 330 | 'subsection_template_file' => NULL, |
@@ -347,8 +346,8 @@ discard block |
||
347 | 346 | private function _auto_copy_attendee_info() { |
348 | 347 | return new EE_Form_Section_HTML( |
349 | 348 | EEH_Template::locate_template( |
350 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
351 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
349 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
350 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
352 | 351 | TRUE, |
353 | 352 | TRUE |
354 | 353 | ) |
@@ -367,25 +366,25 @@ discard block |
||
367 | 366 | $copy_attendee_info_inputs = array(); |
368 | 367 | $prev_ticket = NULL; |
369 | 368 | // grab the saved registrations from the transaction |
370 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
371 | - foreach ( $registrations as $registration ) { |
|
369 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
370 | + foreach ($registrations as $registration) { |
|
372 | 371 | // for all attendees other than the primary attendee |
373 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
372 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
374 | 373 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
375 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
374 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
376 | 375 | $item_name = $registration->ticket()->name(); |
377 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
378 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
379 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
376 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
377 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
378 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
380 | 379 | ); |
381 | 380 | $prev_ticket = $registration->ticket()->ID(); |
382 | 381 | } |
383 | 382 | |
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
385 | 384 | EE_Checkbox_Multi_Input( |
386 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
385 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
387 | 386 | array( |
388 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
387 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
389 | 388 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
390 | 389 | 'display_html_label_text' => FALSE |
391 | 390 | ) |
@@ -404,7 +403,7 @@ discard block |
||
404 | 403 | * @param EE_Registration $registration |
405 | 404 | * @return EE_Form_Input_Base |
406 | 405 | */ |
407 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
406 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
408 | 407 | // generate hidden input |
409 | 408 | return new EE_Hidden_Input( |
410 | 409 | array( |
@@ -422,31 +421,31 @@ discard block |
||
422 | 421 | * @param EE_Question $question |
423 | 422 | * @return EE_Form_Input_Base |
424 | 423 | */ |
425 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
424 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
426 | 425 | |
427 | 426 | // if this question was for an attendee detail, then check for that answer |
428 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
427 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
429 | 428 | $answer = $answer_value === null |
430 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
429 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
431 | 430 | : null; |
432 | 431 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
433 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
432 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
434 | 433 | // create an EE_Answer object for storing everything in |
435 | - $answer = EE_Answer::new_instance ( array( |
|
434 | + $answer = EE_Answer::new_instance(array( |
|
436 | 435 | 'QST_ID'=> $question->ID(), |
437 | 436 | 'REG_ID'=> $registration->ID() |
438 | 437 | )); |
439 | 438 | } |
440 | 439 | // verify instance |
441 | - if( $answer instanceof EE_Answer ){ |
|
442 | - if ( ! empty( $answer_value )) { |
|
443 | - $answer->set( 'ANS_value', $answer_value ); |
|
440 | + if ($answer instanceof EE_Answer) { |
|
441 | + if ( ! empty($answer_value)) { |
|
442 | + $answer->set('ANS_value', $answer_value); |
|
444 | 443 | } |
445 | - $answer->cache( 'Question', $question ); |
|
446 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
447 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
444 | + $answer->cache('Question', $question); |
|
445 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
446 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
448 | 447 | } |
449 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
448 | + return $this->_generate_question_input($registration, $question, $answer); |
|
450 | 449 | |
451 | 450 | } |
452 | 451 | |
@@ -458,7 +457,7 @@ discard block |
||
458 | 457 | * @param mixed EE_Answer|NULL $answer |
459 | 458 | * @return EE_Form_Input_Base |
460 | 459 | */ |
461 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
460 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
462 | 461 | // d( $registration ); |
463 | 462 | // d( $question ); |
464 | 463 | // d( $answer ); |
@@ -481,95 +480,95 @@ discard block |
||
481 | 480 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
482 | 481 | |
483 | 482 | $input_constructor_args = array( |
484 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
485 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
486 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
483 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
484 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
485 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
487 | 486 | 'required' => $question->required() ? TRUE : FALSE, |
488 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
487 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
489 | 488 | 'html_label_class' => 'ee-reg-qstn', |
490 | 489 | 'html_label_text' => $question->display_text(), |
491 | 490 | 'required_validation_error_message' => $question->required_text() |
492 | 491 | ); |
493 | 492 | // has this question been answered ? |
494 | - if ( $answer instanceof EE_Answer ) { |
|
495 | - if ( $answer->ID() ) { |
|
496 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
497 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
498 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
493 | + if ($answer instanceof EE_Answer) { |
|
494 | + if ($answer->ID()) { |
|
495 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
496 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
497 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
499 | 498 | } |
500 | 499 | $input_constructor_args['default'] = $answer->value(); |
501 | 500 | } |
502 | 501 | //add "-lbl" to the end of the label id |
503 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
502 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
504 | 503 | |
505 | - switch ( $question->type() ) { |
|
504 | + switch ($question->type()) { |
|
506 | 505 | // Text |
507 | 506 | case EEM_Question::QST_type_text : |
508 | - if( $identifier == 'email' ){ |
|
509 | - return new EE_Email_Input( $input_constructor_args ); |
|
510 | - }else{ |
|
511 | - return new EE_Text_Input( $input_constructor_args ); |
|
507 | + if ($identifier == 'email') { |
|
508 | + return new EE_Email_Input($input_constructor_args); |
|
509 | + } else { |
|
510 | + return new EE_Text_Input($input_constructor_args); |
|
512 | 511 | } |
513 | 512 | break; |
514 | 513 | // Textarea |
515 | 514 | case EEM_Question::QST_type_textarea : |
516 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
515 | + return new EE_Text_Area_Input($input_constructor_args); |
|
517 | 516 | break; |
518 | 517 | // Radio Buttons |
519 | 518 | case EEM_Question::QST_type_radio : |
520 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
519 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
521 | 520 | break; |
522 | 521 | // Dropdown |
523 | 522 | case EEM_Question::QST_type_dropdown : |
524 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
523 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
525 | 524 | break; |
526 | 525 | // State Dropdown |
527 | 526 | case EEM_Question::QST_type_state : |
528 | - $state_options = array( '' => array( '' => '')); |
|
527 | + $state_options = array('' => array('' => '')); |
|
529 | 528 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
530 | - if ( ! empty( $states )) { |
|
531 | - foreach( $states as $state ){ |
|
532 | - if ( $state instanceof EE_State ) { |
|
533 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
529 | + if ( ! empty($states)) { |
|
530 | + foreach ($states as $state) { |
|
531 | + if ($state instanceof EE_State) { |
|
532 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
534 | 533 | } |
535 | 534 | } |
536 | 535 | } |
537 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
538 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
536 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
537 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
539 | 538 | break; |
540 | 539 | // Country Dropdown |
541 | 540 | case EEM_Question::QST_type_country : |
542 | - $country_options = array( '' => '' ); |
|
541 | + $country_options = array('' => ''); |
|
543 | 542 | // get possibly cached list of countries |
544 | 543 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
545 | - if ( ! empty( $countries )) { |
|
546 | - foreach( $countries as $country ){ |
|
547 | - if ( $country instanceof EE_Country ) { |
|
548 | - $country_options[ $country->ID() ] = $country->name(); |
|
544 | + if ( ! empty($countries)) { |
|
545 | + foreach ($countries as $country) { |
|
546 | + if ($country instanceof EE_Country) { |
|
547 | + $country_options[$country->ID()] = $country->name(); |
|
549 | 548 | } |
550 | 549 | } |
551 | 550 | } |
552 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
553 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
551 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
552 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
554 | 553 | break; |
555 | 554 | // Checkboxes |
556 | 555 | case EEM_Question::QST_type_checkbox : |
557 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
556 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
558 | 557 | break; |
559 | 558 | // Date |
560 | 559 | case EEM_Question::QST_type_date : |
561 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
560 | + return new EE_Datepicker_Input($input_constructor_args); |
|
562 | 561 | break; |
563 | 562 | case EEM_Question::QST_type_html_textarea : |
564 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
565 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
566 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
563 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
564 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
565 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
567 | 566 | return $input; |
568 | 567 | // fallback |
569 | 568 | default : |
570 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
571 | - if( ! $default_input ){ |
|
572 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
569 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
570 | + if ( ! $default_input) { |
|
571 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
573 | 572 | } |
574 | 573 | return $default_input; |
575 | 574 | } |
@@ -594,65 +593,65 @@ discard block |
||
594 | 593 | */ |
595 | 594 | public function process_reg_step() { |
596 | 595 | |
597 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
596 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
598 | 597 | // grab validated data from form |
599 | 598 | $valid_data = $this->checkout->current_step->valid_data(); |
600 | 599 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
601 | 600 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
602 | 601 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
603 | - if ( empty( $valid_data )) { |
|
604 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
602 | + if (empty($valid_data)) { |
|
603 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
605 | 604 | return FALSE; |
606 | 605 | } |
607 | 606 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
608 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
609 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
607 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
608 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
610 | 609 | return FALSE; |
611 | 610 | } |
612 | 611 | // get cached registrations |
613 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
612 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
614 | 613 | // verify we got the goods |
615 | - if ( empty( $registrations )) { |
|
616 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
614 | + if (empty($registrations)) { |
|
615 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
617 | 616 | return FALSE; |
618 | 617 | } |
619 | 618 | // extract attendee info from form data and save to model objects |
620 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
619 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
621 | 620 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
622 | - if ( $registrations_processed === FALSE ) { |
|
621 | + if ($registrations_processed === FALSE) { |
|
623 | 622 | // but return immediately if the previous step exited early due to errors |
624 | 623 | return FALSE; |
625 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
624 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
626 | 625 | // generate a correctly translated string for all possible singular/plural combinations |
627 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
626 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
628 | 627 | $error_msg = sprintf( |
629 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
628 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
630 | 629 | $this->checkout->total_ticket_count, |
631 | 630 | $registrations_processed |
632 | 631 | ); |
633 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
632 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
634 | 633 | $error_msg = sprintf( |
635 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
634 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
636 | 635 | $this->checkout->total_ticket_count, |
637 | 636 | $registrations_processed |
638 | 637 | ); |
639 | 638 | } else { |
640 | 639 | $error_msg = sprintf( |
641 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
640 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
642 | 641 | $this->checkout->total_ticket_count, |
643 | 642 | $registrations_processed |
644 | 643 | ); |
645 | 644 | |
646 | 645 | } |
647 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
646 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
648 | 647 | return FALSE; |
649 | 648 | } |
650 | 649 | // mark this reg step as completed |
651 | 650 | $this->checkout->current_step->set_completed(); |
652 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
651 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
653 | 652 | //do action in case a plugin wants to do something with the data submitted in step 1. |
654 | 653 | //passes EE_Single_Page_Checkout, and it's posted data |
655 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
654 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
656 | 655 | return TRUE; |
657 | 656 | |
658 | 657 | } |
@@ -666,9 +665,9 @@ discard block |
||
666 | 665 | * @param array $valid_data |
667 | 666 | * @return boolean | int |
668 | 667 | */ |
669 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
668 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
670 | 669 | // load resources and set some defaults |
671 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
670 | + EE_Registry::instance()->load_model('Attendee'); |
|
672 | 671 | // holder for primary registrant attendee object |
673 | 672 | $this->checkout->primary_attendee_obj = NULL; |
674 | 673 | // array for tracking reg form data for the primary registrant |
@@ -685,19 +684,19 @@ discard block |
||
685 | 684 | // attendee counter |
686 | 685 | $att_nmbr = 0; |
687 | 686 | // grab the saved registrations from the transaction |
688 | - foreach ( $registrations as $registration ) { |
|
687 | + foreach ($registrations as $registration) { |
|
689 | 688 | // verify EE_Registration object |
690 | - if ( ! $registration instanceof EE_Registration ) { |
|
691 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
689 | + if ( ! $registration instanceof EE_Registration) { |
|
690 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
692 | 691 | return FALSE; |
693 | 692 | } |
694 | 693 | $reg_url_link = $registration->reg_url_link(); |
695 | 694 | // reg_url_link exists ? |
696 | - if ( $reg_url_link ) { |
|
695 | + if ($reg_url_link) { |
|
697 | 696 | // should this registration be processed during this visit ? |
698 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
697 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
699 | 698 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
700 | - if ( ! $this->checkout->revisit ) { |
|
699 | + if ( ! $this->checkout->revisit) { |
|
701 | 700 | $registration->save(); |
702 | 701 | } |
703 | 702 | |
@@ -708,41 +707,41 @@ discard block |
||
708 | 707 | * @var bool if TRUE is returned by the plugin then the |
709 | 708 | * registration processing is halted. |
710 | 709 | */ |
711 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
710 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
712 | 711 | return FALSE; |
713 | 712 | } |
714 | 713 | |
715 | 714 | // Houston, we have a registration! |
716 | 715 | $att_nmbr++; |
717 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
716 | + $this->_attendee_data[$reg_url_link] = array(); |
|
718 | 717 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
719 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
718 | + if (isset($valid_data[$reg_url_link])) { |
|
720 | 719 | // do we need to copy basic info from primary attendee ? |
721 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
720 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
722 | 721 | // filter form input data for this registration |
723 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
722 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
724 | 723 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
725 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
726 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
727 | - unset( $valid_data['primary_attendee'] ); |
|
724 | + if (isset($valid_data['primary_attendee'])) { |
|
725 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
726 | + unset($valid_data['primary_attendee']); |
|
728 | 727 | } |
729 | 728 | // now loop through our array of valid post data && process attendee reg forms |
730 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
731 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
732 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
729 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
730 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
731 | + foreach ($form_inputs as $form_input => $input_value) { |
|
733 | 732 | // check for critical inputs |
734 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
733 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
735 | 734 | return FALSE; |
736 | 735 | } |
737 | 736 | // store a bit of data about the primary attendee |
738 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
739 | - $primary_registrant[ $form_input ] = $input_value; |
|
740 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
741 | - $input_value = $primary_registrant[ $form_input ]; |
|
737 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
738 | + $primary_registrant[$form_input] = $input_value; |
|
739 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
740 | + $input_value = $primary_registrant[$form_input]; |
|
742 | 741 | } |
743 | 742 | // now attempt to save the input data |
744 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
745 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
743 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
744 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
746 | 745 | return FALSE; |
747 | 746 | } |
748 | 747 | } |
@@ -751,51 +750,51 @@ discard block |
||
751 | 750 | } |
752 | 751 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
753 | 752 | // this registration does not require additional attendee information ? |
754 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
753 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
755 | 754 | // just copy the primary registrant |
756 | 755 | $attendee = $this->checkout->primary_attendee_obj; |
757 | 756 | } else { |
758 | 757 | // have we met before? |
759 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
758 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
760 | 759 | // did we find an already existing record for this attendee ? |
761 | - if ( $attendee instanceof EE_Attendee ) { |
|
762 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
760 | + if ($attendee instanceof EE_Attendee) { |
|
761 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
763 | 762 | } else { |
764 | 763 | // ensure critical details are set for additional attendees |
765 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
766 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
764 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
765 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
767 | 766 | } |
768 | 767 | // who's #1 ? |
769 | - if ( $att_nmbr == 1 ) { |
|
768 | + if ($att_nmbr == 1) { |
|
770 | 769 | $this->checkout->primary_attendee_obj = $attendee; |
771 | 770 | } |
772 | 771 | } |
773 | 772 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
774 | 773 | // add relation to registration, set attendee ID, and cache attendee |
775 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
776 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
777 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
774 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
775 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
776 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
778 | 777 | return FALSE; |
779 | 778 | } |
780 | 779 | /** @type EE_Registration_Processor $registration_processor */ |
781 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
780 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
782 | 781 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
783 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
782 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
784 | 783 | /** @type EE_Transaction_Processor $transaction_processor */ |
785 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
784 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
786 | 785 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
787 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
786 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
788 | 787 | // if we've gotten this far, then let's save what we have |
789 | 788 | $registration->save(); |
790 | 789 | // add relation between TXN and registration |
791 | - $this->_associate_registration_with_transaction( $registration ); |
|
790 | + $this->_associate_registration_with_transaction($registration); |
|
792 | 791 | |
793 | 792 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 793 | |
795 | - } else { |
|
796 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
794 | + } else { |
|
795 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 796 | // remove malformed data |
798 | - unset( $valid_data[ $reg_url_link ] ); |
|
797 | + unset($valid_data[$reg_url_link]); |
|
799 | 798 | return FALSE; |
800 | 799 | } |
801 | 800 | |
@@ -813,22 +812,22 @@ discard block |
||
813 | 812 | * @param string $input_value |
814 | 813 | * @return boolean |
815 | 814 | */ |
816 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
815 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
817 | 816 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
818 | 817 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
819 | 818 | // allow for plugins to hook in and do their own processing of the form input. |
820 | 819 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
821 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
820 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
822 | 821 | return TRUE; |
823 | 822 | } |
824 | 823 | |
825 | 824 | // grab related answer objects |
826 | 825 | $answers = $registration->answers(); |
827 | 826 | // $answer_cache_id is the key used to find the EE_Answer we want |
828 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
829 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
827 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
828 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
830 | 829 | //rename form_inputs if they are EE_Attendee properties |
831 | - switch( (string)$form_input ) { |
|
830 | + switch ((string) $form_input) { |
|
832 | 831 | |
833 | 832 | case 'state' : |
834 | 833 | case 'STA_ID' : |
@@ -843,32 +842,32 @@ discard block |
||
843 | 842 | break; |
844 | 843 | |
845 | 844 | default : |
846 | - $ATT_input = 'ATT_' . $form_input; |
|
845 | + $ATT_input = 'ATT_'.$form_input; |
|
847 | 846 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
848 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
849 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
847 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
848 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
850 | 849 | } |
851 | 850 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
852 | 851 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
853 | 852 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
854 | 853 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
855 | 854 | // if this form input has a corresponding attendee property |
856 | - if ( $attendee_property ) { |
|
857 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
858 | - if ( $answer_is_obj ) { |
|
855 | + if ($attendee_property) { |
|
856 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
857 | + if ($answer_is_obj) { |
|
859 | 858 | // and delete the corresponding answer since we won't be storing this data in that object |
860 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
859 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
861 | 860 | } |
862 | 861 | return TRUE; |
863 | - } elseif ( $answer_is_obj ) { |
|
862 | + } elseif ($answer_is_obj) { |
|
864 | 863 | // save this data to the answer object |
865 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
866 | - $result = $answers[ $answer_cache_id ]->save(); |
|
864 | + $answers[$answer_cache_id]->set_value($input_value); |
|
865 | + $result = $answers[$answer_cache_id]->save(); |
|
867 | 866 | return $result !== false ? true : false; |
868 | 867 | } else { |
869 | - foreach ( $answers as $answer ) { |
|
870 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
871 | - $answer->set_value( $input_value ); |
|
868 | + foreach ($answers as $answer) { |
|
869 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
870 | + $answer->set_value($input_value); |
|
872 | 871 | $result = $answer->save(); |
873 | 872 | return $result !== false ? true : false; |
874 | 873 | } |
@@ -886,29 +885,29 @@ discard block |
||
886 | 885 | * @param string $input_value |
887 | 886 | * @return boolean |
888 | 887 | */ |
889 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
890 | - if ( empty( $input_value )) { |
|
891 | - switch( $form_input ) { |
|
888 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
889 | + if (empty($input_value)) { |
|
890 | + switch ($form_input) { |
|
892 | 891 | case 'fname' : |
893 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
892 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
894 | 893 | return FALSE; |
895 | 894 | break; |
896 | 895 | case 'lname' : |
897 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
896 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
898 | 897 | return FALSE; |
899 | 898 | break; |
900 | 899 | case 'email' : |
901 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
900 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
902 | 901 | return FALSE; |
903 | 902 | break; |
904 | 903 | } |
905 | - } else if ( $form_input === 'email' ) { |
|
904 | + } else if ($form_input === 'email') { |
|
906 | 905 | // clean the email address |
907 | - $valid_email = sanitize_email( $input_value ); |
|
906 | + $valid_email = sanitize_email($input_value); |
|
908 | 907 | // check if it matches |
909 | - if ( $input_value != $valid_email ) { |
|
908 | + if ($input_value != $valid_email) { |
|
910 | 909 | // whoops!!! |
911 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
910 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
912 | 911 | return FALSE; |
913 | 912 | } |
914 | 913 | } |
@@ -936,14 +935,14 @@ discard block |
||
936 | 935 | * @param array $attendee_data |
937 | 936 | * @return boolean |
938 | 937 | */ |
939 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
938 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
940 | 939 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
941 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
942 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
943 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
940 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
941 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
942 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
944 | 943 | // but only if those have values |
945 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
946 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
944 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
945 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
947 | 946 | 'ATT_fname' => $ATT_fname, |
948 | 947 | 'ATT_lname' => $ATT_lname, |
949 | 948 | 'ATT_email' => $ATT_email |
@@ -951,7 +950,7 @@ discard block |
||
951 | 950 | } else { |
952 | 951 | $existing_attendee = NULL; |
953 | 952 | } |
954 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
953 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
955 | 954 | } |
956 | 955 | |
957 | 956 | |
@@ -963,13 +962,13 @@ discard block |
||
963 | 962 | * @param array $attendee_data |
964 | 963 | * @return \EE_Attendee |
965 | 964 | */ |
966 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
965 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
967 | 966 | // first remove fname, lname, and email from attendee data |
968 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
967 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
969 | 968 | // now loop thru what's left and add to attendee CPT |
970 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
971 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
972 | - $existing_attendee->set( $property_name, $property_value ); |
|
969 | + foreach ($attendee_data as $property_name => $property_value) { |
|
970 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
971 | + $existing_attendee->set($property_name, $property_value); |
|
973 | 972 | } |
974 | 973 | } |
975 | 974 | // better save that now |
@@ -986,11 +985,11 @@ discard block |
||
986 | 985 | * @param EE_Attendee $attendee |
987 | 986 | * @return void |
988 | 987 | */ |
989 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
988 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
990 | 989 | // add relation to attendee |
991 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
992 | - $registration->set_attendee_id( $attendee->ID() ); |
|
993 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
990 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
991 | + $registration->set_attendee_id($attendee->ID()); |
|
992 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
994 | 993 | } |
995 | 994 | |
996 | 995 | |
@@ -1001,10 +1000,10 @@ discard block |
||
1001 | 1000 | * @param EE_Registration $registration |
1002 | 1001 | * @return void |
1003 | 1002 | */ |
1004 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1003 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1005 | 1004 | // add relation to attendee |
1006 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1007 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1005 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1006 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1008 | 1007 | } |
1009 | 1008 | |
1010 | 1009 | |
@@ -1016,17 +1015,17 @@ discard block |
||
1016 | 1015 | * @param array $attendee_data |
1017 | 1016 | * @return array |
1018 | 1017 | */ |
1019 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1018 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1020 | 1019 | // bare minimum critical details include first name, last name, email address |
1021 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1020 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1022 | 1021 | // add address info to critical details? |
1023 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1024 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1025 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1022 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1023 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1024 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1026 | 1025 | } |
1027 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1028 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1029 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1026 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1027 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1028 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1030 | 1029 | } |
1031 | 1030 | } |
1032 | 1031 | return $attendee_data; |
@@ -1041,11 +1040,11 @@ discard block |
||
1041 | 1040 | * @param array $attendee_data |
1042 | 1041 | * @return \EE_Attendee |
1043 | 1042 | */ |
1044 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1043 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1045 | 1044 | // create new attendee object |
1046 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1045 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1047 | 1046 | // set author to event creator |
1048 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1047 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1049 | 1048 | $new_attendee->save(); |
1050 | 1049 | return $new_attendee; |
1051 | 1050 | } |
@@ -1061,7 +1060,7 @@ discard block |
||
1061 | 1060 | */ |
1062 | 1061 | public function update_reg_step() { |
1063 | 1062 | // save everything |
1064 | - if ( $this->process_reg_step() ) { |
|
1063 | + if ($this->process_reg_step()) { |
|
1065 | 1064 | $this->checkout->redirect = TRUE; |
1066 | 1065 | $this->checkout->redirect_url = add_query_arg( |
1067 | 1066 | array( |
@@ -1070,7 +1069,7 @@ discard block |
||
1070 | 1069 | ), |
1071 | 1070 | $this->checkout->thank_you_page_url |
1072 | 1071 | ); |
1073 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1072 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1074 | 1073 | return TRUE; |
1075 | 1074 | } |
1076 | 1075 | return FALSE; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | - * @return boolean |
|
45 | + * @return boolean|null |
|
46 | 46 | */ |
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | |
171 | 171 | /** |
172 | - * @return boolean |
|
172 | + * @return boolean|null |
|
173 | 173 | */ |
174 | 174 | public function update_reg_step() { |
175 | 175 | EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'finalize_registration'; |
25 | 25 | $this->_name = __('Finalize Registration', 'event_espresso'); |
26 | 26 | $this->_submit_button_text = $this->_name; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
49 | 49 | // there's actually no reg form to process if this is the final step |
50 | - if ( $this->is_current_step() ) { |
|
50 | + if ($this->is_current_step()) { |
|
51 | 51 | $this->checkout->step = $_REQUEST['step'] = $this->slug(); |
52 | - $this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step'; |
|
52 | + $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
|
53 | 53 | $this->checkout->generate_reg_form = false; |
54 | 54 | } |
55 | 55 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function process_reg_step() { |
74 | 74 | // ensure all data gets refreshed from the db |
75 | - $this->checkout->refresh_all_entities( true ); |
|
75 | + $this->checkout->refresh_all_entities(true); |
|
76 | 76 | // ensures that all details and statuses for transaction, registration, and payments are updated |
77 | 77 | $txn_update_params = $this->_finalize_transaction(); |
78 | 78 | // DEBUG LOG |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | // ) |
87 | 87 | //); |
88 | 88 | // set a hook point |
89 | - do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params ); |
|
89 | + do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params); |
|
90 | 90 | // check if transaction has a primary registrant and that it has a related Attendee object |
91 | - if ( $this->checkout->transaction_has_primary_registrant() ) { |
|
91 | + if ($this->checkout->transaction_has_primary_registrant()) { |
|
92 | 92 | // setup URL for redirect |
93 | 93 | $this->checkout->redirect_url = add_query_arg( |
94 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
94 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
95 | 95 | $this->checkout->thank_you_page_url |
96 | 96 | ); |
97 | 97 | } else { |
98 | - EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
98 | + EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
99 | 99 | $this->checkout->redirect = false; |
100 | 100 | $this->checkout->continue_reg = false; |
101 | 101 | return false; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | // you don't have to go home but you can't stay here ! |
104 | 104 | $this->checkout->redirect = true; |
105 | 105 | $this->checkout->continue_reg = true; |
106 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
107 | - if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) { |
|
106 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
107 | + if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) { |
|
108 | 108 | // mark this reg step as completed |
109 | 109 | $this->checkout->current_step->set_completed(); |
110 | 110 | } |
@@ -121,41 +121,41 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function _finalize_transaction() { |
123 | 123 | /** @type EE_Transaction_Processor $transaction_processor */ |
124 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
124 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
125 | 125 | //set revisit flag in txn processor |
126 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
126 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
127 | 127 | // at this point we'll consider a TXN to not have been abandoned |
128 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
129 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
128 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
129 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
130 | 130 | // save TXN data to the cart |
131 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
131 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
132 | 132 | } |
133 | 133 | /** @type EE_Transaction_Payments $transaction_payments */ |
134 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
134 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
135 | 135 | // maybe update status, but don't save transaction just yet |
136 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
136 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
137 | 137 | // If the selected method of payment used an off-site gateway... |
138 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
139 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) { |
|
140 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
141 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
138 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
139 | + if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) { |
|
140 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
141 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
142 | 142 | // do NOT trigger notifications because it was already done during the IPN |
143 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
144 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
143 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
144 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
145 | 145 | } |
146 | 146 | } else if ( |
147 | 147 | // if SPCO revisit and TXN status has changed due to a payment |
148 | - filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ) && |
|
149 | - ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() ) |
|
148 | + filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN) && |
|
149 | + ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated()) |
|
150 | 150 | ) { |
151 | 151 | // send out notifications |
152 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
152 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
153 | 153 | } else { |
154 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
154 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | // this will result in the base session properties getting saved to the TXN_Session_data field |
158 | - $this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true )); |
|
158 | + $this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true)); |
|
159 | 159 | |
160 | 160 | // update the TXN if payment conditions have changed |
161 | 161 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @return boolean |
173 | 173 | */ |
174 | 174 | public function update_reg_step() { |
175 | - EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
|
175 | + EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0'); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | /** |
43 | - * @return boolean |
|
43 | + * @return boolean|null |
|
44 | 44 | */ |
45 | 45 | public function initialize_reg_step() { |
46 | 46 | $this->checkout->remove_reg_step( $this->_slug ); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
61 | - * @return boolean |
|
61 | + * @return boolean|null |
|
62 | 62 | */ |
63 | 63 | public function process_reg_step() { |
64 | 64 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | |
69 | 69 | /** |
70 | - * @return boolean |
|
70 | + * @return boolean|null |
|
71 | 71 | */ |
72 | 72 | public function update_reg_step() { |
73 | 73 |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Registration_Confirmation |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'registration_confirmation'; |
25 | 25 | $this->_name = __('Registration Confirmation', 'event_espresso'); |
26 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'registration_page_confirmation.template.php'; |
|
26 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'registration_page_confirmation.template.php'; |
|
27 | 27 | $this->checkout = $checkout; |
28 | 28 | } |
29 | 29 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return boolean |
44 | 44 | */ |
45 | 45 | public function initialize_reg_step() { |
46 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
46 | + $this->checkout->remove_reg_step($this->_slug); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 |
@@ -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_Registration_Confirmation |
|
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_Registration_Confirmation |
|
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_Registration_Confirmation extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |