@@ -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 | } |
@@ -1320,13 +1320,13 @@ discard block |
||
1320 | 1320 | ) { |
1321 | 1321 | add_filter( |
1322 | 1322 | 'FHEE__EEH_Template__powered_by_event_espresso__url', |
1323 | - function( $url) { |
|
1324 | - return apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1323 | + function($url) { |
|
1324 | + return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1325 | 1325 | } |
1326 | 1326 | ); |
1327 | 1327 | echo apply_filters( |
1328 | 1328 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1329 | - \EEH_Template::powered_by_event_espresso( '', 'espresso-registration-footer-dv' ) |
|
1329 | + \EEH_Template::powered_by_event_espresso('', 'espresso-registration-footer-dv') |
|
1330 | 1330 | ); |
1331 | 1331 | } |
1332 | 1332 | return ''; |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | * @throws \EE_Error |
1343 | 1343 | */ |
1344 | 1344 | public function unlock_transaction() { |
1345 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1345 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1346 | 1346 | $this->checkout->transaction->unlock(); |
1347 | 1347 | } |
1348 | 1348 | } |
@@ -1357,12 +1357,12 @@ discard block |
||
1357 | 1357 | * @return array |
1358 | 1358 | */ |
1359 | 1359 | private function _setup_redirect() { |
1360 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1360 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1361 | 1361 | $this->checkout->redirect = TRUE; |
1362 | - if ( empty( $this->checkout->redirect_url )) { |
|
1362 | + if (empty($this->checkout->redirect_url)) { |
|
1363 | 1363 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1364 | 1364 | } |
1365 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1365 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1366 | 1366 | } |
1367 | 1367 | } |
1368 | 1368 | |
@@ -1376,9 +1376,9 @@ discard block |
||
1376 | 1376 | * @throws \EE_Error |
1377 | 1377 | */ |
1378 | 1378 | public function go_to_next_step() { |
1379 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1379 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1380 | 1380 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1381 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1381 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1382 | 1382 | } |
1383 | 1383 | $this->unlock_transaction(); |
1384 | 1384 | // just return for these conditions |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | */ |
1408 | 1408 | protected function _handle_json_response() { |
1409 | 1409 | // if this is an ajax request |
1410 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1410 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1411 | 1411 | // DEBUG LOG |
1412 | 1412 | //$this->checkout->log( |
1413 | 1413 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | $this->checkout->json_response->set_registration_time_limit( |
1421 | 1421 | $this->checkout->get_registration_time_limit() |
1422 | 1422 | ); |
1423 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1423 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1424 | 1424 | // just send the ajax ( |
1425 | 1425 | $json_response = apply_filters( |
1426 | 1426 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1441,9 +1441,9 @@ discard block |
||
1441 | 1441 | */ |
1442 | 1442 | protected function _handle_html_redirects() { |
1443 | 1443 | // going somewhere ? |
1444 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1444 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1445 | 1445 | // store notices in a transient |
1446 | - EE_Error::get_notices( false, true, true ); |
|
1446 | + EE_Error::get_notices(false, true, true); |
|
1447 | 1447 | // DEBUG LOG |
1448 | 1448 | //$this->checkout->log( |
1449 | 1449 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | // 'headers_list' => headers_list(), |
1454 | 1454 | // ) |
1455 | 1455 | //); |
1456 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1456 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1457 | 1457 | exit(); |
1458 | 1458 | } |
1459 | 1459 | } |
@@ -25,9 +25,6 @@ |
||
25 | 25 | |
26 | 26 | ) |
27 | 27 | ); |
28 | - |
|
29 | - |
|
30 | - |
|
31 | 28 | * |
32 | 29 | */ |
33 | 30 | class EE_DMS_4_1_0_event_venue extends EE_Data_Migration_Script_Stage{ |
@@ -36,53 +36,53 @@ discard block |
||
36 | 36 | <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso')?></h2> |
37 | 37 | <h3 id="invoice-date"><?php _e('Date:', 'event_espresso')?> <span class="plain-text">[registration_date]</span></h3> |
38 | 38 | <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso')?> <span class="plain-text">[transaction_id]</span></h3> |
39 | - <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status();?></span></h3> |
|
39 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status(); ?></span></h3> |
|
40 | 40 | </div> |
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | </table> |
44 | 44 | <div class="events"> |
45 | - <?php foreach($events_for_txn as $event_id => $event){ |
|
46 | - ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png';?>"><?php _e("Event Name:","event_espresso")?> <span class="plain-text"><?php echo $event->name();?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | - <?php if (strlen($event->description()>1)){?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
45 | + <?php foreach ($events_for_txn as $event_id => $event) { |
|
46 | + ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso")?> <span class="plain-text"><?php echo $event->name(); ?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | + <?php if (strlen($event->description() > 1)) {?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
48 | 48 | <ul class="tickets-per-event"> |
49 | - <?php foreach($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item){ |
|
49 | + <?php foreach ($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item) { |
|
50 | 50 | $ticket = $line_item->ticket(); |
51 | - $taxable_html = $ticket->taxable() ? '*': ''; |
|
51 | + $taxable_html = $ticket->taxable() ? '*' : ''; |
|
52 | 52 | $subitems = $line_item->children(); |
53 | - $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
53 | + $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
54 | 54 | ?> |
55 | 55 | <li class="event-ticket"> |
56 | 56 | <div class="ticket-details"> |
57 | 57 | <table class="invoice-amount"> |
58 | 58 | <thead> |
59 | 59 | <tr class="header_row"> |
60 | - <th class="name-column"><?php _e("Ticket", "event_espresso");?></th> |
|
61 | - <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso");?></th> |
|
62 | - <th class="number-column item_c"><?php _e("Quantity", "event_espresso");?></th> |
|
63 | - <th class="number-column item_c"><?php _e("Price", "event_espresso");?></th> |
|
64 | - <th class="number-column item_r"><?php _e("Total", "event_espresso");?></th> |
|
60 | + <th class="name-column"><?php _e("Ticket", "event_espresso"); ?></th> |
|
61 | + <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso"); ?></th> |
|
62 | + <th class="number-column item_c"><?php _e("Quantity", "event_espresso"); ?></th> |
|
63 | + <th class="number-column item_c"><?php _e("Price", "event_espresso"); ?></th> |
|
64 | + <th class="number-column item_r"><?php _e("Total", "event_espresso"); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if( count($subitems) < 2){?> |
|
68 | + <?php if (count($subitems) < 2) {?> |
|
69 | 69 | <tr class="item"> |
70 | 70 | <td><?php echo $line_item->name().$taxable_html?></td> |
71 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
71 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
72 | 72 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
73 | 73 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
74 | 74 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
75 | 75 | </tr> |
76 | - <?php }else{?> |
|
76 | + <?php } else {?> |
|
77 | 77 | <tr class="item"> |
78 | 78 | <td class="aln-left"><?php echo $line_item->name().$taxable_html?></td> |
79 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
79 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
80 | 80 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
81 | 81 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
82 | 82 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
83 | 83 | </tr> |
84 | - <?php foreach($subitems as $sub_line_item){ |
|
85 | - $is_percent = $sub_line_item->is_percent();?> |
|
84 | + <?php foreach ($subitems as $sub_line_item) { |
|
85 | + $is_percent = $sub_line_item->is_percent(); ?> |
|
86 | 86 | <tr class="subitem-row"> |
87 | 87 | <td class="subitem"><?php echo $sub_line_item->name()?></td> |
88 | 88 | <td colspan="2"><?php echo $sub_line_item->desc()?></td> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | <?php } ?> |
94 | 94 | <tr class="total_tr odd"> |
95 | 95 | <td colspan="4"></td> |
96 | - <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso");?></td> |
|
96 | + <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso"); ?></td> |
|
97 | 97 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
98 | 98 | </tr> |
99 | 99 | <?php }?> |
@@ -104,22 +104,22 @@ discard block |
||
104 | 104 | <div class="reg-details-for-ticket"> |
105 | 105 | <div class="ticket-time-and-place-details"> |
106 | 106 | <div class="ticket-time-details"> |
107 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png';?>"><?php echo _n("Date/Time:","Dates/Times:",count($ticket->datetimes()), "event_espresso");?></h4> |
|
107 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php echo _n("Date/Time:", "Dates/Times:", count($ticket->datetimes()), "event_espresso"); ?></h4> |
|
108 | 108 | <ul class="event-dates"> |
109 | - <?php foreach($ticket->datetimes_ordered() as $datetime){ |
|
109 | + <?php foreach ($ticket->datetimes_ordered() as $datetime) { |
|
110 | 110 | /* @var $datetime EE_Datetime */ ?> |
111 | 111 | <li><?php |
112 | - echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '' ; |
|
113 | - echo sprintf(__("%s - %s (%s)", "event_espresso"),$datetime->start_date_and_time(),$datetime->end_date_and_time(),$datetime->get_timezone()); |
|
112 | + echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : ''; |
|
113 | + echo sprintf(__("%s - %s (%s)", "event_espresso"), $datetime->start_date_and_time(), $datetime->end_date_and_time(), $datetime->get_timezone()); |
|
114 | 114 | echo $datetime->description() ? '<p class="ticket-note">'.$datetime->description().'</p>' : '' ?></li> |
115 | 115 | <?php }?> |
116 | 116 | </ul> |
117 | 117 | </div> |
118 | - <?php if ($event->venues()){?> |
|
118 | + <?php if ($event->venues()) {?> |
|
119 | 119 | <div class="ticket-place-details"> |
120 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png';?>"><?php echo _n("Venue:","Venues:",count($event->venues()), "event_espresso");?></h4> |
|
120 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php echo _n("Venue:", "Venues:", count($event->venues()), "event_espresso"); ?></h4> |
|
121 | 121 | <ul class="event-venues"> |
122 | - <?php foreach($event->venues() as $venue){?> |
|
122 | + <?php foreach ($event->venues() as $venue) {?> |
|
123 | 123 | <li><?php echo $venue->name()?> <span class="small-text">[ <a href='<?php echo $venue->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></li> |
124 | 124 | <?php } ?> |
125 | 125 | </ul> |
@@ -127,34 +127,34 @@ discard block |
||
127 | 127 | <?php }?> |
128 | 128 | </div> |
129 | 129 | <div class="ticket-registrations-area"> |
130 | - <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png';?>"><?php echo __("Registration Details", "event_espresso");?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
130 | + <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php echo __("Registration Details", "event_espresso"); ?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
131 | 131 | <ul class="ticket-registrations-list"> |
132 | - <?php foreach($registrations_per_line_item[$line_item_id] as $registration){ |
|
132 | + <?php foreach ($registrations_per_line_item[$line_item_id] as $registration) { |
|
133 | 133 | /* @var $registration EE_Registration */ |
134 | 134 | $attendee = $registration->attendee(); |
135 | - $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC')));?> |
|
135 | + $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC'))); ?> |
|
136 | 136 | <li class="ticket-registration"> |
137 | 137 | <table class="registration-details"> |
138 | 138 | <tr class="odd"> |
139 | - <th><?php echo _e("Registration Code:", "event_espresso");?></th> |
|
140 | - <td><?php echo $registration->reg_code();?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
139 | + <th><?php echo _e("Registration Code:", "event_espresso"); ?></th> |
|
140 | + <td><?php echo $registration->reg_code(); ?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
141 | 141 | </tr> |
142 | 142 | <?php |
143 | - foreach($event->question_groups() as $question_group){ |
|
144 | - ?><tr><th><?php $question_group->e('QSG_name');?></th><td></td></tr><?php |
|
143 | + foreach ($event->question_groups() as $question_group) { |
|
144 | + ?><tr><th><?php $question_group->e('QSG_name'); ?></th><td></td></tr><?php |
|
145 | 145 | $has_personal_info = false; |
146 | - foreach($question_group->questions() as $question){ |
|
147 | - if( in_array($question->system_ID(),$questions_to_skip)){ |
|
146 | + foreach ($question_group->questions() as $question) { |
|
147 | + if (in_array($question->system_ID(), $questions_to_skip)) { |
|
148 | 148 | $has_personal_info = true; |
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | ?><tr> |
152 | 152 | <th><?php echo $question->display_text()?></th> |
153 | - <td><?php echo $registration->answer_value_to_question($question);?></td> |
|
153 | + <td><?php echo $registration->answer_value_to_question($question); ?></td> |
|
154 | 154 | </tr><?php |
155 | 155 | } |
156 | - if($has_personal_info){ |
|
157 | - ?><tr><th><?php _e('Attendee', 'event_espresso');?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"),$attendee->full_name(),$attendee->email())?></td></tr><?php |
|
156 | + if ($has_personal_info) { |
|
157 | + ?><tr><th><?php _e('Attendee', 'event_espresso'); ?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"), $attendee->full_name(), $attendee->email())?></td></tr><?php |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | ?> |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | <?php }?> |
172 | 172 | </div> |
173 | 173 | <div class="taxes"> |
174 | - <?php if ($tax_total_line_item && $tax_total_line_item->children()){?> |
|
175 | - <h3 class="section-title"><?php _e("Taxes",'event_espresso')?></h3> |
|
174 | + <?php if ($tax_total_line_item && $tax_total_line_item->children()) {?> |
|
175 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso')?></h3> |
|
176 | 176 | <table class="invoice-amount"> |
177 | 177 | |
178 | 178 | <thead> |
179 | 179 | <tr class="header_row"> |
180 | - <th class="left ticket_th"><?php _e("Tax Name", "event_espresso");?></th> |
|
181 | - <th class="left"><?php _e('Description', 'event_espresso');?></th> |
|
180 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
181 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
182 | 182 | <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
183 | 183 | <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
184 | 184 | </tr> |
185 | 185 | </thead> |
186 | 186 | <tbody> |
187 | 187 | <?php |
188 | - foreach($tax_total_line_item->children() as $child_tax){?> |
|
188 | + foreach ($tax_total_line_item->children() as $child_tax) {?> |
|
189 | 189 | <tr> |
190 | 190 | <td><?php echo $child_tax->name()?></td> |
191 | 191 | <td><?php echo $child_tax->desc()?></td> |
@@ -195,26 +195,26 @@ discard block |
||
195 | 195 | <?php } ?> |
196 | 196 | <tr class="total_tr odd"> |
197 | 197 | <td class="total_tr" colspan="2"></td> |
198 | - <td class="total"><?php _e("Tax Total:", "event_espresso");?></td> |
|
198 | + <td class="total"><?php _e("Tax Total:", "event_espresso"); ?></td> |
|
199 | 199 | <td class="item_r"><?php echo $tax_total_line_item->total_no_code()?></td> |
200 | 200 | </tr> |
201 | 201 | </tbody> |
202 | 202 | |
203 | 203 | </table> |
204 | 204 | <?php }?> |
205 | - <p><?php _e("* taxable items", "event_espresso");?></p> |
|
205 | + <p><?php _e("* taxable items", "event_espresso"); ?></p> |
|
206 | 206 | </div> |
207 | 207 | <div class="grand-total-dv"> |
208 | - <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"),EEH_Template::format_currency($total_cost));?></h2> |
|
208 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), EEH_Template::format_currency($total_cost)); ?></h2> |
|
209 | 209 | </div> |
210 | 210 | <div class="payment-dv"> |
211 | - <h3 class="section-title"><?php _e("Payments",'event_espresso')?></h3> |
|
211 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso')?></h3> |
|
212 | 212 | <p>[instructions]</p> |
213 | 213 | <table class="invoice-amount"> |
214 | 214 | <thead> |
215 | 215 | <tr class="header_row"> |
216 | 216 | <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
217 | - <th class='left datetime_th'><?php _e("Date",'event_espresso')?></th> |
|
217 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso')?></th> |
|
218 | 218 | <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
219 | 219 | <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
220 | 220 | <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | <tbody> |
225 | 225 | <?php |
226 | 226 | $c = false; |
227 | - if(!empty($payments)){ |
|
227 | + if ( ! empty($payments)) { |
|
228 | 228 | |
229 | - foreach($payments as $payment){ |
|
229 | + foreach ($payments as $payment) { |
|
230 | 230 | /* @var $payment EE_Payment */?> |
231 | - <tr class='item <?php echo (($c = !$c) ? ' odd' : '')?>'> |
|
231 | + <tr class='item <?php echo (($c = ! $c) ? ' odd' : '')?>'> |
|
232 | 232 | <td><?php $payment->e('PAY_gateway')?></td> |
233 | 233 | <td><?php echo $payment->timestamp()?></td> |
234 | 234 | <td><?php $payment->e('PAY_txn_id_chq_nmbr')?></td> |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | <td class='item_r'><?php echo $payment->amount_no_code()?></td> |
238 | 238 | </tr> |
239 | 239 | <?php } |
240 | - }else{?> |
|
240 | + } else {?> |
|
241 | 241 | <tr class='item'> |
242 | - <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.",'event_espresso')?> </td> |
|
242 | + <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.", 'event_espresso')?> </td> |
|
243 | 243 | </tr> |
244 | 244 | <?php } |
245 | - ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if($amount_owed){?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso");}?></a></td></tr> |
|
245 | + ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if ($amount_owed) {?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso"); }?></a></td></tr> |
|
246 | 246 | </tbody> |
247 | 247 | <tfoot> |
248 | 248 | <tr class='total_tr'><td colspan="4"> </td> |
249 | - <td class="item_r"><?php _e('Total Paid','event_espresso')?></td> |
|
250 | - <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd,false,false)?> </td> |
|
249 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso')?></td> |
|
250 | + <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd, false, false)?> </td> |
|
251 | 251 | </tr> |
252 | 252 | <?php //echo $discount; ?> |
253 | 253 | <tr class="total_tr odd"> |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | </table> |
260 | 260 | </div> |
261 | 261 | <div class="additional-info-dv"> |
262 | - <h3 class="section-title"><?php _e("Additional Information:", "event_espresso");?></h3> |
|
262 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
263 | 263 | <div class="additional-info"> |
264 | - <?php if($venues_for_events){?> |
|
265 | - <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso",count($venues_for_events));?></h2> |
|
264 | + <?php if ($venues_for_events) {?> |
|
265 | + <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso", count($venues_for_events)); ?></h2> |
|
266 | 266 | <table class="venue-list"> |
267 | - <?php foreach($venues_for_events as $venue){?> |
|
267 | + <?php foreach ($venues_for_events as $venue) {?> |
|
268 | 268 | <tr class="venue-details"> |
269 | 269 | <td class="venue-details-part venue-address-dv"> |
270 | 270 | <h3><a href='<?php echo $venue->get_permalink()?>'><?php |
271 | 271 | echo $venue->name() |
272 | 272 | ?></a></h3> |
273 | 273 | <p><?php echo $venue->description()?></p> |
274 | - <?php echo EEH_Address::format($venue);?></td> |
|
275 | - <?php if($venue->enable_for_gmap()){?> |
|
274 | + <?php echo EEH_Address::format($venue); ?></td> |
|
275 | + <?php if ($venue->enable_for_gmap()) {?> |
|
276 | 276 | <td class="venue-details-part venue-image-dv"><?php echo EEH_Venue_View::espresso_google_static_map($venue)?></td> |
277 | 277 | <?php } ?> |
278 | 278 | </tr> |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | </table> |
281 | 281 | <?php } ?> |
282 | 282 | |
283 | - <?php if($shameless_plug){ |
|
284 | - echo \EEH_Template::powered_by_event_espresso( 'aln-cntr' ); |
|
283 | + <?php if ($shameless_plug) { |
|
284 | + echo \EEH_Template::powered_by_event_espresso('aln-cntr'); |
|
285 | 285 | } ?> |
286 | 286 | </div> |
287 | 287 | </div> |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | </td> |
24 | 24 | <td> |
25 | 25 | <div id="invoice-info"> |
26 | - <h2 id="invoice-hdr"><?php _e( 'Order Confirmation', 'event_espresso' ) ?></h2> |
|
26 | + <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso') ?></h2> |
|
27 | 27 | |
28 | - <h3 id="invoice-date"><?php _e( 'Date:', 'event_espresso' ) ?> |
|
28 | + <h3 id="invoice-date"><?php _e('Date:', 'event_espresso') ?> |
|
29 | 29 | <span class="plain-text">[PRIMARY_REGISTRANT_REGISTRATION_DATE]</span></h3> |
30 | 30 | |
31 | - <h3 id="invoice-txn-id"><?php _e( 'Transaction ID:', 'event_espresso' ) ?> |
|
31 | + <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso') ?> |
|
32 | 32 | <span class="plain-text">[TXN_ID]</span></h3> |
33 | 33 | |
34 | - <h3 id="invoice-txn-status"><?php _e( 'Status:', 'event_espresso' ) ?> |
|
34 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso') ?> |
|
35 | 35 | <span class="[TXN_STATUS_ID] plain-text">[TXN_STATUS]</span></h3> |
36 | 36 | </div> |
37 | 37 | </td> |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | [EVENT_LIST] |
42 | 42 | </div> |
43 | 43 | <div class="taxes"> |
44 | - <h3 class="section-title"><?php _e( "Additional Charges/Discounts", 'event_espresso' ) ?></h3> |
|
44 | + <h3 class="section-title"><?php _e("Additional Charges/Discounts", 'event_espresso') ?></h3> |
|
45 | 45 | <table class="invoice-amount"> |
46 | 46 | <thead> |
47 | 47 | <tr class="header_row"> |
48 | - <th class="left ticket_th"><?php _e( "Name", "event_espresso" ); ?></th> |
|
49 | - <th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th> |
|
50 | - <th class="event_th item_c"><?php _e( 'Quantity', 'event_espresso' ); ?></th> |
|
51 | - <th class="event_th item_c"><?php _e( 'Unit Price', 'event_espresso' ); ?></th> |
|
52 | - <th class="subtotal_th"><?php _e( 'Total', 'event_espresso' ); ?></th> |
|
48 | + <th class="left ticket_th"><?php _e("Name", "event_espresso"); ?></th> |
|
49 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
50 | + <th class="event_th item_c"><?php _e('Quantity', 'event_espresso'); ?></th> |
|
51 | + <th class="event_th item_c"><?php _e('Unit Price', 'event_espresso'); ?></th> |
|
52 | + <th class="subtotal_th"><?php _e('Total', 'event_espresso'); ?></th> |
|
53 | 53 | </tr> |
54 | 54 | </thead> |
55 | 55 | <tbody> |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | </table> |
61 | 61 | </div> |
62 | 62 | <div class="taxes"> |
63 | - <h3 class="section-title"><?php _e( "Taxes", 'event_espresso' ) ?></h3> |
|
64 | - <p><?php printf( __( '%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso' ), '<strong>', '</strong>' ); ?></p> |
|
63 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso') ?></h3> |
|
64 | + <p><?php printf(__('%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
65 | 65 | <table class="invoice-amount"> |
66 | 66 | <thead> |
67 | 67 | <tr class="header_row"> |
68 | - <th class="left ticket_th"><?php _e( "Tax Name", "event_espresso" ); ?></th> |
|
69 | - <th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th> |
|
70 | - <th class="event_th item_c"><?php _e( 'Rate', 'event_espresso' ); ?></th> |
|
71 | - <th class="subtotal_th"><?php _e( 'Tax Amount', 'event_espresso' ); ?></th> |
|
68 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
69 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
70 | + <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
|
71 | + <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
|
72 | 72 | </tr> |
73 | 73 | </thead> |
74 | 74 | <tbody> |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | </table> |
80 | 80 | </div> |
81 | 81 | <div class="grand-total-dv"> |
82 | - <h2 class="grand-total"><?php printf( __( "Grand Total: %s", "event_espresso" ), '[TOTAL_COST]' ); ?></h2> |
|
82 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), '[TOTAL_COST]'); ?></h2> |
|
83 | 83 | </div> |
84 | 84 | <div class="payment-dv"> |
85 | - <h3 class="section-title"><?php _e( "Payments", 'event_espresso' ) ?></h3> |
|
85 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso') ?></h3> |
|
86 | 86 | <table class="invoice-amount"> |
87 | 87 | <thead> |
88 | 88 | <tr class="header_row"> |
89 | - <th><span class=""><?php _e( 'Payment Method', 'event_espresso' ); ?></span></th> |
|
90 | - <th class='left datetime_th'><?php _e( "Date", 'event_espresso' ) ?></th> |
|
91 | - <th><span class=""><?php _e( 'Transaction Id / Cheque #', 'event_espresso' ); ?></span></th> |
|
92 | - <th><span class=""><?php _e( 'P.O. / S.O.#', 'event_espresso' ); ?></span></th> |
|
93 | - <th><span class=""><?php _e( 'Status', 'event_espresso' ); ?></span></th> |
|
94 | - <th><?php _e( 'Amount', 'event_espresso' ); ?></th> |
|
89 | + <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
|
90 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso') ?></th> |
|
91 | + <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
|
92 | + <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
|
93 | + <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
|
94 | + <th><?php _e('Amount', 'event_espresso'); ?></th> |
|
95 | 95 | </tr> |
96 | 96 | </thead> |
97 | 97 | <tbody> |
@@ -105,21 +105,21 @@ discard block |
||
105 | 105 | <tfoot> |
106 | 106 | <tr class='total_tr'> |
107 | 107 | <td colspan="4"> </td> |
108 | - <td class="item_r"><?php _e( 'Total Paid', 'event_espresso' ) ?></td> |
|
108 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso') ?></td> |
|
109 | 109 | <td class="item_r">[TOTAL_AMOUNT_PAID]</td> |
110 | 110 | </tr> |
111 | 111 | <tr class="total_tr odd"> |
112 | 112 | <td colspan="4"> </td> |
113 | - <td class="total" id="total_currency"><?php _e( 'Amount Owed:', 'event_espresso' ); ?></td> |
|
113 | + <td class="total" id="total_currency"><?php _e('Amount Owed:', 'event_espresso'); ?></td> |
|
114 | 114 | <td class="total">[TOTAL_OWING]</td> |
115 | 115 | </tr> |
116 | 116 | </tfoot> |
117 | 117 | </table> |
118 | 118 | </div> |
119 | 119 | <div class="additional-info-dv"> |
120 | - <h3 class="section-title"><?php _e( "Additional Information:", "event_espresso" ); ?></h3> |
|
120 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
121 | 121 | <div class="additional-info"> |
122 | - <h2><?php _e( "Venue Details:", "event_espresso" ); ?></h2> |
|
122 | + <h2><?php _e("Venue Details:", "event_espresso"); ?></h2> |
|
123 | 123 | <table class="venue-list"> |
124 | 124 | <tr class="venue-details"> |
125 | 125 | <td class="venue-details-part venue-address-dv"> |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | <td class="venue-details-part venue-image-dv">[GOOGLE_MAP_IMAGE]</td> |
132 | 132 | </tr> |
133 | 133 | </table> |
134 | - <?php echo \EEH_Template::powered_by_event_espresso( 'aln-cntr' ); ?> |
|
134 | + <?php echo \EEH_Template::powered_by_event_espresso('aln-cntr'); ?> |
|
135 | 135 | </div> |
136 | 136 | </div> |
137 | 137 | </div> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function instance() { |
42 | 42 | // check if class object is instantiated |
43 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
43 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
44 | 44 | self::$_instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$_instance; |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | // define global EE_Admin constants |
58 | 58 | $this->_define_all_constants(); |
59 | 59 | // set autoloaders for our admin page classes based on included path information |
60 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
60 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
61 | 61 | // admin hooks |
62 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
62 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
63 | 63 | // load EE_Request_Handler early |
64 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
65 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
64 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
65 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
66 | 66 | // post shortcode tracking |
67 | 67 | add_action( |
68 | 68 | 'AHEE__EE_System__initialize_last', |
69 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' ) |
|
69 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin') |
|
70 | 70 | ); |
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin === $main_file ) { |
|
122 | + if ($plugin === $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -174,31 +174,31 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function init() { |
176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
177 | - if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
177 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
178 | 178 | //ok so we want to enable the entire admin |
179 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
180 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
179 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
180 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
181 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
182 | 182 | //at a glance dashboard widget |
183 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 ); |
|
183 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
184 | 184 | //filter for get_edit_post_link used on comments for custom post types |
185 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 ); |
|
185 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2); |
|
186 | 186 | } |
187 | 187 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
188 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
188 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
189 | 189 | try { |
190 | 190 | //this loads the controller for the admin pages which will setup routing etc |
191 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
192 | - } catch ( EE_Error $e ) { |
|
191 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
192 | + } catch (EE_Error $e) { |
|
193 | 193 | $e->get_error(); |
194 | 194 | } |
195 | 195 | } |
196 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
196 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
197 | 197 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
198 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
199 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
198 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
199 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
200 | 200 | //exclude EE critical pages from all nav menus and wp_list_pages |
201 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
201 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * @param object $post_type WP post type object |
212 | 212 | * @return object WP post type object |
213 | 213 | */ |
214 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
214 | + public function remove_pages_from_nav_menu($post_type) { |
|
215 | 215 | //if this isn't the "pages" post type let's get out |
216 | - if ( $post_type->name !== 'page' ) { |
|
216 | + if ($post_type->name !== 'page') { |
|
217 | 217 | return $post_type; |
218 | 218 | } |
219 | 219 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -233,28 +233,28 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function enable_hidden_ee_nav_menu_metaboxes() { |
235 | 235 | global $wp_meta_boxes, $pagenow; |
236 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
236 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | $user = wp_get_current_user(); |
240 | 240 | //has this been done yet? |
241 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
241 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
245 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
246 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
245 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
246 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
247 | 247 | |
248 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
249 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
250 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
251 | - unset( $hidden_meta_boxes[ $key ] ); |
|
248 | + if (is_array($hidden_meta_boxes)) { |
|
249 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
250 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
251 | + unset($hidden_meta_boxes[$key]); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
257 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
256 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
257 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return void |
274 | 274 | */ |
275 | 275 | public function register_custom_nav_menu_boxes() { |
276 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
276 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string the (maybe) modified link |
291 | 291 | */ |
292 | - public function modify_edit_post_link( $link, $id ) { |
|
293 | - if ( ! $post = get_post( $id ) ){ |
|
292 | + public function modify_edit_post_link($link, $id) { |
|
293 | + if ( ! $post = get_post($id)) { |
|
294 | 294 | return $link; |
295 | 295 | } |
296 | - if ( $post->post_type === 'espresso_attendees' ) { |
|
296 | + if ($post->post_type === 'espresso_attendees') { |
|
297 | 297 | $query_args = array( |
298 | 298 | 'action' => 'edit_attendee', |
299 | 299 | 'post' => $id |
300 | 300 | ); |
301 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
301 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
302 | 302 | } |
303 | 303 | return $link; |
304 | 304 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | global $nav_menu_selected_id; |
311 | 311 | |
312 | 312 | $db_fields = false; |
313 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
313 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
314 | 314 | $current_tab = 'event-archives'; |
315 | 315 | |
316 | 316 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
331 | 331 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
332 | - <li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>> |
|
333 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
332 | + <li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>> |
|
333 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
335 | 335 | </a> |
336 | 336 | </li> |
337 | 337 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | <?php */ ?> |
350 | 350 | |
351 | 351 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
352 | - echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
352 | + echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
353 | 353 | ?>"> |
354 | 354 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
355 | 355 | <?php |
356 | 356 | $pages = $this->_get_extra_nav_menu_pages_items(); |
357 | 357 | $args['walker'] = $walker; |
358 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
358 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
359 | 359 | ?> |
360 | 360 | </ul> |
361 | 361 | </div><!-- /.tabs-panel --> |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | <p class="button-controls"> |
364 | 364 | <span class="list-controls"> |
365 | 365 | <a href="<?php |
366 | - echo esc_url( add_query_arg( |
|
366 | + echo esc_url(add_query_arg( |
|
367 | 367 | array( |
368 | 368 | 'extra-nav-menu-pages-tab' => 'event-archives', |
369 | 369 | 'selectall' => 1, |
370 | 370 | ), |
371 | - remove_query_arg( $removed_args ) |
|
371 | + remove_query_arg($removed_args) |
|
372 | 372 | )); |
373 | 373 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
374 | 374 | </span> |
375 | 375 | |
376 | 376 | <span class="add-to-menu"> |
377 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
377 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
378 | 378 | <span class="spinner"></span> |
379 | 379 | </span> |
380 | 380 | </p> |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | private function _get_extra_nav_menu_pages_items() { |
396 | 396 | $menuitems[] = array( |
397 | 397 | 'title' => __('Event List', 'event_espresso'), |
398 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
398 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
399 | 399 | 'description' => __('Archive page for all events.', 'event_espresso') |
400 | 400 | ); |
401 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
401 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param $menu_item_values |
411 | 411 | * @return stdClass |
412 | 412 | */ |
413 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
413 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
414 | 414 | $menu_item = new stdClass(); |
415 | 415 | $keys = array( |
416 | 416 | 'ID' => 0, |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | 'xfn' => '' |
431 | 431 | ); |
432 | 432 | |
433 | - foreach ( $keys as $key => $value) { |
|
434 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
433 | + foreach ($keys as $key => $value) { |
|
434 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
435 | 435 | } |
436 | 436 | return $menu_item; |
437 | 437 | } |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | * - check if doing post processing of one of EE CPTs |
471 | 471 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
472 | 472 | */ |
473 | - if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) { |
|
474 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
475 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
473 | + if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') { |
|
474 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
475 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
482 | 482 | */ |
483 | 483 | global $pagenow; |
484 | - if ( $pagenow === 'options-reading.php' ) { |
|
485 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
484 | + if ($pagenow === 'options-reading.php') { |
|
485 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -494,25 +494,25 @@ discard block |
||
494 | 494 | * @param string $output Current output. |
495 | 495 | * @return string |
496 | 496 | */ |
497 | - public function modify_dropdown_pages( $output ) { |
|
497 | + public function modify_dropdown_pages($output) { |
|
498 | 498 | //get critical pages |
499 | 499 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
500 | 500 | |
501 | 501 | //split current output by line break for easier parsing. |
502 | - $split_output = explode( "\n", $output ); |
|
502 | + $split_output = explode("\n", $output); |
|
503 | 503 | |
504 | 504 | //loop through to remove any critical pages from the array. |
505 | - foreach ( $critical_pages as $page_id ) { |
|
506 | - $needle = 'value="' . $page_id . '"'; |
|
507 | - foreach( $split_output as $key => $haystack ) { |
|
508 | - if( strpos( $haystack, $needle ) !== false ) { |
|
509 | - unset( $split_output[$key] ); |
|
505 | + foreach ($critical_pages as $page_id) { |
|
506 | + $needle = 'value="'.$page_id.'"'; |
|
507 | + foreach ($split_output as $key => $haystack) { |
|
508 | + if (strpos($haystack, $needle) !== false) { |
|
509 | + unset($split_output[$key]); |
|
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | 514 | //replace output with the new contents |
515 | - return implode( "\n", $split_output ); |
|
515 | + return implode("\n", $split_output); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -526,36 +526,36 @@ discard block |
||
526 | 526 | public function enqueue_admin_scripts() { |
527 | 527 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
528 | 528 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
529 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
529 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
530 | 530 | // register cookie script for future dependencies |
531 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
531 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
532 | 532 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
533 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
533 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
534 | 534 | // register jQuery Validate |
535 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
535 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
536 | 536 | } |
537 | 537 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
538 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
538 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
539 | 539 | //joyride style |
540 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
542 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
540 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
542 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
543 | 543 | //joyride JS |
544 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
545 | 545 | // wanna go for a joyride? |
546 | 546 | wp_enqueue_style('ee-joyride-css'); |
547 | 547 | wp_enqueue_script('jquery-joyride'); |
548 | 548 | } |
549 | 549 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
551 | 551 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
552 | 552 | } |
553 | 553 | //accounting.js library |
554 | 554 | // @link http://josscrowcroft.github.io/accounting.js/ |
555 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
556 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
557 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
558 | - wp_enqueue_script( 'ee-accounting' ); |
|
555 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
556 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
557 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
558 | + wp_enqueue_script('ee-accounting'); |
|
559 | 559 | // array of settings to get converted to JSON array via wp_localize_script |
560 | 560 | $currency_config = array( |
561 | 561 | 'currency' => array( |
@@ -602,11 +602,11 @@ discard block |
||
602 | 602 | public function get_persistent_admin_notices() { |
603 | 603 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
604 | 604 | $args = array( |
605 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
606 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
605 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
606 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
607 | 607 | ); |
608 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
609 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
608 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
609 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -627,26 +627,26 @@ discard block |
||
627 | 627 | * @param $elements |
628 | 628 | * @return array |
629 | 629 | */ |
630 | - public function dashboard_glance_items( $elements ) { |
|
630 | + public function dashboard_glance_items($elements) { |
|
631 | 631 | $events = EEM_Event::instance()->count(); |
632 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
633 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
632 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
633 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
634 | 634 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
635 | 635 | $registrations = EEM_Registration::instance()->count( |
636 | 636 | array( |
637 | 637 | array( |
638 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
638 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
639 | 639 | ) |
640 | 640 | ) |
641 | 641 | ); |
642 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
643 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
642 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
643 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
644 | 644 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
645 | 645 | |
646 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
646 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
647 | 647 | |
648 | - foreach ( $items as $type => $item_properties ) { |
|
649 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
648 | + foreach ($items as $type => $item_properties) { |
|
649 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
650 | 650 | } |
651 | 651 | return $elements; |
652 | 652 | } |
@@ -663,31 +663,31 @@ discard block |
||
663 | 663 | * @throws EE_Error |
664 | 664 | * @return string |
665 | 665 | */ |
666 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
666 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
667 | 667 | // check for date_format or time_format |
668 | - switch ( $option ) { |
|
668 | + switch ($option) { |
|
669 | 669 | case 'date_format' : |
670 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
670 | + $date_time_format = $value.' '.get_option('time_format'); |
|
671 | 671 | break; |
672 | 672 | case 'time_format' : |
673 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
673 | + $date_time_format = get_option('date_format').' '.$value; |
|
674 | 674 | break; |
675 | 675 | default : |
676 | 676 | $date_time_format = FALSE; |
677 | 677 | } |
678 | 678 | // do we have a date_time format to check ? |
679 | - if ( $date_time_format ) { |
|
680 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
679 | + if ($date_time_format) { |
|
680 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
681 | 681 | |
682 | - if ( is_array( $error_msg ) ) { |
|
683 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
682 | + if (is_array($error_msg)) { |
|
683 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
684 | 684 | |
685 | 685 | |
686 | - foreach ( $error_msg as $error ) { |
|
687 | - $msg .= '<li>' . $error . '</li>'; |
|
686 | + foreach ($error_msg as $error) { |
|
687 | + $msg .= '<li>'.$error.'</li>'; |
|
688 | 688 | } |
689 | 689 | |
690 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
690 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
691 | 691 | |
692 | 692 | // trigger WP settings error |
693 | 693 | add_settings_error( |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ); |
698 | 698 | |
699 | 699 | // set format to something valid |
700 | - switch ( $option ) { |
|
700 | + switch ($option) { |
|
701 | 701 | case 'date_format' : |
702 | 702 | $value = 'F j, Y'; |
703 | 703 | break; |
@@ -719,8 +719,8 @@ discard block |
||
719 | 719 | * @param $content |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function its_eSpresso( $content ) { |
|
723 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
722 | + public function its_eSpresso($content) { |
|
723 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * @return string |
733 | 733 | */ |
734 | 734 | public function espresso_admin_footer() { |
735 | - return \EEH_Template::powered_by_event_espresso( 'aln-cntr' ); |
|
735 | + return \EEH_Template::powered_by_event_espresso('aln-cntr'); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | * @param array $config |
752 | 752 | * @return void |
753 | 753 | */ |
754 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
755 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
756 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
754 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
755 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
756 | + if (class_exists('EE_Register_Admin_Page')) { |
|
757 | 757 | $config['page_path'] = $page_path; |
758 | 758 | } |
759 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
759 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
760 | 760 | |
761 | 761 | } |
762 | 762 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param \WP_Post $post |
770 | 770 | * @return void |
771 | 771 | */ |
772 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
772 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
773 | 773 | EE_Error::doing_it_wrong( |
774 | 774 | __METHOD__, |
775 | 775 | __( |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | ), |
779 | 779 | '4.8.41' |
780 | 780 | ); |
781 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post ); |
|
781 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @param $value |
792 | 792 | * @return void |
793 | 793 | */ |
794 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
794 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
795 | 795 | EE_Error::doing_it_wrong( |
796 | 796 | __METHOD__, |
797 | 797 | __( |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | ), |
801 | 801 | '4.8.41' |
802 | 802 | ); |
803 | - EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value ); |
|
803 | + EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | } |
@@ -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 | } |
@@ -2516,7 +2516,7 @@ discard block |
||
2516 | 2516 | * @return string |
2517 | 2517 | */ |
2518 | 2518 | public function affiliate_id() { |
2519 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2519 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2520 | 2520 | } |
2521 | 2521 | |
2522 | 2522 | |
@@ -2696,21 +2696,21 @@ discard block |
||
2696 | 2696 | $this->use_google_maps = true; |
2697 | 2697 | $this->google_map_api_key = ''; |
2698 | 2698 | // for event details pages (reg page) |
2699 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2700 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2701 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2702 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2703 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2704 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2705 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2699 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2700 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2701 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2702 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2703 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2704 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2705 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2706 | 2706 | // for event list pages |
2707 | - $this->event_list_map_width = 300; // ee_map_width |
|
2708 | - $this->event_list_map_height = 185; // ee_map_height |
|
2709 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2710 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2711 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2712 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2713 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2707 | + $this->event_list_map_width = 300; // ee_map_width |
|
2708 | + $this->event_list_map_height = 185; // ee_map_height |
|
2709 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2710 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2711 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2712 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2713 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2714 | 2714 | } |
2715 | 2715 | |
2716 | 2716 | } |
@@ -2863,7 +2863,7 @@ discard block |
||
2863 | 2863 | * @return void |
2864 | 2864 | */ |
2865 | 2865 | protected function _set_php_values() { |
2866 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2866 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2867 | 2867 | $this->php->version = phpversion(); |
2868 | 2868 | } |
2869 | 2869 | |
@@ -2882,10 +2882,10 @@ discard block |
||
2882 | 2882 | * @type string $msg Any message to be displayed. |
2883 | 2883 | * } |
2884 | 2884 | */ |
2885 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2886 | - if ( ! empty( $this->php->max_input_vars ) |
|
2887 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2888 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2885 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2886 | + if ( ! empty($this->php->max_input_vars) |
|
2887 | + && ($input_count >= $this->php->max_input_vars) |
|
2888 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2889 | 2889 | ) { |
2890 | 2890 | return sprintf( |
2891 | 2891 | __( |
@@ -2951,7 +2951,7 @@ discard block |
||
2951 | 2951 | */ |
2952 | 2952 | public function __construct() { |
2953 | 2953 | $this->payment_settings = array(); |
2954 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2954 | + $this->active_gateways = array('Invoice' => false); |
|
2955 | 2955 | } |
2956 | 2956 | } |
2957 | 2957 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,54 +407,54 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // filter to allow global setting of display_code |
448 | - $display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code ); |
|
448 | + $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code); |
|
449 | 449 | |
450 | 450 | // add currency code ? |
451 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
451 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
452 | 452 | } |
453 | 453 | // filter results |
454 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
454 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
455 | 455 | } |
456 | 456 | // clean up vars |
457 | - unset( $mny ); |
|
457 | + unset($mny); |
|
458 | 458 | // return formatted currency amount |
459 | 459 | return $amount_formatted; |
460 | 460 | } |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
470 | 470 | * @return string The localized label for the status id. |
471 | 471 | */ |
472 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
472 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
473 | 473 | /** @type EEM_Status $EEM_Status */ |
474 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
475 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
476 | - return $status[ $status_id ]; |
|
474 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
475 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
476 | + return $status[$status_id]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -488,21 +488,21 @@ discard block |
||
488 | 488 | * @param string $title |
489 | 489 | * @return string the html output for the button |
490 | 490 | */ |
491 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) { |
|
491 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') { |
|
492 | 492 | $icon_html = ''; |
493 | - if ( ! empty( $icon ) ) { |
|
494 | - $dashicons = preg_split( "(ee-icon |dashicons )", $icon ); |
|
495 | - $dashicons = array_filter( $dashicons ); |
|
496 | - $count = count( $dashicons ); |
|
493 | + if ( ! empty($icon)) { |
|
494 | + $dashicons = preg_split("(ee-icon |dashicons )", $icon); |
|
495 | + $dashicons = array_filter($dashicons); |
|
496 | + $count = count($dashicons); |
|
497 | 497 | $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : ''; |
498 | - foreach ( $dashicons as $dashicon ) { |
|
499 | - $type = strpos( $dashicon, 'ee-icon' ) !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | - $icon_html .= '<span class="' . $type . $dashicon . '"></span>'; |
|
498 | + foreach ($dashicons as $dashicon) { |
|
499 | + $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | + $icon_html .= '<span class="'.$type.$dashicon.'"></span>'; |
|
501 | 501 | } |
502 | 502 | $icon_html .= $count > 1 ? '</span>' : ''; |
503 | 503 | } |
504 | - $label = ! empty( $icon ) ? $icon_html . $label : $label; |
|
505 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>'; |
|
504 | + $label = ! empty($icon) ? $icon_html.$label : $label; |
|
505 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>'; |
|
506 | 506 | return $button; |
507 | 507 | } |
508 | 508 | |
@@ -519,21 +519,21 @@ discard block |
||
519 | 519 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
520 | 520 | * @return string generated link |
521 | 521 | */ |
522 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
522 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
523 | 523 | |
524 | - if ( ! $page ) |
|
525 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
524 | + if ( ! $page) |
|
525 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
526 | 526 | |
527 | - if ( ! $action ) |
|
528 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
527 | + if ( ! $action) |
|
528 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
529 | 529 | |
530 | 530 | $action = empty($action) ? 'default' : $action; |
531 | 531 | |
532 | 532 | |
533 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
534 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | - $help_text = !$help_text ? '' : $help_text; |
|
536 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
533 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
534 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | + $help_text = ! $help_text ? '' : $help_text; |
|
536 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param EE_Help_Tour |
546 | 546 | * @return string html |
547 | 547 | */ |
548 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
548 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
549 | 549 | $id = $tour->get_slug(); |
550 | 550 | $stops = $tour->get_stops(); |
551 | 551 | |
552 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
552 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
553 | 553 | |
554 | - foreach ( $stops as $stop ) { |
|
555 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
556 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
554 | + foreach ($stops as $stop) { |
|
555 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
556 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
557 | 557 | |
558 | 558 | //if container is set to modal then let's make sure we set the options accordingly |
559 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
559 | + if (empty($data_id) && empty($data_class)) { |
|
560 | 560 | $stop['options']['modal'] = true; |
561 | 561 | $stop['options']['expose'] = true; |
562 | 562 | } |
563 | 563 | |
564 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
565 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
564 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
565 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
566 | 566 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
567 | 567 | |
568 | 568 | //options |
569 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
569 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
570 | 570 | $options = ' data-options="'; |
571 | - foreach ( $stop['options'] as $option => $value ) { |
|
572 | - $options .= $option . ':' . $value . ';'; |
|
571 | + foreach ($stop['options'] as $option => $value) { |
|
572 | + $options .= $option.':'.$value.';'; |
|
573 | 573 | } |
574 | 574 | $options .= '"'; |
575 | 575 | } else { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | //let's put all together |
580 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
580 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | $content .= '</ol>'; |
@@ -598,31 +598,31 @@ discard block |
||
598 | 598 | * @throws EE_Error |
599 | 599 | * @return string html structure for status. |
600 | 600 | */ |
601 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
602 | - if ( !is_array( $status_array ) ) |
|
603 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
601 | + public static function status_legend($status_array, $active_status = '') { |
|
602 | + if ( ! is_array($status_array)) |
|
603 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
604 | 604 | |
605 | 605 | $setup_array = array(); |
606 | - foreach ( $status_array as $item => $status ) { |
|
606 | + foreach ($status_array as $item => $status) { |
|
607 | 607 | $setup_array[$item] = array( |
608 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
609 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
608 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
609 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
610 | 610 | 'status' => $status |
611 | 611 | ); |
612 | 612 | } |
613 | 613 | |
614 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
615 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
616 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
617 | - foreach ( $setup_array as $item => $details ) { |
|
614 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
615 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
616 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
617 | + foreach ($setup_array as $item => $details) { |
|
618 | 618 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
619 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
620 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
621 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
622 | - $content .= '</dt>' . "\n"; |
|
619 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
620 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
621 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
622 | + $content .= '</dt>'."\n"; |
|
623 | 623 | } |
624 | - $content .= '</dl>' . "\n"; |
|
625 | - $content .= '</div>' . "\n"; |
|
624 | + $content .= '</dl>'."\n"; |
|
625 | + $content .= '</div>'."\n"; |
|
626 | 626 | return $content; |
627 | 627 | } |
628 | 628 | |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * @return string |
636 | 636 | */ |
637 | 637 | public static function layout_array_as_table($data) { |
638 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
639 | - $data = (array)$data; |
|
638 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
639 | + $data = (array) $data; |
|
640 | 640 | } |
641 | 641 | ob_start(); |
642 | 642 | if (is_array($data)) { |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <td> |
652 | - <?php echo $data_key;?> |
|
652 | + <?php echo $data_key; ?> |
|
653 | 653 | </td> |
654 | 654 | <td> |
655 | - <?php echo self::layout_array_as_table($data_values);?> |
|
655 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
656 | 656 | </td> |
657 | 657 | </tr> |
658 | 658 | <?php |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | <ul> |
667 | 667 | <?php |
668 | 668 | foreach ($data as $datum) { |
669 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
669 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
670 | 670 | }?> |
671 | 671 | </ul> |
672 | 672 | <?php |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
700 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
699 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
700 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * ) |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
724 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
725 | 725 | $page_links = array(); |
726 | 726 | $disable_first = $disable_last = ''; |
727 | 727 | $total_items = (int) $total_items; |
728 | 728 | $per_page = (int) $per_page; |
729 | 729 | $current = (int) $current; |
730 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
730 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
731 | 731 | |
732 | 732 | //filter items_label |
733 | 733 | $items_label = apply_filters( |
@@ -735,68 +735,68 @@ discard block |
||
735 | 735 | $items_label |
736 | 736 | ); |
737 | 737 | |
738 | - if ( empty( $items_label ) |
|
739 | - || ! is_array( $items_label ) |
|
740 | - || ! isset( $items_label['single'] ) |
|
741 | - || ! isset( $items_label['plural'] ) ) { |
|
738 | + if (empty($items_label) |
|
739 | + || ! is_array($items_label) |
|
740 | + || ! isset($items_label['single']) |
|
741 | + || ! isset($items_label['plural'])) { |
|
742 | 742 | $items_label = array( |
743 | - 'single' => __( '1 item', 'event_espresso' ), |
|
744 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
743 | + 'single' => __('1 item', 'event_espresso'), |
|
744 | + 'plural' => __('%s items', 'event_espresso') |
|
745 | 745 | ); |
746 | 746 | } else { |
747 | 747 | $items_label = array( |
748 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
749 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
748 | + 'single' => '1 '.esc_html($items_label['single']), |
|
749 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
750 | 750 | ); |
751 | 751 | } |
752 | 752 | |
753 | - $total_pages = ceil( $total_items / $per_page ); |
|
753 | + $total_pages = ceil($total_items / $per_page); |
|
754 | 754 | |
755 | - if ( $total_pages <= 1 ) |
|
755 | + if ($total_pages <= 1) |
|
756 | 756 | return ''; |
757 | 757 | |
758 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
758 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
759 | 759 | |
760 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
760 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
761 | 761 | |
762 | - if ( $current === 1 ) { |
|
762 | + if ($current === 1) { |
|
763 | 763 | $disable_first = ' disabled'; |
764 | 764 | } |
765 | - if ( $current == $total_pages ) { |
|
765 | + if ($current == $total_pages) { |
|
766 | 766 | $disable_last = ' disabled'; |
767 | 767 | } |
768 | 768 | |
769 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | - 'first-page' . $disable_first, |
|
771 | - esc_attr__( 'Go to the first page' ), |
|
772 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
769 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | + 'first-page'.$disable_first, |
|
771 | + esc_attr__('Go to the first page'), |
|
772 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
773 | 773 | '«' |
774 | 774 | ); |
775 | 775 | |
776 | 776 | $page_links[] = sprintf( |
777 | 777 | '<a class="%s" title="%s" href="%s">%s</a>', |
778 | - 'prev-page' . $disable_first, |
|
779 | - esc_attr__( 'Go to the previous page' ), |
|
780 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
778 | + 'prev-page'.$disable_first, |
|
779 | + esc_attr__('Go to the previous page'), |
|
780 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
781 | 781 | '‹' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( ! $show_num_field ) { |
|
784 | + if ( ! $show_num_field) { |
|
785 | 785 | $html_current_page = $current; |
786 | 786 | } else { |
787 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | - esc_attr__( 'Current page' ), |
|
787 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | + esc_attr__('Current page'), |
|
789 | 789 | $current, |
790 | - strlen( $total_pages ) |
|
790 | + strlen($total_pages) |
|
791 | 791 | ); |
792 | 792 | } |
793 | 793 | |
794 | 794 | $html_total_pages = sprintf( |
795 | 795 | '<span class="total-pages">%s</span>', |
796 | - number_format_i18n( $total_pages ) |
|
796 | + number_format_i18n($total_pages) |
|
797 | 797 | ); |
798 | 798 | $page_links[] = sprintf( |
799 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
799 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
800 | 800 | $html_current_page, |
801 | 801 | $html_total_pages, |
802 | 802 | '<span class="paging-input">', |
@@ -805,29 +805,29 @@ discard block |
||
805 | 805 | |
806 | 806 | $page_links[] = sprintf( |
807 | 807 | '<a class="%s" title="%s" href="%s">%s</a>', |
808 | - 'next-page' . $disable_last, |
|
809 | - esc_attr__( 'Go to the next page' ), |
|
810 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
808 | + 'next-page'.$disable_last, |
|
809 | + esc_attr__('Go to the next page'), |
|
810 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
811 | 811 | '›' |
812 | 812 | ); |
813 | 813 | |
814 | 814 | $page_links[] = sprintf( |
815 | 815 | '<a class="%s" title="%s" href="%s">%s</a>', |
816 | - 'last-page' . $disable_last, |
|
817 | - esc_attr__( 'Go to the last page' ), |
|
818 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
816 | + 'last-page'.$disable_last, |
|
817 | + esc_attr__('Go to the last page'), |
|
818 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
819 | 819 | '»' |
820 | 820 | ); |
821 | 821 | |
822 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
822 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
823 | 823 | // set page class |
824 | - if ( $total_pages ) { |
|
824 | + if ($total_pages) { |
|
825 | 825 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
826 | 826 | } else { |
827 | 827 | $page_class = ' no-pages'; |
828 | 828 | } |
829 | 829 | |
830 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
830 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -837,18 +837,18 @@ discard block |
||
837 | 837 | * @param string $wrap_id |
838 | 838 | * @return string |
839 | 839 | */ |
840 | - public static function powered_by_event_espresso( $wrap_class = '', $wrap_id = '' ) { |
|
841 | - $attributes = ! empty( $wrap_id ) ? " id=\"{$wrap_id}\"" : ''; |
|
842 | - $attributes .= ! empty( $wrap_class ) |
|
840 | + public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '') { |
|
841 | + $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : ''; |
|
842 | + $attributes .= ! empty($wrap_class) |
|
843 | 843 | ? " class=\"{$wrap_class} powered-by-event-espresso-credit\"" |
844 | 844 | : ' class="powered-by-event-espresso-credit"'; |
845 | 845 | |
846 | 846 | $url = add_query_arg( |
847 | - array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id() ), |
|
847 | + array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id()), |
|
848 | 848 | 'https://eventespresso.com/' |
849 | 849 | ); |
850 | - $url = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso__url', $url ); |
|
851 | - $powered_by = is_admin() && ! ( defined('DOING_AJAX') && DOING_AJAX ) |
|
850 | + $url = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url); |
|
851 | + $powered_by = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
852 | 852 | ? EVENT_ESPRESSO_POWERED_BY |
853 | 853 | : 'Event Espresso'; |
854 | 854 | return (string) apply_filters( |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | '" target="_blank">', |
863 | 863 | '</a>', |
864 | 864 | "<a href=\"{$url}\" title=\"", |
865 | - '" target="_blank">' . $powered_by . '</a></div>' |
|
865 | + '" target="_blank">'.$powered_by.'</a></div>' |
|
866 | 866 | ) |
867 | 867 | ); |
868 | 868 | } |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
883 | 883 | |
884 | 884 | |
885 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
885 | +if ( ! function_exists('espresso_pagination')) { |
|
886 | 886 | /** |
887 | 887 | * espresso_pagination |
888 | 888 | * |
@@ -894,21 +894,21 @@ discard block |
||
894 | 894 | $big = 999999999; // need an unlikely integer |
895 | 895 | $pagination = paginate_links( |
896 | 896 | array( |
897 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
897 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
898 | 898 | 'format' => '?paged=%#%', |
899 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
899 | + 'current' => max(1, get_query_var('paged')), |
|
900 | 900 | 'total' => $wp_query->max_num_pages, |
901 | 901 | 'show_all' => true, |
902 | 902 | 'end_size' => 10, |
903 | 903 | 'mid_size' => 6, |
904 | 904 | 'prev_next' => true, |
905 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
906 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
905 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
906 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
907 | 907 | 'type' => 'plain', |
908 | 908 | 'add_args' => false, |
909 | 909 | 'add_fragment' => '' |
910 | 910 | ) |
911 | 911 | ); |
912 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
912 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
913 | 913 | } |
914 | 914 | } |
915 | 915 | \ No newline at end of file |