@@ -822,12 +822,12 @@ discard block |
||
822 | 822 | if ( $registration instanceof EE_Registration ) { |
823 | 823 | // we display all attendee info for the primary registrant |
824 | 824 | if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
825 | - && $registration->is_primary_registrant() |
|
825 | + && $registration->is_primary_registrant() |
|
826 | 826 | ) { |
827 | 827 | $this->checkout->primary_revisit = true; |
828 | 828 | break; |
829 | 829 | } else if ( $this->checkout->revisit |
830 | - && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
830 | + && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
831 | 831 | ) { |
832 | 832 | // but hide info if it doesn't belong to you |
833 | 833 | $transaction->clear_cache( 'Registration', $registration->ID() ); |
@@ -859,23 +859,23 @@ discard block |
||
859 | 859 | //do the following for each ticket of this type they selected |
860 | 860 | for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
861 | 861 | $att_nmbr++; |
862 | - /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
863 | - $CreateRegistrationCommand = EE_Registry::instance() |
|
864 | - ->create( |
|
865 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
866 | - array( |
|
867 | - $transaction, |
|
868 | - $line_item, |
|
869 | - $att_nmbr, |
|
870 | - $this->checkout->total_ticket_count |
|
871 | - ) |
|
872 | - ); |
|
873 | - // override capabilities for frontend registrations |
|
874 | - if ( ! is_admin()) { |
|
875 | - $CreateRegistrationCommand->setCapCheck( |
|
876 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
877 | - ); |
|
878 | - } |
|
862 | + /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
863 | + $CreateRegistrationCommand = EE_Registry::instance() |
|
864 | + ->create( |
|
865 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
866 | + array( |
|
867 | + $transaction, |
|
868 | + $line_item, |
|
869 | + $att_nmbr, |
|
870 | + $this->checkout->total_ticket_count |
|
871 | + ) |
|
872 | + ); |
|
873 | + // override capabilities for frontend registrations |
|
874 | + if ( ! is_admin()) { |
|
875 | + $CreateRegistrationCommand->setCapCheck( |
|
876 | + new PublicCapabilities( '', 'create_new_registration' ) |
|
877 | + ); |
|
878 | + } |
|
879 | 879 | $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
880 | 880 | if ( ! $registration instanceof EE_Registration ) { |
881 | 881 | throw new InvalidEntityException( $registration, 'EE_Registration' ); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\domain\services\capabilities\PublicCapabilities; |
2 | 2 | use EventEspresso\core\exceptions\InvalidEntityException; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
5 | 5 | /** |
6 | 6 | * Single Page Checkout (SPCO) |
7 | 7 | * |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @return EED_Single_Page_Checkout |
51 | 51 | */ |
52 | 52 | public static function instance() { |
53 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
54 | - return parent::get_instance( __CLASS__ ); |
|
53 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
54 | + return parent::get_instance(__CLASS__); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public static function set_hooks_admin() { |
98 | 98 | EED_Single_Page_Checkout::set_definitions(); |
99 | - if ( defined( 'DOING_AJAX' )) { |
|
99 | + if (defined('DOING_AJAX')) { |
|
100 | 100 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
101 | 101 | ob_start(); |
102 | 102 | EED_Single_Page_Checkout::load_request_handler(); |
103 | 103 | EED_Single_Page_Checkout::load_reg_steps(); |
104 | 104 | } else { |
105 | 105 | // 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 |
106 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
106 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
107 | 107 | } |
108 | 108 | // set ajax hooks |
109 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
110 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
111 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
112 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
113 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
114 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
109 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
110 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
111 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
112 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
113 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
114 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param string $ajax_action |
123 | 123 | * @throws \EE_Error |
124 | 124 | */ |
125 | - public static function process_ajax_request( $ajax_action ) { |
|
126 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
125 | + public static function process_ajax_request($ajax_action) { |
|
126 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
127 | 127 | EED_Single_Page_Checkout::instance()->_initialize(); |
128 | 128 | } |
129 | 129 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @throws \EE_Error |
136 | 136 | */ |
137 | 137 | public static function display_reg_step() { |
138 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
138 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @throws \EE_Error |
147 | 147 | */ |
148 | 148 | public static function process_reg_step() { |
149 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
149 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @throws \EE_Error |
158 | 158 | */ |
159 | 159 | public static function update_reg_step() { |
160 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
160 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @throws \EE_Error |
171 | 171 | */ |
172 | 172 | public static function update_checkout() { |
173 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
173 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public static function load_request_handler() { |
185 | 185 | // load core Request_Handler class |
186 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
187 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
186 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
187 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * @throws \EE_Error |
199 | 199 | */ |
200 | 200 | public static function set_definitions() { |
201 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
202 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
203 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
204 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
205 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
206 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
207 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
208 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
201 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
202 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
203 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
204 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
205 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
206 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
207 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
208 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function load_reg_steps() { |
222 | 222 | static $reg_steps_loaded = FALSE; |
223 | - if ( $reg_steps_loaded ) { |
|
223 | + if ($reg_steps_loaded) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | // filter list of reg_steps |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | EED_Single_Page_Checkout::get_reg_steps() |
230 | 230 | ); |
231 | 231 | // sort by key (order) |
232 | - ksort( $reg_steps_to_load ); |
|
232 | + ksort($reg_steps_to_load); |
|
233 | 233 | // loop through folders |
234 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
234 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
235 | 235 | // we need a |
236 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
236 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
237 | 237 | // copy over to the reg_steps_array |
238 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
238 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
239 | 239 | // register custom key route for each reg step |
240 | 240 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
241 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
241 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
242 | 242 | // add AJAX or other hooks |
243 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
243 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
244 | 244 | // setup autoloaders if necessary |
245 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
246 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
245 | + if ( ! class_exists($reg_step['class_name'])) { |
|
246 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
247 | 247 | } |
248 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
249 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
248 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
249 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
@@ -265,28 +265,28 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public static function get_reg_steps() { |
267 | 267 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
268 | - if ( empty( $reg_steps )) { |
|
268 | + if (empty($reg_steps)) { |
|
269 | 269 | $reg_steps = array( |
270 | 270 | 10 => array( |
271 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
271 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
272 | 272 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
273 | 273 | 'slug' => 'attendee_information', |
274 | 274 | 'has_hooks' => FALSE |
275 | 275 | ), |
276 | 276 | 20 => array( |
277 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
277 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
278 | 278 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
279 | 279 | 'slug' => 'registration_confirmation', |
280 | 280 | 'has_hooks' => FALSE |
281 | 281 | ), |
282 | 282 | 30 => array( |
283 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
283 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
284 | 284 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
285 | 285 | 'slug' => 'payment_options', |
286 | 286 | 'has_hooks' => TRUE |
287 | 287 | ), |
288 | 288 | 999 => array( |
289 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
289 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
290 | 290 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
291 | 291 | 'slug' => 'finalize_registration', |
292 | 292 | 'has_hooks' => FALSE |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public static function registration_checkout_for_admin() { |
309 | 309 | EED_Single_Page_Checkout::load_reg_steps(); |
310 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
311 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
312 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
310 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
311 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
312 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
313 | 313 | EED_Single_Page_Checkout::instance()->_initialize(); |
314 | 314 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
315 | 315 | return EE_Registry::instance()->REQ->get_output(); |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public static function process_registration_from_admin() { |
328 | 328 | EED_Single_Page_Checkout::load_reg_steps(); |
329 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
330 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
331 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
329 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
330 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
331 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
332 | 332 | EED_Single_Page_Checkout::instance()->_initialize(); |
333 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
334 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
335 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
336 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
337 | - if ( $final_reg_step->process_reg_step() ) { |
|
333 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
334 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
335 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
336 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
337 | + if ($final_reg_step->process_reg_step()) { |
|
338 | 338 | $final_reg_step->set_completed(); |
339 | 339 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
340 | 340 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | * @return void |
355 | 355 | * @throws \EE_Error |
356 | 356 | */ |
357 | - public function run( $WP_Query ) { |
|
357 | + public function run($WP_Query) { |
|
358 | 358 | if ( |
359 | 359 | $WP_Query instanceof WP_Query |
360 | 360 | && $WP_Query->is_main_query() |
361 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
361 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
362 | 362 | ) { |
363 | 363 | $this->_initialize(); |
364 | 364 | } |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @return void |
375 | 375 | * @throws \EE_Error |
376 | 376 | */ |
377 | - public static function init( $WP_Query ) { |
|
378 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
377 | + public static function init($WP_Query) { |
|
378 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -389,34 +389,34 @@ discard block |
||
389 | 389 | */ |
390 | 390 | private function _initialize() { |
391 | 391 | // ensure SPCO doesn't run twice |
392 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
392 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | try { |
396 | 396 | // setup the EE_Checkout object |
397 | 397 | $this->checkout = $this->_initialize_checkout(); |
398 | 398 | // filter checkout |
399 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
399 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
400 | 400 | // get the $_GET |
401 | 401 | $this->_get_request_vars(); |
402 | 402 | // filter continue_reg |
403 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
403 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
404 | 404 | // load the reg steps array |
405 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
405 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
406 | 406 | EED_Single_Page_Checkout::$_initialized = true; |
407 | 407 | return; |
408 | 408 | } |
409 | 409 | // set the current step |
410 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
410 | + $this->checkout->set_current_step($this->checkout->step); |
|
411 | 411 | // and the next step |
412 | 412 | $this->checkout->set_next_step(); |
413 | 413 | // was there already a valid transaction in the checkout from the session ? |
414 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
414 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
415 | 415 | // get transaction from db or session |
416 | 416 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
417 | 417 | ? $this->_get_transaction_and_cart_for_previous_visit() |
418 | 418 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
419 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
419 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
420 | 420 | // add some style and make it dance |
421 | 421 | $this->checkout->transaction = EE_Transaction::new_instance(); |
422 | 422 | $this->add_styles_and_scripts(); |
@@ -424,10 +424,10 @@ discard block |
||
424 | 424 | return; |
425 | 425 | } |
426 | 426 | // and the registrations for the transaction |
427 | - $this->_get_registrations( $this->checkout->transaction ); |
|
427 | + $this->_get_registrations($this->checkout->transaction); |
|
428 | 428 | } |
429 | 429 | // verify that everything has been setup correctly |
430 | - if ( ! $this->_final_verifications() ) { |
|
430 | + if ( ! $this->_final_verifications()) { |
|
431 | 431 | EED_Single_Page_Checkout::$_initialized = true; |
432 | 432 | return; |
433 | 433 | } |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | // set no cache headers and constants |
453 | 453 | EE_System::do_not_cache(); |
454 | 454 | // add anchor |
455 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
456 | - } catch ( Exception $e ) { |
|
457 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
455 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
456 | + } catch (Exception $e) { |
|
457 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
@@ -472,20 +472,20 @@ discard block |
||
472 | 472 | // look in session for existing checkout |
473 | 473 | $checkout = EE_Registry::instance()->SSN->checkout(); |
474 | 474 | // verify |
475 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
475 | + if ( ! $checkout instanceof EE_Checkout) { |
|
476 | 476 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
477 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
477 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
478 | 478 | } else { |
479 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
479 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
480 | 480 | $this->unlock_transaction(); |
481 | - wp_safe_redirect( $checkout->redirect_url ); |
|
481 | + wp_safe_redirect($checkout->redirect_url); |
|
482 | 482 | exit(); |
483 | 483 | } |
484 | 484 | } |
485 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
485 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
486 | 486 | // verify again |
487 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
488 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
487 | + if ( ! $checkout instanceof EE_Checkout) { |
|
488 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
489 | 489 | } |
490 | 490 | // reset anything that needs a clean slate for each request |
491 | 491 | $checkout->reset_for_current_request(); |
@@ -505,24 +505,24 @@ discard block |
||
505 | 505 | // load classes |
506 | 506 | EED_Single_Page_Checkout::load_request_handler(); |
507 | 507 | //make sure this request is marked as belonging to EE |
508 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
508 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
509 | 509 | // which step is being requested ? |
510 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
510 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
511 | 511 | // which step is being edited ? |
512 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
512 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
513 | 513 | // and what we're doing on the current step |
514 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
514 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
515 | 515 | // returning to edit ? |
516 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
516 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
517 | 517 | // or some other kind of revisit ? |
518 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
518 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
519 | 519 | // and whether or not to generate a reg form for this request |
520 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
520 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
521 | 521 | // and whether or not to process a reg form submission for this request |
522 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
522 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
523 | 523 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
524 | 524 | ? $this->checkout->process_form_submission |
525 | - : FALSE; // TRUE FALSE |
|
525 | + : FALSE; // TRUE FALSE |
|
526 | 526 | // $this->_display_request_vars(); |
527 | 527 | } |
528 | 528 | |
@@ -535,17 +535,17 @@ discard block |
||
535 | 535 | * @return void |
536 | 536 | */ |
537 | 537 | protected function _display_request_vars() { |
538 | - if ( ! WP_DEBUG ) { |
|
538 | + if ( ! WP_DEBUG) { |
|
539 | 539 | return; |
540 | 540 | } |
541 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
542 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
543 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
544 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
545 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
546 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
547 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
548 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
541 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
542 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
543 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
544 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
545 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
546 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
547 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
548 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * @return array |
560 | 560 | */ |
561 | 561 | private function _get_first_step() { |
562 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
563 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
562 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
563 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -576,27 +576,27 @@ discard block |
||
576 | 576 | private function _load_and_instantiate_reg_steps() { |
577 | 577 | // have reg_steps already been instantiated ? |
578 | 578 | if ( |
579 | - empty( $this->checkout->reg_steps ) || |
|
580 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
579 | + empty($this->checkout->reg_steps) || |
|
580 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
581 | 581 | ) { |
582 | 582 | // if not, then loop through raw reg steps array |
583 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
584 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
583 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
584 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
585 | 585 | return false; |
586 | 586 | } |
587 | 587 | } |
588 | 588 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
589 | 589 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
590 | 590 | // skip the registration_confirmation page ? |
591 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
591 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
592 | 592 | // just remove it from the reg steps array |
593 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
593 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
594 | 594 | } else if ( |
595 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
595 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
596 | 596 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
597 | 597 | ) { |
598 | 598 | // set the order to something big like 100 |
599 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
599 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
600 | 600 | } |
601 | 601 | // filter the array for good luck |
602 | 602 | $this->checkout->reg_steps = apply_filters( |
@@ -606,13 +606,13 @@ discard block |
||
606 | 606 | // finally re-sort based on the reg step class order properties |
607 | 607 | $this->checkout->sort_reg_steps(); |
608 | 608 | } else { |
609 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
609 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
610 | 610 | // set all current step stati to FALSE |
611 | - $reg_step->set_is_current_step( FALSE ); |
|
611 | + $reg_step->set_is_current_step(FALSE); |
|
612 | 612 | } |
613 | 613 | } |
614 | - if ( empty( $this->checkout->reg_steps )) { |
|
615 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
614 | + if (empty($this->checkout->reg_steps)) { |
|
615 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
616 | 616 | return false; |
617 | 617 | } |
618 | 618 | // make reg step details available to JS |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | * @param int $order |
631 | 631 | * @return bool |
632 | 632 | */ |
633 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
633 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
634 | 634 | |
635 | 635 | // we need a file_path, class_name, and slug to add a reg step |
636 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
636 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
637 | 637 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
638 | 638 | if ( |
639 | 639 | $this->checkout->reg_url_link |
@@ -651,26 +651,26 @@ discard block |
||
651 | 651 | FALSE |
652 | 652 | ); |
653 | 653 | // did we gets the goods ? |
654 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
654 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
655 | 655 | // set reg step order based on config |
656 | - $reg_step_obj->set_order( $order ); |
|
656 | + $reg_step_obj->set_order($order); |
|
657 | 657 | // add instantiated reg step object to the master reg steps array |
658 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
658 | + $this->checkout->add_reg_step($reg_step_obj); |
|
659 | 659 | } else { |
660 | 660 | EE_Error::add_error( |
661 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
661 | + __('The current step could not be set.', 'event_espresso'), |
|
662 | 662 | __FILE__, __FUNCTION__, __LINE__ |
663 | 663 | ); |
664 | 664 | return false; |
665 | 665 | } |
666 | 666 | } else { |
667 | - if ( WP_DEBUG ) { |
|
667 | + if (WP_DEBUG) { |
|
668 | 668 | EE_Error::add_error( |
669 | 669 | sprintf( |
670 | - __( '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' ), |
|
671 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
672 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
673 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
670 | + __('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'), |
|
671 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
672 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
673 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
674 | 674 | '<ul>', |
675 | 675 | '<li>', |
676 | 676 | '</li>', |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | */ |
695 | 695 | private function _get_transaction_and_cart_for_previous_visit() { |
696 | 696 | /** @var $TXN_model EEM_Transaction */ |
697 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
697 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
698 | 698 | // 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 |
699 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
699 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
700 | 700 | // verify transaction |
701 | - if ( $transaction instanceof EE_Transaction ) { |
|
701 | + if ($transaction instanceof EE_Transaction) { |
|
702 | 702 | // and get the cart that was used for that transaction |
703 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
703 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
704 | 704 | return $transaction; |
705 | 705 | } else { |
706 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
706 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
707 | 707 | return NULL; |
708 | 708 | } |
709 | 709 | } |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | * @param EE_Transaction $transaction |
718 | 718 | * @return EE_Cart |
719 | 719 | */ |
720 | - private function _get_cart_for_transaction( $transaction ) { |
|
721 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
720 | + private function _get_cart_for_transaction($transaction) { |
|
721 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | * @param EE_Transaction $transaction |
731 | 731 | * @return EE_Cart |
732 | 732 | */ |
733 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
734 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
733 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
734 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | |
@@ -747,17 +747,17 @@ discard block |
||
747 | 747 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
748 | 748 | // if there's no transaction, then this is the FIRST visit to SPCO |
749 | 749 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
750 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
750 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
751 | 751 | // and then create a new transaction |
752 | 752 | $transaction = $this->_initialize_transaction(); |
753 | 753 | // verify transaction |
754 | - if ( $transaction instanceof EE_Transaction ) { |
|
754 | + if ($transaction instanceof EE_Transaction) { |
|
755 | 755 | // save it so that we have an ID for other objects to use |
756 | 756 | $transaction->save(); |
757 | 757 | // and save TXN data to the cart |
758 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
758 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
759 | 759 | } else { |
760 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
760 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
761 | 761 | } |
762 | 762 | return $transaction; |
763 | 763 | } |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | 'STS_ID' => EEM_Transaction::failed_status_code, |
786 | 786 | ) |
787 | 787 | ); |
788 | - } catch( Exception $e ) { |
|
789 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
788 | + } catch (Exception $e) { |
|
789 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
790 | 790 | } |
791 | 791 | return NULL; |
792 | 792 | } |
@@ -801,38 +801,38 @@ discard block |
||
801 | 801 | * @return EE_Cart |
802 | 802 | * @throws \EE_Error |
803 | 803 | */ |
804 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
804 | + private function _get_registrations(EE_Transaction $transaction) { |
|
805 | 805 | // first step: grab the registrants { : o |
806 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
806 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
807 | 807 | // verify registrations have been set |
808 | - if ( empty( $registrations )) { |
|
808 | + if (empty($registrations)) { |
|
809 | 809 | // if no cached registrations, then check the db |
810 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
810 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
811 | 811 | // still nothing ? well as long as this isn't a revisit |
812 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
812 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
813 | 813 | // generate new registrations from scratch |
814 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
814 | + $registrations = $this->_initialize_registrations($transaction); |
|
815 | 815 | } |
816 | 816 | } |
817 | 817 | // sort by their original registration order |
818 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
818 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
819 | 819 | // then loop thru the array |
820 | - foreach ( $registrations as $registration ) { |
|
820 | + foreach ($registrations as $registration) { |
|
821 | 821 | // verify each registration |
822 | - if ( $registration instanceof EE_Registration ) { |
|
822 | + if ($registration instanceof EE_Registration) { |
|
823 | 823 | // we display all attendee info for the primary registrant |
824 | - if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
|
824 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
825 | 825 | && $registration->is_primary_registrant() |
826 | 826 | ) { |
827 | 827 | $this->checkout->primary_revisit = true; |
828 | 828 | break; |
829 | - } else if ( $this->checkout->revisit |
|
829 | + } else if ($this->checkout->revisit |
|
830 | 830 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
831 | 831 | ) { |
832 | 832 | // but hide info if it doesn't belong to you |
833 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
833 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
834 | 834 | } |
835 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
835 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | } |
@@ -847,17 +847,17 @@ discard block |
||
847 | 847 | * @return array |
848 | 848 | * @throws \EE_Error |
849 | 849 | */ |
850 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
850 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
851 | 851 | $att_nmbr = 0; |
852 | 852 | $registrations = array(); |
853 | - if ( $transaction instanceof EE_Transaction ) { |
|
853 | + if ($transaction instanceof EE_Transaction) { |
|
854 | 854 | /** @type EE_Registration_Processor $registration_processor */ |
855 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
855 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
856 | 856 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
857 | 857 | // now let's add the cart items to the $transaction |
858 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
858 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
859 | 859 | //do the following for each ticket of this type they selected |
860 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
860 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
861 | 861 | $att_nmbr++; |
862 | 862 | /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
863 | 863 | $CreateRegistrationCommand = EE_Registry::instance() |
@@ -873,17 +873,17 @@ discard block |
||
873 | 873 | // override capabilities for frontend registrations |
874 | 874 | if ( ! is_admin()) { |
875 | 875 | $CreateRegistrationCommand->setCapCheck( |
876 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
876 | + new PublicCapabilities('', 'create_new_registration') |
|
877 | 877 | ); |
878 | 878 | } |
879 | - $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
|
880 | - if ( ! $registration instanceof EE_Registration ) { |
|
881 | - throw new InvalidEntityException( $registration, 'EE_Registration' ); |
|
879 | + $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand); |
|
880 | + if ( ! $registration instanceof EE_Registration) { |
|
881 | + throw new InvalidEntityException($registration, 'EE_Registration'); |
|
882 | 882 | } |
883 | - $registrations[ $registration->ID() ] = $registration; |
|
883 | + $registrations[$registration->ID()] = $registration; |
|
884 | 884 | } |
885 | 885 | } |
886 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
886 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
887 | 887 | } |
888 | 888 | return $registrations; |
889 | 889 | } |
@@ -898,12 +898,12 @@ discard block |
||
898 | 898 | * @param EE_Registration $reg_B |
899 | 899 | * @return int |
900 | 900 | */ |
901 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
901 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
902 | 902 | // this shouldn't ever happen within the same TXN, but oh well |
903 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
903 | + if ($reg_A->count() === $reg_B->count()) { |
|
904 | 904 | return 0; |
905 | 905 | } |
906 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
906 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | |
@@ -918,21 +918,21 @@ discard block |
||
918 | 918 | */ |
919 | 919 | private function _final_verifications() { |
920 | 920 | // filter checkout |
921 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
921 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
922 | 922 | //verify that current step is still set correctly |
923 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
924 | - 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__ ); |
|
923 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
924 | + 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__); |
|
925 | 925 | return false; |
926 | 926 | } |
927 | 927 | // if returning to SPCO, then verify that primary registrant is set |
928 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
928 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
929 | 929 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
930 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
931 | - 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__ ); |
|
930 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
931 | + 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__); |
|
932 | 932 | return false; |
933 | 933 | } |
934 | 934 | $valid_registrant = null; |
935 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
935 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
936 | 936 | if ( |
937 | 937 | $registration instanceof EE_Registration |
938 | 938 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -940,9 +940,9 @@ discard block |
||
940 | 940 | $valid_registrant = $registration; |
941 | 941 | } |
942 | 942 | } |
943 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
943 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
944 | 944 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
945 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
945 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
946 | 946 | // clear the session, mark the checkout as unverified, and try again |
947 | 947 | EE_Registry::instance()->SSN->clear_session(); |
948 | 948 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -951,13 +951,13 @@ discard block |
||
951 | 951 | EE_Error::reset_notices(); |
952 | 952 | return false; |
953 | 953 | } |
954 | - 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__ ); |
|
954 | + 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__); |
|
955 | 955 | return false; |
956 | 956 | } |
957 | 957 | } |
958 | 958 | // now that things have been kinda sufficiently verified, |
959 | 959 | // let's add the checkout to the session so that's available other systems |
960 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
960 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
961 | 961 | return true; |
962 | 962 | } |
963 | 963 | |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | * @param bool $reinitializing |
973 | 973 | * @throws \EE_Error |
974 | 974 | */ |
975 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
976 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
975 | + private function _initialize_reg_steps($reinitializing = false) { |
|
976 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
977 | 977 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
978 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
979 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
978 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
979 | + if ( ! $reg_step->initialize_reg_step()) { |
|
980 | 980 | // if not initialized then maybe this step is being removed... |
981 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
981 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
982 | 982 | // if it was the current step, then we need to start over here |
983 | - $this->_initialize_reg_steps( true ); |
|
983 | + $this->_initialize_reg_steps(true); |
|
984 | 984 | return; |
985 | 985 | } |
986 | 986 | continue; |
@@ -989,13 +989,13 @@ discard block |
||
989 | 989 | $reg_step->enqueue_styles_and_scripts(); |
990 | 990 | // i18n |
991 | 991 | $reg_step->translate_js_strings(); |
992 | - if ( $reg_step->is_current_step() ) { |
|
992 | + if ($reg_step->is_current_step()) { |
|
993 | 993 | // the text that appears on the reg step form submit button |
994 | 994 | $reg_step->set_submit_button_text(); |
995 | 995 | } |
996 | 996 | } |
997 | 997 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
998 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
998 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
@@ -1008,43 +1008,43 @@ discard block |
||
1008 | 1008 | */ |
1009 | 1009 | private function _check_form_submission() { |
1010 | 1010 | //does this request require the reg form to be generated ? |
1011 | - if ( $this->checkout->generate_reg_form ) { |
|
1011 | + if ($this->checkout->generate_reg_form) { |
|
1012 | 1012 | // ever heard that song by Blue Rodeo ? |
1013 | 1013 | try { |
1014 | 1014 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1015 | 1015 | // if not displaying a form, then check for form submission |
1016 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1016 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1017 | 1017 | // clear out any old data in case this step is being run again |
1018 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1018 | + $this->checkout->current_step->set_valid_data(array()); |
|
1019 | 1019 | // capture submitted form data |
1020 | 1020 | $this->checkout->current_step->reg_form->receive_form_submission( |
1021 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1021 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1022 | 1022 | ); |
1023 | 1023 | // validate submitted form data |
1024 | - if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1024 | + if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1025 | 1025 | // thou shall not pass !!! |
1026 | 1026 | $this->checkout->continue_reg = FALSE; |
1027 | 1027 | // any form validation errors? |
1028 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1028 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1029 | 1029 | $submission_error_messages = array(); |
1030 | 1030 | // bad, bad, bad registrant |
1031 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1032 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1031 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1032 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1033 | 1033 | $submission_error_messages[] = sprintf( |
1034 | - __( '%s : %s', 'event_espresso' ), |
|
1034 | + __('%s : %s', 'event_espresso'), |
|
1035 | 1035 | $validation_error->get_form_section()->html_label_text(), |
1036 | 1036 | $validation_error->getMessage() |
1037 | 1037 | ); |
1038 | 1038 | } |
1039 | 1039 | } |
1040 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1040 | + EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1041 | 1041 | } |
1042 | 1042 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1043 | 1043 | $this->go_to_next_step(); |
1044 | 1044 | return; |
1045 | 1045 | } |
1046 | 1046 | } |
1047 | - } catch( EE_Error $e ) { |
|
1047 | + } catch (EE_Error $e) { |
|
1048 | 1048 | $e->get_error(); |
1049 | 1049 | } |
1050 | 1050 | } |
@@ -1061,22 +1061,22 @@ discard block |
||
1061 | 1061 | */ |
1062 | 1062 | private function _process_form_action() { |
1063 | 1063 | // what cha wanna do? |
1064 | - switch( $this->checkout->action ) { |
|
1064 | + switch ($this->checkout->action) { |
|
1065 | 1065 | // AJAX next step reg form |
1066 | 1066 | case 'display_spco_reg_step' : |
1067 | 1067 | $this->checkout->redirect = FALSE; |
1068 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1069 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1068 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1069 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1070 | 1070 | } |
1071 | 1071 | break; |
1072 | 1072 | |
1073 | 1073 | default : |
1074 | 1074 | // meh... do one of those other steps first |
1075 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1075 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1076 | 1076 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1077 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1077 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1078 | 1078 | // call action on current step |
1079 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1079 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1080 | 1080 | // good registrant, you get to proceed |
1081 | 1081 | if ( |
1082 | 1082 | $this->checkout->current_step->success_message() !== '' |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | ) { |
1088 | 1088 | EE_Error::add_success( |
1089 | 1089 | $this->checkout->current_step->success_message() |
1090 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1090 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1091 | 1091 | ); |
1092 | 1092 | |
1093 | 1093 | } |
@@ -1095,12 +1095,12 @@ discard block |
||
1095 | 1095 | $this->_setup_redirect(); |
1096 | 1096 | } |
1097 | 1097 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1098 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1098 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1099 | 1099 | |
1100 | 1100 | } else { |
1101 | 1101 | EE_Error::add_error( |
1102 | 1102 | sprintf( |
1103 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1103 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1104 | 1104 | $this->checkout->action, |
1105 | 1105 | $this->checkout->current_step->name() |
1106 | 1106 | ), |
@@ -1126,10 +1126,10 @@ discard block |
||
1126 | 1126 | public function add_styles_and_scripts() { |
1127 | 1127 | // i18n |
1128 | 1128 | $this->translate_js_strings(); |
1129 | - if ( $this->checkout->admin_request ) { |
|
1130 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1129 | + if ($this->checkout->admin_request) { |
|
1130 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1131 | 1131 | } else { |
1132 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1132 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | |
@@ -1145,42 +1145,42 @@ discard block |
||
1145 | 1145 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1146 | 1146 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1147 | 1147 | 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'); |
1148 | - 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' ); |
|
1149 | - 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' ); |
|
1150 | - 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' ); |
|
1148 | + 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'); |
|
1149 | + 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'); |
|
1150 | + 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'); |
|
1151 | 1151 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1152 | 1152 | 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'); |
1153 | - 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/>' ); |
|
1154 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1153 | + 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/>'); |
|
1154 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1155 | 1155 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1156 | 1156 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1157 | 1157 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1158 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1159 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1160 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1161 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1162 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1163 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1164 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1165 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1166 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1167 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1168 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1169 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1170 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1171 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1158 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1159 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1160 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1161 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1162 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1163 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1164 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1165 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1166 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1167 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1168 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1169 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1170 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1171 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1172 | 1172 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1173 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1173 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1174 | 1174 | '<h4 class="important-notice">', |
1175 | 1175 | '</h4>', |
1176 | 1176 | '<br />', |
1177 | 1177 | '<p>', |
1178 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1178 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1179 | 1179 | '">', |
1180 | 1180 | '</a>', |
1181 | 1181 | '</p>' |
1182 | 1182 | ); |
1183 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1183 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | |
@@ -1193,25 +1193,25 @@ discard block |
||
1193 | 1193 | */ |
1194 | 1194 | public function enqueue_styles_and_scripts() { |
1195 | 1195 | // load css |
1196 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1197 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1196 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1197 | + wp_enqueue_style('single_page_checkout'); |
|
1198 | 1198 | // load JS |
1199 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1200 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1201 | - 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 ); |
|
1202 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1199 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1200 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1201 | + 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); |
|
1202 | + wp_enqueue_script('single_page_checkout'); |
|
1203 | 1203 | |
1204 | 1204 | /** |
1205 | 1205 | * global action hook for enqueueing styles and scripts with |
1206 | 1206 | * spco calls. |
1207 | 1207 | */ |
1208 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1208 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1209 | 1209 | |
1210 | 1210 | /** |
1211 | 1211 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1212 | 1212 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1213 | 1213 | */ |
1214 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1214 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1215 | 1215 | |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1226,19 +1226,19 @@ discard block |
||
1226 | 1226 | */ |
1227 | 1227 | private function _display_spco_reg_form() { |
1228 | 1228 | // if registering via the admin, just display the reg form for the current step |
1229 | - if ( $this->checkout->admin_request ) { |
|
1230 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1229 | + if ($this->checkout->admin_request) { |
|
1230 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1231 | 1231 | } else { |
1232 | 1232 | // add powered by EE msg |
1233 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1233 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1234 | 1234 | |
1235 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1235 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1236 | 1236 | $cookies_not_set_msg = ''; |
1237 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1237 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1238 | 1238 | $cookies_not_set_msg = apply_filters( |
1239 | 1239 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1240 | 1240 | sprintf( |
1241 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1241 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1242 | 1242 | '<div class="ee-attention">', |
1243 | 1243 | '</div>', |
1244 | 1244 | '<h6 class="important-notice">', |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | 'layout_strategy' => |
1259 | 1259 | new EE_Template_Layout( |
1260 | 1260 | array( |
1261 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1261 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1262 | 1262 | 'template_args' => array( |
1263 | 1263 | 'empty_cart' => $empty_cart, |
1264 | 1264 | 'revisit' => $this->checkout->revisit, |
@@ -1267,8 +1267,8 @@ discard block |
||
1267 | 1267 | 'empty_msg' => apply_filters( |
1268 | 1268 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1269 | 1269 | sprintf( |
1270 | - __( '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' ), |
|
1271 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1270 | + __('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'), |
|
1271 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1272 | 1272 | '">', |
1273 | 1273 | '</a>' |
1274 | 1274 | ) |
@@ -1276,14 +1276,14 @@ discard block |
||
1276 | 1276 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1277 | 1277 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1278 | 1278 | 'session_expiration' => |
1279 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1279 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1280 | 1280 | ) |
1281 | 1281 | ) |
1282 | 1282 | ) |
1283 | 1283 | ) |
1284 | 1284 | ); |
1285 | 1285 | // load template and add to output sent that gets filtered into the_content() |
1286 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1286 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | |
@@ -1297,8 +1297,8 @@ discard block |
||
1297 | 1297 | * @internal param string $label |
1298 | 1298 | * @return string |
1299 | 1299 | */ |
1300 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1301 | - if ( $next_step === 'finalize_registration' ) { |
|
1300 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1301 | + if ($next_step === 'finalize_registration') { |
|
1302 | 1302 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1303 | 1303 | } |
1304 | 1304 | } |
@@ -1312,18 +1312,18 @@ discard block |
||
1312 | 1312 | * @return string |
1313 | 1313 | */ |
1314 | 1314 | public static function display_registration_footer() { |
1315 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1316 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1317 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1318 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1315 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1316 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1317 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1318 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1319 | 1319 | echo apply_filters( |
1320 | 1320 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1321 | 1321 | sprintf( |
1322 | - __( '%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' ), |
|
1323 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1322 | + __('%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'), |
|
1323 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1324 | 1324 | '" target="_blank">', |
1325 | 1325 | '</a>', |
1326 | - '<a href="' . $url . '" title="', |
|
1326 | + '<a href="'.$url.'" title="', |
|
1327 | 1327 | '" target="_blank">', |
1328 | 1328 | '</a></div>' |
1329 | 1329 | ) |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | * @throws \EE_Error |
1342 | 1342 | */ |
1343 | 1343 | public function unlock_transaction() { |
1344 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1344 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1345 | 1345 | $this->checkout->transaction->unlock(); |
1346 | 1346 | } |
1347 | 1347 | } |
@@ -1356,12 +1356,12 @@ discard block |
||
1356 | 1356 | * @return array |
1357 | 1357 | */ |
1358 | 1358 | private function _setup_redirect() { |
1359 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1359 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1360 | 1360 | $this->checkout->redirect = TRUE; |
1361 | - if ( empty( $this->checkout->redirect_url )) { |
|
1361 | + if (empty($this->checkout->redirect_url)) { |
|
1362 | 1362 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1363 | 1363 | } |
1364 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1364 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1365 | 1365 | } |
1366 | 1366 | } |
1367 | 1367 | |
@@ -1375,9 +1375,9 @@ discard block |
||
1375 | 1375 | * @throws \EE_Error |
1376 | 1376 | */ |
1377 | 1377 | public function go_to_next_step() { |
1378 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1378 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1379 | 1379 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1380 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1380 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1381 | 1381 | } |
1382 | 1382 | $this->unlock_transaction(); |
1383 | 1383 | // just return for these conditions |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | */ |
1407 | 1407 | protected function _handle_json_response() { |
1408 | 1408 | // if this is an ajax request |
1409 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1409 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1410 | 1410 | // DEBUG LOG |
1411 | 1411 | //$this->checkout->log( |
1412 | 1412 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | $this->checkout->json_response->set_registration_time_limit( |
1420 | 1420 | $this->checkout->get_registration_time_limit() |
1421 | 1421 | ); |
1422 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1422 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1423 | 1423 | // just send the ajax ( |
1424 | 1424 | $json_response = apply_filters( |
1425 | 1425 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1440,9 +1440,9 @@ discard block |
||
1440 | 1440 | */ |
1441 | 1441 | protected function _handle_html_redirects() { |
1442 | 1442 | // going somewhere ? |
1443 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1443 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1444 | 1444 | // store notices in a transient |
1445 | - EE_Error::get_notices( false, true, true ); |
|
1445 | + EE_Error::get_notices(false, true, true); |
|
1446 | 1446 | // DEBUG LOG |
1447 | 1447 | //$this->checkout->log( |
1448 | 1448 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | // 'headers_list' => headers_list(), |
1453 | 1453 | // ) |
1454 | 1454 | //); |
1455 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1455 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1456 | 1456 | exit(); |
1457 | 1457 | } |
1458 | 1458 | } |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | * _get_transaction_and_cart_for_previous_visit |
691 | 691 | * |
692 | 692 | * @access private |
693 | - * @return mixed EE_Transaction|NULL |
|
693 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
694 | 694 | */ |
695 | 695 | private function _get_transaction_and_cart_for_previous_visit() { |
696 | 696 | /** @var $TXN_model EEM_Transaction */ |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
769 | 769 | * |
770 | 770 | * @access private |
771 | - * @return mixed EE_Transaction|NULL |
|
771 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
772 | 772 | */ |
773 | 773 | private function _initialize_transaction() { |
774 | 774 | try { |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Transactions_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | protected function _ajax_hooks() { |
83 | - add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds')); |
|
84 | - add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds')); |
|
85 | - add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment')); |
|
83 | + add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds')); |
|
84 | + add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds')); |
|
85 | + add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'buttons' => array( |
98 | 98 | 'add' => esc_html__('Add New Transaction', 'event_espresso'), |
99 | 99 | 'edit' => esc_html__('Edit Transaction', 'event_espresso'), |
100 | - 'delete' => esc_html__('Delete Transaction','event_espresso'), |
|
100 | + 'delete' => esc_html__('Delete Transaction', 'event_espresso'), |
|
101 | 101 | ) |
102 | 102 | ); |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
115 | 115 | |
116 | - $txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0; |
|
116 | + $txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0; |
|
117 | 117 | |
118 | 118 | $this->_page_routes = array( |
119 | 119 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'filename' => 'transactions_overview_views_filters_search' |
186 | 186 | ), |
187 | 187 | ), |
188 | - 'help_tour' => array( 'Transactions_Overview_Help_Tour' ), |
|
188 | + 'help_tour' => array('Transactions_Overview_Help_Tour'), |
|
189 | 189 | /** |
190 | 190 | * commented out because currently we are not displaying tips for transaction list table status but this |
191 | 191 | * may change in a later iteration so want to keep the code for then. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'nav' => array( |
198 | 198 | 'label' => esc_html__('View Transaction', 'event_espresso'), |
199 | 199 | 'order' => 5, |
200 | - 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
200 | + 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
201 | 201 | 'persistent' => FALSE |
202 | 202 | ), |
203 | 203 | 'help_tabs' => array( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | 'filename' => 'transactions_view_transaction_primary_registrant_billing_information' |
219 | 219 | ), |
220 | 220 | ), |
221 | - 'qtips' => array( 'Transaction_Details_Tips' ), |
|
222 | - 'help_tour' => array( 'Transaction_Details_Help_Tour' ), |
|
221 | + 'qtips' => array('Transaction_Details_Tips'), |
|
222 | + 'help_tour' => array('Transaction_Details_Help_Tour'), |
|
223 | 223 | 'metaboxes' => array('_transaction_details_metaboxes'), |
224 | 224 | |
225 | 225 | 'require_nonce' => FALSE |
@@ -237,23 +237,23 @@ discard block |
||
237 | 237 | // IF a registration was JUST added via the admin... |
238 | 238 | if ( |
239 | 239 | isset( |
240 | - $this->_req_data[ 'redirect_from' ], |
|
241 | - $this->_req_data[ 'EVT_ID' ], |
|
242 | - $this->_req_data[ 'event_name' ] |
|
240 | + $this->_req_data['redirect_from'], |
|
241 | + $this->_req_data['EVT_ID'], |
|
242 | + $this->_req_data['event_name'] |
|
243 | 243 | ) |
244 | 244 | ) { |
245 | 245 | // then set a cookie so that we can block any attempts to use |
246 | 246 | // the back button as a way to enter another registration. |
247 | - setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' ); |
|
247 | + setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/'); |
|
248 | 248 | // and update the global |
249 | - $_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ]; |
|
249 | + $_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID']; |
|
250 | 250 | } |
251 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = esc_html__( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
252 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = esc_html__( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
253 | - EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status; |
|
254 | - EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status; |
|
255 | - EE_Registry::$i18n_js_strings[ 'payments_total' ] = esc_html__( 'Payments Total', 'event_espresso' ); |
|
256 | - EE_Registry::$i18n_js_strings[ 'transaction_overpaid' ] = esc_html__( 'This transaction has been overpaid ! Payments Total', 'event_espresso' ); |
|
251 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
252 | + EE_Registry::$i18n_js_strings['error_occurred'] = esc_html__('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
253 | + EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; |
|
254 | + EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; |
|
255 | + EE_Registry::$i18n_js_strings['payments_total'] = esc_html__('Payments Total', 'event_espresso'); |
|
256 | + EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__('This transaction has been overpaid ! Payments Total', 'event_espresso'); |
|
257 | 257 | } |
258 | 258 | public function admin_notices() {} |
259 | 259 | public function admin_footer_scripts() {} |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function load_scripts_styles() { |
322 | 322 | //enqueue style |
323 | - wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
323 | + wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
324 | 324 | wp_enqueue_style('espresso_txn'); |
325 | 325 | |
326 | 326 | //scripts |
327 | 327 | add_filter('FHEE_load_accounting_js', '__return_true'); |
328 | 328 | |
329 | 329 | //scripts |
330 | - wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
330 | + wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
331 | 331 | wp_enqueue_script('espresso_txn'); |
332 | 332 | |
333 | 333 | } |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @return void |
368 | 368 | */ |
369 | 369 | protected function _set_list_table_views_default() { |
370 | - $this->_views = array ( |
|
371 | - 'all' => array ( |
|
370 | + $this->_views = array( |
|
371 | + 'all' => array( |
|
372 | 372 | 'slug' => 'all', |
373 | 373 | 'label' => esc_html__('View All Transactions', 'event_espresso'), |
374 | 374 | 'count' => 0 |
@@ -396,20 +396,20 @@ discard block |
||
396 | 396 | * @return void |
397 | 397 | */ |
398 | 398 | private function _set_transaction_object() { |
399 | - if ( is_object( $this->_transaction) ) |
|
399 | + if (is_object($this->_transaction)) |
|
400 | 400 | return; //get out we've already set the object |
401 | 401 | |
402 | 402 | $TXN = EEM_Transaction::instance(); |
403 | 403 | |
404 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
404 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
405 | 405 | |
406 | 406 | //get transaction object |
407 | 407 | $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
408 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
408 | + $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
409 | 409 | |
410 | - if ( empty( $this->_transaction ) ) { |
|
411 | - $error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . esc_html__(' could not be retrieved.', 'event_espresso'); |
|
412 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
410 | + if (empty($this->_transaction)) { |
|
411 | + $error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.esc_html__(' could not be retrieved.', 'event_espresso'); |
|
412 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -422,12 +422,12 @@ discard block |
||
422 | 422 | * @return array |
423 | 423 | */ |
424 | 424 | protected function _transaction_legend_items() { |
425 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
425 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
426 | 426 | $items = array(); |
427 | 427 | |
428 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
429 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
430 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
428 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
429 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
430 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
431 | 431 | $items['view_related_messages'] = array( |
432 | 432 | 'class' => $related_for_icon['css_class'], |
433 | 433 | 'desc' => $related_for_icon['label'], |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | $items = apply_filters( |
439 | 439 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__items', |
440 | - array_merge( $items, |
|
440 | + array_merge($items, |
|
441 | 441 | array( |
442 | 442 | 'view_details' => array( |
443 | 443 | 'class' => 'dashicons dashicons-cart', |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | ), |
450 | 450 | 'view_receipt' => array( |
451 | 451 | 'class' => 'dashicons dashicons-media-default', |
452 | - 'desc' => esc_html__('View Transaction Receipt', 'event_espresso' ) |
|
452 | + 'desc' => esc_html__('View Transaction Receipt', 'event_espresso') |
|
453 | 453 | ), |
454 | 454 | 'view_registration' => array( |
455 | 455 | 'class' => 'dashicons dashicons-clipboard', |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | ) |
460 | 460 | ); |
461 | 461 | |
462 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
463 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
462 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
463 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
464 | 464 | $items['send_payment_reminder'] = array( |
465 | 465 | 'class' => 'dashicons dashicons-email-alt', |
466 | 466 | 'desc' => esc_html__('Send Payment Reminder', 'event_espresso') |
@@ -481,29 +481,29 @@ discard block |
||
481 | 481 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
482 | 482 | array( |
483 | 483 | 'overpaid' => array( |
484 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
485 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
484 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
485 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
486 | 486 | ), |
487 | 487 | 'complete' => array( |
488 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
489 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
488 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
489 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
490 | 490 | ), |
491 | 491 | 'incomplete' => array( |
492 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
493 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
492 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
493 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
494 | 494 | ), |
495 | 495 | 'abandoned' => array( |
496 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
497 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
496 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
497 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
498 | 498 | ), |
499 | 499 | 'failed' => array( |
500 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
501 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
500 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
501 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
502 | 502 | ) |
503 | 503 | ) |
504 | 504 | ); |
505 | 505 | |
506 | - return array_merge( $items, $more_items); |
|
506 | + return array_merge($items, $more_items); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | */ |
517 | 517 | protected function _transactions_overview_list_table() { |
518 | 518 | $this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); |
519 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
520 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : ''; |
|
521 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
519 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
520 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : ''; |
|
521 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
522 | 522 | $this->display_admin_list_table_page_with_no_sidebar(); |
523 | 523 | } |
524 | 524 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @return void |
533 | 533 | */ |
534 | 534 | protected function _transaction_details() { |
535 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
535 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
536 | 536 | |
537 | 537 | $this->_set_transaction_status_array(); |
538 | 538 | |
@@ -545,14 +545,14 @@ discard block |
||
545 | 545 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
546 | 546 | |
547 | 547 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
548 | - $this->_template_args['txn_nmbr']['label'] = esc_html__( 'Transaction Number', 'event_espresso' ); |
|
548 | + $this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso'); |
|
549 | 549 | |
550 | 550 | $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); |
551 | - $this->_template_args['txn_datetime']['label'] = esc_html__( 'Date', 'event_espresso' ); |
|
551 | + $this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso'); |
|
552 | 552 | |
553 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
554 | - $this->_template_args['txn_status']['label'] = esc_html__( 'Transaction Status', 'event_espresso' ); |
|
555 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
553 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
554 | + $this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso'); |
|
555 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
556 | 556 | |
557 | 557 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
558 | 558 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | ) |
566 | 566 | ) { |
567 | 567 | $this->_template_args['send_payment_reminder_button'] = |
568 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
568 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
569 | 569 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
570 | 570 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
571 | 571 | ? EEH_Template::get_button_or_link( |
@@ -587,40 +587,40 @@ discard block |
||
587 | 587 | } |
588 | 588 | |
589 | 589 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
590 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
591 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
592 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
590 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
591 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
592 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
593 | 593 | } else { |
594 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
594 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
595 | 595 | } |
596 | - $this->_template_args['amount_due_class'] = ''; |
|
596 | + $this->_template_args['amount_due_class'] = ''; |
|
597 | 597 | |
598 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
598 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
599 | 599 | // paid in full |
600 | - $this->_template_args['amount_due'] = FALSE; |
|
601 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
600 | + $this->_template_args['amount_due'] = FALSE; |
|
601 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
602 | 602 | // overpaid |
603 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
604 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
603 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
604 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
605 | 605 | // monies owing |
606 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
607 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
606 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
607 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
608 | 608 | // no payments made yet |
609 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
610 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
609 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
610 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
611 | 611 | // free event |
612 | - $this->_template_args['amount_due'] = FALSE; |
|
612 | + $this->_template_args['amount_due'] = FALSE; |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | $payment_method = $this->_transaction->payment_method(); |
616 | 616 | |
617 | 617 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
618 | 618 | ? $payment_method->admin_name() |
619 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
619 | + : esc_html__('Unknown', 'event_espresso'); |
|
620 | 620 | |
621 | 621 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
622 | 622 | // link back to overview |
623 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
623 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
624 | 624 | ? $_SERVER['HTTP_REFERER'] |
625 | 625 | : TXN_ADMIN_URL; |
626 | 626 | |
@@ -628,13 +628,13 @@ discard block |
||
628 | 628 | // next link |
629 | 629 | $next_txn = $this->_transaction->next( |
630 | 630 | null, |
631 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
631 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
632 | 632 | 'TXN_ID' |
633 | 633 | ); |
634 | 634 | $this->_template_args['next_transaction'] = $next_txn |
635 | 635 | ? $this->_next_link( |
636 | 636 | EE_Admin_Page::add_query_args_and_nonce( |
637 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
637 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
638 | 638 | TXN_ADMIN_URL |
639 | 639 | ), |
640 | 640 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | // previous link |
644 | 644 | $previous_txn = $this->_transaction->previous( |
645 | 645 | null, |
646 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
646 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
647 | 647 | 'TXN_ID' |
648 | 648 | ); |
649 | 649 | $this->_template_args['previous_transaction'] = $previous_txn |
650 | 650 | ? $this->_previous_link( |
651 | 651 | EE_Admin_Page::add_query_args_and_nonce( |
652 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
652 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
653 | 653 | TXN_ADMIN_URL |
654 | 654 | ), |
655 | 655 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -659,16 +659,16 @@ discard block |
||
659 | 659 | // were we just redirected here after adding a new registration ??? |
660 | 660 | if ( |
661 | 661 | isset( |
662 | - $this->_req_data[ 'redirect_from' ], |
|
663 | - $this->_req_data[ 'EVT_ID' ], |
|
664 | - $this->_req_data[ 'event_name' ] |
|
662 | + $this->_req_data['redirect_from'], |
|
663 | + $this->_req_data['EVT_ID'], |
|
664 | + $this->_req_data['event_name'] |
|
665 | 665 | ) |
666 | 666 | ) { |
667 | 667 | if ( |
668 | 668 | EE_Registry::instance()->CAP->current_user_can( |
669 | 669 | 'ee_edit_registrations', |
670 | 670 | 'espresso_registrations_new_registration', |
671 | - $this->_req_data[ 'EVT_ID' ] |
|
671 | + $this->_req_data['EVT_ID'] |
|
672 | 672 | ) |
673 | 673 | ) { |
674 | 674 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -678,25 +678,25 @@ discard block |
||
678 | 678 | 'action' => 'new_registration', |
679 | 679 | 'return' => 'default', |
680 | 680 | 'TXN_ID' => $this->_transaction->ID(), |
681 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
681 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
682 | 682 | ), |
683 | 683 | REG_ADMIN_URL |
684 | 684 | ); |
685 | 685 | $this->_admin_page_title .= '">'; |
686 | 686 | |
687 | 687 | $this->_admin_page_title .= sprintf( |
688 | - esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso' ), |
|
689 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
688 | + esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'), |
|
689 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
690 | 690 | ); |
691 | 691 | $this->_admin_page_title .= '</a>'; |
692 | 692 | } |
693 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
693 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
694 | 694 | } |
695 | 695 | // grab messages at the last second |
696 | 696 | $this->_template_args['notices'] = EE_Error::get_notices(); |
697 | 697 | // path to template |
698 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
699 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
698 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
699 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
700 | 700 | |
701 | 701 | // the details template wrapper |
702 | 702 | $this->display_admin_page_with_sidebar(); |
@@ -715,18 +715,18 @@ discard block |
||
715 | 715 | |
716 | 716 | $this->_set_transaction_object(); |
717 | 717 | |
718 | - add_meta_box( 'edit-txn-details-mbox', esc_html__( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' ); |
|
718 | + add_meta_box('edit-txn-details-mbox', esc_html__('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high'); |
|
719 | 719 | add_meta_box( |
720 | 720 | 'edit-txn-attendees-mbox', |
721 | - esc_html__( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
722 | - array( $this, 'txn_attendees_meta_box' ), |
|
721 | + esc_html__('Attendees Registered in this Transaction', 'event_espresso'), |
|
722 | + array($this, 'txn_attendees_meta_box'), |
|
723 | 723 | $this->_wp_page_slug, |
724 | 724 | 'normal', |
725 | 725 | 'high', |
726 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
726 | + array('TXN_ID' => $this->_transaction->ID()) |
|
727 | 727 | ); |
728 | - add_meta_box( 'edit-txn-registrant-mbox', esc_html__( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
729 | - add_meta_box( 'edit-txn-billing-info-mbox', esc_html__( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
728 | + add_meta_box('edit-txn-registrant-mbox', esc_html__('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
729 | + add_meta_box('edit-txn-billing-info-mbox', esc_html__('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
730 | 730 | |
731 | 731 | } |
732 | 732 | |
@@ -747,15 +747,15 @@ discard block |
||
747 | 747 | |
748 | 748 | //get line table |
749 | 749 | EEH_Autoloader::register_line_item_display_autoloaders(); |
750 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
751 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
750 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
751 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
752 | 752 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
753 | 753 | |
754 | 754 | // process taxes |
755 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
756 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
755 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
756 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
757 | 757 | |
758 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
758 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
759 | 759 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
760 | 760 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
761 | 761 | |
@@ -763,63 +763,63 @@ discard block |
||
763 | 763 | |
764 | 764 | // process payment details |
765 | 765 | $payments = $this->_transaction->get_many_related('Payment'); |
766 | - if( ! empty( $payments ) ) { |
|
767 | - $this->_template_args[ 'payments' ] = $payments; |
|
768 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
766 | + if ( ! empty($payments)) { |
|
767 | + $this->_template_args['payments'] = $payments; |
|
768 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
769 | 769 | } else { |
770 | - $this->_template_args[ 'payments' ] = false; |
|
771 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
770 | + $this->_template_args['payments'] = false; |
|
771 | + $this->_template_args['existing_reg_payments'] = array(); |
|
772 | 772 | } |
773 | 773 | |
774 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
775 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
774 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
775 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
776 | 776 | |
777 | - if ( isset( $txn_details['invoice_number'] )) { |
|
777 | + if (isset($txn_details['invoice_number'])) { |
|
778 | 778 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
779 | - $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( 'Invoice Number', 'event_espresso' ); |
|
779 | + $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__('Invoice Number', 'event_espresso'); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
783 | - $this->_template_args['txn_details']['registration_session']['label'] = esc_html__( 'Registration Session', 'event_espresso' ); |
|
783 | + $this->_template_args['txn_details']['registration_session']['label'] = esc_html__('Registration Session', 'event_espresso'); |
|
784 | 784 | |
785 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
786 | - $this->_template_args['txn_details']['ip_address']['label'] = esc_html__( 'Transaction placed from IP', 'event_espresso' ); |
|
785 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
786 | + $this->_template_args['txn_details']['ip_address']['label'] = esc_html__('Transaction placed from IP', 'event_espresso'); |
|
787 | 787 | |
788 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
789 | - $this->_template_args['txn_details']['user_agent']['label'] = esc_html__( 'Registrant User Agent', 'event_espresso' ); |
|
788 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
789 | + $this->_template_args['txn_details']['user_agent']['label'] = esc_html__('Registrant User Agent', 'event_espresso'); |
|
790 | 790 | |
791 | 791 | $reg_steps = '<ul>'; |
792 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
793 | - if ( $reg_step_status === true ) { |
|
794 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( esc_html__( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
795 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
796 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
797 | - esc_html__( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
798 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
799 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
800 | - ) . '</li>'; |
|
792 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
793 | + if ($reg_step_status === true) { |
|
794 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(esc_html__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
795 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
796 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
797 | + esc_html__('%1$s : Initiated %2$s', 'event_espresso'), |
|
798 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
799 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
800 | + ).'</li>'; |
|
801 | 801 | } else { |
802 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( esc_html__( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
802 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(esc_html__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
803 | 803 | } |
804 | 804 | } |
805 | 805 | $reg_steps .= '</ul>'; |
806 | 806 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
807 | - $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( 'Registration Step Progress', 'event_espresso' ); |
|
807 | + $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__('Registration Step Progress', 'event_espresso'); |
|
808 | 808 | |
809 | 809 | |
810 | 810 | $this->_get_registrations_to_apply_payment_to(); |
811 | - $this->_get_payment_methods( $payments ); |
|
811 | + $this->_get_payment_methods($payments); |
|
812 | 812 | $this->_get_payment_status_array(); |
813 | 813 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
814 | 814 | |
815 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
816 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
817 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
815 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
816 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
817 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
818 | 818 | |
819 | 819 | // 'espresso_delete_payment_nonce' |
820 | 820 | |
821 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
822 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
821 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
822 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
823 | 823 | |
824 | 824 | } |
825 | 825 | |
@@ -834,27 +834,27 @@ discard block |
||
834 | 834 | * @param EE_Payment[] $payments |
835 | 835 | * @return array |
836 | 836 | */ |
837 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
837 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
838 | 838 | $existing_reg_payments = array(); |
839 | 839 | // get all reg payments for these payments |
840 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
840 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
841 | 841 | array( |
842 | 842 | 'PAY_ID' => array( |
843 | 843 | 'IN', |
844 | - array_keys( $payments ) |
|
844 | + array_keys($payments) |
|
845 | 845 | ) |
846 | 846 | ) |
847 | - ) ); |
|
848 | - if ( ! empty( $reg_payments ) ) { |
|
849 | - foreach ( $payments as $payment ) { |
|
850 | - if ( ! $payment instanceof EE_Payment ) { |
|
847 | + )); |
|
848 | + if ( ! empty($reg_payments)) { |
|
849 | + foreach ($payments as $payment) { |
|
850 | + if ( ! $payment instanceof EE_Payment) { |
|
851 | 851 | continue; |
852 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
853 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
852 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
853 | + $existing_reg_payments[$payment->ID()] = array(); |
|
854 | 854 | } |
855 | - foreach ( $reg_payments as $reg_payment ) { |
|
856 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
857 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
855 | + foreach ($reg_payments as $reg_payment) { |
|
856 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
857 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
858 | 858 | } |
859 | 859 | } |
860 | 860 | } |
@@ -887,54 +887,54 @@ discard block |
||
887 | 887 | ) |
888 | 888 | ) |
889 | 889 | ); |
890 | - $registrations_to_apply_payment_to = EEH_HTML::br() . EEH_HTML::div( |
|
890 | + $registrations_to_apply_payment_to = EEH_HTML::br().EEH_HTML::div( |
|
891 | 891 | '', 'txn-admin-apply-payment-to-registrations-dv', '', 'clear: both; margin: 1.5em 0 0; display: none;' |
892 | 892 | ); |
893 | - $registrations_to_apply_payment_to .= EEH_HTML::br() . EEH_HTML::div( '', '', 'admin-primary-mbox-tbl-wrap' ); |
|
894 | - $registrations_to_apply_payment_to .= EEH_HTML::table( '', '', 'admin-primary-mbox-tbl' ); |
|
893 | + $registrations_to_apply_payment_to .= EEH_HTML::br().EEH_HTML::div('', '', 'admin-primary-mbox-tbl-wrap'); |
|
894 | + $registrations_to_apply_payment_to .= EEH_HTML::table('', '', 'admin-primary-mbox-tbl'); |
|
895 | 895 | $registrations_to_apply_payment_to .= EEH_HTML::thead( |
896 | 896 | EEH_HTML::tr( |
897 | - EEH_HTML::th( esc_html__( 'ID', 'event_espresso' ) ) . |
|
898 | - EEH_HTML::th( esc_html__( 'Registrant', 'event_espresso' ) ) . |
|
899 | - EEH_HTML::th( esc_html__( 'Ticket', 'event_espresso' ) ) . |
|
900 | - EEH_HTML::th( esc_html__( 'Event', 'event_espresso' ) ) . |
|
901 | - EEH_HTML::th( esc_html__( 'Paid', 'event_espresso' ), '', 'txn-admin-payment-paid-td jst-cntr' ) . |
|
902 | - EEH_HTML::th( esc_html__( 'Owing', 'event_espresso' ), '', 'txn-admin-payment-owing-td jst-cntr' ) . |
|
903 | - EEH_HTML::th( esc_html__( 'Apply', 'event_espresso' ), '', 'jst-cntr' ) |
|
897 | + EEH_HTML::th(esc_html__('ID', 'event_espresso')). |
|
898 | + EEH_HTML::th(esc_html__('Registrant', 'event_espresso')). |
|
899 | + EEH_HTML::th(esc_html__('Ticket', 'event_espresso')). |
|
900 | + EEH_HTML::th(esc_html__('Event', 'event_espresso')). |
|
901 | + EEH_HTML::th(esc_html__('Paid', 'event_espresso'), '', 'txn-admin-payment-paid-td jst-cntr'). |
|
902 | + EEH_HTML::th(esc_html__('Owing', 'event_espresso'), '', 'txn-admin-payment-owing-td jst-cntr'). |
|
903 | + EEH_HTML::th(esc_html__('Apply', 'event_espresso'), '', 'jst-cntr') |
|
904 | 904 | ) |
905 | 905 | ); |
906 | 906 | $registrations_to_apply_payment_to .= EEH_HTML::tbody(); |
907 | 907 | // get registrations for TXN |
908 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
909 | - foreach ( $registrations as $registration ) { |
|
910 | - if ( $registration instanceof EE_Registration ) { |
|
908 | + $registrations = $this->_transaction->registrations($query_params); |
|
909 | + foreach ($registrations as $registration) { |
|
910 | + if ($registration instanceof EE_Registration) { |
|
911 | 911 | $attendee_name = $registration->attendee() instanceof EE_Attendee |
912 | 912 | ? $registration->attendee()->full_name() |
913 | - : esc_html__( 'Unknown Attendee', 'event_espresso' ); |
|
913 | + : esc_html__('Unknown Attendee', 'event_espresso'); |
|
914 | 914 | $owing = $registration->final_price() - $registration->paid(); |
915 | 915 | $taxable = $registration->ticket()->taxable() |
916 | - ? ' <span class="smaller-text lt-grey-text"> ' . esc_html__( '+ tax', 'event_espresso' ) . '</span>' |
|
916 | + ? ' <span class="smaller-text lt-grey-text"> '.esc_html__('+ tax', 'event_espresso').'</span>' |
|
917 | 917 | : ''; |
918 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) |
|
918 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) |
|
919 | 919 | ? ' checked="checked"' |
920 | 920 | : ''; |
921 | 921 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
922 | 922 | $registrations_to_apply_payment_to .= EEH_HTML::tr( |
923 | - EEH_HTML::td( $registration->ID() ) . |
|
924 | - EEH_HTML::td( $attendee_name ) . |
|
923 | + EEH_HTML::td($registration->ID()). |
|
924 | + EEH_HTML::td($attendee_name). |
|
925 | 925 | EEH_HTML::td( |
926 | - $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable |
|
927 | - ) . |
|
928 | - EEH_HTML::td( $registration->event_name() ) . |
|
929 | - EEH_HTML::td( $registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr' ) . |
|
930 | - EEH_HTML::td( EEH_Template::format_currency( $owing ), '', 'txn-admin-payment-owing-td jst-cntr' ) . |
|
926 | + $registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable |
|
927 | + ). |
|
928 | + EEH_HTML::td($registration->event_name()). |
|
929 | + EEH_HTML::td($registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr'). |
|
930 | + EEH_HTML::td(EEH_Template::format_currency($owing), '', 'txn-admin-payment-owing-td jst-cntr'). |
|
931 | 931 | EEH_HTML::td( |
932 | - '<input type="checkbox" value="' . $registration->ID() |
|
932 | + '<input type="checkbox" value="'.$registration->ID() |
|
933 | 933 | . '" name="txn_admin_payment[registrations]"' |
934 | - . $checked . $disabled . '>', |
|
934 | + . $checked.$disabled.'>', |
|
935 | 935 | '', 'jst-cntr' |
936 | 936 | ), |
937 | - 'apply-payment-registration-row-' . $registration->ID() |
|
937 | + 'apply-payment-registration-row-'.$registration->ID() |
|
938 | 938 | ); |
939 | 939 | } |
940 | 940 | } |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | '', 'clear description' |
950 | 950 | ); |
951 | 951 | $registrations_to_apply_payment_to .= EEH_HTML::divx(); |
952 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
952 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -966,9 +966,9 @@ discard block |
||
966 | 966 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
967 | 967 | //let's add a "don't change" option. |
968 | 968 | $status_array['NAN'] = esc_html__('Leave the Same', 'event_espresso'); |
969 | - $status_array = array_merge( $status_array, $statuses ); |
|
970 | - $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' ); |
|
971 | - $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' ); |
|
969 | + $status_array = array_merge($status_array, $statuses); |
|
970 | + $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status'); |
|
971 | + $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status'); |
|
972 | 972 | |
973 | 973 | } |
974 | 974 | |
@@ -983,21 +983,21 @@ discard block |
||
983 | 983 | * @param EE_Payment[] to show on this page |
984 | 984 | * @return void |
985 | 985 | */ |
986 | - private function _get_payment_methods( $payments = array() ) { |
|
986 | + private function _get_payment_methods($payments = array()) { |
|
987 | 987 | $payment_methods_of_payments = array(); |
988 | - foreach( $payments as $payment ){ |
|
989 | - if( $payment instanceof EE_Payment ){ |
|
990 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
988 | + foreach ($payments as $payment) { |
|
989 | + if ($payment instanceof EE_Payment) { |
|
990 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
991 | 991 | } |
992 | 992 | } |
993 | - if( $payment_methods_of_payments ){ |
|
994 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
995 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
996 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
997 | - }else{ |
|
998 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
993 | + if ($payment_methods_of_payments) { |
|
994 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
995 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
996 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
997 | + } else { |
|
998 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
999 | 999 | } |
1000 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
1000 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1011,17 +1011,17 @@ discard block |
||
1011 | 1011 | * @param array $metabox |
1012 | 1012 | * @return void |
1013 | 1013 | */ |
1014 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
1014 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
1015 | 1015 | |
1016 | - extract( $metabox['args'] ); |
|
1016 | + extract($metabox['args']); |
|
1017 | 1017 | $this->_template_args['post'] = $post; |
1018 | 1018 | $this->_template_args['event_attendees'] = array(); |
1019 | 1019 | // process items in cart |
1020 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
1021 | - if ( ! empty( $line_items )) { |
|
1022 | - foreach ( $line_items as $item ) { |
|
1023 | - if ( $item instanceof EE_Line_Item ) { |
|
1024 | - switch( $item->OBJ_type() ) { |
|
1020 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
1021 | + if ( ! empty($line_items)) { |
|
1022 | + foreach ($line_items as $item) { |
|
1023 | + if ($item instanceof EE_Line_Item) { |
|
1024 | + switch ($item->OBJ_type()) { |
|
1025 | 1025 | |
1026 | 1026 | case 'Event' : |
1027 | 1027 | break; |
@@ -1029,39 +1029,39 @@ discard block |
||
1029 | 1029 | case 'Ticket' : |
1030 | 1030 | $ticket = $item->ticket(); |
1031 | 1031 | //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
1032 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
1032 | + if ( ! $ticket instanceof EE_Ticket) { |
|
1033 | 1033 | continue; |
1034 | 1034 | } |
1035 | 1035 | try { |
1036 | 1036 | $event_name = $ticket->get_event_name(); |
1037 | - } catch ( Exception $e ) { |
|
1038 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1039 | - $event_name = esc_html__( 'Unknown Event', 'event_espresso' ); |
|
1037 | + } catch (Exception $e) { |
|
1038 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1039 | + $event_name = esc_html__('Unknown Event', 'event_espresso'); |
|
1040 | 1040 | } |
1041 | - $event_name .= ' - ' . $item->get( 'LIN_name' ); |
|
1042 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ) ); |
|
1041 | + $event_name .= ' - '.$item->get('LIN_name'); |
|
1042 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
1043 | 1043 | // now get all of the registrations for this transaction that use this ticket |
1044 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1045 | - foreach( $registrations as $registration ) { |
|
1046 | - if ( ! $registration instanceof EE_Registration ) { |
|
1044 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1045 | + foreach ($registrations as $registration) { |
|
1046 | + if ( ! $registration instanceof EE_Registration) { |
|
1047 | 1047 | continue; |
1048 | 1048 | } |
1049 | - $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
|
1050 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
|
1051 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1052 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1049 | + $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
|
1050 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
|
1051 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1052 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1053 | 1053 | // attendee info |
1054 | 1054 | $attendee = $registration->get_first_related('Attendee'); |
1055 | - if ( $attendee instanceof EE_Attendee ) { |
|
1056 | - $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
|
1057 | - $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
|
1058 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event_name . esc_html__(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1059 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = EEH_Address::format( $attendee, 'inline', false, false ); |
|
1055 | + if ($attendee instanceof EE_Attendee) { |
|
1056 | + $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
|
1057 | + $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
|
1058 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event_name.esc_html__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1059 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = EEH_Address::format($attendee, 'inline', false, false); |
|
1060 | 1060 | } else { |
1061 | 1061 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1062 | - $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
|
1062 | + $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
|
1063 | 1063 | $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
1064 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
|
1064 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | break; |
@@ -1070,12 +1070,12 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | } |
1072 | 1072 | |
1073 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1074 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1073 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1074 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1075 | 1075 | |
1076 | 1076 | } else { |
1077 | 1077 | echo sprintf( |
1078 | - esc_html__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ), |
|
1078 | + esc_html__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), |
|
1079 | 1079 | '<p class="important-notice">', |
1080 | 1080 | '</p>' |
1081 | 1081 | ); |
@@ -1094,19 +1094,19 @@ discard block |
||
1094 | 1094 | */ |
1095 | 1095 | public function txn_registrant_side_meta_box() { |
1096 | 1096 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1097 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1097 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1098 | 1098 | $this->_template_args['no_attendee_message'] = esc_html__('There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', 'event_espresso'); |
1099 | 1099 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1100 | 1100 | } |
1101 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1101 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1102 | 1102 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1103 | 1103 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1104 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1104 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1105 | 1105 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1106 | - $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID() ), REG_ADMIN_URL ); |
|
1106 | + $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL); |
|
1107 | 1107 | // get formatted address for registrant |
1108 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1109 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1108 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1109 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | |
@@ -1122,12 +1122,12 @@ discard block |
||
1122 | 1122 | |
1123 | 1123 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1124 | 1124 | $this->_template_args['billing_form_url'] = add_query_arg( |
1125 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1125 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1126 | 1126 | TXN_ADMIN_URL |
1127 | 1127 | ); |
1128 | 1128 | |
1129 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1130 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1129 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1130 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | |
@@ -1140,42 +1140,42 @@ discard block |
||
1140 | 1140 | * @return void |
1141 | 1141 | */ |
1142 | 1142 | public function apply_payments_or_refunds() { |
1143 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1143 | + $json_response_data = array('return_data' => FALSE); |
|
1144 | 1144 | $valid_data = $this->_validate_payment_request_data(); |
1145 | - if ( ! empty( $valid_data ) ) { |
|
1146 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1145 | + if ( ! empty($valid_data)) { |
|
1146 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1147 | 1147 | //save the new payment |
1148 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1148 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1149 | 1149 | // get the TXN for this payment |
1150 | 1150 | $transaction = $payment->transaction(); |
1151 | 1151 | // verify transaction |
1152 | - if ( $transaction instanceof EE_Transaction ) { |
|
1152 | + if ($transaction instanceof EE_Transaction) { |
|
1153 | 1153 | // calculate_total_payments_and_update_status |
1154 | - $this->_process_transaction_payments( $transaction ); |
|
1155 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1156 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1154 | + $this->_process_transaction_payments($transaction); |
|
1155 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1156 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1157 | 1157 | // apply payment to registrations (if applicable) |
1158 | - if ( ! empty( $REG_IDs ) ) { |
|
1159 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1158 | + if ( ! empty($REG_IDs)) { |
|
1159 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1160 | 1160 | $this->_maybe_send_notifications(); |
1161 | 1161 | // now process status changes for the same registrations |
1162 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1162 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1163 | 1163 | } |
1164 | - $this->_maybe_send_notifications( $payment ); |
|
1164 | + $this->_maybe_send_notifications($payment); |
|
1165 | 1165 | //prepare to render page |
1166 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1167 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1166 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1167 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1168 | 1168 | } else { |
1169 | 1169 | EE_Error::add_error( |
1170 | - esc_html__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1170 | + esc_html__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1171 | 1171 | __FILE__, __FUNCTION__, __LINE__ |
1172 | 1172 | ); |
1173 | 1173 | } |
1174 | 1174 | } else { |
1175 | - EE_Error::add_error( esc_html__( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1175 | + EE_Error::add_error(esc_html__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1178 | + $notices = EE_Error::get_notices(false, false, false); |
|
1179 | 1179 | $this->_template_args = array( |
1180 | 1180 | 'data' => $json_response_data, |
1181 | 1181 | 'error' => $notices['errors'], |
@@ -1192,30 +1192,30 @@ discard block |
||
1192 | 1192 | * @return array |
1193 | 1193 | */ |
1194 | 1194 | protected function _validate_payment_request_data() { |
1195 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1195 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1196 | 1196 | return false; |
1197 | 1197 | } |
1198 | 1198 | $payment_form = $this->_generate_payment_form_section(); |
1199 | 1199 | try { |
1200 | - if ( $payment_form->was_submitted() ) { |
|
1200 | + if ($payment_form->was_submitted()) { |
|
1201 | 1201 | $payment_form->receive_form_submission(); |
1202 | - if ( ! $payment_form->is_valid() ) { |
|
1202 | + if ( ! $payment_form->is_valid()) { |
|
1203 | 1203 | $submission_error_messages = array(); |
1204 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1205 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1204 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1205 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1206 | 1206 | $submission_error_messages[] = sprintf( |
1207 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1207 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1208 | 1208 | $validation_error->get_form_section()->html_label_text(), |
1209 | 1209 | $validation_error->getMessage() |
1210 | 1210 | ); |
1211 | 1211 | } |
1212 | 1212 | } |
1213 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1213 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1214 | 1214 | return array(); |
1215 | 1215 | } |
1216 | 1216 | } |
1217 | - } catch ( EE_Error $e ) { |
|
1218 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1217 | + } catch (EE_Error $e) { |
|
1218 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1219 | 1219 | return array(); |
1220 | 1220 | } |
1221 | 1221 | return $payment_form->valid_data(); |
@@ -1237,63 +1237,63 @@ discard block |
||
1237 | 1237 | array( |
1238 | 1238 | 'default' => 0, |
1239 | 1239 | 'required' => false, |
1240 | - 'html_label_text' => esc_html__( 'Payment ID', 'event_espresso' ), |
|
1241 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1240 | + 'html_label_text' => esc_html__('Payment ID', 'event_espresso'), |
|
1241 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1242 | 1242 | ) |
1243 | 1243 | ), |
1244 | 1244 | 'TXN_ID' => new EE_Text_Input( |
1245 | 1245 | array( |
1246 | 1246 | 'default' => 0, |
1247 | 1247 | 'required' => true, |
1248 | - 'html_label_text' => esc_html__( 'Transaction ID', 'event_espresso' ), |
|
1249 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1248 | + 'html_label_text' => esc_html__('Transaction ID', 'event_espresso'), |
|
1249 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1250 | 1250 | ) |
1251 | 1251 | ), |
1252 | 1252 | 'type' => new EE_Text_Input( |
1253 | 1253 | array( |
1254 | 1254 | 'default' => 1, |
1255 | 1255 | 'required' => true, |
1256 | - 'html_label_text' => esc_html__( 'Payment or Refund', 'event_espresso' ), |
|
1257 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1256 | + 'html_label_text' => esc_html__('Payment or Refund', 'event_espresso'), |
|
1257 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1258 | 1258 | ) |
1259 | 1259 | ), |
1260 | 1260 | 'amount' => new EE_Text_Input( |
1261 | 1261 | array( |
1262 | 1262 | 'default' => 0, |
1263 | 1263 | 'required' => true, |
1264 | - 'html_label_text' => esc_html__( 'Payment amount', 'event_espresso' ), |
|
1265 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1264 | + 'html_label_text' => esc_html__('Payment amount', 'event_espresso'), |
|
1265 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1266 | 1266 | ) |
1267 | 1267 | ), |
1268 | 1268 | 'status' => new EE_Text_Input( |
1269 | 1269 | array( |
1270 | 1270 | 'default' => EEM_Payment::status_id_approved, |
1271 | 1271 | 'required' => true, |
1272 | - 'html_label_text' => esc_html__( 'Payment status', 'event_espresso' ), |
|
1272 | + 'html_label_text' => esc_html__('Payment status', 'event_espresso'), |
|
1273 | 1273 | ) |
1274 | 1274 | ), |
1275 | 1275 | 'PMD_ID' => new EE_Text_Input( |
1276 | 1276 | array( |
1277 | 1277 | 'default' => 2, |
1278 | 1278 | 'required' => true, |
1279 | - 'html_label_text' => esc_html__( 'Payment Method', 'event_espresso' ), |
|
1280 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1279 | + 'html_label_text' => esc_html__('Payment Method', 'event_espresso'), |
|
1280 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1281 | 1281 | ) |
1282 | 1282 | ), |
1283 | 1283 | 'date' => new EE_Text_Input( |
1284 | 1284 | array( |
1285 | 1285 | 'default' => time(), |
1286 | 1286 | 'required' => true, |
1287 | - 'html_label_text' => esc_html__( 'Payment date', 'event_espresso' ), |
|
1287 | + 'html_label_text' => esc_html__('Payment date', 'event_espresso'), |
|
1288 | 1288 | ) |
1289 | 1289 | ), |
1290 | 1290 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1291 | 1291 | array( |
1292 | 1292 | 'default' => '', |
1293 | 1293 | 'required' => false, |
1294 | - 'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1294 | + 'html_label_text' => esc_html__('Transaction or Cheque Number', 'event_espresso'), |
|
1295 | 1295 | 'validation_strategies' => array( |
1296 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1296 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1297 | 1297 | ) |
1298 | 1298 | ) |
1299 | 1299 | ), |
@@ -1301,9 +1301,9 @@ discard block |
||
1301 | 1301 | array( |
1302 | 1302 | 'default' => '', |
1303 | 1303 | 'required' => false, |
1304 | - 'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ), |
|
1304 | + 'html_label_text' => esc_html__('Purchase Order Number', 'event_espresso'), |
|
1305 | 1305 | 'validation_strategies' => array( |
1306 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1306 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1307 | 1307 | ) |
1308 | 1308 | ) |
1309 | 1309 | ), |
@@ -1311,9 +1311,9 @@ discard block |
||
1311 | 1311 | array( |
1312 | 1312 | 'default' => '', |
1313 | 1313 | 'required' => false, |
1314 | - 'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ), |
|
1314 | + 'html_label_text' => esc_html__('Extra Field for Accounting', 'event_espresso'), |
|
1315 | 1315 | 'validation_strategies' => array( |
1316 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1316 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1317 | 1317 | ) |
1318 | 1318 | ) |
1319 | 1319 | ), |
@@ -1330,37 +1330,37 @@ discard block |
||
1330 | 1330 | * @param array $valid_data |
1331 | 1331 | * @return EE_Payment |
1332 | 1332 | */ |
1333 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1334 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1333 | + protected function _create_payment_from_request_data($valid_data) { |
|
1334 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1335 | 1335 | // get payment amount |
1336 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1336 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1337 | 1337 | // payments have a type value of 1 and refunds have a type value of -1 |
1338 | 1338 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1339 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1339 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1340 | 1340 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1341 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1341 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1342 | 1342 | $payment = EE_Payment::new_instance( |
1343 | 1343 | array( |
1344 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1345 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1344 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1345 | + 'STS_ID' => $valid_data['status'], |
|
1346 | 1346 | 'PAY_timestamp' => $date, |
1347 | 1347 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1348 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1348 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1349 | 1349 | 'PAY_amount' => $amount, |
1350 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1351 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1352 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1350 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1351 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1352 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1353 | 1353 | 'PAY_details' => $valid_data, |
1354 | 1354 | 'PAY_ID' => $PAY_ID |
1355 | 1355 | ), |
1356 | 1356 | '', |
1357 | - array( 'Y-m-d', 'g:i a' ) |
|
1357 | + array('Y-m-d', 'g:i a') |
|
1358 | 1358 | ); |
1359 | 1359 | |
1360 | - if ( ! $payment->save() ) { |
|
1360 | + if ( ! $payment->save()) { |
|
1361 | 1361 | EE_Error::add_error( |
1362 | 1362 | sprintf( |
1363 | - esc_html__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1363 | + esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1364 | 1364 | $payment->ID() |
1365 | 1365 | ), |
1366 | 1366 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1377,15 +1377,15 @@ discard block |
||
1377 | 1377 | * @param \EE_Transaction $transaction |
1378 | 1378 | * @return array |
1379 | 1379 | */ |
1380 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1380 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1381 | 1381 | /** @type EE_Transaction_Payments $transaction_payments */ |
1382 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1382 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1383 | 1383 | //update the transaction with this payment |
1384 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1385 | - EE_Error::add_success( esc_html__( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1384 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1385 | + EE_Error::add_success(esc_html__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1386 | 1386 | } else { |
1387 | 1387 | EE_Error::add_error( |
1388 | - esc_html__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1388 | + esc_html__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1389 | 1389 | , __FILE__, __FUNCTION__, __LINE__ |
1390 | 1390 | ); |
1391 | 1391 | } |
@@ -1401,19 +1401,19 @@ discard block |
||
1401 | 1401 | * @param \EE_Payment $payment |
1402 | 1402 | * @return array |
1403 | 1403 | */ |
1404 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1404 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1405 | 1405 | $REG_IDs = array(); |
1406 | 1406 | // grab array of IDs for specific registrations to apply changes to |
1407 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1408 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1407 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1408 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1409 | 1409 | } |
1410 | 1410 | //nothing specified ? then get all reg IDs |
1411 | - if ( empty( $REG_IDs ) ) { |
|
1411 | + if (empty($REG_IDs)) { |
|
1412 | 1412 | $registrations = $payment->transaction()->registrations(); |
1413 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1413 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1414 | 1414 | } |
1415 | 1415 | // ensure that REG_IDs are integers and NOT strings |
1416 | - return array_map( 'intval', $REG_IDs ); |
|
1416 | + return array_map('intval', $REG_IDs); |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | |
@@ -1430,7 +1430,7 @@ discard block |
||
1430 | 1430 | /** |
1431 | 1431 | * @param array $existing_reg_payment_REG_IDs |
1432 | 1432 | */ |
1433 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1433 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1434 | 1434 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1435 | 1435 | } |
1436 | 1436 | |
@@ -1445,13 +1445,13 @@ discard block |
||
1445 | 1445 | * @param \EE_Payment $payment |
1446 | 1446 | * @return array |
1447 | 1447 | */ |
1448 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1449 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1448 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1449 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1450 | 1450 | // let's get any existing reg payment records for this payment |
1451 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1451 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1452 | 1452 | // but we only want the REG IDs, so grab the array keys |
1453 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1454 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1453 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1454 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1455 | 1455 | } |
1456 | 1456 | return $this->existing_reg_payment_REG_IDs(); |
1457 | 1457 | } |
@@ -1470,23 +1470,23 @@ discard block |
||
1470 | 1470 | * @param int $PAY_ID |
1471 | 1471 | * @return bool; |
1472 | 1472 | */ |
1473 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1473 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1474 | 1474 | // newly created payments will have nothing recorded for $PAY_ID |
1475 | - if ( $PAY_ID == 0 ) { |
|
1475 | + if ($PAY_ID == 0) { |
|
1476 | 1476 | return false; |
1477 | 1477 | } |
1478 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1479 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1478 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1479 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1480 | 1480 | return false; |
1481 | 1481 | } |
1482 | 1482 | /** @type EE_Transaction_Payments $transaction_payments */ |
1483 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1483 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1484 | 1484 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1485 | 1485 | $payment, |
1486 | 1486 | array( |
1487 | 1487 | array( |
1488 | 1488 | 'PAY_ID' => $payment->ID(), |
1489 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1489 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1490 | 1490 | ) |
1491 | 1491 | ) |
1492 | 1492 | ); |
@@ -1505,25 +1505,25 @@ discard block |
||
1505 | 1505 | * @param array $REG_IDs |
1506 | 1506 | * @return bool |
1507 | 1507 | */ |
1508 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1508 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1509 | 1509 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1510 | 1510 | // so let's do that using our set of REG_IDs from the form |
1511 | 1511 | $registration_query_where_params = array( |
1512 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1512 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1513 | 1513 | ); |
1514 | 1514 | // but add in some conditions regarding payment, |
1515 | 1515 | // so that we don't apply payments to registrations that are free or have already been paid for |
1516 | 1516 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1517 | - if ( ! $payment->is_a_refund() ) { |
|
1518 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1519 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1517 | + if ( ! $payment->is_a_refund()) { |
|
1518 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1519 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1520 | 1520 | } |
1521 | 1521 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1522 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1523 | - if ( ! empty( $registrations ) ) { |
|
1522 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1523 | + if ( ! empty($registrations)) { |
|
1524 | 1524 | /** @type EE_Payment_Processor $payment_processor */ |
1525 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1526 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1525 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1526 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1527 | 1527 | } |
1528 | 1528 | } |
1529 | 1529 | |
@@ -1539,22 +1539,22 @@ discard block |
||
1539 | 1539 | * @param array $REG_IDs |
1540 | 1540 | * @return bool |
1541 | 1541 | */ |
1542 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1542 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1543 | 1543 | // first if there is no change in status then we get out. |
1544 | 1544 | if ( |
1545 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1545 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1546 | 1546 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1547 | 1547 | ) { |
1548 | 1548 | //no error message, no change requested, just nothing to do man. |
1549 | 1549 | return FALSE; |
1550 | 1550 | } |
1551 | 1551 | /** @type EE_Transaction_Processor $transaction_processor */ |
1552 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1552 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1553 | 1553 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1554 | 1554 | return $transaction_processor->manually_update_registration_statuses( |
1555 | 1555 | $transaction, |
1556 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1557 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1556 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1557 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1558 | 1558 | ); |
1559 | 1559 | } |
1560 | 1560 | |
@@ -1569,16 +1569,16 @@ discard block |
||
1569 | 1569 | * @param bool | null $delete_txn_reg_status_change |
1570 | 1570 | * @return array |
1571 | 1571 | */ |
1572 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1572 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1573 | 1573 | // was the payment deleted ? |
1574 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1574 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1575 | 1575 | return array( |
1576 | 1576 | 'PAY_ID' => $payment->ID(), |
1577 | 1577 | 'amount' => $payment->amount(), |
1578 | 1578 | 'total_paid' => $payment->transaction()->paid(), |
1579 | 1579 | 'txn_status' => $payment->transaction()->status_ID(), |
1580 | 1580 | 'pay_status' => $payment->STS_ID(), |
1581 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1581 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1582 | 1582 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1583 | 1583 | ); |
1584 | 1584 | } else { |
@@ -1590,16 +1590,16 @@ discard block |
||
1590 | 1590 | 'pay_status' => $payment->STS_ID(), |
1591 | 1591 | 'PAY_ID' => $payment->ID(), |
1592 | 1592 | 'STS_ID' => $payment->STS_ID(), |
1593 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1594 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1595 | - 'method' => strtoupper( $payment->source() ), |
|
1593 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1594 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1595 | + 'method' => strtoupper($payment->source()), |
|
1596 | 1596 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1597 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__( "Unknown", 'event_espresso' ), |
|
1597 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__("Unknown", 'event_espresso'), |
|
1598 | 1598 | 'gateway_response' => $payment->gateway_response(), |
1599 | 1599 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1600 | 1600 | 'po_number' => $payment->po_number(), |
1601 | 1601 | 'extra_accntng' => $payment->extra_accntng(), |
1602 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1602 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1603 | 1603 | ); |
1604 | 1604 | } |
1605 | 1605 | } |
@@ -1614,39 +1614,39 @@ discard block |
||
1614 | 1614 | * @return void |
1615 | 1615 | */ |
1616 | 1616 | public function delete_payment() { |
1617 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1618 | - $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
|
1619 | - if ( $PAY_ID ) { |
|
1620 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1621 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1622 | - if ( $payment instanceof EE_Payment ) { |
|
1623 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1617 | + $json_response_data = array('return_data' => FALSE); |
|
1618 | + $PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0; |
|
1619 | + if ($PAY_ID) { |
|
1620 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1621 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1622 | + if ($payment instanceof EE_Payment) { |
|
1623 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1624 | 1624 | /** @type EE_Transaction_Payments $transaction_payments */ |
1625 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1626 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1627 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1628 | - if ( $delete_txn_reg_status_change ) { |
|
1625 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1626 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1627 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1628 | + if ($delete_txn_reg_status_change) { |
|
1629 | 1629 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1630 | 1630 | //MAKE sure we also add the delete_txn_req_status_change to the |
1631 | 1631 | //$_REQUEST global because that's how messages will be looking for it. |
1632 | 1632 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1633 | 1633 | $this->_maybe_send_notifications(); |
1634 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1634 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1635 | 1635 | } |
1636 | 1636 | } |
1637 | 1637 | } else { |
1638 | 1638 | EE_Error::add_error( |
1639 | - esc_html__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1639 | + esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1640 | 1640 | __FILE__, __FUNCTION__, __LINE__ |
1641 | 1641 | ); |
1642 | 1642 | } |
1643 | 1643 | } else { |
1644 | 1644 | EE_Error::add_error( |
1645 | - esc_html__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1645 | + esc_html__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1646 | 1646 | __FILE__, __FUNCTION__, __LINE__ |
1647 | 1647 | ); |
1648 | 1648 | } |
1649 | - $notices = EE_Error::get_notices( false, false, false); |
|
1649 | + $notices = EE_Error::get_notices(false, false, false); |
|
1650 | 1650 | $this->_template_args = array( |
1651 | 1651 | 'data' => $json_response_data, |
1652 | 1652 | 'success' => $notices['success'], |
@@ -1666,16 +1666,16 @@ discard block |
||
1666 | 1666 | * @param array $REG_IDs |
1667 | 1667 | * @return array |
1668 | 1668 | */ |
1669 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1669 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1670 | 1670 | $registration_payment_data = array(); |
1671 | 1671 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1672 | - if ( ! empty( $REG_IDs ) ) { |
|
1673 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1674 | - foreach ( $registrations as $registration ) { |
|
1675 | - if ( $registration instanceof EE_Registration ) { |
|
1676 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1672 | + if ( ! empty($REG_IDs)) { |
|
1673 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1674 | + foreach ($registrations as $registration) { |
|
1675 | + if ($registration instanceof EE_Registration) { |
|
1676 | + $registration_payment_data[$registration->ID()] = array( |
|
1677 | 1677 | 'paid' => $registration->pretty_paid(), |
1678 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1678 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1679 | 1679 | ); |
1680 | 1680 | } |
1681 | 1681 | } |
@@ -1695,30 +1695,30 @@ discard block |
||
1695 | 1695 | * @access protected |
1696 | 1696 | * @param \EE_Payment | null $payment |
1697 | 1697 | */ |
1698 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1699 | - switch ( $payment instanceof EE_Payment ) { |
|
1698 | + protected function _maybe_send_notifications($payment = null) { |
|
1699 | + switch ($payment instanceof EE_Payment) { |
|
1700 | 1700 | // payment notifications |
1701 | 1701 | case true : |
1702 | 1702 | if ( |
1703 | 1703 | isset( |
1704 | - $this->_req_data[ 'txn_payments' ], |
|
1705 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1704 | + $this->_req_data['txn_payments'], |
|
1705 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1706 | 1706 | ) && |
1707 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1707 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1708 | 1708 | ) { |
1709 | - $this->_process_payment_notification( $payment ); |
|
1709 | + $this->_process_payment_notification($payment); |
|
1710 | 1710 | } |
1711 | 1711 | break; |
1712 | 1712 | // registration notifications |
1713 | 1713 | case false : |
1714 | 1714 | if ( |
1715 | 1715 | isset( |
1716 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1717 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1716 | + $this->_req_data['txn_reg_status_change'], |
|
1717 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1718 | 1718 | ) && |
1719 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1719 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1720 | 1720 | ) { |
1721 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1721 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1722 | 1722 | } |
1723 | 1723 | break; |
1724 | 1724 | } |
@@ -1734,11 +1734,11 @@ discard block |
||
1734 | 1734 | * @return void |
1735 | 1735 | */ |
1736 | 1736 | protected function _send_payment_reminder() { |
1737 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1738 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1739 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1740 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1741 | - $this->_redirect_after_action( FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE ); |
|
1737 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1738 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1739 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1740 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1741 | + $this->_redirect_after_action(FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE); |
|
1742 | 1742 | } |
1743 | 1743 | |
1744 | 1744 | |
@@ -1752,36 +1752,36 @@ discard block |
||
1752 | 1752 | * @param string $view |
1753 | 1753 | * @return mixed int = count || array of transaction objects |
1754 | 1754 | */ |
1755 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1755 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1756 | 1756 | |
1757 | 1757 | $TXN = EEM_Transaction::instance(); |
1758 | 1758 | |
1759 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
1760 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
1759 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
1760 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
1761 | 1761 | |
1762 | 1762 | //make sure our timestamps start and end right at the boundaries for each day |
1763 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1764 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1763 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1764 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1765 | 1765 | |
1766 | 1766 | |
1767 | 1767 | //convert to timestamps |
1768 | - $start_date = strtotime( $start_date ); |
|
1769 | - $end_date = strtotime( $end_date ); |
|
1768 | + $start_date = strtotime($start_date); |
|
1769 | + $end_date = strtotime($end_date); |
|
1770 | 1770 | |
1771 | 1771 | //makes sure start date is the lowest value and vice versa |
1772 | - $start_date = min( $start_date, $end_date ); |
|
1773 | - $end_date = max( $start_date, $end_date ); |
|
1772 | + $start_date = min($start_date, $end_date); |
|
1773 | + $end_date = max($start_date, $end_date); |
|
1774 | 1774 | |
1775 | 1775 | //convert to correct format for query |
1776 | - $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
1777 | - $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
1776 | + $start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
1777 | + $end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
1778 | 1778 | |
1779 | 1779 | |
1780 | 1780 | |
1781 | 1781 | //set orderby |
1782 | 1782 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1783 | 1783 | |
1784 | - switch ( $this->_req_data['orderby'] ) { |
|
1784 | + switch ($this->_req_data['orderby']) { |
|
1785 | 1785 | case 'TXN_ID': |
1786 | 1786 | $orderby = 'TXN_ID'; |
1787 | 1787 | break; |
@@ -1795,66 +1795,66 @@ discard block |
||
1795 | 1795 | $orderby = 'TXN_timestamp'; |
1796 | 1796 | } |
1797 | 1797 | |
1798 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1799 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1800 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1801 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1798 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1799 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1800 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1801 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1802 | 1802 | |
1803 | - $offset = ($current_page-1)*$per_page; |
|
1804 | - $limit = array( $offset, $per_page ); |
|
1803 | + $offset = ($current_page - 1) * $per_page; |
|
1804 | + $limit = array($offset, $per_page); |
|
1805 | 1805 | |
1806 | 1806 | $_where = array( |
1807 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1807 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1808 | 1808 | 'Registration.REG_count' => 1 |
1809 | 1809 | ); |
1810 | 1810 | |
1811 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1811 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1812 | 1812 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1813 | 1813 | } |
1814 | 1814 | |
1815 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1816 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1815 | + if (isset($this->_req_data['s'])) { |
|
1816 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1817 | 1817 | $_where['OR'] = array( |
1818 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1819 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1820 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1821 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1822 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1823 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1824 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1825 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1826 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1827 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1828 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1829 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1830 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1831 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1832 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1833 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1834 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1835 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1836 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1837 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1838 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1818 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1819 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1820 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1821 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1822 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1823 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1824 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1825 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1826 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1827 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1828 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1829 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1830 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1831 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1832 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1833 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1834 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1835 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1836 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1837 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1838 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1839 | 1839 | ); |
1840 | 1840 | } |
1841 | 1841 | |
1842 | 1842 | //failed transactions |
1843 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE; |
|
1844 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE; |
|
1843 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE; |
|
1844 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE; |
|
1845 | 1845 | |
1846 | - if ( $failed ) { |
|
1847 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1848 | - } else if ( $abandoned ) { |
|
1846 | + if ($failed) { |
|
1847 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1848 | + } else if ($abandoned) { |
|
1849 | 1849 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1850 | 1850 | } else { |
1851 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1852 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1851 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1852 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1853 | 1853 | } |
1854 | 1854 | |
1855 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1855 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1856 | 1856 | |
1857 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1857 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1858 | 1858 | |
1859 | 1859 | |
1860 | 1860 | return $transactions; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{ |
|
11 | +abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * the input's name attribute |
@@ -143,54 +143,54 @@ discard block |
||
143 | 143 | * @type EE_Validation_Strategy_Base[] $validation_strategies |
144 | 144 | * } |
145 | 145 | */ |
146 | - public function __construct( $input_args = array() ){ |
|
147 | - $input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this ); |
|
146 | + public function __construct($input_args = array()) { |
|
147 | + $input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this); |
|
148 | 148 | // the following properties must be cast as arrays |
149 | - if ( isset( $input_args['validation_strategies'] ) ) { |
|
150 | - foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) { |
|
151 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
152 | - $this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy; |
|
149 | + if (isset($input_args['validation_strategies'])) { |
|
150 | + foreach ((array) $input_args['validation_strategies'] as $validation_strategy) { |
|
151 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
152 | + $this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy; |
|
153 | 153 | } |
154 | 154 | } |
155 | - unset( $input_args['validation_strategies'] ); |
|
155 | + unset($input_args['validation_strategies']); |
|
156 | 156 | } |
157 | 157 | // loop thru incoming options |
158 | - foreach( $input_args as $key => $value ) { |
|
158 | + foreach ($input_args as $key => $value) { |
|
159 | 159 | // add underscore to $key to match property names |
160 | - $_key = '_' . $key; |
|
161 | - if ( property_exists( $this, $_key )) { |
|
160 | + $_key = '_'.$key; |
|
161 | + if (property_exists($this, $_key)) { |
|
162 | 162 | $this->{$_key} = $value; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | // ensure that "required" is set correctly |
166 | 166 | $this->set_required( |
167 | - $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) |
|
168 | - ? $input_args[ 'required_validation_error_message' ] |
|
167 | + $this->_required, isset($input_args['required_validation_error_message']) |
|
168 | + ? $input_args['required_validation_error_message'] |
|
169 | 169 | : null |
170 | 170 | ); |
171 | 171 | |
172 | 172 | //$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE; |
173 | 173 | |
174 | 174 | $this->_display_strategy->_construct_finalize($this); |
175 | - foreach( $this->_validation_strategies as $validation_strategy ){ |
|
175 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
176 | 176 | $validation_strategy->_construct_finalize($this); |
177 | 177 | } |
178 | 178 | |
179 | - if( ! $this->_normalization_strategy){ |
|
179 | + if ( ! $this->_normalization_strategy) { |
|
180 | 180 | $this->_normalization_strategy = new EE_Text_Normalization(); |
181 | 181 | } |
182 | 182 | $this->_normalization_strategy->_construct_finalize($this); |
183 | 183 | |
184 | 184 | //at least we can use the normalization strategy to populate the default |
185 | - if( isset( $input_args[ 'default' ] ) ) { |
|
186 | - $this->set_default( $input_args[ 'default' ] ); |
|
185 | + if (isset($input_args['default'])) { |
|
186 | + $this->set_default($input_args['default']); |
|
187 | 187 | } |
188 | 188 | |
189 | - if( ! $this->_sensitive_data_removal_strategy){ |
|
189 | + if ( ! $this->_sensitive_data_removal_strategy) { |
|
190 | 190 | $this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal(); |
191 | 191 | } |
192 | 192 | $this->_sensitive_data_removal_strategy->_construct_finalize($this); |
193 | - parent::__construct( $input_args ); |
|
193 | + parent::__construct($input_args); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | - protected function _set_default_html_name_if_empty(){ |
|
205 | - if( ! $this->_html_name){ |
|
204 | + protected function _set_default_html_name_if_empty() { |
|
205 | + if ( ! $this->_html_name) { |
|
206 | 206 | $this->_html_name = $this->name(); |
207 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){ |
|
208 | - $this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]"; |
|
207 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
208 | + $this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]"; |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | } |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | public function _construct_finalize($parent_form_section, $name) { |
221 | 221 | parent::_construct_finalize($parent_form_section, $name); |
222 | 222 | $this->_set_default_html_name_if_empty(); |
223 | - if( $this->_html_label === null && $this->_html_label_text === null ){ |
|
224 | - $this->_html_label_text = ucwords( str_replace("_"," ",$name)); |
|
223 | + if ($this->_html_label === null && $this->_html_label_text === null) { |
|
224 | + $this->_html_label_text = ucwords(str_replace("_", " ", $name)); |
|
225 | 225 | } |
226 | - do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name ); |
|
226 | + do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @return EE_Display_Strategy_Base |
232 | 232 | * @throws EE_Error |
233 | 233 | */ |
234 | - protected function _get_display_strategy(){ |
|
235 | - if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){ |
|
234 | + protected function _get_display_strategy() { |
|
235 | + if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) { |
|
236 | 236 | throw new EE_Error( |
237 | 237 | sprintf( |
238 | 238 | __( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->html_id() |
244 | 244 | ) |
245 | 245 | ); |
246 | - }else{ |
|
246 | + } else { |
|
247 | 247 | return $this->_display_strategy; |
248 | 248 | } |
249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * Sets the display strategy. |
252 | 252 | * @param EE_Display_Strategy_Base $strategy |
253 | 253 | */ |
254 | - protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){ |
|
254 | + protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) { |
|
255 | 255 | $this->_display_strategy = $strategy; |
256 | 256 | } |
257 | 257 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * Sets the sanitization strategy |
260 | 260 | * @param EE_Normalization_Strategy_Base $strategy |
261 | 261 | */ |
262 | - protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){ |
|
262 | + protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) { |
|
263 | 263 | $this->_normalization_strategy = $strategy; |
264 | 264 | } |
265 | 265 | |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | * Gets the display strategy for this input |
286 | 286 | * @return EE_Display_Strategy_Base |
287 | 287 | */ |
288 | - public function get_display_strategy(){ |
|
288 | + public function get_display_strategy() { |
|
289 | 289 | return $this->_display_strategy; |
290 | 290 | } |
291 | 291 | /** |
292 | 292 | * Overwrites the display strategy |
293 | 293 | * @param EE_Display_Strategy_Base $display_strategy |
294 | 294 | */ |
295 | - public function set_display_strategy($display_strategy){ |
|
295 | + public function set_display_strategy($display_strategy) { |
|
296 | 296 | $this->_display_strategy = $display_strategy; |
297 | 297 | $this->_display_strategy->_construct_finalize($this); |
298 | 298 | } |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * Gets the normalization strategy set on this input |
301 | 301 | * @return EE_Normalization_Strategy_Base |
302 | 302 | */ |
303 | - public function get_normalization_strategy(){ |
|
303 | + public function get_normalization_strategy() { |
|
304 | 304 | return $this->_normalization_strategy; |
305 | 305 | } |
306 | 306 | /** |
307 | 307 | * Overwrites the normalization strategy |
308 | 308 | * @param EE_Normalization_Strategy_Base $normalization_strategy |
309 | 309 | */ |
310 | - public function set_normalization_strategy($normalization_strategy){ |
|
310 | + public function set_normalization_strategy($normalization_strategy) { |
|
311 | 311 | $this->_normalization_strategy = $normalization_strategy; |
312 | 312 | $this->_normalization_strategy->_construct_finalize($this); |
313 | 313 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * Returns all teh validation strategies which apply to this field, numerically indexed |
317 | 317 | * @return EE_Validation_Strategy_Base[] |
318 | 318 | */ |
319 | - public function get_validation_strategies(){ |
|
319 | + public function get_validation_strategies() { |
|
320 | 320 | return $this->_validation_strategies; |
321 | 321 | } |
322 | 322 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * @param EE_Validation_Strategy_Base $validation_strategy |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){ |
|
331 | - $validation_strategy->_construct_finalize( $this ); |
|
330 | + protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
331 | + $validation_strategy->_construct_finalize($this); |
|
332 | 332 | $this->_validation_strategies[] = $validation_strategy; |
333 | 333 | } |
334 | 334 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_Validation_Strategy_Base $validation_strategy |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) { |
|
343 | - $this->_add_validation_strategy( $validation_strategy ); |
|
342 | + public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
343 | + $this->_add_validation_strategy($validation_strategy); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -350,13 +350,13 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @param string $validation_strategy_classname |
352 | 352 | */ |
353 | - public function remove_validation_strategy( $validation_strategy_classname ) { |
|
354 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
355 | - if( |
|
353 | + public function remove_validation_strategy($validation_strategy_classname) { |
|
354 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
355 | + if ( |
|
356 | 356 | $validation_strategy instanceof $validation_strategy_classname |
357 | - || is_subclass_of( $validation_strategy, $validation_strategy_classname ) |
|
357 | + || is_subclass_of($validation_strategy, $validation_strategy_classname) |
|
358 | 358 | ) { |
359 | - unset( $this->_validation_strategies[ $key ] ); |
|
359 | + unset($this->_validation_strategies[$key]); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | } |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | * @param array $validation_strategy_classnames |
370 | 370 | * @return bool |
371 | 371 | */ |
372 | - public function has_validation_strategy( $validation_strategy_classnames ) { |
|
373 | - $validation_strategy_classnames = is_array( $validation_strategy_classnames ) |
|
372 | + public function has_validation_strategy($validation_strategy_classnames) { |
|
373 | + $validation_strategy_classnames = is_array($validation_strategy_classnames) |
|
374 | 374 | ? $validation_strategy_classnames |
375 | - : array( $validation_strategy_classnames ); |
|
376 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
377 | - if( in_array( $key, $validation_strategy_classnames ) ) { |
|
375 | + : array($validation_strategy_classnames); |
|
376 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
377 | + if (in_array($key, $validation_strategy_classnames)) { |
|
378 | 378 | return true; |
379 | 379 | } |
380 | 380 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * Gets the HTML |
388 | 388 | * @return string |
389 | 389 | */ |
390 | - public function get_html(){ |
|
390 | + public function get_html() { |
|
391 | 391 | return $this->_parent_section->get_html_for_input($this); |
392 | 392 | } |
393 | 393 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @return string |
402 | 402 | * @throws \EE_Error |
403 | 403 | */ |
404 | - public function get_html_for_input(){ |
|
404 | + public function get_html_for_input() { |
|
405 | 405 | return $this->_get_display_strategy()->display(); |
406 | 406 | } |
407 | 407 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @return string |
412 | 412 | */ |
413 | 413 | public function html_other_attributes() { |
414 | - return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : ''; |
|
414 | + return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : ''; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | /** |
420 | 420 | * @param string $html_other_attributes |
421 | 421 | */ |
422 | - public function set_html_other_attributes( $html_other_attributes ) { |
|
422 | + public function set_html_other_attributes($html_other_attributes) { |
|
423 | 423 | $this->_html_other_attributes = $html_other_attributes; |
424 | 424 | } |
425 | 425 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * according to the form section's layout strategy |
429 | 429 | * @return string |
430 | 430 | */ |
431 | - public function get_html_for_label(){ |
|
431 | + public function get_html_for_label() { |
|
432 | 432 | return $this->_parent_section->get_layout_strategy()->display_label($this); |
433 | 433 | } |
434 | 434 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * according to the form section's layout strategy |
437 | 437 | * @return string |
438 | 438 | */ |
439 | - public function get_html_for_errors(){ |
|
439 | + public function get_html_for_errors() { |
|
440 | 440 | return $this->_parent_section->get_layout_strategy()->display_errors($this); |
441 | 441 | } |
442 | 442 | /** |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * according to the form section's layout strategy |
445 | 445 | * @return string |
446 | 446 | */ |
447 | - public function get_html_for_help(){ |
|
447 | + public function get_html_for_help() { |
|
448 | 448 | return $this->_parent_section->get_layout_strategy()->display_help_text($this); |
449 | 449 | } |
450 | 450 | /** |
@@ -453,18 +453,18 @@ discard block |
||
453 | 453 | * @return boolean |
454 | 454 | */ |
455 | 455 | protected function _validate() { |
456 | - foreach($this->_validation_strategies as $validation_strategy){ |
|
457 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
458 | - try{ |
|
456 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
457 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
458 | + try { |
|
459 | 459 | $validation_strategy->validate($this->normalized_value()); |
460 | - }catch(EE_Validation_Error $e){ |
|
460 | + } catch (EE_Validation_Error $e) { |
|
461 | 461 | $this->add_validation_error($e); |
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
465 | - if( $this->get_validation_errors()){ |
|
465 | + if ($this->get_validation_errors()) { |
|
466 | 466 | return false; |
467 | - }else{ |
|
467 | + } else { |
|
468 | 468 | return true; |
469 | 469 | } |
470 | 470 | } |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @param string $value |
479 | 479 | * @return null|string |
480 | 480 | */ |
481 | - private function _sanitize( $value ) { |
|
482 | - return $value !== null ? stripslashes( html_entity_decode( trim( $value ) ) ) : null; |
|
481 | + private function _sanitize($value) { |
|
482 | + return $value !== null ? stripslashes(html_entity_decode(trim($value))) : null; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -493,25 +493,25 @@ discard block |
||
493 | 493 | * @return boolean whether or not there was an error |
494 | 494 | * @throws \EE_Error |
495 | 495 | */ |
496 | - protected function _normalize( $req_data ) { |
|
496 | + protected function _normalize($req_data) { |
|
497 | 497 | //any existing validation errors don't apply so clear them |
498 | 498 | $this->_validation_errors = array(); |
499 | 499 | try { |
500 | - $raw_input = $this->find_form_data_for_this_section( $req_data ); |
|
500 | + $raw_input = $this->find_form_data_for_this_section($req_data); |
|
501 | 501 | //super simple sanitization for now |
502 | - if ( is_array( $raw_input )) { |
|
502 | + if (is_array($raw_input)) { |
|
503 | 503 | $raw_value = array(); |
504 | - foreach( $raw_input as $key => $value ) { |
|
505 | - $raw_value[ $key ] = $this->_sanitize( $value ); |
|
504 | + foreach ($raw_input as $key => $value) { |
|
505 | + $raw_value[$key] = $this->_sanitize($value); |
|
506 | 506 | } |
507 | - $this->_set_raw_value( $raw_value ); |
|
507 | + $this->_set_raw_value($raw_value); |
|
508 | 508 | } else { |
509 | - $this->_set_raw_value( $this->_sanitize( $raw_input ) ); |
|
509 | + $this->_set_raw_value($this->_sanitize($raw_input)); |
|
510 | 510 | } |
511 | 511 | //we want to mostly leave the input alone in case we need to re-display it to the user |
512 | - $this->_set_normalized_value( $this->_normalization_strategy->normalize( $this->raw_value() ) ); |
|
513 | - } catch ( EE_Validation_Error $e ) { |
|
514 | - $this->add_validation_error( $e ); |
|
512 | + $this->_set_normalized_value($this->_normalization_strategy->normalize($this->raw_value())); |
|
513 | + } catch (EE_Validation_Error $e) { |
|
514 | + $this->add_validation_error($e); |
|
515 | 515 | } |
516 | 516 | } |
517 | 517 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | /** |
521 | 521 | * @return string |
522 | 522 | */ |
523 | - public function html_name(){ |
|
523 | + public function html_name() { |
|
524 | 524 | return $this->_html_name; |
525 | 525 | } |
526 | 526 | |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | /** |
530 | 530 | * @return string |
531 | 531 | */ |
532 | - public function html_label_id(){ |
|
533 | - return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl'; |
|
532 | + public function html_label_id() { |
|
533 | + return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl'; |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | /** |
539 | 539 | * @return string |
540 | 540 | */ |
541 | - public function html_label_class(){ |
|
541 | + public function html_label_class() { |
|
542 | 542 | return $this->_html_label_class; |
543 | 543 | } |
544 | 544 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * @return string |
549 | 549 | */ |
550 | - public function html_label_style(){ |
|
550 | + public function html_label_style() { |
|
551 | 551 | return $this->_html_label_style; |
552 | 552 | } |
553 | 553 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | /** |
557 | 557 | * @return string |
558 | 558 | */ |
559 | - public function html_label_text(){ |
|
559 | + public function html_label_text() { |
|
560 | 560 | return $this->_html_label_text; |
561 | 561 | } |
562 | 562 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * @return string |
567 | 567 | */ |
568 | - public function html_help_text(){ |
|
568 | + public function html_help_text() { |
|
569 | 569 | return $this->_html_help_text; |
570 | 570 | } |
571 | 571 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | /** |
575 | 575 | * @return string |
576 | 576 | */ |
577 | - public function html_help_class(){ |
|
577 | + public function html_help_class() { |
|
578 | 578 | return $this->_html_help_class; |
579 | 579 | } |
580 | 580 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | /** |
584 | 584 | * @return string |
585 | 585 | */ |
586 | - public function html_help_style(){ |
|
586 | + public function html_help_style() { |
|
587 | 587 | return $this->_html_style; |
588 | 588 | } |
589 | 589 | /** |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | * in which case, we would have stored the malicious content to our database. |
597 | 597 | * @return string |
598 | 598 | */ |
599 | - public function raw_value(){ |
|
599 | + public function raw_value() { |
|
600 | 600 | return $this->_raw_value; |
601 | 601 | } |
602 | 602 | /** |
@@ -604,15 +604,15 @@ discard block |
||
604 | 604 | * it escapes all html entities |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - public function raw_value_in_form(){ |
|
608 | - return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8'); |
|
607 | + public function raw_value_in_form() { |
|
608 | + return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8'); |
|
609 | 609 | } |
610 | 610 | /** |
611 | 611 | * returns the value after it's been sanitized, and then converted into it's proper type |
612 | 612 | * in PHP. Eg, a string, an int, an array, |
613 | 613 | * @return mixed |
614 | 614 | */ |
615 | - public function normalized_value(){ |
|
615 | + public function normalized_value() { |
|
616 | 616 | return $this->_normalized_value; |
617 | 617 | } |
618 | 618 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * the best thing to display |
623 | 623 | * @return string |
624 | 624 | */ |
625 | - public function pretty_value(){ |
|
625 | + public function pretty_value() { |
|
626 | 626 | return $this->_normalized_value; |
627 | 627 | } |
628 | 628 | /** |
@@ -641,19 +641,19 @@ discard block |
||
641 | 641 | }</code> |
642 | 642 | * @return array |
643 | 643 | */ |
644 | - public function get_jquery_validation_rules(){ |
|
644 | + public function get_jquery_validation_rules() { |
|
645 | 645 | $jquery_validation_js = array(); |
646 | 646 | $jquery_validation_rules = array(); |
647 | - foreach($this->get_validation_strategies() as $validation_strategy){ |
|
647 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
648 | 648 | $jquery_validation_rules = array_replace_recursive( |
649 | 649 | $jquery_validation_rules, |
650 | 650 | $validation_strategy->get_jquery_validation_rule_array() |
651 | 651 | ); |
652 | 652 | } |
653 | 653 | |
654 | - if(! empty($jquery_validation_rules)){ |
|
655 | - foreach( $this->get_display_strategy()->get_html_input_ids( true ) as $html_id_with_pound_sign ) { |
|
656 | - $jquery_validation_js[ $html_id_with_pound_sign ] = $jquery_validation_rules; |
|
654 | + if ( ! empty($jquery_validation_rules)) { |
|
655 | + foreach ($this->get_display_strategy()->get_html_input_ids(true) as $html_id_with_pound_sign) { |
|
656 | + $jquery_validation_js[$html_id_with_pound_sign] = $jquery_validation_rules; |
|
657 | 657 | } |
658 | 658 | } |
659 | 659 | return $jquery_validation_js; |
@@ -665,16 +665,16 @@ discard block |
||
665 | 665 | * @param mixed $value |
666 | 666 | * @return void |
667 | 667 | */ |
668 | - public function set_default($value){ |
|
669 | - $this->_set_normalized_value( $value ); |
|
670 | - $this->_set_raw_value( $value ); |
|
668 | + public function set_default($value) { |
|
669 | + $this->_set_normalized_value($value); |
|
670 | + $this->_set_raw_value($value); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | /** |
674 | 674 | * Sets the normalized value on this input |
675 | 675 | * @param mixed $value |
676 | 676 | */ |
677 | - protected function _set_normalized_value( $value ) { |
|
677 | + protected function _set_normalized_value($value) { |
|
678 | 678 | $this->_normalized_value = $value; |
679 | 679 | } |
680 | 680 | |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | * Sets the raw value on this input (ie, exactly as the user submitted it) |
683 | 683 | * @param mixed $value |
684 | 684 | */ |
685 | - protected function _set_raw_value( $value ) { |
|
686 | - $this->_raw_value = $this->_normalization_strategy->unnormalize( $value ); |
|
685 | + protected function _set_raw_value($value) { |
|
686 | + $this->_raw_value = $this->_normalization_strategy->unnormalize($value); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | /** |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * @param string $label |
692 | 692 | * @return void |
693 | 693 | */ |
694 | - public function set_html_label_text($label){ |
|
694 | + public function set_html_label_text($label) { |
|
695 | 695 | $this->_html_label_text = $label; |
696 | 696 | } |
697 | 697 | |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | * @param boolean $required boolean |
706 | 706 | * @param null $required_text |
707 | 707 | */ |
708 | - public function set_required($required = true, $required_text = NULL ){ |
|
709 | - $required = filter_var( $required, FILTER_VALIDATE_BOOLEAN ); |
|
708 | + public function set_required($required = true, $required_text = NULL) { |
|
709 | + $required = filter_var($required, FILTER_VALIDATE_BOOLEAN); |
|
710 | 710 | //whether $required is a string or a boolean, we want to add a required validation strategy |
711 | - if ( $required ) { |
|
712 | - $this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) ); |
|
711 | + if ($required) { |
|
712 | + $this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text)); |
|
713 | 713 | } else { |
714 | - unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] ); |
|
714 | + unset($this->_validation_strategies['EE_Required_Validation_Strategy']); |
|
715 | 715 | } |
716 | 716 | $this->_required = $required; |
717 | 717 | } |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | * Returns whether or not this field is required |
720 | 720 | * @return boolean |
721 | 721 | */ |
722 | - public function required(){ |
|
722 | + public function required() { |
|
723 | 723 | return $this->_required; |
724 | 724 | } |
725 | 725 | |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | /** |
729 | 729 | * @param string $required_css_class |
730 | 730 | */ |
731 | - public function set_required_css_class( $required_css_class ) { |
|
731 | + public function set_required_css_class($required_css_class) { |
|
732 | 732 | $this->_required_css_class = $required_css_class; |
733 | 733 | } |
734 | 734 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * Sets the help text, in case |
748 | 748 | * @param string $text |
749 | 749 | */ |
750 | - public function set_html_help_text($text){ |
|
750 | + public function set_html_help_text($text) { |
|
751 | 751 | $this->_html_help_text = $text; |
752 | 752 | } |
753 | 753 | /** |
@@ -759,9 +759,9 @@ discard block |
||
759 | 759 | public function clean_sensitive_data() { |
760 | 760 | //if we do ANY kind of sensitive data removal on this, then just clear out the raw value |
761 | 761 | //if we need more logic than this we'll make a strategy for it |
762 | - if( $this->_sensitive_data_removal_strategy && |
|
763 | - ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){ |
|
764 | - $this->_set_raw_value( null ); |
|
762 | + if ($this->_sensitive_data_removal_strategy && |
|
763 | + ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) { |
|
764 | + $this->_set_raw_value(null); |
|
765 | 765 | } |
766 | 766 | //and clean the normalized value according to the appropriate strategy |
767 | 767 | $this->_set_normalized_value( |
@@ -778,10 +778,10 @@ discard block |
||
778 | 778 | * @param string $button_size |
779 | 779 | * @param string $other_attributes |
780 | 780 | */ |
781 | - public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) { |
|
781 | + public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') { |
|
782 | 782 | $button_css_attributes = 'button'; |
783 | 783 | $button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary'; |
784 | - switch ( $button_size ) { |
|
784 | + switch ($button_size) { |
|
785 | 785 | case 'xs' : |
786 | 786 | case 'extra-small' : |
787 | 787 | $button_css_attributes .= ' button-xs'; |
@@ -802,8 +802,8 @@ discard block |
||
802 | 802 | default : |
803 | 803 | $button_css_attributes .= ''; |
804 | 804 | } |
805 | - $this->_button_css_attributes .= ! empty( $other_attributes ) |
|
806 | - ? $button_css_attributes . ' ' . $other_attributes |
|
805 | + $this->_button_css_attributes .= ! empty($other_attributes) |
|
806 | + ? $button_css_attributes.' '.$other_attributes |
|
807 | 807 | : $button_css_attributes; |
808 | 808 | } |
809 | 809 | |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * @return string |
814 | 814 | */ |
815 | 815 | public function button_css_attributes() { |
816 | - if ( empty( $this->_button_css_attributes )) { |
|
816 | + if (empty($this->_button_css_attributes)) { |
|
817 | 817 | $this->set_button_css_attributes(); |
818 | 818 | } |
819 | 819 | return $this->_button_css_attributes; |
@@ -835,26 +835,26 @@ discard block |
||
835 | 835 | * @return mixed whatever the raw value of this form section is in the request data |
836 | 836 | * @throws \EE_Error |
837 | 837 | */ |
838 | - public function find_form_data_for_this_section( $req_data ){ |
|
838 | + public function find_form_data_for_this_section($req_data) { |
|
839 | 839 | // break up the html name by "[]" |
840 | - if ( strpos( $this->html_name(), '[' ) !== FALSE ) { |
|
841 | - $before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') ); |
|
840 | + if (strpos($this->html_name(), '[') !== FALSE) { |
|
841 | + $before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '[')); |
|
842 | 842 | } else { |
843 | 843 | $before_any_brackets = $this->html_name(); |
844 | 844 | } |
845 | 845 | // grab all of the segments |
846 | - preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches); |
|
847 | - if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
|
848 | - $name_parts = $matches[ 1 ]; |
|
846 | + preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches); |
|
847 | + if (isset($matches[1]) && is_array($matches[1])) { |
|
848 | + $name_parts = $matches[1]; |
|
849 | 849 | array_unshift($name_parts, $before_any_brackets); |
850 | - }else{ |
|
851 | - $name_parts = array( $before_any_brackets ); |
|
850 | + } else { |
|
851 | + $name_parts = array($before_any_brackets); |
|
852 | 852 | } |
853 | 853 | // now get the value for the input |
854 | 854 | $value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data); |
855 | 855 | // check if this thing's name is at the TOP level of the request data |
856 | - if( $value === null && isset( $req_data[ $this->name() ] ) ){ |
|
857 | - $value = $req_data[ $this->name() ]; |
|
856 | + if ($value === null && isset($req_data[$this->name()])) { |
|
857 | + $value = $req_data[$this->name()]; |
|
858 | 858 | } |
859 | 859 | return $value; |
860 | 860 | } |
@@ -867,18 +867,18 @@ discard block |
||
867 | 867 | * @param array $req_data |
868 | 868 | * @return array | NULL |
869 | 869 | */ |
870 | - public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){ |
|
871 | - $first_part_to_consider = array_shift( $html_name_parts ); |
|
872 | - if( isset( $req_data[ $first_part_to_consider ] ) ){ |
|
873 | - if( empty($html_name_parts ) ){ |
|
874 | - return $req_data[ $first_part_to_consider ]; |
|
875 | - }else{ |
|
870 | + public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) { |
|
871 | + $first_part_to_consider = array_shift($html_name_parts); |
|
872 | + if (isset($req_data[$first_part_to_consider])) { |
|
873 | + if (empty($html_name_parts)) { |
|
874 | + return $req_data[$first_part_to_consider]; |
|
875 | + } else { |
|
876 | 876 | return $this->_find_form_data_for_this_section_using_name_parts( |
877 | 877 | $html_name_parts, |
878 | - $req_data[ $first_part_to_consider ] |
|
878 | + $req_data[$first_part_to_consider] |
|
879 | 879 | ); |
880 | 880 | } |
881 | - }else{ |
|
881 | + } else { |
|
882 | 882 | return NULL; |
883 | 883 | } |
884 | 884 | } |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | * @return boolean |
893 | 893 | * @throws \EE_Error |
894 | 894 | */ |
895 | - public function form_data_present_in($req_data = NULL){ |
|
896 | - if( $req_data === NULL ){ |
|
895 | + public function form_data_present_in($req_data = NULL) { |
|
896 | + if ($req_data === NULL) { |
|
897 | 897 | $req_data = $_POST; |
898 | 898 | } |
899 | - $checked_value = $this->find_form_data_for_this_section( $req_data ); |
|
900 | - if( $checked_value !== null ){ |
|
899 | + $checked_value = $this->find_form_data_for_this_section($req_data); |
|
900 | + if ($checked_value !== null) { |
|
901 | 901 | return TRUE; |
902 | - }else{ |
|
902 | + } else { |
|
903 | 903 | return FALSE; |
904 | 904 | } |
905 | 905 | } |
@@ -910,8 +910,8 @@ discard block |
||
910 | 910 | * @param array $form_other_js_data |
911 | 911 | * @return array |
912 | 912 | */ |
913 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
914 | - $form_other_js_data = $this->get_other_js_data_from_strategies( $form_other_js_data ); |
|
913 | + public function get_other_js_data($form_other_js_data = array()) { |
|
914 | + $form_other_js_data = $this->get_other_js_data_from_strategies($form_other_js_data); |
|
915 | 915 | return $form_other_js_data; |
916 | 916 | } |
917 | 917 | |
@@ -924,10 +924,10 @@ discard block |
||
924 | 924 | * @param array $form_other_js_data |
925 | 925 | * @return array |
926 | 926 | */ |
927 | - public function get_other_js_data_from_strategies( $form_other_js_data = array() ) { |
|
928 | - $form_other_js_data = $this->get_display_strategy()->get_other_js_data( $form_other_js_data ); |
|
929 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
930 | - $form_other_js_data = $validation_strategy->get_other_js_data( $form_other_js_data ); |
|
927 | + public function get_other_js_data_from_strategies($form_other_js_data = array()) { |
|
928 | + $form_other_js_data = $this->get_display_strategy()->get_other_js_data($form_other_js_data); |
|
929 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
930 | + $form_other_js_data = $validation_strategy->get_other_js_data($form_other_js_data); |
|
931 | 931 | } |
932 | 932 | return $form_other_js_data; |
933 | 933 | } |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | * Override parent because we want to give our strategies an opportunity to enqueue some js and css |
937 | 937 | * @return void |
938 | 938 | */ |
939 | - public function enqueue_js(){ |
|
939 | + public function enqueue_js() { |
|
940 | 940 | //ask our display strategy and validation strategies if they have js to enqueue |
941 | 941 | $this->enqueue_js_from_strategies(); |
942 | 942 | } |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | */ |
948 | 948 | public function enqueue_js_from_strategies() { |
949 | 949 | $this->get_display_strategy()->enqueue_js(); |
950 | - foreach( $this->get_validation_strategies() as $validation_strategy ) { |
|
950 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
951 | 951 | $validation_strategy->enqueue_js(); |
952 | 952 | } |
953 | 953 | } |
@@ -105,41 +105,41 @@ discard block |
||
105 | 105 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
106 | 106 | * @return \EEM_Line_Item |
107 | 107 | */ |
108 | - protected function __construct( $timezone ) { |
|
109 | - $this->singular_item = __('Line Item','event_espresso'); |
|
110 | - $this->plural_item = __('Line Items','event_espresso'); |
|
108 | + protected function __construct($timezone) { |
|
109 | + $this->singular_item = __('Line Item', 'event_espresso'); |
|
110 | + $this->plural_item = __('Line Items', 'event_espresso'); |
|
111 | 111 | |
112 | 112 | $this->_tables = array( |
113 | - 'Line_Item'=>new EE_Primary_Table('esp_line_item','LIN_ID') |
|
113 | + 'Line_Item'=>new EE_Primary_Table('esp_line_item', 'LIN_ID') |
|
114 | 114 | ); |
115 | - $line_items_can_be_for = apply_filters( 'FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket','Price', 'Event' ) ); |
|
115 | + $line_items_can_be_for = apply_filters('FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket', 'Price', 'Event')); |
|
116 | 116 | $this->_fields = array( |
117 | 117 | 'Line_Item' => array( |
118 | - 'LIN_ID' => new EE_Primary_Key_Int_Field( 'LIN_ID', __( "ID", "event_espresso" ) ), |
|
119 | - 'LIN_code' => new EE_Slug_Field( 'LIN_code', __( "Code for index into Cart", "event_espresso" ), TRUE ), |
|
120 | - 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( "Transaction ID", "event_espresso" ), TRUE, NULL, 'Transaction' ), |
|
121 | - 'LIN_name' => new EE_Full_HTML_Field( 'LIN_name', __( "Line Item Name", "event_espresso" ), FALSE, '' ), |
|
122 | - 'LIN_desc' => new EE_Full_HTML_Field( 'LIN_desc', __( "Line Item Description", "event_espresso" ), TRUE ), |
|
123 | - 'LIN_unit_price' => new EE_Money_Field( 'LIN_unit_price', __( "Unit Price", "event_espresso" ), FALSE, 0 ), |
|
124 | - 'LIN_percent' => new EE_Float_Field( 'LIN_percent', __( "Percent", "event_espresso" ), FALSE, 0 ), |
|
125 | - 'LIN_is_taxable' => new EE_Boolean_Field( 'LIN_is_taxable', __( "Taxable", "event_espresso" ), FALSE, FALSE ), |
|
126 | - 'LIN_order' => new EE_Integer_Field( 'LIN_order', __( "Order of Application towards total of parent", "event_espresso" ), FALSE, 1 ), |
|
127 | - 'LIN_total' => new EE_Money_Field( 'LIN_total', __( "Total (unit price x quantity)", "event_espresso" ), FALSE, 0 ), |
|
128 | - 'LIN_quantity' => new EE_Integer_Field( 'LIN_quantity', __( "Quantity", "event_espresso" ), TRUE, 1 ), |
|
129 | - 'LIN_parent' => new EE_Integer_Field( 'LIN_parent', __( "Parent ID (this item goes towards that Line Item's total)", "event_espresso" ), TRUE, NULL ), |
|
130 | - 'LIN_type' => new EE_Enum_Text_Field( 'LIN_type', __( "Type", "event_espresso" ), FALSE, 'line-item', array( |
|
118 | + 'LIN_ID' => new EE_Primary_Key_Int_Field('LIN_ID', __("ID", "event_espresso")), |
|
119 | + 'LIN_code' => new EE_Slug_Field('LIN_code', __("Code for index into Cart", "event_espresso"), TRUE), |
|
120 | + 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __("Transaction ID", "event_espresso"), TRUE, NULL, 'Transaction'), |
|
121 | + 'LIN_name' => new EE_Full_HTML_Field('LIN_name', __("Line Item Name", "event_espresso"), FALSE, ''), |
|
122 | + 'LIN_desc' => new EE_Full_HTML_Field('LIN_desc', __("Line Item Description", "event_espresso"), TRUE), |
|
123 | + 'LIN_unit_price' => new EE_Money_Field('LIN_unit_price', __("Unit Price", "event_espresso"), FALSE, 0), |
|
124 | + 'LIN_percent' => new EE_Float_Field('LIN_percent', __("Percent", "event_espresso"), FALSE, 0), |
|
125 | + 'LIN_is_taxable' => new EE_Boolean_Field('LIN_is_taxable', __("Taxable", "event_espresso"), FALSE, FALSE), |
|
126 | + 'LIN_order' => new EE_Integer_Field('LIN_order', __("Order of Application towards total of parent", "event_espresso"), FALSE, 1), |
|
127 | + 'LIN_total' => new EE_Money_Field('LIN_total', __("Total (unit price x quantity)", "event_espresso"), FALSE, 0), |
|
128 | + 'LIN_quantity' => new EE_Integer_Field('LIN_quantity', __("Quantity", "event_espresso"), TRUE, 1), |
|
129 | + 'LIN_parent' => new EE_Integer_Field('LIN_parent', __("Parent ID (this item goes towards that Line Item's total)", "event_espresso"), TRUE, NULL), |
|
130 | + 'LIN_type' => new EE_Enum_Text_Field('LIN_type', __("Type", "event_espresso"), FALSE, 'line-item', array( |
|
131 | 131 | self::type_line_item => __("Line Item", "event_espresso"), |
132 | 132 | self::type_sub_line_item => __("Sub-Item", "event_espresso"), |
133 | 133 | self::type_sub_total => __("Subtotal", "event_espresso"), |
134 | 134 | self::type_tax_sub_total => __("Tax Subtotal", "event_espresso"), |
135 | 135 | self::type_tax => __("Tax", "event_espresso"), |
136 | 136 | self::type_total => __("Total", "event_espresso"), |
137 | - self::type_cancellation => __( 'Cancellation', 'event_espresso' ) |
|
137 | + self::type_cancellation => __('Cancellation', 'event_espresso') |
|
138 | 138 | ) |
139 | 139 | ), |
140 | - 'OBJ_ID' => new EE_Foreign_Key_Int_Field( 'OBJ_ID', __( 'ID of Item purchased.', 'event_espresso' ), TRUE, NULL, $line_items_can_be_for ), |
|
141 | - 'OBJ_type' =>new EE_Any_Foreign_Model_Name_Field( 'OBJ_type', __( "Model Name this Line Item is for", "event_espresso" ), TRUE, NULL, $line_items_can_be_for ), |
|
142 | - 'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created','event_espresso'), false, EE_Datetime_Field::now, $timezone ), |
|
140 | + 'OBJ_ID' => new EE_Foreign_Key_Int_Field('OBJ_ID', __('ID of Item purchased.', 'event_espresso'), TRUE, NULL, $line_items_can_be_for), |
|
141 | + 'OBJ_type' =>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Model Name this Line Item is for", "event_espresso"), TRUE, NULL, $line_items_can_be_for), |
|
142 | + 'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created', 'event_espresso'), false, EE_Datetime_Field::now, $timezone), |
|
143 | 143 | ) |
144 | 144 | ); |
145 | 145 | $this->_model_relations = array( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | ); |
151 | 151 | $this->_model_chain_to_wp_user = 'Transaction.Registration.Event'; |
152 | 152 | $this->_caps_slug = 'transactions'; |
153 | - parent::__construct( $timezone ); |
|
153 | + parent::__construct($timezone); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | * @param EE_Transaction|int $transaction |
162 | 162 | * @return EE_Line_Item[] |
163 | 163 | */ |
164 | - public function get_all_of_type_for_transaction( $line_item_type, $transaction ){ |
|
165 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
166 | - return $this->get_all( array( array( |
|
164 | + public function get_all_of_type_for_transaction($line_item_type, $transaction) { |
|
165 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
166 | + return $this->get_all(array(array( |
|
167 | 167 | 'LIN_type' => $line_item_type, |
168 | 168 | 'TXN_ID' => $transaction |
169 | 169 | ))); |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | * @param EE_Transaction|int $transaction |
178 | 178 | * @return EE_Line_Item[] |
179 | 179 | */ |
180 | - public function get_all_non_ticket_line_items_for_transaction( $transaction ) { |
|
181 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
182 | - return $this->get_all( array( array( |
|
180 | + public function get_all_non_ticket_line_items_for_transaction($transaction) { |
|
181 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
182 | + return $this->get_all(array(array( |
|
183 | 183 | 'LIN_type' => self::type_line_item, |
184 | 184 | 'TXN_ID' => $transaction, |
185 | 185 | 'OR' => array( |
186 | - 'OBJ_type*notticket' => array( '!=', 'Ticket'), |
|
187 | - 'OBJ_type*null' => array( 'IS_NULL' )) |
|
186 | + 'OBJ_type*notticket' => array('!=', 'Ticket'), |
|
187 | + 'OBJ_type*null' => array('IS_NULL')) |
|
188 | 188 | ))); |
189 | 189 | } |
190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * because if there are spam bots afoot there will be LOTS of line items |
195 | 195 | * @return int count of how many deleted |
196 | 196 | */ |
197 | - public function delete_line_items_with_no_transaction(){ |
|
197 | + public function delete_line_items_with_no_transaction() { |
|
198 | 198 | /** @type WPDB $wpdb */ |
199 | 199 | global $wpdb; |
200 | 200 | $time_to_leave_alone = apply_filters( |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | ); |
203 | 203 | $query = $wpdb->prepare( |
204 | 204 | 'DELETE li |
205 | - FROM ' . $this->table() . ' li |
|
206 | - LEFT JOIN ' . EEM_Transaction::instance()->table(). ' t ON li.TXN_ID = t.TXN_ID |
|
205 | + FROM ' . $this->table().' li |
|
206 | + LEFT JOIN ' . EEM_Transaction::instance()->table().' t ON li.TXN_ID = t.TXN_ID |
|
207 | 207 | WHERE t.TXN_ID IS NULL AND li.LIN_timestamp < %s', |
208 | 208 | // use GMT time because that's what TXN_timestamps are in |
209 | - gmdate( 'Y-m-d H:i:s', time() - $time_to_leave_alone ) |
|
209 | + gmdate('Y-m-d H:i:s', time() - $time_to_leave_alone) |
|
210 | 210 | ); |
211 | - return $wpdb->query( $query ); |
|
211 | + return $wpdb->query($query); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * @param \EE_Base_Class $object |
222 | 222 | * @return EE_Line_Item[] |
223 | 223 | */ |
224 | - public function get_line_item_for_transaction_object( $TXN_ID, EE_Base_Class $object ){ |
|
225 | - return $this->get_all( array( array( |
|
224 | + public function get_line_item_for_transaction_object($TXN_ID, EE_Base_Class $object) { |
|
225 | + return $this->get_all(array(array( |
|
226 | 226 | 'TXN_ID' => $TXN_ID, |
227 | - 'OBJ_type' => str_replace( 'EE_', '', get_class( $object )), |
|
227 | + 'OBJ_type' => str_replace('EE_', '', get_class($object)), |
|
228 | 228 | 'OBJ_ID' => $object->ID() |
229 | 229 | ))); |
230 | 230 | } |
@@ -240,16 +240,16 @@ discard block |
||
240 | 240 | * @param array $OBJ_IDs |
241 | 241 | * @return EE_Line_Item[] |
242 | 242 | */ |
243 | - public function get_object_line_items_for_transaction( $TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array() ){ |
|
243 | + public function get_object_line_items_for_transaction($TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array()) { |
|
244 | 244 | $query_params = array( |
245 | 245 | 'OBJ_type' => $OBJ_type, |
246 | 246 | // if incoming $OBJ_IDs is an array, then make sure it is formatted correctly for the query |
247 | - 'OBJ_ID' => is_array( $OBJ_IDs ) && ! isset( $OBJ_IDs['IN'] ) ? array( 'IN', $OBJ_IDs ) : $OBJ_IDs |
|
247 | + 'OBJ_ID' => is_array($OBJ_IDs) && ! isset($OBJ_IDs['IN']) ? array('IN', $OBJ_IDs) : $OBJ_IDs |
|
248 | 248 | ); |
249 | - if ( $TXN_ID ) { |
|
249 | + if ($TXN_ID) { |
|
250 | 250 | $query_params['TXN_ID'] = $TXN_ID; |
251 | 251 | } |
252 | - return $this->get_all( array( $query_params )); |
|
252 | + return $this->get_all(array($query_params)); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | * @param EE_Transaction $transaction |
261 | 261 | * @return EE_Line_Item[] |
262 | 262 | */ |
263 | - public function get_all_ticket_line_items_for_transaction( EE_Transaction $transaction ) { |
|
264 | - return $this->get_all( array( |
|
263 | + public function get_all_ticket_line_items_for_transaction(EE_Transaction $transaction) { |
|
264 | + return $this->get_all(array( |
|
265 | 265 | array( |
266 | 266 | 'TXN_ID' => $transaction->ID(), |
267 | 267 | 'OBJ_type' => 'Ticket', |
268 | 268 | ) |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | * @param int $TKT_ID |
279 | 279 | * @return \EE_Line_Item |
280 | 280 | */ |
281 | - public function get_ticket_line_item_for_transaction( $TXN_ID, $TKT_ID ) { |
|
282 | - return $this->get_one( array( |
|
281 | + public function get_ticket_line_item_for_transaction($TXN_ID, $TKT_ID) { |
|
282 | + return $this->get_one(array( |
|
283 | 283 | array( |
284 | - 'TXN_ID' => EEM_Transaction::instance()->ensure_is_ID( $TXN_ID ), |
|
284 | + 'TXN_ID' => EEM_Transaction::instance()->ensure_is_ID($TXN_ID), |
|
285 | 285 | 'OBJ_ID' => $TKT_ID, |
286 | 286 | 'OBJ_type' => 'Ticket', |
287 | 287 | ) |
288 | - ) ); |
|
288 | + )); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | * @param EE_Promotion $promotion |
301 | 301 | * @return EE_Line_Item |
302 | 302 | */ |
303 | - public function get_existing_promotion_line_item( EE_Line_Item $parent_line_item, EE_Promotion $promotion ) { |
|
304 | - return $this->get_one( array( |
|
303 | + public function get_existing_promotion_line_item(EE_Line_Item $parent_line_item, EE_Promotion $promotion) { |
|
304 | + return $this->get_one(array( |
|
305 | 305 | array( |
306 | 306 | 'TXN_ID' => $parent_line_item->TXN_ID(), |
307 | 307 | 'LIN_parent' => $parent_line_item->ID(), |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | * @param EE_Line_Item $parent_line_item |
323 | 323 | * @return EE_Line_Item[] |
324 | 324 | */ |
325 | - public function get_all_promotion_line_items( EE_Line_Item $parent_line_item ) { |
|
326 | - return $this->get_all( array( |
|
325 | + public function get_all_promotion_line_items(EE_Line_Item $parent_line_item) { |
|
326 | + return $this->get_all(array( |
|
327 | 327 | array( |
328 | 328 | 'TXN_ID' => $parent_line_item->TXN_ID(), |
329 | 329 | 'LIN_parent' => $parent_line_item->ID(), |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * @param EE_Registration $registration |
341 | 341 | * @return EE_Line_ITem |
342 | 342 | */ |
343 | - public function get_line_item_for_registration( EE_Registration $registration ) { |
|
344 | - return $this->get_one( $this->line_item_for_registration_query_params( $registration )); |
|
343 | + public function get_line_item_for_registration(EE_Registration $registration) { |
|
344 | + return $this->get_one($this->line_item_for_registration_query_params($registration)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | * @param array $original_query_params any extra query params you'd like to be merged with |
351 | 351 | * @return array like EEM_Base::get_all()'s $query_params |
352 | 352 | */ |
353 | - public function line_item_for_registration_query_params( EE_Registration $registration, $original_query_params = array() ) { |
|
354 | - return array_replace_recursive( $original_query_params, array( |
|
353 | + public function line_item_for_registration_query_params(EE_Registration $registration, $original_query_params = array()) { |
|
354 | + return array_replace_recursive($original_query_params, array( |
|
355 | 355 | array( |
356 | 356 | 'OBJ_ID' => $registration->ticket_ID(), |
357 | 357 | 'OBJ_type' => 'Ticket', |
358 | 358 | 'TXN_ID' => $registration->transaction_ID() |
359 | 359 | ) |
360 | - ) ); |
|
360 | + )); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -55,38 +55,38 @@ discard block |
||
55 | 55 | '[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'), |
56 | 56 | '[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'), |
57 | 57 | '[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'), |
58 | - '[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ), |
|
58 | + '[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'), |
|
59 | 59 | '[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'), |
60 | 60 | '[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'), |
61 | 61 | '[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'), |
62 | 62 | '[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'), |
63 | 63 | '[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'), |
64 | 64 | '[EVENT_IMAGE_*]' => sprintf( |
65 | - __( 'This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso' ), |
|
65 | + __('This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso'), |
|
66 | 66 | '<code>', |
67 | 67 | '</code>' |
68 | 68 | ), |
69 | 69 | '[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf( |
70 | - __( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event. There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode). %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ), |
|
70 | + __('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event. There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode). %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'), |
|
71 | 71 | '<code>', |
72 | 72 | '</code>' |
73 | 73 | ), |
74 | - '[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ), |
|
74 | + '[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'), |
|
75 | 75 | '[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'), |
76 | 76 | '[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'), |
77 | 77 | '[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'), |
78 | - '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ), |
|
78 | + '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'), |
|
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | - protected function _parser( $shortcode ) { |
|
83 | + protected function _parser($shortcode) { |
|
84 | 84 | |
85 | 85 | |
86 | 86 | $this->_event = $this->_data instanceof EE_Event ? $this->_data : null; |
87 | 87 | |
88 | 88 | //if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the reg_obj instead. |
89 | - if ( empty( $this->_event ) ) { |
|
89 | + if (empty($this->_event)) { |
|
90 | 90 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
91 | 91 | $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
92 | 92 | |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | |
96 | 96 | |
97 | 97 | //If there is no event objecdt by now then get out. |
98 | - if ( ! $this->_event instanceof EE_Event ) |
|
98 | + if ( ! $this->_event instanceof EE_Event) |
|
99 | 99 | return ''; |
100 | 100 | |
101 | - switch ( $shortcode ) { |
|
101 | + switch ($shortcode) { |
|
102 | 102 | |
103 | 103 | case '[EVENT_ID]' : |
104 | 104 | return $this->_event->ID(); |
@@ -131,41 +131,41 @@ discard block |
||
131 | 131 | |
132 | 132 | case '[VIRTUAL_URL]' : |
133 | 133 | $venue = $this->_event->get_first_related('Venue'); |
134 | - if ( empty( $venue ) ) |
|
134 | + if (empty($venue)) |
|
135 | 135 | return ''; |
136 | 136 | return $venue->get('VNU_virtual_url'); |
137 | 137 | |
138 | 138 | case '[VIRTUAL_PHONE]' : |
139 | 139 | $venue = $this->_event->get_first_related('Venue'); |
140 | - if ( empty( $venue ) ) |
|
140 | + if (empty($venue)) |
|
141 | 141 | return ''; |
142 | 142 | return $venue->get('VNU_virtual_phone'); |
143 | 143 | break; |
144 | 144 | |
145 | 145 | case '[EVENT_IMAGE]' : |
146 | - $image = $this->_event->feature_image_url(array(600,300) ); |
|
146 | + $image = $this->_event->feature_image_url(array(600, 300)); |
|
147 | 147 | // @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned. |
148 | - return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : ''; |
|
148 | + return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : ''; |
|
149 | 149 | break; |
150 | 150 | |
151 | 151 | case '[EVENT_FACEBOOK_URL]' : |
152 | - $facebook_url = $this->_event->get_post_meta('event_facebook', true ); |
|
153 | - return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url; |
|
152 | + $facebook_url = $this->_event->get_post_meta('event_facebook', true); |
|
153 | + return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url; |
|
154 | 154 | break; |
155 | 155 | |
156 | 156 | case '[EVENT_TWITTER_URL]' : |
157 | 157 | $twitter_url = $this->_event->get_post_meta('event_twitter', true); |
158 | - return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url; |
|
158 | + return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url; |
|
159 | 159 | break; |
160 | 160 | |
161 | 161 | case '[EVENT_AUTHOR_EMAIL]' : |
162 | 162 | $author_id = $this->_event->get('EVT_wp_user'); |
163 | - $user_data = get_userdata( (int) $author_id ); |
|
163 | + $user_data = get_userdata((int) $author_id); |
|
164 | 164 | return $user_data->user_email; |
165 | 165 | break; |
166 | 166 | |
167 | 167 | case '[EVENT_TOTAL_SPOTS_TAKEN]' : |
168 | - return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true ); |
|
168 | + return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true); |
|
169 | 169 | break; |
170 | 170 | |
171 | 171 | case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' : |
@@ -175,49 +175,49 @@ discard block |
||
175 | 175 | 'page' => 'espresso_registrations', |
176 | 176 | 'action' => 'default' |
177 | 177 | ), |
178 | - admin_url( 'admin.php' ), |
|
178 | + admin_url('admin.php'), |
|
179 | 179 | true |
180 | 180 | ); |
181 | 181 | break; |
182 | 182 | } |
183 | 183 | |
184 | - if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) { |
|
185 | - $shortcode = str_replace( '[EVENT_META_*', '', $shortcode ); |
|
186 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
184 | + if (strpos($shortcode, '[EVENT_META_*') !== false) { |
|
185 | + $shortcode = str_replace('[EVENT_META_*', '', $shortcode); |
|
186 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
187 | 187 | |
188 | 188 | //pull the meta value from the event post |
189 | - $event_meta = $this->_event->get_post_meta( $shortcode, true ); |
|
189 | + $event_meta = $this->_event->get_post_meta($shortcode, true); |
|
190 | 190 | |
191 | - return ! empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : ''; |
|
191 | + return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : ''; |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | - if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) { |
|
196 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
197 | - $method = empty( $attrs['method'] ) ? 'current' : $attrs['method']; |
|
195 | + if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) { |
|
196 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
197 | + $method = empty($attrs['method']) ? 'current' : $attrs['method']; |
|
198 | 198 | $method = $method === 'current'; |
199 | 199 | $available = $this->_event->total_available_spaces($method); |
200 | 200 | return $available === EE_INF ? '∞' : $available; |
201 | 201 | } |
202 | 202 | |
203 | - if ( strpos( $shortcode, '[EVENT_IMAGE_*' ) !== false ) { |
|
204 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
205 | - $width = empty( $attrs['width'] ) ? '' : ' width="' . $attrs['width'] . '"'; |
|
206 | - $height = empty( $attrs['height'] ) ? '' : ' height="'. $attrs['height'] .'"'; |
|
203 | + if (strpos($shortcode, '[EVENT_IMAGE_*') !== false) { |
|
204 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
205 | + $width = empty($attrs['width']) ? '' : ' width="'.$attrs['width'].'"'; |
|
206 | + $height = empty($attrs['height']) ? '' : ' height="'.$attrs['height'].'"'; |
|
207 | 207 | |
208 | 208 | //Size may be set to a string such as 'tumbnail' or "width, height" eg - '200,200' |
209 | - if ( ! empty( $attrs['size'] ) ) { |
|
210 | - $size = explode( ',', $attrs['size'] ); |
|
211 | - if ( count($size) === 1 ) { |
|
209 | + if ( ! empty($attrs['size'])) { |
|
210 | + $size = explode(',', $attrs['size']); |
|
211 | + if (count($size) === 1) { |
|
212 | 212 | $size = $size[0]; |
213 | 213 | } |
214 | 214 | } else { |
215 | 215 | $size = 'thumbnail'; |
216 | 216 | } |
217 | 217 | |
218 | - $image = $this->_event->feature_image_url( $size ); |
|
218 | + $image = $this->_event->feature_image_url($size); |
|
219 | 219 | |
220 | - return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '"' . $width . $height . '/>' : ''; |
|
220 | + return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'"'.$width.$height.'/>' : ''; |
|
221 | 221 | break; |
222 | 222 | } |
223 | 223 | |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @param boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event. Otherwise we just return the url of the event. |
232 | 232 | * @return string |
233 | 233 | */ |
234 | - private function _get_event_link( $event, $full_link = TRUE ) { |
|
234 | + private function _get_event_link($event, $full_link = TRUE) { |
|
235 | 235 | $url = get_permalink($event->ID()); |
236 | 236 | |
237 | - return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url; |
|
237 | + return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | namespace EventEspresso\core\services\commands; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | * @param \EE_Line_Item $parent_line_item |
71 | 71 | * @return mixed |
72 | 72 | */ |
73 | - public function display_line_item( EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null ) { |
|
73 | + public function display_line_item(EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null) { |
|
74 | 74 | |
75 | 75 | $html = ''; |
76 | 76 | // set some default options and merge with incoming |
77 | 77 | $default_options = array( |
78 | - 'show_desc' => true, // true false |
|
78 | + 'show_desc' => true, // true false |
|
79 | 79 | 'odd' => false |
80 | 80 | ); |
81 | - $options = array_merge( $default_options, (array)$options ); |
|
81 | + $options = array_merge($default_options, (array) $options); |
|
82 | 82 | |
83 | - switch( $line_item->type() ) { |
|
83 | + switch ($line_item->type()) { |
|
84 | 84 | |
85 | 85 | case EEM_Line_Item::type_line_item: |
86 | 86 | $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes; |
87 | - if ( $line_item->OBJ_type() == 'Ticket' ) { |
|
87 | + if ($line_item->OBJ_type() == 'Ticket') { |
|
88 | 88 | // item row |
89 | - $html .= $this->_ticket_row( $line_item, $options ); |
|
89 | + $html .= $this->_ticket_row($line_item, $options); |
|
90 | 90 | } else { |
91 | 91 | // item row |
92 | - $html .= $this->_item_row( $line_item, $options ); |
|
92 | + $html .= $this->_item_row($line_item, $options); |
|
93 | 93 | } |
94 | 94 | if ( |
95 | 95 | apply_filters( |
@@ -98,76 +98,76 @@ discard block |
||
98 | 98 | ) |
99 | 99 | ) { |
100 | 100 | // got any kids? |
101 | - foreach ( $line_item->children() as $child_line_item ) { |
|
102 | - $html .= $this->display_line_item( $child_line_item, $options, $line_item ); |
|
101 | + foreach ($line_item->children() as $child_line_item) { |
|
102 | + $html .= $this->display_line_item($child_line_item, $options, $line_item); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | break; |
106 | 106 | |
107 | 107 | case EEM_Line_Item::type_sub_line_item: |
108 | - $html .= $this->_sub_item_row( $line_item, $options, $parent_line_item ); |
|
108 | + $html .= $this->_sub_item_row($line_item, $options, $parent_line_item); |
|
109 | 109 | break; |
110 | 110 | |
111 | 111 | case EEM_Line_Item::type_sub_total: |
112 | 112 | static $sub_total = 0; |
113 | 113 | $event_sub_total = 0; |
114 | - $text = __( 'Sub-Total', 'event_espresso' ); |
|
115 | - if ( $line_item->OBJ_type() == 'Event' ) { |
|
116 | - $options[ 'event_id' ] = $event_id = $line_item->OBJ_ID(); |
|
117 | - if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
118 | - $event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] ); |
|
119 | - if ( $event instanceof EE_Event ) { |
|
120 | - if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) { |
|
114 | + $text = __('Sub-Total', 'event_espresso'); |
|
115 | + if ($line_item->OBJ_type() == 'Event') { |
|
116 | + $options['event_id'] = $event_id = $line_item->OBJ_ID(); |
|
117 | + if ( ! isset($this->_events[$options['event_id']])) { |
|
118 | + $event = EEM_Event::instance()->get_one_by_ID($options['event_id']); |
|
119 | + if ($event instanceof EE_Event) { |
|
120 | + if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) { |
|
121 | 121 | return ''; |
122 | 122 | } |
123 | 123 | } |
124 | - $this->_events[ $options[ 'event_id' ] ] = 0; |
|
125 | - $html .= $this->_event_row( $line_item ); |
|
126 | - $text = __( 'Event Sub-Total', 'event_espresso' ); |
|
124 | + $this->_events[$options['event_id']] = 0; |
|
125 | + $html .= $this->_event_row($line_item); |
|
126 | + $text = __('Event Sub-Total', 'event_espresso'); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | $child_line_items = $line_item->children(); |
130 | 130 | // loop thru children |
131 | - foreach( $child_line_items as $child_line_item ) { |
|
131 | + foreach ($child_line_items as $child_line_item) { |
|
132 | 132 | // recursively feed children back into this method |
133 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
133 | + $html .= $this->display_line_item($child_line_item, $options); |
|
134 | 134 | } |
135 | - $event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0; |
|
135 | + $event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0; |
|
136 | 136 | $sub_total += $event_sub_total; |
137 | 137 | if ( |
138 | 138 | ( |
139 | 139 | // event subtotals |
140 | 140 | $line_item->code() != 'pre-tax-subtotal' && |
141 | - count( $child_line_items ) > 1 |
|
141 | + count($child_line_items) > 1 |
|
142 | 142 | ) |
143 | 143 | || |
144 | 144 | ( |
145 | 145 | // pre-tax subtotals |
146 | 146 | $line_item->code() == 'pre-tax-subtotal' && |
147 | - count( $this->_events ) > 1 |
|
147 | + count($this->_events) > 1 |
|
148 | 148 | ) |
149 | 149 | ) { |
150 | 150 | $options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total; |
151 | - $html .= $this->_sub_total_row( $line_item, $text, $options ); |
|
151 | + $html .= $this->_sub_total_row($line_item, $text, $options); |
|
152 | 152 | } |
153 | 153 | break; |
154 | 154 | |
155 | 155 | case EEM_Line_Item::type_tax: |
156 | - if ( $this->_show_taxes ) { |
|
157 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
156 | + if ($this->_show_taxes) { |
|
157 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
158 | 158 | } |
159 | 159 | break; |
160 | 160 | |
161 | 161 | case EEM_Line_Item::type_tax_sub_total: |
162 | - if ( $this->_show_taxes ) { |
|
162 | + if ($this->_show_taxes) { |
|
163 | 163 | $child_line_items = $line_item->children(); |
164 | 164 | // loop thru children |
165 | - foreach( $child_line_items as $child_line_item ) { |
|
165 | + foreach ($child_line_items as $child_line_item) { |
|
166 | 166 | // recursively feed children back into this method |
167 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
167 | + $html .= $this->display_line_item($child_line_item, $options); |
|
168 | 168 | } |
169 | - if ( count( $child_line_items ) > 1 ) { |
|
170 | - $this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) ); |
|
169 | + if (count($child_line_items) > 1) { |
|
170 | + $this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso')); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | break; |
@@ -176,25 +176,25 @@ discard block |
||
176 | 176 | // get all child line items |
177 | 177 | $children = $line_item->children(); |
178 | 178 | // loop thru all non-tax child line items |
179 | - foreach( $children as $child_line_item ) { |
|
180 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
179 | + foreach ($children as $child_line_item) { |
|
180 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
181 | 181 | // recursively feed children back into this method |
182 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
182 | + $html .= $this->display_line_item($child_line_item, $options); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | 186 | // now loop thru tax child line items |
187 | - foreach( $children as $child_line_item ) { |
|
188 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
187 | + foreach ($children as $child_line_item) { |
|
188 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
189 | 189 | // recursively feed children back into this method |
190 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
190 | + $html .= $this->display_line_item($child_line_item, $options); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | $html .= $this->_taxes_html; |
194 | - $html .= $this->_total_row( $line_item, __('Total', 'event_espresso') ); |
|
194 | + $html .= $this->_total_row($line_item, __('Total', 'event_espresso')); |
|
195 | 195 | |
196 | 196 | |
197 | - $html .= $this->_payments_and_amount_owing_rows( $line_item, $options ); |
|
197 | + $html .= $this->_payments_and_amount_owing_rows($line_item, $options); |
|
198 | 198 | break; |
199 | 199 | |
200 | 200 | } |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | * @param EE_Line_Item $line_item |
210 | 210 | * @return mixed |
211 | 211 | */ |
212 | - private function _event_row( EE_Line_Item $line_item ) { |
|
212 | + private function _event_row(EE_Line_Item $line_item) { |
|
213 | 213 | // start of row |
214 | - $html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' ); |
|
214 | + $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd'); |
|
215 | 215 | // event name td |
216 | - $html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' ); |
|
216 | + $html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"'); |
|
217 | 217 | // end of row |
218 | 218 | $html .= EEH_HTML::trx(); |
219 | 219 | return $html; |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | * @param array $options |
229 | 229 | * @return mixed |
230 | 230 | */ |
231 | - private function _ticket_row( EE_Line_Item $line_item, $options = array() ) { |
|
231 | + private function _ticket_row(EE_Line_Item $line_item, $options = array()) { |
|
232 | 232 | // start of row |
233 | 233 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
234 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
234 | + $html = EEH_HTML::tr('', '', $row_class); |
|
235 | 235 | // name && desc |
236 | 236 | $name_and_desc = apply_filters( |
237 | 237 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
@@ -240,23 +240,23 @@ discard block |
||
240 | 240 | ); |
241 | 241 | $name_and_desc .= apply_filters( |
242 | 242 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
243 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
243 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
244 | 244 | $line_item, |
245 | 245 | $options |
246 | 246 | ); |
247 | 247 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
248 | 248 | // name td |
249 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
249 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
250 | 250 | // price td |
251 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
251 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
252 | 252 | // quantity td |
253 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
253 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
254 | 254 | $this->_total_items += $line_item->quantity(); |
255 | 255 | // determine total for line item |
256 | 256 | $total = $line_item->total(); |
257 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
257 | + $this->_events[$options['event_id']] += $total; |
|
258 | 258 | // total td |
259 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
259 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
260 | 260 | // end of row |
261 | 261 | $html .= EEH_HTML::trx(); |
262 | 262 | return $html; |
@@ -271,41 +271,41 @@ discard block |
||
271 | 271 | * @param array $options |
272 | 272 | * @return mixed |
273 | 273 | */ |
274 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
274 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
275 | 275 | // start of row |
276 | 276 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
277 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
278 | - $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : ''; |
|
277 | + $html = EEH_HTML::tr('', '', $row_class); |
|
278 | + $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().': ' : ''; |
|
279 | 279 | // name && desc |
280 | 280 | $name_and_desc = apply_filters( |
281 | 281 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
282 | - $obj_name . $line_item->name(), |
|
282 | + $obj_name.$line_item->name(), |
|
283 | 283 | $line_item |
284 | 284 | ); |
285 | 285 | $name_and_desc .= apply_filters( |
286 | 286 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
287 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
287 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
288 | 288 | $line_item, |
289 | 289 | $options |
290 | 290 | ); |
291 | 291 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
292 | 292 | // name td |
293 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
293 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
294 | 294 | // price td |
295 | - if ( $line_item->is_percent() ) { |
|
296 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' ); |
|
295 | + if ($line_item->is_percent()) { |
|
296 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght'); |
|
297 | 297 | } else { |
298 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
298 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
299 | 299 | } |
300 | 300 | // quantity td |
301 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
301 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
302 | 302 | //$total = $line_item->total() * $line_item->quantity(); |
303 | 303 | $total = $line_item->total(); |
304 | - if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
305 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
304 | + if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) { |
|
305 | + $this->_events[$options['event_id']] += $total; |
|
306 | 306 | } |
307 | 307 | // total td |
308 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
308 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
309 | 309 | // end of row |
310 | 310 | $html .= EEH_HTML::trx(); |
311 | 311 | return $html; |
@@ -321,25 +321,25 @@ discard block |
||
321 | 321 | * @param \EE_Line_Item $parent_line_item |
322 | 322 | * @return mixed |
323 | 323 | */ |
324 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null ) { |
|
324 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null) { |
|
325 | 325 | // start of row |
326 | - $html = EEH_HTML::tr( '', '', 'item sub-item-row' ); |
|
326 | + $html = EEH_HTML::tr('', '', 'item sub-item-row'); |
|
327 | 327 | // name && desc |
328 | - $name_and_desc = EEH_HTML::span('', '', 'sub-item-row-bullet dashicons dashicons-arrow-right' ) . $line_item->name(); |
|
329 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
328 | + $name_and_desc = EEH_HTML::span('', '', 'sub-item-row-bullet dashicons dashicons-arrow-right').$line_item->name(); |
|
329 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
330 | 330 | // name td |
331 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
331 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
332 | 332 | // discount/surcharge td |
333 | - if ( $line_item->is_percent() ) { |
|
333 | + if ($line_item->is_percent()) { |
|
334 | 334 | $html .= EEH_HTML::td( |
335 | 335 | EEH_Template::format_currency( |
336 | 336 | $line_item->total() / $parent_line_item->quantity(), |
337 | 337 | false, false |
338 | 338 | ), |
339 | - '', 'item_c jst-rght' |
|
339 | + '', 'item_c jst-rght' |
|
340 | 340 | ); |
341 | 341 | } else { |
342 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
342 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
343 | 343 | } |
344 | 344 | // no quantity td |
345 | 345 | $html .= EEH_HTML::td(); |
@@ -359,21 +359,21 @@ discard block |
||
359 | 359 | * @param array $options |
360 | 360 | * @return mixed |
361 | 361 | */ |
362 | - private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
362 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
363 | 363 | // start of row |
364 | - $html = EEH_HTML::tr( '', 'item sub-item tax-total' ); |
|
364 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
365 | 365 | // name && desc |
366 | 366 | $name_and_desc = $line_item->name(); |
367 | - $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>'; |
|
368 | - $name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : ''; |
|
367 | + $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>'; |
|
368 | + $name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : ''; |
|
369 | 369 | // name td |
370 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
370 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
371 | 371 | // percent td |
372 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', ' jst-rght', '' ); |
|
372 | + $html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', ''); |
|
373 | 373 | // empty td (price) |
374 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
374 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
375 | 375 | // total td |
376 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
376 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
377 | 377 | // end of row |
378 | 378 | $html .= EEH_HTML::trx(); |
379 | 379 | return $html; |
@@ -388,17 +388,17 @@ discard block |
||
388 | 388 | * @param string $text |
389 | 389 | * @return mixed |
390 | 390 | */ |
391 | - private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) { |
|
391 | + private function _total_tax_row(EE_Line_Item $line_item, $text = '') { |
|
392 | 392 | $html = ''; |
393 | - if ( $line_item->total() ) { |
|
393 | + if ($line_item->total()) { |
|
394 | 394 | // start of row |
395 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
395 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
396 | 396 | // total td |
397 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' ); |
|
397 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"'); |
|
398 | 398 | // empty td (price) |
399 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
399 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
400 | 400 | // total td |
401 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
401 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
402 | 402 | // end of row |
403 | 403 | $html .= EEH_HTML::trx(); |
404 | 404 | } |
@@ -415,15 +415,15 @@ discard block |
||
415 | 415 | * @param array $options |
416 | 416 | * @return mixed |
417 | 417 | */ |
418 | - private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
418 | + private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
419 | 419 | $html = ''; |
420 | - if ( $line_item->total() ) { |
|
420 | + if ($line_item->total()) { |
|
421 | 421 | // start of row |
422 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
422 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
423 | 423 | // total td |
424 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
424 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
425 | 425 | // total td |
426 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' ); |
|
426 | + $html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght'); |
|
427 | 427 | // end of row |
428 | 428 | $html .= EEH_HTML::trx(); |
429 | 429 | } |
@@ -440,13 +440,13 @@ discard block |
||
440 | 440 | * @param string $text |
441 | 441 | * @return mixed |
442 | 442 | */ |
443 | - private function _total_row( EE_Line_Item $line_item, $text = '' ) { |
|
443 | + private function _total_row(EE_Line_Item $line_item, $text = '') { |
|
444 | 444 | // start of row |
445 | - $html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' ); |
|
445 | + $html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd'); |
|
446 | 446 | // total td |
447 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
447 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
448 | 448 | // total td |
449 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
449 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
450 | 450 | // end of row |
451 | 451 | $html .= EEH_HTML::trx(); |
452 | 452 | return $html; |
@@ -461,30 +461,30 @@ discard block |
||
461 | 461 | * @param array $options |
462 | 462 | * @return mixed |
463 | 463 | */ |
464 | - private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) { |
|
464 | + private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) { |
|
465 | 465 | $html = ''; |
466 | 466 | $owing = $line_item->total(); |
467 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() ); |
|
468 | - if ( $transaction instanceof EE_Transaction ) { |
|
467 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID()); |
|
468 | + if ($transaction instanceof EE_Transaction) { |
|
469 | 469 | $registration_payments = array(); |
470 | - $registrations = ! empty( $options['registrations'] ) |
|
471 | - ? $options[ 'registrations' ] |
|
470 | + $registrations = ! empty($options['registrations']) |
|
471 | + ? $options['registrations'] |
|
472 | 472 | : $transaction->registrations(); |
473 | - foreach ( $registrations as $registration ) { |
|
474 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
473 | + foreach ($registrations as $registration) { |
|
474 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
475 | 475 | $registration_payments = $registration_payments + $registration->registration_payments(); |
476 | 476 | } |
477 | 477 | } |
478 | - if ( ! empty( $registration_payments )) { |
|
479 | - foreach ( $registration_payments as $registration_payment ) { |
|
480 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
478 | + if ( ! empty($registration_payments)) { |
|
479 | + foreach ($registration_payments as $registration_payment) { |
|
480 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
481 | 481 | $owing = $owing - $registration_payment->amount(); |
482 | 482 | $payment = $registration_payment->payment(); |
483 | - if ( $payment instanceof EE_Payment ) { |
|
483 | + if ($payment instanceof EE_Payment) { |
|
484 | 484 | $payment_desc = sprintf( |
485 | - __( 'Payment%1$s Received: %2$s', 'event_espresso' ), |
|
485 | + __('Payment%1$s Received: %2$s', 'event_espresso'), |
|
486 | 486 | $payment->txn_id_chq_nmbr() != '' |
487 | - ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' |
|
487 | + ? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> ' |
|
488 | 488 | : '', |
489 | 489 | $payment->timestamp() |
490 | 490 | ); |
@@ -492,12 +492,12 @@ discard block |
||
492 | 492 | $payment_desc = ''; |
493 | 493 | } |
494 | 494 | // start of row |
495 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
495 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
496 | 496 | // payment desc |
497 | - $html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' ); |
|
497 | + $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"'); |
|
498 | 498 | // total td |
499 | 499 | $html .= EEH_HTML::td( |
500 | - EEH_Template::format_currency( $registration_payment->amount(), false, false ), |
|
500 | + EEH_Template::format_currency($registration_payment->amount(), false, false), |
|
501 | 501 | '', |
502 | 502 | 'total jst-rght' |
503 | 503 | ); |
@@ -505,17 +505,17 @@ discard block |
||
505 | 505 | $html .= EEH_HTML::trx(); |
506 | 506 | } |
507 | 507 | } |
508 | - if ( $line_item->total() ) { |
|
508 | + if ($line_item->total()) { |
|
509 | 509 | // start of row |
510 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
510 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
511 | 511 | // total td |
512 | 512 | $html .= EEH_HTML::td( |
513 | 513 | __('Amount Owing', 'event_espresso'), |
514 | - '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
514 | + '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
515 | 515 | ); |
516 | 516 | // total td |
517 | 517 | $html .= EEH_HTML::td( |
518 | - EEH_Template::format_currency( $owing, false, false ), '', 'total jst-rght' |
|
518 | + EEH_Template::format_currency($owing, false, false), '', 'total jst-rght' |
|
519 | 519 | ); |
520 | 520 | // end of row |
521 | 521 | $html .= EEH_HTML::trx(); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param string $name |
462 | 462 | * @param string $config_class |
463 | 463 | * @param EE_Config_Base $config_obj |
464 | - * @param array $tests_to_run |
|
464 | + * @param integer[] $tests_to_run |
|
465 | 465 | * @param bool $display_errors |
466 | 466 | * @return bool TRUE on success, FALSE on fail |
467 | 467 | */ |
@@ -1759,7 +1759,7 @@ discard block |
||
1759 | 1759 | |
1760 | 1760 | |
1761 | 1761 | /** |
1762 | - * @return array |
|
1762 | + * @return integer[] |
|
1763 | 1763 | */ |
1764 | 1764 | public function get_critical_pages_array() { |
1765 | 1765 | return array( |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | |
1774 | 1774 | |
1775 | 1775 | /** |
1776 | - * @return array |
|
1776 | + * @return string[] |
|
1777 | 1777 | */ |
1778 | 1778 | public function get_critical_pages_shortcodes_array() { |
1779 | 1779 | return array( |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | * according to max_input_vars |
2867 | 2867 | * |
2868 | 2868 | * @param int $input_count the count of input vars. |
2869 | - * @return array { |
|
2869 | + * @return string { |
|
2870 | 2870 | * An array that represents whether available space and if no available space the error |
2871 | 2871 | * message. |
2872 | 2872 | * @type bool $has_space whether more inputs can be added. |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @access private |
170 | 170 | */ |
171 | 171 | private function __construct() { |
172 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
172 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
173 | 173 | // setup empty config classes |
174 | 174 | $this->_initialize_config(); |
175 | 175 | // load existing EE site settings |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | // register shortcodes and modules |
180 | 180 | add_action( |
181 | 181 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
182 | - array( $this, 'register_shortcodes_and_modules' ), |
|
182 | + array($this, 'register_shortcodes_and_modules'), |
|
183 | 183 | 999 |
184 | 184 | ); |
185 | 185 | // initialize shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
186 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
187 | 187 | // register widgets |
188 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
188 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
189 | 189 | // shutdown |
190 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
190 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
191 | 191 | // construct__end hook |
192 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
192 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
193 | 193 | // hardcoded hack |
194 | 194 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
195 | 195 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return string current theme set. |
203 | 203 | */ |
204 | 204 | public static function get_current_theme() { |
205 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
205 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
206 | 206 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
207 | 207 | } |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | private function _initialize_config() { |
218 | 218 | EE_Config::trim_log(); |
219 | 219 | //set defaults |
220 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
220 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
221 | 221 | $this->addons = new stdClass(); |
222 | 222 | // set _module_route_map |
223 | 223 | EE_Config::$_module_route_map = array(); |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | */ |
238 | 238 | private function _load_core_config() { |
239 | 239 | // load_core_config__start hook |
240 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
240 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
241 | 241 | $espresso_config = $this->get_espresso_config(); |
242 | - foreach ( $espresso_config as $config => $settings ) { |
|
242 | + foreach ($espresso_config as $config => $settings) { |
|
243 | 243 | // load_core_config__start hook |
244 | 244 | $settings = apply_filters( |
245 | 245 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -247,22 +247,22 @@ discard block |
||
247 | 247 | $config, |
248 | 248 | $this |
249 | 249 | ); |
250 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
251 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
250 | + if (is_object($settings) && property_exists($this, $config)) { |
|
251 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
252 | 252 | //call configs populate method to ensure any defaults are set for empty values. |
253 | - if ( method_exists( $settings, 'populate' ) ) { |
|
253 | + if (method_exists($settings, 'populate')) { |
|
254 | 254 | $this->{$config}->populate(); |
255 | 255 | } |
256 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
256 | + if (method_exists($settings, 'do_hooks')) { |
|
257 | 257 | $this->{$config}->do_hooks(); |
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
261 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
262 | 262 | $this->update_espresso_config(); |
263 | 263 | } |
264 | 264 | // load_core_config__end hook |
265 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
265 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -277,23 +277,23 @@ discard block |
||
277 | 277 | $this->core = $this->core instanceof EE_Core_Config |
278 | 278 | ? $this->core |
279 | 279 | : new EE_Core_Config(); |
280 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
280 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
281 | 281 | $this->organization = $this->organization instanceof EE_Organization_Config |
282 | 282 | ? $this->organization |
283 | 283 | : new EE_Organization_Config(); |
284 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
284 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
285 | 285 | $this->currency = $this->currency instanceof EE_Currency_Config |
286 | 286 | ? $this->currency |
287 | 287 | : new EE_Currency_Config(); |
288 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
288 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
289 | 289 | $this->registration = $this->registration instanceof EE_Registration_Config |
290 | 290 | ? $this->registration |
291 | 291 | : new EE_Registration_Config(); |
292 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
292 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
293 | 293 | $this->admin = $this->admin instanceof EE_Admin_Config |
294 | 294 | ? $this->admin |
295 | 295 | : new EE_Admin_Config(); |
296 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
296 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
297 | 297 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
298 | 298 | ? $this->template_settings |
299 | 299 | : new EE_Template_Config(); |
@@ -304,15 +304,15 @@ discard block |
||
304 | 304 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
305 | 305 | ? $this->map_settings |
306 | 306 | : new EE_Map_Config(); |
307 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
307 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
308 | 308 | $this->environment = $this->environment instanceof EE_Environment_Config |
309 | 309 | ? $this->environment |
310 | 310 | : new EE_Environment_Config(); |
311 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
311 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
312 | 312 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
313 | 313 | ? $this->gateway |
314 | 314 | : new EE_Gateway_Config(); |
315 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
315 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | // grab espresso configuration |
328 | 328 | return apply_filters( |
329 | 329 | 'FHEE__EE_Config__get_espresso_config__CFG', |
330 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
330 | + get_option(EE_Config::OPTION_NAME, array()) |
|
331 | 331 | ); |
332 | 332 | } |
333 | 333 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * @param $old_value |
342 | 342 | * @param $value |
343 | 343 | */ |
344 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
344 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
345 | 345 | // make sure we're checking the ee config |
346 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
346 | + if ($option === EE_Config::OPTION_NAME) { |
|
347 | 347 | // run a loose comparison of the old value against the new value for type and properties, |
348 | 348 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
349 | - if ( $value != $old_value ) { |
|
349 | + if ($value != $old_value) { |
|
350 | 350 | // if they are NOT the same, then remove the hook, |
351 | 351 | // which means the subsequent update results will be based solely on the update query results |
352 | 352 | // the reason we do this is because, as stated above, |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | // the string it sees in the db looks the same as the new one it has been passed!!! |
362 | 362 | // This results in the query returning an "affected rows" value of ZERO, |
363 | 363 | // which gets returned immediately by WP update_option and looks like an error. |
364 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
364 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | } |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | */ |
376 | 376 | protected function _reset_espresso_addon_config() { |
377 | 377 | $this->_addon_option_names = array(); |
378 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
379 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
380 | - $config_class = get_class( $addon_config_obj ); |
|
381 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
382 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
378 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
379 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
380 | + $config_class = get_class($addon_config_obj); |
|
381 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
382 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
383 | 383 | } |
384 | 384 | $this->addons->{$addon_name} = null; |
385 | 385 | } |
@@ -395,22 +395,22 @@ discard block |
||
395 | 395 | * @param bool $add_error |
396 | 396 | * @return bool |
397 | 397 | */ |
398 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
398 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
399 | 399 | // don't allow config updates during WP heartbeats |
400 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
400 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
401 | 401 | return false; |
402 | 402 | } |
403 | 403 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
404 | 404 | //$clone = clone( self::$_instance ); |
405 | 405 | //self::$_instance = NULL; |
406 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
406 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
407 | 407 | $this->_reset_espresso_addon_config(); |
408 | 408 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
409 | 409 | // but BEFORE the actual update occurs |
410 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
410 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
411 | 411 | // now update "ee_config" |
412 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
413 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
412 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
413 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
414 | 414 | // if not saved... check if the hook we just added still exists; |
415 | 415 | // if it does, it means one of two things: |
416 | 416 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -421,17 +421,17 @@ discard block |
||
421 | 421 | // but just means no update occurred, so don't display an error to the user. |
422 | 422 | // BUT... if update_option returns FALSE, AND the hook is missing, |
423 | 423 | // then it means that something truly went wrong |
424 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
424 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
425 | 425 | // remove our action since we don't want it in the system anymore |
426 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
427 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
426 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
427 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
428 | 428 | //self::$_instance = $clone; |
429 | 429 | //unset( $clone ); |
430 | 430 | // if config remains the same or was updated successfully |
431 | - if ( $saved ) { |
|
432 | - if ( $add_success ) { |
|
431 | + if ($saved) { |
|
432 | + if ($add_success) { |
|
433 | 433 | EE_Error::add_success( |
434 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
434 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
435 | 435 | __FILE__, |
436 | 436 | __FUNCTION__, |
437 | 437 | __LINE__ |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | } |
440 | 440 | return true; |
441 | 441 | } else { |
442 | - if ( $add_error ) { |
|
442 | + if ($add_error) { |
|
443 | 443 | EE_Error::add_error( |
444 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
444 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
445 | 445 | __FILE__, |
446 | 446 | __FUNCTION__, |
447 | 447 | __LINE__ |
@@ -470,16 +470,16 @@ discard block |
||
470 | 470 | $name = '', |
471 | 471 | $config_class = '', |
472 | 472 | $config_obj = null, |
473 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
473 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
474 | 474 | $display_errors = true |
475 | 475 | ) { |
476 | 476 | try { |
477 | - foreach ( $tests_to_run as $test ) { |
|
478 | - switch ( $test ) { |
|
477 | + foreach ($tests_to_run as $test) { |
|
478 | + switch ($test) { |
|
479 | 479 | // TEST #1 : check that section was set |
480 | 480 | case 1 : |
481 | - if ( empty( $section ) ) { |
|
482 | - if ( $display_errors ) { |
|
481 | + if (empty($section)) { |
|
482 | + if ($display_errors) { |
|
483 | 483 | throw new EE_Error( |
484 | 484 | sprintf( |
485 | 485 | __( |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | break; |
496 | 496 | // TEST #2 : check that settings section exists |
497 | 497 | case 2 : |
498 | - if ( ! isset( $this->{$section} ) ) { |
|
499 | - if ( $display_errors ) { |
|
498 | + if ( ! isset($this->{$section} )) { |
|
499 | + if ($display_errors) { |
|
500 | 500 | throw new EE_Error( |
501 | 501 | sprintf( |
502 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
502 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
503 | 503 | $section |
504 | 504 | ) |
505 | 505 | ); |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | // TEST #3 : check that section is the proper format |
511 | 511 | case 3 : |
512 | 512 | if ( |
513 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
513 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
514 | 514 | ) { |
515 | - if ( $display_errors ) { |
|
515 | + if ($display_errors) { |
|
516 | 516 | throw new EE_Error( |
517 | 517 | sprintf( |
518 | 518 | __( |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | break; |
529 | 529 | // TEST #4 : check that config section name has been set |
530 | 530 | case 4 : |
531 | - if ( empty( $name ) ) { |
|
532 | - if ( $display_errors ) { |
|
531 | + if (empty($name)) { |
|
532 | + if ($display_errors) { |
|
533 | 533 | throw new EE_Error( |
534 | 534 | __( |
535 | 535 | 'No name has been provided for the specific configuration section.', |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | break; |
543 | 543 | // TEST #5 : check that a config class name has been set |
544 | 544 | case 5 : |
545 | - if ( empty( $config_class ) ) { |
|
546 | - if ( $display_errors ) { |
|
545 | + if (empty($config_class)) { |
|
546 | + if ($display_errors) { |
|
547 | 547 | throw new EE_Error( |
548 | 548 | __( |
549 | 549 | 'No class name has been provided for the specific configuration section.', |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | break; |
557 | 557 | // TEST #6 : verify config class is accessible |
558 | 558 | case 6 : |
559 | - if ( ! class_exists( $config_class ) ) { |
|
560 | - if ( $display_errors ) { |
|
559 | + if ( ! class_exists($config_class)) { |
|
560 | + if ($display_errors) { |
|
561 | 561 | throw new EE_Error( |
562 | 562 | sprintf( |
563 | 563 | __( |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | break; |
574 | 574 | // TEST #7 : check that config has even been set |
575 | 575 | case 7 : |
576 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
577 | - if ( $display_errors ) { |
|
576 | + if ( ! isset($this->{$section}->{$name} )) { |
|
577 | + if ($display_errors) { |
|
578 | 578 | throw new EE_Error( |
579 | 579 | sprintf( |
580 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
580 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
581 | 581 | $section, |
582 | 582 | $name |
583 | 583 | ) |
@@ -586,13 +586,13 @@ discard block |
||
586 | 586 | return false; |
587 | 587 | } else { |
588 | 588 | // and make sure it's not serialized |
589 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
589 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
590 | 590 | } |
591 | 591 | break; |
592 | 592 | // TEST #8 : check that config is the requested type |
593 | 593 | case 8 : |
594 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
595 | - if ( $display_errors ) { |
|
594 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
595 | + if ($display_errors) { |
|
596 | 596 | throw new EE_Error( |
597 | 597 | sprintf( |
598 | 598 | __( |
@@ -610,12 +610,12 @@ discard block |
||
610 | 610 | break; |
611 | 611 | // TEST #9 : verify config object |
612 | 612 | case 9 : |
613 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
614 | - if ( $display_errors ) { |
|
613 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
614 | + if ($display_errors) { |
|
615 | 615 | throw new EE_Error( |
616 | 616 | sprintf( |
617 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
618 | - print_r( $config_obj, true ) |
|
617 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
618 | + print_r($config_obj, true) |
|
619 | 619 | ) |
620 | 620 | ); |
621 | 621 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | break; |
625 | 625 | } |
626 | 626 | } |
627 | - } catch ( EE_Error $e ) { |
|
627 | + } catch (EE_Error $e) { |
|
628 | 628 | $e->get_error(); |
629 | 629 | } |
630 | 630 | // you have successfully run the gauntlet |
@@ -641,8 +641,8 @@ discard block |
||
641 | 641 | * @param string $name |
642 | 642 | * @return string |
643 | 643 | */ |
644 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
645 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
644 | + private function _generate_config_option_name($section = '', $name = '') { |
|
645 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @param string $name |
657 | 657 | * @return string |
658 | 658 | */ |
659 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
660 | - return ! empty( $config_class ) |
|
659 | + private function _set_config_class($config_class = '', $name = '') { |
|
660 | + return ! empty($config_class) |
|
661 | 661 | ? $config_class |
662 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
662 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | |
@@ -674,36 +674,36 @@ discard block |
||
674 | 674 | * @param EE_Config_Base $config_obj |
675 | 675 | * @return EE_Config_Base |
676 | 676 | */ |
677 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
677 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
678 | 678 | // ensure config class is set to something |
679 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
679 | + $config_class = $this->_set_config_class($config_class, $name); |
|
680 | 680 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
681 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
681 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
682 | 682 | return null; |
683 | 683 | } |
684 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
684 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
685 | 685 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
686 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
687 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
686 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
687 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
688 | 688 | $this->update_addon_option_names(); |
689 | 689 | } |
690 | 690 | // verify the incoming config object but suppress errors |
691 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
691 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
692 | 692 | $config_obj = new $config_class(); |
693 | 693 | } |
694 | - if ( get_option( $config_option_name ) ) { |
|
695 | - EE_Config::log( $config_option_name ); |
|
696 | - update_option( $config_option_name, $config_obj ); |
|
694 | + if (get_option($config_option_name)) { |
|
695 | + EE_Config::log($config_option_name); |
|
696 | + update_option($config_option_name, $config_obj); |
|
697 | 697 | $this->{$section}->{$name} = $config_obj; |
698 | 698 | return $this->{$section}->{$name}; |
699 | 699 | } else { |
700 | 700 | // create a wp-option for this config |
701 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
702 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
701 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
702 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
703 | 703 | return $this->{$section}->{$name}; |
704 | 704 | } else { |
705 | 705 | EE_Error::add_error( |
706 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
706 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
707 | 707 | __FILE__, |
708 | 708 | __FUNCTION__, |
709 | 709 | __LINE__ |
@@ -726,46 +726,46 @@ discard block |
||
726 | 726 | * @param bool $throw_errors |
727 | 727 | * @return bool |
728 | 728 | */ |
729 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
729 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
730 | 730 | // don't allow config updates during WP heartbeats |
731 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
731 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
732 | 732 | return false; |
733 | 733 | } |
734 | - $config_obj = maybe_unserialize( $config_obj ); |
|
734 | + $config_obj = maybe_unserialize($config_obj); |
|
735 | 735 | // get class name of the incoming object |
736 | - $config_class = get_class( $config_obj ); |
|
736 | + $config_class = get_class($config_obj); |
|
737 | 737 | // run tests 1-5 and 9 to verify config |
738 | 738 | if ( ! $this->_verify_config_params( |
739 | 739 | $section, |
740 | 740 | $name, |
741 | 741 | $config_class, |
742 | 742 | $config_obj, |
743 | - array( 1, 2, 3, 4, 7, 9 ) |
|
743 | + array(1, 2, 3, 4, 7, 9) |
|
744 | 744 | ) |
745 | 745 | ) { |
746 | 746 | return false; |
747 | 747 | } |
748 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
748 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
749 | 749 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
750 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
750 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
751 | 751 | // save new config to db |
752 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
752 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
753 | 753 | return true; |
754 | 754 | } |
755 | 755 | } else { |
756 | 756 | // first check if the record already exists |
757 | - $existing_config = get_option( $config_option_name ); |
|
758 | - $config_obj = serialize( $config_obj ); |
|
757 | + $existing_config = get_option($config_option_name); |
|
758 | + $config_obj = serialize($config_obj); |
|
759 | 759 | // just return if db record is already up to date (NOT type safe comparison) |
760 | - if ( $existing_config == $config_obj ) { |
|
760 | + if ($existing_config == $config_obj) { |
|
761 | 761 | $this->{$section}->{$name} = $config_obj; |
762 | 762 | return true; |
763 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
764 | - EE_Config::log( $config_option_name ); |
|
763 | + } else if (update_option($config_option_name, $config_obj)) { |
|
764 | + EE_Config::log($config_option_name); |
|
765 | 765 | // update wp-option for this config class |
766 | 766 | $this->{$section}->{$name} = $config_obj; |
767 | 767 | return true; |
768 | - } elseif ( $throw_errors ) { |
|
768 | + } elseif ($throw_errors) { |
|
769 | 769 | EE_Error::add_error( |
770 | 770 | sprintf( |
771 | 771 | __( |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | 'event_espresso' |
774 | 774 | ), |
775 | 775 | $config_class, |
776 | - 'EE_Config->' . $section . '->' . $name |
|
776 | + 'EE_Config->'.$section.'->'.$name |
|
777 | 777 | ), |
778 | 778 | __FILE__, |
779 | 779 | __FUNCTION__, |
@@ -795,34 +795,34 @@ discard block |
||
795 | 795 | * @param string $config_class |
796 | 796 | * @return mixed EE_Config_Base | NULL |
797 | 797 | */ |
798 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
798 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
799 | 799 | // ensure config class is set to something |
800 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
800 | + $config_class = $this->_set_config_class($config_class, $name); |
|
801 | 801 | // run tests 1-4, 6 and 7 to verify that all params have been set |
802 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
802 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
803 | 803 | return null; |
804 | 804 | } |
805 | 805 | // now test if the requested config object exists, but suppress errors |
806 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
806 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
807 | 807 | // config already exists, so pass it back |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // load config option from db if it exists |
811 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
811 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
812 | 812 | // verify the newly retrieved config object, but suppress errors |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
814 | 814 | // config is good, so set it and pass it back |
815 | 815 | $this->{$section}->{$name} = $config_obj; |
816 | 816 | return $this->{$section}->{$name}; |
817 | 817 | } |
818 | 818 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
819 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
819 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
820 | 820 | // verify the newly created config object |
821 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
821 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
822 | 822 | return $this->{$section}->{$name}; |
823 | 823 | } else { |
824 | 824 | EE_Error::add_error( |
825 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
825 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
826 | 826 | __FILE__, |
827 | 827 | __FUNCTION__, |
828 | 828 | __LINE__ |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | * @param string $config_option_name |
841 | 841 | * @return mixed EE_Config_Base | FALSE |
842 | 842 | */ |
843 | - public function get_config_option( $config_option_name = '' ) { |
|
843 | + public function get_config_option($config_option_name = '') { |
|
844 | 844 | // retrieve the wp-option for this config class. |
845 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
846 | - if ( empty( $config_option ) ) { |
|
847 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
845 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
846 | + if (empty($config_option)) { |
|
847 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
848 | 848 | } |
849 | 849 | return $config_option; |
850 | 850 | } |
@@ -856,17 +856,17 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @param string $config_option_name |
858 | 858 | */ |
859 | - public static function log( $config_option_name = '' ) { |
|
860 | - if ( ! empty( $config_option_name ) ) { |
|
861 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
859 | + public static function log($config_option_name = '') { |
|
860 | + if ( ! empty($config_option_name)) { |
|
861 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
862 | 862 | //copy incoming $_REQUEST and sanitize it so we can save it |
863 | 863 | $_request = $_REQUEST; |
864 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
865 | - $config_log[ (string) microtime( true ) ] = array( |
|
864 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
865 | + $config_log[(string) microtime(true)] = array( |
|
866 | 866 | 'config_name' => $config_option_name, |
867 | 867 | 'request' => $_request, |
868 | 868 | ); |
869 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
869 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
878 | 878 | */ |
879 | 879 | public static function trim_log() { |
880 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
881 | - $log_length = count( $config_log ); |
|
882 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
883 | - ksort( $config_log ); |
|
884 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
885 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
881 | + $log_length = count($config_log); |
|
882 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
883 | + ksort($config_log); |
|
884 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
885 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | * @return string |
898 | 898 | */ |
899 | 899 | public static function get_page_for_posts() { |
900 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
901 | - if ( ! $page_for_posts ) { |
|
900 | + $page_for_posts = get_option('page_for_posts'); |
|
901 | + if ( ! $page_for_posts) { |
|
902 | 902 | return 'posts'; |
903 | 903 | } |
904 | 904 | /** @type WPDB $wpdb */ |
905 | 905 | global $wpdb; |
906 | 906 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
907 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
907 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -960,17 +960,17 @@ discard block |
||
960 | 960 | ) |
961 | 961 | ) { |
962 | 962 | // grab list of installed widgets |
963 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
963 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
964 | 964 | // filter list of modules to register |
965 | 965 | $widgets_to_register = apply_filters( |
966 | 966 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
967 | 967 | $widgets_to_register |
968 | 968 | ); |
969 | - if ( ! empty( $widgets_to_register ) ) { |
|
969 | + if ( ! empty($widgets_to_register)) { |
|
970 | 970 | // cycle thru widget folders |
971 | - foreach ( $widgets_to_register as $widget_path ) { |
|
971 | + foreach ($widgets_to_register as $widget_path) { |
|
972 | 972 | // add to list of installed widget modules |
973 | - EE_Config::register_ee_widget( $widget_path ); |
|
973 | + EE_Config::register_ee_widget($widget_path); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | // filter list of installed modules |
@@ -990,57 +990,57 @@ discard block |
||
990 | 990 | * @param string $widget_path - full path up to and including widget folder |
991 | 991 | * @return void |
992 | 992 | */ |
993 | - public static function register_ee_widget( $widget_path = null ) { |
|
994 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
993 | + public static function register_ee_widget($widget_path = null) { |
|
994 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
995 | 995 | $widget_ext = '.widget.php'; |
996 | 996 | // make all separators match |
997 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
997 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
998 | 998 | // does the file path INCLUDE the actual file name as part of the path ? |
999 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
999 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1000 | 1000 | // grab and shortcode file name from directory name and break apart at dots |
1001 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1001 | + $file_name = explode('.', basename($widget_path)); |
|
1002 | 1002 | // take first segment from file name pieces and remove class prefix if it exists |
1003 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1003 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1004 | 1004 | // sanitize shortcode directory name |
1005 | - $widget = sanitize_key( $widget ); |
|
1005 | + $widget = sanitize_key($widget); |
|
1006 | 1006 | // now we need to rebuild the shortcode path |
1007 | - $widget_path = explode( DS, $widget_path ); |
|
1007 | + $widget_path = explode(DS, $widget_path); |
|
1008 | 1008 | // remove last segment |
1009 | - array_pop( $widget_path ); |
|
1009 | + array_pop($widget_path); |
|
1010 | 1010 | // glue it back together |
1011 | - $widget_path = implode( DS, $widget_path ); |
|
1011 | + $widget_path = implode(DS, $widget_path); |
|
1012 | 1012 | } else { |
1013 | 1013 | // grab and sanitize widget directory name |
1014 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1014 | + $widget = sanitize_key(basename($widget_path)); |
|
1015 | 1015 | } |
1016 | 1016 | // create classname from widget directory name |
1017 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1017 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1018 | 1018 | // add class prefix |
1019 | - $widget_class = 'EEW_' . $widget; |
|
1019 | + $widget_class = 'EEW_'.$widget; |
|
1020 | 1020 | // does the widget exist ? |
1021 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1021 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1022 | 1022 | $msg = sprintf( |
1023 | 1023 | __( |
1024 | 1024 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1025 | 1025 | 'event_espresso' |
1026 | 1026 | ), |
1027 | 1027 | $widget_class, |
1028 | - $widget_path . DS . $widget_class . $widget_ext |
|
1028 | + $widget_path.DS.$widget_class.$widget_ext |
|
1029 | 1029 | ); |
1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | 1033 | // load the widget class file |
1034 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1034 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1035 | 1035 | // verify that class exists |
1036 | - if ( ! class_exists( $widget_class ) ) { |
|
1037 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1038 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1036 | + if ( ! class_exists($widget_class)) { |
|
1037 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1038 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1039 | 1039 | return; |
1040 | 1040 | } |
1041 | - register_widget( $widget_class ); |
|
1041 | + register_widget($widget_class); |
|
1042 | 1042 | // add to array of registered widgets |
1043 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1043 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
@@ -1053,17 +1053,17 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | private function _register_shortcodes() { |
1055 | 1055 | // grab list of installed shortcodes |
1056 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1056 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1057 | 1057 | // filter list of modules to register |
1058 | 1058 | $shortcodes_to_register = apply_filters( |
1059 | 1059 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1060 | 1060 | $shortcodes_to_register |
1061 | 1061 | ); |
1062 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1062 | + if ( ! empty($shortcodes_to_register)) { |
|
1063 | 1063 | // cycle thru shortcode folders |
1064 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1064 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1065 | 1065 | // add to list of installed shortcode modules |
1066 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1066 | + EE_Config::register_shortcode($shortcode_path); |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | // filter list of installed modules |
@@ -1082,64 +1082,64 @@ discard block |
||
1082 | 1082 | * @param string $shortcode_path - full path up to and including shortcode folder |
1083 | 1083 | * @return bool |
1084 | 1084 | */ |
1085 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1086 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1085 | + public static function register_shortcode($shortcode_path = null) { |
|
1086 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1087 | 1087 | $shortcode_ext = '.shortcode.php'; |
1088 | 1088 | // make all separators match |
1089 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1089 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1090 | 1090 | // does the file path INCLUDE the actual file name as part of the path ? |
1091 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1091 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1092 | 1092 | // grab shortcode file name from directory name and break apart at dots |
1093 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1093 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1094 | 1094 | // take first segment from file name pieces and remove class prefix if it exists |
1095 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1096 | - ? substr( $shortcode_file[0], 4 ) |
|
1095 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1096 | + ? substr($shortcode_file[0], 4) |
|
1097 | 1097 | : $shortcode_file[0]; |
1098 | 1098 | // sanitize shortcode directory name |
1099 | - $shortcode = sanitize_key( $shortcode ); |
|
1099 | + $shortcode = sanitize_key($shortcode); |
|
1100 | 1100 | // now we need to rebuild the shortcode path |
1101 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1101 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1102 | 1102 | // remove last segment |
1103 | - array_pop( $shortcode_path ); |
|
1103 | + array_pop($shortcode_path); |
|
1104 | 1104 | // glue it back together |
1105 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1105 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1106 | 1106 | } else { |
1107 | 1107 | // we need to generate the filename based off of the folder name |
1108 | 1108 | // grab and sanitize shortcode directory name |
1109 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1110 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1109 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1110 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1111 | 1111 | } |
1112 | 1112 | // create classname from shortcode directory or file name |
1113 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1113 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1114 | 1114 | // add class prefix |
1115 | - $shortcode_class = 'EES_' . $shortcode; |
|
1115 | + $shortcode_class = 'EES_'.$shortcode; |
|
1116 | 1116 | // does the shortcode exist ? |
1117 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1117 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1118 | 1118 | $msg = sprintf( |
1119 | 1119 | __( |
1120 | 1120 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1121 | 1121 | 'event_espresso' |
1122 | 1122 | ), |
1123 | 1123 | $shortcode_class, |
1124 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1124 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1125 | 1125 | ); |
1126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1127 | 1127 | return false; |
1128 | 1128 | } |
1129 | 1129 | // load the shortcode class file |
1130 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1130 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1131 | 1131 | // verify that class exists |
1132 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1132 | + if ( ! class_exists($shortcode_class)) { |
|
1133 | 1133 | $msg = sprintf( |
1134 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1134 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1135 | 1135 | $shortcode_class |
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | - $shortcode = strtoupper( $shortcode ); |
|
1140 | + $shortcode = strtoupper($shortcode); |
|
1141 | 1141 | // add to array of registered shortcodes |
1142 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1142 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1143 | 1143 | return true; |
1144 | 1144 | } |
1145 | 1145 | |
@@ -1153,22 +1153,22 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | private function _register_modules() { |
1155 | 1155 | // grab list of installed modules |
1156 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1156 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1157 | 1157 | // filter list of modules to register |
1158 | 1158 | $modules_to_register = apply_filters( |
1159 | 1159 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1160 | 1160 | $modules_to_register |
1161 | 1161 | ); |
1162 | - if ( ! empty( $modules_to_register ) ) { |
|
1162 | + if ( ! empty($modules_to_register)) { |
|
1163 | 1163 | // loop through folders |
1164 | - foreach ( $modules_to_register as $module_path ) { |
|
1164 | + foreach ($modules_to_register as $module_path) { |
|
1165 | 1165 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1166 | 1166 | if ( |
1167 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1168 | - && $module_path !== EE_MODULES . 'gateways' |
|
1167 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1168 | + && $module_path !== EE_MODULES.'gateways' |
|
1169 | 1169 | ) { |
1170 | 1170 | // add to list of installed modules |
1171 | - EE_Config::register_module( $module_path ); |
|
1171 | + EE_Config::register_module($module_path); |
|
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1188,39 +1188,39 @@ discard block |
||
1188 | 1188 | * @param string $module_path - full path up to and including module folder |
1189 | 1189 | * @return bool |
1190 | 1190 | */ |
1191 | - public static function register_module( $module_path = null ) { |
|
1192 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1191 | + public static function register_module($module_path = null) { |
|
1192 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1193 | 1193 | $module_ext = '.module.php'; |
1194 | 1194 | // make all separators match |
1195 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1195 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1196 | 1196 | // does the file path INCLUDE the actual file name as part of the path ? |
1197 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1197 | + if (strpos($module_path, $module_ext) !== false) { |
|
1198 | 1198 | // grab and shortcode file name from directory name and break apart at dots |
1199 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1199 | + $module_file = explode('.', basename($module_path)); |
|
1200 | 1200 | // now we need to rebuild the shortcode path |
1201 | - $module_path = explode( DS, $module_path ); |
|
1201 | + $module_path = explode(DS, $module_path); |
|
1202 | 1202 | // remove last segment |
1203 | - array_pop( $module_path ); |
|
1203 | + array_pop($module_path); |
|
1204 | 1204 | // glue it back together |
1205 | - $module_path = implode( DS, $module_path ) . DS; |
|
1205 | + $module_path = implode(DS, $module_path).DS; |
|
1206 | 1206 | // take first segment from file name pieces and sanitize it |
1207 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1207 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1208 | 1208 | // ensure class prefix is added |
1209 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1209 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1210 | 1210 | } else { |
1211 | 1211 | // we need to generate the filename based off of the folder name |
1212 | 1212 | // grab and sanitize module name |
1213 | - $module = strtolower( basename( $module_path ) ); |
|
1214 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1213 | + $module = strtolower(basename($module_path)); |
|
1214 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1215 | 1215 | // like trailingslashit() |
1216 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1216 | + $module_path = rtrim($module_path, DS).DS; |
|
1217 | 1217 | // create classname from module directory name |
1218 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1218 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1219 | 1219 | // add class prefix |
1220 | - $module_class = 'EED_' . $module; |
|
1220 | + $module_class = 'EED_'.$module; |
|
1221 | 1221 | } |
1222 | 1222 | // does the module exist ? |
1223 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1223 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1224 | 1224 | $msg = sprintf( |
1225 | 1225 | __( |
1226 | 1226 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1228,19 +1228,19 @@ discard block |
||
1228 | 1228 | ), |
1229 | 1229 | $module |
1230 | 1230 | ); |
1231 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1231 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // load the module class file |
1235 | - require_once( $module_path . $module_class . $module_ext ); |
|
1235 | + require_once($module_path.$module_class.$module_ext); |
|
1236 | 1236 | // verify that class exists |
1237 | - if ( ! class_exists( $module_class ) ) { |
|
1238 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1239 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1237 | + if ( ! class_exists($module_class)) { |
|
1238 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1239 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | // add to array of registered modules |
1243 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1243 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1244 | 1244 | do_action( |
1245 | 1245 | 'AHEE__EE_Config__register_module__complete', |
1246 | 1246 | $module_class, |
@@ -1260,26 +1260,26 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | private function _initialize_shortcodes() { |
1262 | 1262 | // cycle thru shortcode folders |
1263 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1263 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1264 | 1264 | // add class prefix |
1265 | - $shortcode_class = 'EES_' . $shortcode; |
|
1265 | + $shortcode_class = 'EES_'.$shortcode; |
|
1266 | 1266 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1267 | 1267 | // which set hooks ? |
1268 | - if ( is_admin() ) { |
|
1268 | + if (is_admin()) { |
|
1269 | 1269 | // fire immediately |
1270 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1270 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1271 | 1271 | } else { |
1272 | 1272 | // delay until other systems are online |
1273 | 1273 | add_action( |
1274 | 1274 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1275 | - array( $shortcode_class, 'set_hooks' ) |
|
1275 | + array($shortcode_class, 'set_hooks') |
|
1276 | 1276 | ); |
1277 | 1277 | // convert classname to UPPERCASE and create WP shortcode. |
1278 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1278 | + $shortcode_tag = strtoupper($shortcode); |
|
1279 | 1279 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1280 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1280 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1281 | 1281 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1282 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1282 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1296,17 +1296,17 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | private function _initialize_modules() { |
1298 | 1298 | // cycle thru shortcode folders |
1299 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1299 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1300 | 1300 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1301 | 1301 | // which set hooks ? |
1302 | - if ( is_admin() ) { |
|
1302 | + if (is_admin()) { |
|
1303 | 1303 | // fire immediately |
1304 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1304 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1305 | 1305 | } else { |
1306 | 1306 | // delay until other systems are online |
1307 | 1307 | add_action( |
1308 | 1308 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1309 | - array( $module_class, 'set_hooks' ) |
|
1309 | + array($module_class, 'set_hooks') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | } |
@@ -1324,29 +1324,29 @@ discard block |
||
1324 | 1324 | * @param string $key - url param key indicating a route is being called |
1325 | 1325 | * @return bool |
1326 | 1326 | */ |
1327 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1328 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1329 | - $module = str_replace( 'EED_', '', $module ); |
|
1330 | - $module_class = 'EED_' . $module; |
|
1331 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1332 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1333 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1328 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1329 | + $module = str_replace('EED_', '', $module); |
|
1330 | + $module_class = 'EED_'.$module; |
|
1331 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1332 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1333 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1334 | 1334 | return false; |
1335 | 1335 | } |
1336 | - if ( empty( $route ) ) { |
|
1337 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1338 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if (empty($route)) { |
|
1337 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1338 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1339 | 1339 | return false; |
1340 | 1340 | } |
1341 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1341 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1342 | 1342 | $msg = sprintf( |
1343 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1343 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1344 | 1344 | $route |
1345 | 1345 | ); |
1346 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1347 | 1347 | return false; |
1348 | 1348 | } |
1349 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1349 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1350 | 1350 | return true; |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1360,11 +1360,11 @@ discard block |
||
1360 | 1360 | * @param string $key - url param key indicating a route is being called |
1361 | 1361 | * @return string |
1362 | 1362 | */ |
1363 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1364 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1365 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1366 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1367 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1363 | + public static function get_route($route = null, $key = 'ee') { |
|
1364 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1365 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1366 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1367 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1368 | 1368 | } |
1369 | 1369 | return null; |
1370 | 1370 | } |
@@ -1394,49 +1394,49 @@ discard block |
||
1394 | 1394 | * @param string $key - url param key indicating a route is being called |
1395 | 1395 | * @return bool |
1396 | 1396 | */ |
1397 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1398 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1399 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1397 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1398 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1399 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1400 | 1400 | $msg = sprintf( |
1401 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1401 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1402 | 1402 | $route |
1403 | 1403 | ); |
1404 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1404 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1405 | 1405 | return false; |
1406 | 1406 | } |
1407 | - if ( empty( $forward ) ) { |
|
1408 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1409 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1407 | + if (empty($forward)) { |
|
1408 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1409 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1410 | 1410 | return false; |
1411 | 1411 | } |
1412 | - if ( is_array( $forward ) ) { |
|
1413 | - if ( ! isset( $forward[1] ) ) { |
|
1412 | + if (is_array($forward)) { |
|
1413 | + if ( ! isset($forward[1])) { |
|
1414 | 1414 | $msg = sprintf( |
1415 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1415 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1416 | 1416 | $route |
1417 | 1417 | ); |
1418 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1419 | 1419 | return false; |
1420 | 1420 | } |
1421 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1421 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1422 | 1422 | $msg = sprintf( |
1423 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1423 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1424 | 1424 | $forward[1], |
1425 | 1425 | $route |
1426 | 1426 | ); |
1427 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1427 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - } else if ( ! function_exists( $forward ) ) { |
|
1430 | + } else if ( ! function_exists($forward)) { |
|
1431 | 1431 | $msg = sprintf( |
1432 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1432 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1433 | 1433 | $forward, |
1434 | 1434 | $route |
1435 | 1435 | ); |
1436 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | 1437 | return false; |
1438 | 1438 | } |
1439 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1439 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1440 | 1440 | return true; |
1441 | 1441 | } |
1442 | 1442 | |
@@ -1452,12 +1452,12 @@ discard block |
||
1452 | 1452 | * @param string $key - url param key indicating a route is being called |
1453 | 1453 | * @return string |
1454 | 1454 | */ |
1455 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1456 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1457 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1455 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1456 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1457 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1458 | 1458 | return apply_filters( |
1459 | 1459 | 'FHEE__EE_Config__get_forward', |
1460 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1460 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1461 | 1461 | $route, |
1462 | 1462 | $status |
1463 | 1463 | ); |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * @param string $key - url param key indicating a route is being called |
1480 | 1480 | * @return bool |
1481 | 1481 | */ |
1482 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1483 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1484 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1482 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1483 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1484 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1485 | 1485 | $msg = sprintf( |
1486 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1486 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1487 | 1487 | $route |
1488 | 1488 | ); |
1489 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1489 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1490 | 1490 | return false; |
1491 | 1491 | } |
1492 | - if ( ! is_readable( $view ) ) { |
|
1492 | + if ( ! is_readable($view)) { |
|
1493 | 1493 | $msg = sprintf( |
1494 | 1494 | __( |
1495 | 1495 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1497,10 +1497,10 @@ discard block |
||
1497 | 1497 | ), |
1498 | 1498 | $view |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1503 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1504 | 1504 | return true; |
1505 | 1505 | } |
1506 | 1506 | |
@@ -1516,12 +1516,12 @@ discard block |
||
1516 | 1516 | * @param string $key - url param key indicating a route is being called |
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1520 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1521 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1519 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1520 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1521 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1522 | 1522 | return apply_filters( |
1523 | 1523 | 'FHEE__EE_Config__get_view', |
1524 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1524 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1525 | 1525 | $route, |
1526 | 1526 | $status |
1527 | 1527 | ); |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | |
1534 | 1534 | public function update_addon_option_names() { |
1535 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1535 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | |
@@ -1560,22 +1560,22 @@ discard block |
||
1560 | 1560 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1561 | 1561 | * @throws \EE_Error |
1562 | 1562 | */ |
1563 | - public function get_pretty( $property ) { |
|
1564 | - if ( ! property_exists( $this, $property ) ) { |
|
1563 | + public function get_pretty($property) { |
|
1564 | + if ( ! property_exists($this, $property)) { |
|
1565 | 1565 | throw new EE_Error( |
1566 | 1566 | sprintf( |
1567 | 1567 | __( |
1568 | 1568 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1569 | 1569 | 'event_espresso' |
1570 | 1570 | ), |
1571 | - get_class( $this ), |
|
1571 | + get_class($this), |
|
1572 | 1572 | $property |
1573 | 1573 | ) |
1574 | 1574 | ); |
1575 | 1575 | } |
1576 | 1576 | //just handling escaping of strings for now. |
1577 | - if ( is_string( $this->{$property} ) ) { |
|
1578 | - return stripslashes( $this->{$property} ); |
|
1577 | + if (is_string($this->{$property} )) { |
|
1578 | + return stripslashes($this->{$property} ); |
|
1579 | 1579 | } |
1580 | 1580 | return $this->{$property}; |
1581 | 1581 | } |
@@ -1584,17 +1584,17 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | public function populate() { |
1586 | 1586 | //grab defaults via a new instance of this class. |
1587 | - $class_name = get_class( $this ); |
|
1587 | + $class_name = get_class($this); |
|
1588 | 1588 | $defaults = new $class_name; |
1589 | 1589 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1590 | 1590 | //default from our $defaults object. |
1591 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1592 | - if ( $this->{$property} === null ) { |
|
1591 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1592 | + if ($this->{$property} === null) { |
|
1593 | 1593 | $this->{$property} = $value; |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | //cleanup |
1597 | - unset( $defaults ); |
|
1597 | + unset($defaults); |
|
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | * @param $a |
1611 | 1611 | * @return bool |
1612 | 1612 | */ |
1613 | - public function __isset( $a ) { |
|
1613 | + public function __isset($a) { |
|
1614 | 1614 | return false; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | * @param $a |
1623 | 1623 | * @return bool |
1624 | 1624 | */ |
1625 | - public function __unset( $a ) { |
|
1625 | + public function __unset($a) { |
|
1626 | 1626 | return false; |
1627 | 1627 | } |
1628 | 1628 | |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | $this->current_blog_id = get_current_blog_id(); |
1733 | 1733 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1734 | 1734 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1735 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1735 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1736 | 1736 | $this->post_shortcodes = array(); |
1737 | 1737 | $this->module_route_map = array(); |
1738 | 1738 | $this->module_forward_map = array(); |
@@ -1748,9 +1748,9 @@ discard block |
||
1748 | 1748 | $this->thank_you_page_url = ''; |
1749 | 1749 | $this->cancel_page_url = ''; |
1750 | 1750 | //cpt slugs |
1751 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1751 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1752 | 1752 | //ueip constant check |
1753 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1753 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1754 | 1754 | $this->ee_ueip_optin = false; |
1755 | 1755 | $this->ee_ueip_has_notified = true; |
1756 | 1756 | } |
@@ -1793,11 +1793,11 @@ discard block |
||
1793 | 1793 | * @return string |
1794 | 1794 | */ |
1795 | 1795 | public function reg_page_url() { |
1796 | - if ( ! $this->reg_page_url ) { |
|
1796 | + if ( ! $this->reg_page_url) { |
|
1797 | 1797 | $this->reg_page_url = add_query_arg( |
1798 | - array( 'uts' => time() ), |
|
1799 | - get_permalink( $this->reg_page_id ) |
|
1800 | - ) . '#checkout'; |
|
1798 | + array('uts' => time()), |
|
1799 | + get_permalink($this->reg_page_id) |
|
1800 | + ).'#checkout'; |
|
1801 | 1801 | } |
1802 | 1802 | return $this->reg_page_url; |
1803 | 1803 | } |
@@ -1812,12 +1812,12 @@ discard block |
||
1812 | 1812 | * @access public |
1813 | 1813 | * @return string |
1814 | 1814 | */ |
1815 | - public function txn_page_url( $query_args = array() ) { |
|
1816 | - if ( ! $this->txn_page_url ) { |
|
1817 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1815 | + public function txn_page_url($query_args = array()) { |
|
1816 | + if ( ! $this->txn_page_url) { |
|
1817 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1818 | 1818 | } |
1819 | - if ( $query_args ) { |
|
1820 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1819 | + if ($query_args) { |
|
1820 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1821 | 1821 | } else { |
1822 | 1822 | return $this->txn_page_url; |
1823 | 1823 | } |
@@ -1833,12 +1833,12 @@ discard block |
||
1833 | 1833 | * @access public |
1834 | 1834 | * @return string |
1835 | 1835 | */ |
1836 | - public function thank_you_page_url( $query_args = array() ) { |
|
1837 | - if ( ! $this->thank_you_page_url ) { |
|
1838 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1836 | + public function thank_you_page_url($query_args = array()) { |
|
1837 | + if ( ! $this->thank_you_page_url) { |
|
1838 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1839 | 1839 | } |
1840 | - if ( $query_args ) { |
|
1841 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1840 | + if ($query_args) { |
|
1841 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1842 | 1842 | } else { |
1843 | 1843 | return $this->thank_you_page_url; |
1844 | 1844 | } |
@@ -1853,8 +1853,8 @@ discard block |
||
1853 | 1853 | * @return string |
1854 | 1854 | */ |
1855 | 1855 | public function cancel_page_url() { |
1856 | - if ( ! $this->cancel_page_url ) { |
|
1857 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1856 | + if ( ! $this->cancel_page_url) { |
|
1857 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1858 | 1858 | } |
1859 | 1859 | return $this->cancel_page_url; |
1860 | 1860 | } |
@@ -1883,22 +1883,22 @@ discard block |
||
1883 | 1883 | */ |
1884 | 1884 | protected function _get_main_ee_ueip_optin() { |
1885 | 1885 | //if this is the main site then we can just bypass our direct query. |
1886 | - if ( is_main_site() ) { |
|
1887 | - return get_option( 'ee_ueip_optin', false ); |
|
1886 | + if (is_main_site()) { |
|
1887 | + return get_option('ee_ueip_optin', false); |
|
1888 | 1888 | } |
1889 | 1889 | |
1890 | 1890 | //is this already cached for this request? If so use it. |
1891 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1891 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1892 | 1892 | return EE_Core_Config::$ee_ueip_option; |
1893 | 1893 | } |
1894 | 1894 | |
1895 | 1895 | global $wpdb; |
1896 | 1896 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1897 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1897 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1898 | 1898 | $option = 'ee_ueip_optin'; |
1899 | 1899 | |
1900 | 1900 | //set correct table for query |
1901 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1901 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1902 | 1902 | |
1903 | 1903 | |
1904 | 1904 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1906,20 +1906,20 @@ discard block |
||
1906 | 1906 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1907 | 1907 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1908 | 1908 | //for the purpose of caching. |
1909 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1910 | - if ( false !== $pre ) { |
|
1909 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1910 | + if (false !== $pre) { |
|
1911 | 1911 | EE_Core_Config::$ee_ueip_option = $pre; |
1912 | 1912 | return EE_Core_Config::$ee_ueip_option; |
1913 | 1913 | } |
1914 | 1914 | |
1915 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1916 | - if ( is_object( $row ) ) { |
|
1915 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1916 | + if (is_object($row)) { |
|
1917 | 1917 | $value = $row->option_value; |
1918 | 1918 | } else { //option does not exist so use default. |
1919 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1919 | + return apply_filters('default_option_'.$option, false, $option); |
|
1920 | 1920 | } |
1921 | 1921 | |
1922 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1922 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | //reset all url properties |
1936 | 1936 | $this->_reset_urls(); |
1937 | 1937 | //return what to save to db |
1938 | - return array_keys( get_object_vars( $this ) ); |
|
1938 | + return array_keys(get_object_vars($this)); |
|
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | } |
@@ -2082,14 +2082,14 @@ discard block |
||
2082 | 2082 | */ |
2083 | 2083 | public function __construct() { |
2084 | 2084 | // set default organization settings |
2085 | - $this->name = get_bloginfo( 'name' ); |
|
2085 | + $this->name = get_bloginfo('name'); |
|
2086 | 2086 | $this->address_1 = '123 Onna Road'; |
2087 | 2087 | $this->address_2 = 'PO Box 123'; |
2088 | 2088 | $this->city = 'Inna City'; |
2089 | 2089 | $this->STA_ID = 4; |
2090 | 2090 | $this->CNT_ISO = 'US'; |
2091 | 2091 | $this->zip = '12345'; |
2092 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2092 | + $this->email = get_bloginfo('admin_email'); |
|
2093 | 2093 | $this->phone = ''; |
2094 | 2094 | $this->vat = '123456789'; |
2095 | 2095 | $this->logo_url = ''; |
@@ -2176,44 +2176,44 @@ discard block |
||
2176 | 2176 | * @access public |
2177 | 2177 | * @param string $CNT_ISO |
2178 | 2178 | */ |
2179 | - public function __construct( $CNT_ISO = '' ) { |
|
2179 | + public function __construct($CNT_ISO = '') { |
|
2180 | 2180 | // get country code from organization settings or use default |
2181 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2181 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2182 | 2182 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2183 | 2183 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2184 | 2184 | : ''; |
2185 | 2185 | // but override if requested |
2186 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2186 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2187 | 2187 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2188 | 2188 | if ( |
2189 | - ! empty( $CNT_ISO ) |
|
2189 | + ! empty($CNT_ISO) |
|
2190 | 2190 | && EE_Maintenance_Mode::instance()->models_can_query() |
2191 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2191 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
2192 | 2192 | ) { |
2193 | 2193 | // retrieve the country settings from the db, just in case they have been customized |
2194 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2195 | - if ( $country instanceof EE_Country ) { |
|
2196 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | - $this->name = $country->currency_name_single(); // Dollar |
|
2198 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2194 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2195 | + if ($country instanceof EE_Country) { |
|
2196 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | + $this->name = $country->currency_name_single(); // Dollar |
|
2198 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2204 | 2204 | } |
2205 | 2205 | } |
2206 | 2206 | // fallback to hardcoded defaults, in case the above failed |
2207 | - if ( empty( $this->code ) ) { |
|
2207 | + if (empty($this->code)) { |
|
2208 | 2208 | // set default currency settings |
2209 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2211 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2212 | - $this->sign = '$'; // currency sign: $ |
|
2213 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2209 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2211 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2212 | + $this->sign = '$'; // currency sign: $ |
|
2213 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2217 | 2217 | } |
2218 | 2218 | } |
2219 | 2219 | } |
@@ -2375,7 +2375,7 @@ discard block |
||
2375 | 2375 | * @since 4.8.8.rc.019 |
2376 | 2376 | */ |
2377 | 2377 | public function do_hooks() { |
2378 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2378 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2379 | 2379 | } |
2380 | 2380 | |
2381 | 2381 | |
@@ -2384,7 +2384,7 @@ discard block |
||
2384 | 2384 | * @return void |
2385 | 2385 | */ |
2386 | 2386 | public function set_default_reg_status_on_EEM_Event() { |
2387 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2387 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2388 | 2388 | } |
2389 | 2389 | |
2390 | 2390 | |
@@ -2488,10 +2488,10 @@ discard block |
||
2488 | 2488 | * @param bool $reset |
2489 | 2489 | * @return string |
2490 | 2490 | */ |
2491 | - public function log_file_name( $reset = false ) { |
|
2492 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2493 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2494 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2491 | + public function log_file_name($reset = false) { |
|
2492 | + if (empty($this->log_file_name) || $reset) { |
|
2493 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2494 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2495 | 2495 | } |
2496 | 2496 | return $this->log_file_name; |
2497 | 2497 | } |
@@ -2502,10 +2502,10 @@ discard block |
||
2502 | 2502 | * @param bool $reset |
2503 | 2503 | * @return string |
2504 | 2504 | */ |
2505 | - public function debug_file_name( $reset = false ) { |
|
2506 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2507 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2508 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2505 | + public function debug_file_name($reset = false) { |
|
2506 | + if (empty($this->debug_file_name) || $reset) { |
|
2507 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2508 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2509 | 2509 | } |
2510 | 2510 | return $this->debug_file_name; |
2511 | 2511 | } |
@@ -2687,21 +2687,21 @@ discard block |
||
2687 | 2687 | $this->use_google_maps = true; |
2688 | 2688 | $this->google_map_api_key = ''; |
2689 | 2689 | // for event details pages (reg page) |
2690 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2691 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2692 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2693 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2694 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2695 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2696 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2690 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2691 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2692 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2693 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2694 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2695 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2696 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2697 | 2697 | // for event list pages |
2698 | - $this->event_list_map_width = 300; // ee_map_width |
|
2699 | - $this->event_list_map_height = 185; // ee_map_height |
|
2700 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2701 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2702 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2703 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2704 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2698 | + $this->event_list_map_width = 300; // ee_map_width |
|
2699 | + $this->event_list_map_height = 185; // ee_map_height |
|
2700 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2701 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2702 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2703 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2704 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2705 | 2705 | } |
2706 | 2706 | |
2707 | 2707 | } |
@@ -2854,7 +2854,7 @@ discard block |
||
2854 | 2854 | * @return void |
2855 | 2855 | */ |
2856 | 2856 | protected function _set_php_values() { |
2857 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2857 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2858 | 2858 | $this->php->version = phpversion(); |
2859 | 2859 | } |
2860 | 2860 | |
@@ -2873,10 +2873,10 @@ discard block |
||
2873 | 2873 | * @type string $msg Any message to be displayed. |
2874 | 2874 | * } |
2875 | 2875 | */ |
2876 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2877 | - if ( ! empty( $this->php->max_input_vars ) |
|
2878 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2879 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2876 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2877 | + if ( ! empty($this->php->max_input_vars) |
|
2878 | + && ($input_count >= $this->php->max_input_vars) |
|
2879 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2880 | 2880 | ) { |
2881 | 2881 | return sprintf( |
2882 | 2882 | __( |
@@ -2942,7 +2942,7 @@ discard block |
||
2942 | 2942 | */ |
2943 | 2943 | public function __construct() { |
2944 | 2944 | $this->payment_settings = array(); |
2945 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2945 | + $this->active_gateways = array('Invoice' => false); |
|
2946 | 2946 | } |
2947 | 2947 | } |
2948 | 2948 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base{ |
|
9 | +class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base { |
|
10 | 10 | protected $_individual_item_normalization_strategy = array(); |
11 | 11 | /** |
12 | 12 | * |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | * @return array |
24 | 24 | */ |
25 | 25 | public function normalize($value_to_normalize) { |
26 | - if ( is_array( $value_to_normalize )){ |
|
26 | + if (is_array($value_to_normalize)) { |
|
27 | 27 | $items_to_normalize = $value_to_normalize; |
28 | - } else if( $value_to_normalize !== NULL ){ |
|
29 | - $items_to_normalize = array( $value_to_normalize ); |
|
28 | + } else if ($value_to_normalize !== NULL) { |
|
29 | + $items_to_normalize = array($value_to_normalize); |
|
30 | 30 | } else { |
31 | 31 | $items_to_normalize = array(); |
32 | 32 | } |
33 | 33 | $normalized_array_value = array(); |
34 | - foreach( $items_to_normalize as $key => $individual_item ){ |
|
35 | - $normalized_array_value[ $key ] = $this->normalize_one( $individual_item ); |
|
34 | + foreach ($items_to_normalize as $key => $individual_item) { |
|
35 | + $normalized_array_value[$key] = $this->normalize_one($individual_item); |
|
36 | 36 | } |
37 | 37 | return $normalized_array_value; |
38 | 38 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $individual_value_to_normalize but definitely NOT an array |
43 | 43 | * @return mixed |
44 | 44 | */ |
45 | - public function normalize_one( $individual_value_to_normalize ) { |
|
46 | - return $this->_individual_item_normalization_strategy->normalize( $individual_value_to_normalize ); |
|
45 | + public function normalize_one($individual_value_to_normalize) { |
|
46 | + return $this->_individual_item_normalization_strategy->normalize($individual_value_to_normalize); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | * @param array $normalized_values |
52 | 52 | * @return string[] |
53 | 53 | */ |
54 | - public function unnormalize( $normalized_values ) { |
|
55 | - if( $normalized_values === null ) { |
|
54 | + public function unnormalize($normalized_values) { |
|
55 | + if ($normalized_values === null) { |
|
56 | 56 | $normalized_values = array(); |
57 | 57 | } |
58 | - if( ! is_array( $normalized_values ) ){ |
|
59 | - $normalized_values = array( $normalized_values ); |
|
58 | + if ( ! is_array($normalized_values)) { |
|
59 | + $normalized_values = array($normalized_values); |
|
60 | 60 | } |
61 | 61 | $non_normal_values = array(); |
62 | - foreach( $normalized_values as $key => $value ) { |
|
63 | - $non_normal_values[ $key ] = $this->unnormalize_one( $value ); |
|
62 | + foreach ($normalized_values as $key => $value) { |
|
63 | + $non_normal_values[$key] = $this->unnormalize_one($value); |
|
64 | 64 | } |
65 | 65 | return $non_normal_values; |
66 | 66 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @param mixed $individual_value_to_unnormalize but certainly NOT an array |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - public function unnormalize_one( $individual_value_to_unnormalize ) { |
|
74 | - return $this->_individual_item_normalization_strategy->unnormalize( $individual_value_to_unnormalize ); |
|
73 | + public function unnormalize_one($individual_value_to_unnormalize) { |
|
74 | + return $this->_individual_item_normalization_strategy->unnormalize($individual_value_to_unnormalize); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 |