@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param string $name |
462 | 462 | * @param string $config_class |
463 | 463 | * @param EE_Config_Base $config_obj |
464 | - * @param array $tests_to_run |
|
464 | + * @param integer[] $tests_to_run |
|
465 | 465 | * @param bool $display_errors |
466 | 466 | * @return bool TRUE on success, FALSE on fail |
467 | 467 | */ |
@@ -1759,7 +1759,7 @@ discard block |
||
1759 | 1759 | |
1760 | 1760 | |
1761 | 1761 | /** |
1762 | - * @return array |
|
1762 | + * @return integer[] |
|
1763 | 1763 | */ |
1764 | 1764 | public function get_critical_pages_array() { |
1765 | 1765 | return array( |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | |
1774 | 1774 | |
1775 | 1775 | /** |
1776 | - * @return array |
|
1776 | + * @return string[] |
|
1777 | 1777 | */ |
1778 | 1778 | public function get_critical_pages_shortcodes_array() { |
1779 | 1779 | return array( |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | * according to max_input_vars |
2867 | 2867 | * |
2868 | 2868 | * @param int $input_count the count of input vars. |
2869 | - * @return array { |
|
2869 | + * @return string { |
|
2870 | 2870 | * An array that represents whether available space and if no available space the error |
2871 | 2871 | * message. |
2872 | 2872 | * @type bool $has_space whether more inputs can be added. |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @access private |
170 | 170 | */ |
171 | 171 | private function __construct() { |
172 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
172 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
173 | 173 | // setup empty config classes |
174 | 174 | $this->_initialize_config(); |
175 | 175 | // load existing EE site settings |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | // register shortcodes and modules |
180 | 180 | add_action( |
181 | 181 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
182 | - array( $this, 'register_shortcodes_and_modules' ), |
|
182 | + array($this, 'register_shortcodes_and_modules'), |
|
183 | 183 | 999 |
184 | 184 | ); |
185 | 185 | // initialize shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
186 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
187 | 187 | // register widgets |
188 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
188 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
189 | 189 | // shutdown |
190 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
190 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
191 | 191 | // construct__end hook |
192 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
192 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
193 | 193 | // hardcoded hack |
194 | 194 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
195 | 195 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return string current theme set. |
203 | 203 | */ |
204 | 204 | public static function get_current_theme() { |
205 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
205 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
206 | 206 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
207 | 207 | } |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | private function _initialize_config() { |
218 | 218 | EE_Config::trim_log(); |
219 | 219 | //set defaults |
220 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
220 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
221 | 221 | $this->addons = new stdClass(); |
222 | 222 | // set _module_route_map |
223 | 223 | EE_Config::$_module_route_map = array(); |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | */ |
238 | 238 | private function _load_core_config() { |
239 | 239 | // load_core_config__start hook |
240 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
240 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
241 | 241 | $espresso_config = $this->get_espresso_config(); |
242 | - foreach ( $espresso_config as $config => $settings ) { |
|
242 | + foreach ($espresso_config as $config => $settings) { |
|
243 | 243 | // load_core_config__start hook |
244 | 244 | $settings = apply_filters( |
245 | 245 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -247,22 +247,22 @@ discard block |
||
247 | 247 | $config, |
248 | 248 | $this |
249 | 249 | ); |
250 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
251 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
250 | + if (is_object($settings) && property_exists($this, $config)) { |
|
251 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
252 | 252 | //call configs populate method to ensure any defaults are set for empty values. |
253 | - if ( method_exists( $settings, 'populate' ) ) { |
|
253 | + if (method_exists($settings, 'populate')) { |
|
254 | 254 | $this->{$config}->populate(); |
255 | 255 | } |
256 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
256 | + if (method_exists($settings, 'do_hooks')) { |
|
257 | 257 | $this->{$config}->do_hooks(); |
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
261 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
262 | 262 | $this->update_espresso_config(); |
263 | 263 | } |
264 | 264 | // load_core_config__end hook |
265 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
265 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -277,23 +277,23 @@ discard block |
||
277 | 277 | $this->core = $this->core instanceof EE_Core_Config |
278 | 278 | ? $this->core |
279 | 279 | : new EE_Core_Config(); |
280 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
280 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
281 | 281 | $this->organization = $this->organization instanceof EE_Organization_Config |
282 | 282 | ? $this->organization |
283 | 283 | : new EE_Organization_Config(); |
284 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
284 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
285 | 285 | $this->currency = $this->currency instanceof EE_Currency_Config |
286 | 286 | ? $this->currency |
287 | 287 | : new EE_Currency_Config(); |
288 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
288 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
289 | 289 | $this->registration = $this->registration instanceof EE_Registration_Config |
290 | 290 | ? $this->registration |
291 | 291 | : new EE_Registration_Config(); |
292 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
292 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
293 | 293 | $this->admin = $this->admin instanceof EE_Admin_Config |
294 | 294 | ? $this->admin |
295 | 295 | : new EE_Admin_Config(); |
296 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
296 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
297 | 297 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
298 | 298 | ? $this->template_settings |
299 | 299 | : new EE_Template_Config(); |
@@ -304,15 +304,15 @@ discard block |
||
304 | 304 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
305 | 305 | ? $this->map_settings |
306 | 306 | : new EE_Map_Config(); |
307 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
307 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
308 | 308 | $this->environment = $this->environment instanceof EE_Environment_Config |
309 | 309 | ? $this->environment |
310 | 310 | : new EE_Environment_Config(); |
311 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
311 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
312 | 312 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
313 | 313 | ? $this->gateway |
314 | 314 | : new EE_Gateway_Config(); |
315 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
315 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | // grab espresso configuration |
328 | 328 | return apply_filters( |
329 | 329 | 'FHEE__EE_Config__get_espresso_config__CFG', |
330 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
330 | + get_option(EE_Config::OPTION_NAME, array()) |
|
331 | 331 | ); |
332 | 332 | } |
333 | 333 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * @param $old_value |
342 | 342 | * @param $value |
343 | 343 | */ |
344 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
344 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
345 | 345 | // make sure we're checking the ee config |
346 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
346 | + if ($option === EE_Config::OPTION_NAME) { |
|
347 | 347 | // run a loose comparison of the old value against the new value for type and properties, |
348 | 348 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
349 | - if ( $value != $old_value ) { |
|
349 | + if ($value != $old_value) { |
|
350 | 350 | // if they are NOT the same, then remove the hook, |
351 | 351 | // which means the subsequent update results will be based solely on the update query results |
352 | 352 | // the reason we do this is because, as stated above, |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | // the string it sees in the db looks the same as the new one it has been passed!!! |
362 | 362 | // This results in the query returning an "affected rows" value of ZERO, |
363 | 363 | // which gets returned immediately by WP update_option and looks like an error. |
364 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
364 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | } |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | */ |
376 | 376 | protected function _reset_espresso_addon_config() { |
377 | 377 | $this->_addon_option_names = array(); |
378 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
379 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
380 | - $config_class = get_class( $addon_config_obj ); |
|
381 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
382 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
378 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
379 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
380 | + $config_class = get_class($addon_config_obj); |
|
381 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
382 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
383 | 383 | } |
384 | 384 | $this->addons->{$addon_name} = null; |
385 | 385 | } |
@@ -395,22 +395,22 @@ discard block |
||
395 | 395 | * @param bool $add_error |
396 | 396 | * @return bool |
397 | 397 | */ |
398 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
398 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
399 | 399 | // don't allow config updates during WP heartbeats |
400 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
400 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
401 | 401 | return false; |
402 | 402 | } |
403 | 403 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
404 | 404 | //$clone = clone( self::$_instance ); |
405 | 405 | //self::$_instance = NULL; |
406 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
406 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
407 | 407 | $this->_reset_espresso_addon_config(); |
408 | 408 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
409 | 409 | // but BEFORE the actual update occurs |
410 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
410 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
411 | 411 | // now update "ee_config" |
412 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
413 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
412 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
413 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
414 | 414 | // if not saved... check if the hook we just added still exists; |
415 | 415 | // if it does, it means one of two things: |
416 | 416 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -421,17 +421,17 @@ discard block |
||
421 | 421 | // but just means no update occurred, so don't display an error to the user. |
422 | 422 | // BUT... if update_option returns FALSE, AND the hook is missing, |
423 | 423 | // then it means that something truly went wrong |
424 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
424 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
425 | 425 | // remove our action since we don't want it in the system anymore |
426 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
427 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
426 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
427 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
428 | 428 | //self::$_instance = $clone; |
429 | 429 | //unset( $clone ); |
430 | 430 | // if config remains the same or was updated successfully |
431 | - if ( $saved ) { |
|
432 | - if ( $add_success ) { |
|
431 | + if ($saved) { |
|
432 | + if ($add_success) { |
|
433 | 433 | EE_Error::add_success( |
434 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
434 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
435 | 435 | __FILE__, |
436 | 436 | __FUNCTION__, |
437 | 437 | __LINE__ |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | } |
440 | 440 | return true; |
441 | 441 | } else { |
442 | - if ( $add_error ) { |
|
442 | + if ($add_error) { |
|
443 | 443 | EE_Error::add_error( |
444 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
444 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
445 | 445 | __FILE__, |
446 | 446 | __FUNCTION__, |
447 | 447 | __LINE__ |
@@ -470,16 +470,16 @@ discard block |
||
470 | 470 | $name = '', |
471 | 471 | $config_class = '', |
472 | 472 | $config_obj = null, |
473 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
473 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
474 | 474 | $display_errors = true |
475 | 475 | ) { |
476 | 476 | try { |
477 | - foreach ( $tests_to_run as $test ) { |
|
478 | - switch ( $test ) { |
|
477 | + foreach ($tests_to_run as $test) { |
|
478 | + switch ($test) { |
|
479 | 479 | // TEST #1 : check that section was set |
480 | 480 | case 1 : |
481 | - if ( empty( $section ) ) { |
|
482 | - if ( $display_errors ) { |
|
481 | + if (empty($section)) { |
|
482 | + if ($display_errors) { |
|
483 | 483 | throw new EE_Error( |
484 | 484 | sprintf( |
485 | 485 | __( |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | break; |
496 | 496 | // TEST #2 : check that settings section exists |
497 | 497 | case 2 : |
498 | - if ( ! isset( $this->{$section} ) ) { |
|
499 | - if ( $display_errors ) { |
|
498 | + if ( ! isset($this->{$section} )) { |
|
499 | + if ($display_errors) { |
|
500 | 500 | throw new EE_Error( |
501 | 501 | sprintf( |
502 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
502 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
503 | 503 | $section |
504 | 504 | ) |
505 | 505 | ); |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | // TEST #3 : check that section is the proper format |
511 | 511 | case 3 : |
512 | 512 | if ( |
513 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
513 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
514 | 514 | ) { |
515 | - if ( $display_errors ) { |
|
515 | + if ($display_errors) { |
|
516 | 516 | throw new EE_Error( |
517 | 517 | sprintf( |
518 | 518 | __( |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | break; |
529 | 529 | // TEST #4 : check that config section name has been set |
530 | 530 | case 4 : |
531 | - if ( empty( $name ) ) { |
|
532 | - if ( $display_errors ) { |
|
531 | + if (empty($name)) { |
|
532 | + if ($display_errors) { |
|
533 | 533 | throw new EE_Error( |
534 | 534 | __( |
535 | 535 | 'No name has been provided for the specific configuration section.', |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | break; |
543 | 543 | // TEST #5 : check that a config class name has been set |
544 | 544 | case 5 : |
545 | - if ( empty( $config_class ) ) { |
|
546 | - if ( $display_errors ) { |
|
545 | + if (empty($config_class)) { |
|
546 | + if ($display_errors) { |
|
547 | 547 | throw new EE_Error( |
548 | 548 | __( |
549 | 549 | 'No class name has been provided for the specific configuration section.', |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | break; |
557 | 557 | // TEST #6 : verify config class is accessible |
558 | 558 | case 6 : |
559 | - if ( ! class_exists( $config_class ) ) { |
|
560 | - if ( $display_errors ) { |
|
559 | + if ( ! class_exists($config_class)) { |
|
560 | + if ($display_errors) { |
|
561 | 561 | throw new EE_Error( |
562 | 562 | sprintf( |
563 | 563 | __( |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | break; |
574 | 574 | // TEST #7 : check that config has even been set |
575 | 575 | case 7 : |
576 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
577 | - if ( $display_errors ) { |
|
576 | + if ( ! isset($this->{$section}->{$name} )) { |
|
577 | + if ($display_errors) { |
|
578 | 578 | throw new EE_Error( |
579 | 579 | sprintf( |
580 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
580 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
581 | 581 | $section, |
582 | 582 | $name |
583 | 583 | ) |
@@ -586,13 +586,13 @@ discard block |
||
586 | 586 | return false; |
587 | 587 | } else { |
588 | 588 | // and make sure it's not serialized |
589 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
589 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
590 | 590 | } |
591 | 591 | break; |
592 | 592 | // TEST #8 : check that config is the requested type |
593 | 593 | case 8 : |
594 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
595 | - if ( $display_errors ) { |
|
594 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
595 | + if ($display_errors) { |
|
596 | 596 | throw new EE_Error( |
597 | 597 | sprintf( |
598 | 598 | __( |
@@ -610,12 +610,12 @@ discard block |
||
610 | 610 | break; |
611 | 611 | // TEST #9 : verify config object |
612 | 612 | case 9 : |
613 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
614 | - if ( $display_errors ) { |
|
613 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
614 | + if ($display_errors) { |
|
615 | 615 | throw new EE_Error( |
616 | 616 | sprintf( |
617 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
618 | - print_r( $config_obj, true ) |
|
617 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
618 | + print_r($config_obj, true) |
|
619 | 619 | ) |
620 | 620 | ); |
621 | 621 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | break; |
625 | 625 | } |
626 | 626 | } |
627 | - } catch ( EE_Error $e ) { |
|
627 | + } catch (EE_Error $e) { |
|
628 | 628 | $e->get_error(); |
629 | 629 | } |
630 | 630 | // you have successfully run the gauntlet |
@@ -641,8 +641,8 @@ discard block |
||
641 | 641 | * @param string $name |
642 | 642 | * @return string |
643 | 643 | */ |
644 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
645 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
644 | + private function _generate_config_option_name($section = '', $name = '') { |
|
645 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @param string $name |
657 | 657 | * @return string |
658 | 658 | */ |
659 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
660 | - return ! empty( $config_class ) |
|
659 | + private function _set_config_class($config_class = '', $name = '') { |
|
660 | + return ! empty($config_class) |
|
661 | 661 | ? $config_class |
662 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
662 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | |
@@ -674,36 +674,36 @@ discard block |
||
674 | 674 | * @param EE_Config_Base $config_obj |
675 | 675 | * @return EE_Config_Base |
676 | 676 | */ |
677 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
677 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
678 | 678 | // ensure config class is set to something |
679 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
679 | + $config_class = $this->_set_config_class($config_class, $name); |
|
680 | 680 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
681 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
681 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
682 | 682 | return null; |
683 | 683 | } |
684 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
684 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
685 | 685 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
686 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
687 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
686 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
687 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
688 | 688 | $this->update_addon_option_names(); |
689 | 689 | } |
690 | 690 | // verify the incoming config object but suppress errors |
691 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
691 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
692 | 692 | $config_obj = new $config_class(); |
693 | 693 | } |
694 | - if ( get_option( $config_option_name ) ) { |
|
695 | - EE_Config::log( $config_option_name ); |
|
696 | - update_option( $config_option_name, $config_obj ); |
|
694 | + if (get_option($config_option_name)) { |
|
695 | + EE_Config::log($config_option_name); |
|
696 | + update_option($config_option_name, $config_obj); |
|
697 | 697 | $this->{$section}->{$name} = $config_obj; |
698 | 698 | return $this->{$section}->{$name}; |
699 | 699 | } else { |
700 | 700 | // create a wp-option for this config |
701 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
702 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
701 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
702 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
703 | 703 | return $this->{$section}->{$name}; |
704 | 704 | } else { |
705 | 705 | EE_Error::add_error( |
706 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
706 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
707 | 707 | __FILE__, |
708 | 708 | __FUNCTION__, |
709 | 709 | __LINE__ |
@@ -726,46 +726,46 @@ discard block |
||
726 | 726 | * @param bool $throw_errors |
727 | 727 | * @return bool |
728 | 728 | */ |
729 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
729 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
730 | 730 | // don't allow config updates during WP heartbeats |
731 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
731 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
732 | 732 | return false; |
733 | 733 | } |
734 | - $config_obj = maybe_unserialize( $config_obj ); |
|
734 | + $config_obj = maybe_unserialize($config_obj); |
|
735 | 735 | // get class name of the incoming object |
736 | - $config_class = get_class( $config_obj ); |
|
736 | + $config_class = get_class($config_obj); |
|
737 | 737 | // run tests 1-5 and 9 to verify config |
738 | 738 | if ( ! $this->_verify_config_params( |
739 | 739 | $section, |
740 | 740 | $name, |
741 | 741 | $config_class, |
742 | 742 | $config_obj, |
743 | - array( 1, 2, 3, 4, 7, 9 ) |
|
743 | + array(1, 2, 3, 4, 7, 9) |
|
744 | 744 | ) |
745 | 745 | ) { |
746 | 746 | return false; |
747 | 747 | } |
748 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
748 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
749 | 749 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
750 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
750 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
751 | 751 | // save new config to db |
752 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
752 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
753 | 753 | return true; |
754 | 754 | } |
755 | 755 | } else { |
756 | 756 | // first check if the record already exists |
757 | - $existing_config = get_option( $config_option_name ); |
|
758 | - $config_obj = serialize( $config_obj ); |
|
757 | + $existing_config = get_option($config_option_name); |
|
758 | + $config_obj = serialize($config_obj); |
|
759 | 759 | // just return if db record is already up to date (NOT type safe comparison) |
760 | - if ( $existing_config == $config_obj ) { |
|
760 | + if ($existing_config == $config_obj) { |
|
761 | 761 | $this->{$section}->{$name} = $config_obj; |
762 | 762 | return true; |
763 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
764 | - EE_Config::log( $config_option_name ); |
|
763 | + } else if (update_option($config_option_name, $config_obj)) { |
|
764 | + EE_Config::log($config_option_name); |
|
765 | 765 | // update wp-option for this config class |
766 | 766 | $this->{$section}->{$name} = $config_obj; |
767 | 767 | return true; |
768 | - } elseif ( $throw_errors ) { |
|
768 | + } elseif ($throw_errors) { |
|
769 | 769 | EE_Error::add_error( |
770 | 770 | sprintf( |
771 | 771 | __( |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | 'event_espresso' |
774 | 774 | ), |
775 | 775 | $config_class, |
776 | - 'EE_Config->' . $section . '->' . $name |
|
776 | + 'EE_Config->'.$section.'->'.$name |
|
777 | 777 | ), |
778 | 778 | __FILE__, |
779 | 779 | __FUNCTION__, |
@@ -795,34 +795,34 @@ discard block |
||
795 | 795 | * @param string $config_class |
796 | 796 | * @return mixed EE_Config_Base | NULL |
797 | 797 | */ |
798 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
798 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
799 | 799 | // ensure config class is set to something |
800 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
800 | + $config_class = $this->_set_config_class($config_class, $name); |
|
801 | 801 | // run tests 1-4, 6 and 7 to verify that all params have been set |
802 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
802 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
803 | 803 | return null; |
804 | 804 | } |
805 | 805 | // now test if the requested config object exists, but suppress errors |
806 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
806 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
807 | 807 | // config already exists, so pass it back |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // load config option from db if it exists |
811 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
811 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
812 | 812 | // verify the newly retrieved config object, but suppress errors |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
814 | 814 | // config is good, so set it and pass it back |
815 | 815 | $this->{$section}->{$name} = $config_obj; |
816 | 816 | return $this->{$section}->{$name}; |
817 | 817 | } |
818 | 818 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
819 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
819 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
820 | 820 | // verify the newly created config object |
821 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
821 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
822 | 822 | return $this->{$section}->{$name}; |
823 | 823 | } else { |
824 | 824 | EE_Error::add_error( |
825 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
825 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
826 | 826 | __FILE__, |
827 | 827 | __FUNCTION__, |
828 | 828 | __LINE__ |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | * @param string $config_option_name |
841 | 841 | * @return mixed EE_Config_Base | FALSE |
842 | 842 | */ |
843 | - public function get_config_option( $config_option_name = '' ) { |
|
843 | + public function get_config_option($config_option_name = '') { |
|
844 | 844 | // retrieve the wp-option for this config class. |
845 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
846 | - if ( empty( $config_option ) ) { |
|
847 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
845 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
846 | + if (empty($config_option)) { |
|
847 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
848 | 848 | } |
849 | 849 | return $config_option; |
850 | 850 | } |
@@ -856,17 +856,17 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @param string $config_option_name |
858 | 858 | */ |
859 | - public static function log( $config_option_name = '' ) { |
|
860 | - if ( ! empty( $config_option_name ) ) { |
|
861 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
859 | + public static function log($config_option_name = '') { |
|
860 | + if ( ! empty($config_option_name)) { |
|
861 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
862 | 862 | //copy incoming $_REQUEST and sanitize it so we can save it |
863 | 863 | $_request = $_REQUEST; |
864 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
865 | - $config_log[ (string) microtime( true ) ] = array( |
|
864 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
865 | + $config_log[(string) microtime(true)] = array( |
|
866 | 866 | 'config_name' => $config_option_name, |
867 | 867 | 'request' => $_request, |
868 | 868 | ); |
869 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
869 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
878 | 878 | */ |
879 | 879 | public static function trim_log() { |
880 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
881 | - $log_length = count( $config_log ); |
|
882 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
883 | - ksort( $config_log ); |
|
884 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
885 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
881 | + $log_length = count($config_log); |
|
882 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
883 | + ksort($config_log); |
|
884 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
885 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | * @return string |
898 | 898 | */ |
899 | 899 | public static function get_page_for_posts() { |
900 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
901 | - if ( ! $page_for_posts ) { |
|
900 | + $page_for_posts = get_option('page_for_posts'); |
|
901 | + if ( ! $page_for_posts) { |
|
902 | 902 | return 'posts'; |
903 | 903 | } |
904 | 904 | /** @type WPDB $wpdb */ |
905 | 905 | global $wpdb; |
906 | 906 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
907 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
907 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -960,17 +960,17 @@ discard block |
||
960 | 960 | ) |
961 | 961 | ) { |
962 | 962 | // grab list of installed widgets |
963 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
963 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
964 | 964 | // filter list of modules to register |
965 | 965 | $widgets_to_register = apply_filters( |
966 | 966 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
967 | 967 | $widgets_to_register |
968 | 968 | ); |
969 | - if ( ! empty( $widgets_to_register ) ) { |
|
969 | + if ( ! empty($widgets_to_register)) { |
|
970 | 970 | // cycle thru widget folders |
971 | - foreach ( $widgets_to_register as $widget_path ) { |
|
971 | + foreach ($widgets_to_register as $widget_path) { |
|
972 | 972 | // add to list of installed widget modules |
973 | - EE_Config::register_ee_widget( $widget_path ); |
|
973 | + EE_Config::register_ee_widget($widget_path); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | // filter list of installed modules |
@@ -990,57 +990,57 @@ discard block |
||
990 | 990 | * @param string $widget_path - full path up to and including widget folder |
991 | 991 | * @return void |
992 | 992 | */ |
993 | - public static function register_ee_widget( $widget_path = null ) { |
|
994 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
993 | + public static function register_ee_widget($widget_path = null) { |
|
994 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
995 | 995 | $widget_ext = '.widget.php'; |
996 | 996 | // make all separators match |
997 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
997 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
998 | 998 | // does the file path INCLUDE the actual file name as part of the path ? |
999 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
999 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1000 | 1000 | // grab and shortcode file name from directory name and break apart at dots |
1001 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1001 | + $file_name = explode('.', basename($widget_path)); |
|
1002 | 1002 | // take first segment from file name pieces and remove class prefix if it exists |
1003 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1003 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1004 | 1004 | // sanitize shortcode directory name |
1005 | - $widget = sanitize_key( $widget ); |
|
1005 | + $widget = sanitize_key($widget); |
|
1006 | 1006 | // now we need to rebuild the shortcode path |
1007 | - $widget_path = explode( DS, $widget_path ); |
|
1007 | + $widget_path = explode(DS, $widget_path); |
|
1008 | 1008 | // remove last segment |
1009 | - array_pop( $widget_path ); |
|
1009 | + array_pop($widget_path); |
|
1010 | 1010 | // glue it back together |
1011 | - $widget_path = implode( DS, $widget_path ); |
|
1011 | + $widget_path = implode(DS, $widget_path); |
|
1012 | 1012 | } else { |
1013 | 1013 | // grab and sanitize widget directory name |
1014 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1014 | + $widget = sanitize_key(basename($widget_path)); |
|
1015 | 1015 | } |
1016 | 1016 | // create classname from widget directory name |
1017 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1017 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1018 | 1018 | // add class prefix |
1019 | - $widget_class = 'EEW_' . $widget; |
|
1019 | + $widget_class = 'EEW_'.$widget; |
|
1020 | 1020 | // does the widget exist ? |
1021 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1021 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1022 | 1022 | $msg = sprintf( |
1023 | 1023 | __( |
1024 | 1024 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1025 | 1025 | 'event_espresso' |
1026 | 1026 | ), |
1027 | 1027 | $widget_class, |
1028 | - $widget_path . DS . $widget_class . $widget_ext |
|
1028 | + $widget_path.DS.$widget_class.$widget_ext |
|
1029 | 1029 | ); |
1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | 1033 | // load the widget class file |
1034 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1034 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1035 | 1035 | // verify that class exists |
1036 | - if ( ! class_exists( $widget_class ) ) { |
|
1037 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1038 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1036 | + if ( ! class_exists($widget_class)) { |
|
1037 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1038 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1039 | 1039 | return; |
1040 | 1040 | } |
1041 | - register_widget( $widget_class ); |
|
1041 | + register_widget($widget_class); |
|
1042 | 1042 | // add to array of registered widgets |
1043 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1043 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
@@ -1053,17 +1053,17 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | private function _register_shortcodes() { |
1055 | 1055 | // grab list of installed shortcodes |
1056 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1056 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1057 | 1057 | // filter list of modules to register |
1058 | 1058 | $shortcodes_to_register = apply_filters( |
1059 | 1059 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1060 | 1060 | $shortcodes_to_register |
1061 | 1061 | ); |
1062 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1062 | + if ( ! empty($shortcodes_to_register)) { |
|
1063 | 1063 | // cycle thru shortcode folders |
1064 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1064 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1065 | 1065 | // add to list of installed shortcode modules |
1066 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1066 | + EE_Config::register_shortcode($shortcode_path); |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | // filter list of installed modules |
@@ -1082,64 +1082,64 @@ discard block |
||
1082 | 1082 | * @param string $shortcode_path - full path up to and including shortcode folder |
1083 | 1083 | * @return bool |
1084 | 1084 | */ |
1085 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1086 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1085 | + public static function register_shortcode($shortcode_path = null) { |
|
1086 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1087 | 1087 | $shortcode_ext = '.shortcode.php'; |
1088 | 1088 | // make all separators match |
1089 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1089 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1090 | 1090 | // does the file path INCLUDE the actual file name as part of the path ? |
1091 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1091 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1092 | 1092 | // grab shortcode file name from directory name and break apart at dots |
1093 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1093 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1094 | 1094 | // take first segment from file name pieces and remove class prefix if it exists |
1095 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1096 | - ? substr( $shortcode_file[0], 4 ) |
|
1095 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1096 | + ? substr($shortcode_file[0], 4) |
|
1097 | 1097 | : $shortcode_file[0]; |
1098 | 1098 | // sanitize shortcode directory name |
1099 | - $shortcode = sanitize_key( $shortcode ); |
|
1099 | + $shortcode = sanitize_key($shortcode); |
|
1100 | 1100 | // now we need to rebuild the shortcode path |
1101 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1101 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1102 | 1102 | // remove last segment |
1103 | - array_pop( $shortcode_path ); |
|
1103 | + array_pop($shortcode_path); |
|
1104 | 1104 | // glue it back together |
1105 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1105 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1106 | 1106 | } else { |
1107 | 1107 | // we need to generate the filename based off of the folder name |
1108 | 1108 | // grab and sanitize shortcode directory name |
1109 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1110 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1109 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1110 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1111 | 1111 | } |
1112 | 1112 | // create classname from shortcode directory or file name |
1113 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1113 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1114 | 1114 | // add class prefix |
1115 | - $shortcode_class = 'EES_' . $shortcode; |
|
1115 | + $shortcode_class = 'EES_'.$shortcode; |
|
1116 | 1116 | // does the shortcode exist ? |
1117 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1117 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1118 | 1118 | $msg = sprintf( |
1119 | 1119 | __( |
1120 | 1120 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1121 | 1121 | 'event_espresso' |
1122 | 1122 | ), |
1123 | 1123 | $shortcode_class, |
1124 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1124 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1125 | 1125 | ); |
1126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1127 | 1127 | return false; |
1128 | 1128 | } |
1129 | 1129 | // load the shortcode class file |
1130 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1130 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1131 | 1131 | // verify that class exists |
1132 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1132 | + if ( ! class_exists($shortcode_class)) { |
|
1133 | 1133 | $msg = sprintf( |
1134 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1134 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1135 | 1135 | $shortcode_class |
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | - $shortcode = strtoupper( $shortcode ); |
|
1140 | + $shortcode = strtoupper($shortcode); |
|
1141 | 1141 | // add to array of registered shortcodes |
1142 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1142 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1143 | 1143 | return true; |
1144 | 1144 | } |
1145 | 1145 | |
@@ -1153,22 +1153,22 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | private function _register_modules() { |
1155 | 1155 | // grab list of installed modules |
1156 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1156 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1157 | 1157 | // filter list of modules to register |
1158 | 1158 | $modules_to_register = apply_filters( |
1159 | 1159 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1160 | 1160 | $modules_to_register |
1161 | 1161 | ); |
1162 | - if ( ! empty( $modules_to_register ) ) { |
|
1162 | + if ( ! empty($modules_to_register)) { |
|
1163 | 1163 | // loop through folders |
1164 | - foreach ( $modules_to_register as $module_path ) { |
|
1164 | + foreach ($modules_to_register as $module_path) { |
|
1165 | 1165 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1166 | 1166 | if ( |
1167 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1168 | - && $module_path !== EE_MODULES . 'gateways' |
|
1167 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1168 | + && $module_path !== EE_MODULES.'gateways' |
|
1169 | 1169 | ) { |
1170 | 1170 | // add to list of installed modules |
1171 | - EE_Config::register_module( $module_path ); |
|
1171 | + EE_Config::register_module($module_path); |
|
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1188,39 +1188,39 @@ discard block |
||
1188 | 1188 | * @param string $module_path - full path up to and including module folder |
1189 | 1189 | * @return bool |
1190 | 1190 | */ |
1191 | - public static function register_module( $module_path = null ) { |
|
1192 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1191 | + public static function register_module($module_path = null) { |
|
1192 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1193 | 1193 | $module_ext = '.module.php'; |
1194 | 1194 | // make all separators match |
1195 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1195 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1196 | 1196 | // does the file path INCLUDE the actual file name as part of the path ? |
1197 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1197 | + if (strpos($module_path, $module_ext) !== false) { |
|
1198 | 1198 | // grab and shortcode file name from directory name and break apart at dots |
1199 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1199 | + $module_file = explode('.', basename($module_path)); |
|
1200 | 1200 | // now we need to rebuild the shortcode path |
1201 | - $module_path = explode( DS, $module_path ); |
|
1201 | + $module_path = explode(DS, $module_path); |
|
1202 | 1202 | // remove last segment |
1203 | - array_pop( $module_path ); |
|
1203 | + array_pop($module_path); |
|
1204 | 1204 | // glue it back together |
1205 | - $module_path = implode( DS, $module_path ) . DS; |
|
1205 | + $module_path = implode(DS, $module_path).DS; |
|
1206 | 1206 | // take first segment from file name pieces and sanitize it |
1207 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1207 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1208 | 1208 | // ensure class prefix is added |
1209 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1209 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1210 | 1210 | } else { |
1211 | 1211 | // we need to generate the filename based off of the folder name |
1212 | 1212 | // grab and sanitize module name |
1213 | - $module = strtolower( basename( $module_path ) ); |
|
1214 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1213 | + $module = strtolower(basename($module_path)); |
|
1214 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1215 | 1215 | // like trailingslashit() |
1216 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1216 | + $module_path = rtrim($module_path, DS).DS; |
|
1217 | 1217 | // create classname from module directory name |
1218 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1218 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1219 | 1219 | // add class prefix |
1220 | - $module_class = 'EED_' . $module; |
|
1220 | + $module_class = 'EED_'.$module; |
|
1221 | 1221 | } |
1222 | 1222 | // does the module exist ? |
1223 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1223 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1224 | 1224 | $msg = sprintf( |
1225 | 1225 | __( |
1226 | 1226 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1228,19 +1228,19 @@ discard block |
||
1228 | 1228 | ), |
1229 | 1229 | $module |
1230 | 1230 | ); |
1231 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1231 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // load the module class file |
1235 | - require_once( $module_path . $module_class . $module_ext ); |
|
1235 | + require_once($module_path.$module_class.$module_ext); |
|
1236 | 1236 | // verify that class exists |
1237 | - if ( ! class_exists( $module_class ) ) { |
|
1238 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1239 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1237 | + if ( ! class_exists($module_class)) { |
|
1238 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1239 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | // add to array of registered modules |
1243 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1243 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1244 | 1244 | do_action( |
1245 | 1245 | 'AHEE__EE_Config__register_module__complete', |
1246 | 1246 | $module_class, |
@@ -1260,26 +1260,26 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | private function _initialize_shortcodes() { |
1262 | 1262 | // cycle thru shortcode folders |
1263 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1263 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1264 | 1264 | // add class prefix |
1265 | - $shortcode_class = 'EES_' . $shortcode; |
|
1265 | + $shortcode_class = 'EES_'.$shortcode; |
|
1266 | 1266 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1267 | 1267 | // which set hooks ? |
1268 | - if ( is_admin() ) { |
|
1268 | + if (is_admin()) { |
|
1269 | 1269 | // fire immediately |
1270 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1270 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1271 | 1271 | } else { |
1272 | 1272 | // delay until other systems are online |
1273 | 1273 | add_action( |
1274 | 1274 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1275 | - array( $shortcode_class, 'set_hooks' ) |
|
1275 | + array($shortcode_class, 'set_hooks') |
|
1276 | 1276 | ); |
1277 | 1277 | // convert classname to UPPERCASE and create WP shortcode. |
1278 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1278 | + $shortcode_tag = strtoupper($shortcode); |
|
1279 | 1279 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1280 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1280 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1281 | 1281 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1282 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1282 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1296,17 +1296,17 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | private function _initialize_modules() { |
1298 | 1298 | // cycle thru shortcode folders |
1299 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1299 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1300 | 1300 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1301 | 1301 | // which set hooks ? |
1302 | - if ( is_admin() ) { |
|
1302 | + if (is_admin()) { |
|
1303 | 1303 | // fire immediately |
1304 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1304 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1305 | 1305 | } else { |
1306 | 1306 | // delay until other systems are online |
1307 | 1307 | add_action( |
1308 | 1308 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1309 | - array( $module_class, 'set_hooks' ) |
|
1309 | + array($module_class, 'set_hooks') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | } |
@@ -1324,29 +1324,29 @@ discard block |
||
1324 | 1324 | * @param string $key - url param key indicating a route is being called |
1325 | 1325 | * @return bool |
1326 | 1326 | */ |
1327 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1328 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1329 | - $module = str_replace( 'EED_', '', $module ); |
|
1330 | - $module_class = 'EED_' . $module; |
|
1331 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1332 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1333 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1328 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1329 | + $module = str_replace('EED_', '', $module); |
|
1330 | + $module_class = 'EED_'.$module; |
|
1331 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1332 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1333 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1334 | 1334 | return false; |
1335 | 1335 | } |
1336 | - if ( empty( $route ) ) { |
|
1337 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1338 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if (empty($route)) { |
|
1337 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1338 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1339 | 1339 | return false; |
1340 | 1340 | } |
1341 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1341 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1342 | 1342 | $msg = sprintf( |
1343 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1343 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1344 | 1344 | $route |
1345 | 1345 | ); |
1346 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1347 | 1347 | return false; |
1348 | 1348 | } |
1349 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1349 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1350 | 1350 | return true; |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1360,11 +1360,11 @@ discard block |
||
1360 | 1360 | * @param string $key - url param key indicating a route is being called |
1361 | 1361 | * @return string |
1362 | 1362 | */ |
1363 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1364 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1365 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1366 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1367 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1363 | + public static function get_route($route = null, $key = 'ee') { |
|
1364 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1365 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1366 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1367 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1368 | 1368 | } |
1369 | 1369 | return null; |
1370 | 1370 | } |
@@ -1394,49 +1394,49 @@ discard block |
||
1394 | 1394 | * @param string $key - url param key indicating a route is being called |
1395 | 1395 | * @return bool |
1396 | 1396 | */ |
1397 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1398 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1399 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1397 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1398 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1399 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1400 | 1400 | $msg = sprintf( |
1401 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1401 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1402 | 1402 | $route |
1403 | 1403 | ); |
1404 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1404 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1405 | 1405 | return false; |
1406 | 1406 | } |
1407 | - if ( empty( $forward ) ) { |
|
1408 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1409 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1407 | + if (empty($forward)) { |
|
1408 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1409 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1410 | 1410 | return false; |
1411 | 1411 | } |
1412 | - if ( is_array( $forward ) ) { |
|
1413 | - if ( ! isset( $forward[1] ) ) { |
|
1412 | + if (is_array($forward)) { |
|
1413 | + if ( ! isset($forward[1])) { |
|
1414 | 1414 | $msg = sprintf( |
1415 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1415 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1416 | 1416 | $route |
1417 | 1417 | ); |
1418 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1419 | 1419 | return false; |
1420 | 1420 | } |
1421 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1421 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1422 | 1422 | $msg = sprintf( |
1423 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1423 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1424 | 1424 | $forward[1], |
1425 | 1425 | $route |
1426 | 1426 | ); |
1427 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1427 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - } else if ( ! function_exists( $forward ) ) { |
|
1430 | + } else if ( ! function_exists($forward)) { |
|
1431 | 1431 | $msg = sprintf( |
1432 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1432 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1433 | 1433 | $forward, |
1434 | 1434 | $route |
1435 | 1435 | ); |
1436 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | 1437 | return false; |
1438 | 1438 | } |
1439 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1439 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1440 | 1440 | return true; |
1441 | 1441 | } |
1442 | 1442 | |
@@ -1452,12 +1452,12 @@ discard block |
||
1452 | 1452 | * @param string $key - url param key indicating a route is being called |
1453 | 1453 | * @return string |
1454 | 1454 | */ |
1455 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1456 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1457 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1455 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1456 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1457 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1458 | 1458 | return apply_filters( |
1459 | 1459 | 'FHEE__EE_Config__get_forward', |
1460 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1460 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1461 | 1461 | $route, |
1462 | 1462 | $status |
1463 | 1463 | ); |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * @param string $key - url param key indicating a route is being called |
1480 | 1480 | * @return bool |
1481 | 1481 | */ |
1482 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1483 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1484 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1482 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1483 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1484 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1485 | 1485 | $msg = sprintf( |
1486 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1486 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1487 | 1487 | $route |
1488 | 1488 | ); |
1489 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1489 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1490 | 1490 | return false; |
1491 | 1491 | } |
1492 | - if ( ! is_readable( $view ) ) { |
|
1492 | + if ( ! is_readable($view)) { |
|
1493 | 1493 | $msg = sprintf( |
1494 | 1494 | __( |
1495 | 1495 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1497,10 +1497,10 @@ discard block |
||
1497 | 1497 | ), |
1498 | 1498 | $view |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1503 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1504 | 1504 | return true; |
1505 | 1505 | } |
1506 | 1506 | |
@@ -1516,12 +1516,12 @@ discard block |
||
1516 | 1516 | * @param string $key - url param key indicating a route is being called |
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1520 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1521 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1519 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1520 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1521 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1522 | 1522 | return apply_filters( |
1523 | 1523 | 'FHEE__EE_Config__get_view', |
1524 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1524 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1525 | 1525 | $route, |
1526 | 1526 | $status |
1527 | 1527 | ); |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | |
1534 | 1534 | public function update_addon_option_names() { |
1535 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1535 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | |
@@ -1560,22 +1560,22 @@ discard block |
||
1560 | 1560 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1561 | 1561 | * @throws \EE_Error |
1562 | 1562 | */ |
1563 | - public function get_pretty( $property ) { |
|
1564 | - if ( ! property_exists( $this, $property ) ) { |
|
1563 | + public function get_pretty($property) { |
|
1564 | + if ( ! property_exists($this, $property)) { |
|
1565 | 1565 | throw new EE_Error( |
1566 | 1566 | sprintf( |
1567 | 1567 | __( |
1568 | 1568 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1569 | 1569 | 'event_espresso' |
1570 | 1570 | ), |
1571 | - get_class( $this ), |
|
1571 | + get_class($this), |
|
1572 | 1572 | $property |
1573 | 1573 | ) |
1574 | 1574 | ); |
1575 | 1575 | } |
1576 | 1576 | //just handling escaping of strings for now. |
1577 | - if ( is_string( $this->{$property} ) ) { |
|
1578 | - return stripslashes( $this->{$property} ); |
|
1577 | + if (is_string($this->{$property} )) { |
|
1578 | + return stripslashes($this->{$property} ); |
|
1579 | 1579 | } |
1580 | 1580 | return $this->{$property}; |
1581 | 1581 | } |
@@ -1584,17 +1584,17 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | public function populate() { |
1586 | 1586 | //grab defaults via a new instance of this class. |
1587 | - $class_name = get_class( $this ); |
|
1587 | + $class_name = get_class($this); |
|
1588 | 1588 | $defaults = new $class_name; |
1589 | 1589 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1590 | 1590 | //default from our $defaults object. |
1591 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1592 | - if ( $this->{$property} === null ) { |
|
1591 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1592 | + if ($this->{$property} === null) { |
|
1593 | 1593 | $this->{$property} = $value; |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | //cleanup |
1597 | - unset( $defaults ); |
|
1597 | + unset($defaults); |
|
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | * @param $a |
1611 | 1611 | * @return bool |
1612 | 1612 | */ |
1613 | - public function __isset( $a ) { |
|
1613 | + public function __isset($a) { |
|
1614 | 1614 | return false; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | * @param $a |
1623 | 1623 | * @return bool |
1624 | 1624 | */ |
1625 | - public function __unset( $a ) { |
|
1625 | + public function __unset($a) { |
|
1626 | 1626 | return false; |
1627 | 1627 | } |
1628 | 1628 | |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | $this->current_blog_id = get_current_blog_id(); |
1733 | 1733 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1734 | 1734 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1735 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1735 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1736 | 1736 | $this->post_shortcodes = array(); |
1737 | 1737 | $this->module_route_map = array(); |
1738 | 1738 | $this->module_forward_map = array(); |
@@ -1748,9 +1748,9 @@ discard block |
||
1748 | 1748 | $this->thank_you_page_url = ''; |
1749 | 1749 | $this->cancel_page_url = ''; |
1750 | 1750 | //cpt slugs |
1751 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1751 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1752 | 1752 | //ueip constant check |
1753 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1753 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1754 | 1754 | $this->ee_ueip_optin = false; |
1755 | 1755 | $this->ee_ueip_has_notified = true; |
1756 | 1756 | } |
@@ -1793,11 +1793,11 @@ discard block |
||
1793 | 1793 | * @return string |
1794 | 1794 | */ |
1795 | 1795 | public function reg_page_url() { |
1796 | - if ( ! $this->reg_page_url ) { |
|
1796 | + if ( ! $this->reg_page_url) { |
|
1797 | 1797 | $this->reg_page_url = add_query_arg( |
1798 | - array( 'uts' => time() ), |
|
1799 | - get_permalink( $this->reg_page_id ) |
|
1800 | - ) . '#checkout'; |
|
1798 | + array('uts' => time()), |
|
1799 | + get_permalink($this->reg_page_id) |
|
1800 | + ).'#checkout'; |
|
1801 | 1801 | } |
1802 | 1802 | return $this->reg_page_url; |
1803 | 1803 | } |
@@ -1812,12 +1812,12 @@ discard block |
||
1812 | 1812 | * @access public |
1813 | 1813 | * @return string |
1814 | 1814 | */ |
1815 | - public function txn_page_url( $query_args = array() ) { |
|
1816 | - if ( ! $this->txn_page_url ) { |
|
1817 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1815 | + public function txn_page_url($query_args = array()) { |
|
1816 | + if ( ! $this->txn_page_url) { |
|
1817 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1818 | 1818 | } |
1819 | - if ( $query_args ) { |
|
1820 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1819 | + if ($query_args) { |
|
1820 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1821 | 1821 | } else { |
1822 | 1822 | return $this->txn_page_url; |
1823 | 1823 | } |
@@ -1833,12 +1833,12 @@ discard block |
||
1833 | 1833 | * @access public |
1834 | 1834 | * @return string |
1835 | 1835 | */ |
1836 | - public function thank_you_page_url( $query_args = array() ) { |
|
1837 | - if ( ! $this->thank_you_page_url ) { |
|
1838 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1836 | + public function thank_you_page_url($query_args = array()) { |
|
1837 | + if ( ! $this->thank_you_page_url) { |
|
1838 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1839 | 1839 | } |
1840 | - if ( $query_args ) { |
|
1841 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1840 | + if ($query_args) { |
|
1841 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1842 | 1842 | } else { |
1843 | 1843 | return $this->thank_you_page_url; |
1844 | 1844 | } |
@@ -1853,8 +1853,8 @@ discard block |
||
1853 | 1853 | * @return string |
1854 | 1854 | */ |
1855 | 1855 | public function cancel_page_url() { |
1856 | - if ( ! $this->cancel_page_url ) { |
|
1857 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1856 | + if ( ! $this->cancel_page_url) { |
|
1857 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1858 | 1858 | } |
1859 | 1859 | return $this->cancel_page_url; |
1860 | 1860 | } |
@@ -1883,22 +1883,22 @@ discard block |
||
1883 | 1883 | */ |
1884 | 1884 | protected function _get_main_ee_ueip_optin() { |
1885 | 1885 | //if this is the main site then we can just bypass our direct query. |
1886 | - if ( is_main_site() ) { |
|
1887 | - return get_option( 'ee_ueip_optin', false ); |
|
1886 | + if (is_main_site()) { |
|
1887 | + return get_option('ee_ueip_optin', false); |
|
1888 | 1888 | } |
1889 | 1889 | |
1890 | 1890 | //is this already cached for this request? If so use it. |
1891 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1891 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1892 | 1892 | return EE_Core_Config::$ee_ueip_option; |
1893 | 1893 | } |
1894 | 1894 | |
1895 | 1895 | global $wpdb; |
1896 | 1896 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1897 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1897 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1898 | 1898 | $option = 'ee_ueip_optin'; |
1899 | 1899 | |
1900 | 1900 | //set correct table for query |
1901 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1901 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1902 | 1902 | |
1903 | 1903 | |
1904 | 1904 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1906,20 +1906,20 @@ discard block |
||
1906 | 1906 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1907 | 1907 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1908 | 1908 | //for the purpose of caching. |
1909 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1910 | - if ( false !== $pre ) { |
|
1909 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1910 | + if (false !== $pre) { |
|
1911 | 1911 | EE_Core_Config::$ee_ueip_option = $pre; |
1912 | 1912 | return EE_Core_Config::$ee_ueip_option; |
1913 | 1913 | } |
1914 | 1914 | |
1915 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1916 | - if ( is_object( $row ) ) { |
|
1915 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1916 | + if (is_object($row)) { |
|
1917 | 1917 | $value = $row->option_value; |
1918 | 1918 | } else { //option does not exist so use default. |
1919 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1919 | + return apply_filters('default_option_'.$option, false, $option); |
|
1920 | 1920 | } |
1921 | 1921 | |
1922 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1922 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | //reset all url properties |
1936 | 1936 | $this->_reset_urls(); |
1937 | 1937 | //return what to save to db |
1938 | - return array_keys( get_object_vars( $this ) ); |
|
1938 | + return array_keys(get_object_vars($this)); |
|
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | } |
@@ -2082,14 +2082,14 @@ discard block |
||
2082 | 2082 | */ |
2083 | 2083 | public function __construct() { |
2084 | 2084 | // set default organization settings |
2085 | - $this->name = get_bloginfo( 'name' ); |
|
2085 | + $this->name = get_bloginfo('name'); |
|
2086 | 2086 | $this->address_1 = '123 Onna Road'; |
2087 | 2087 | $this->address_2 = 'PO Box 123'; |
2088 | 2088 | $this->city = 'Inna City'; |
2089 | 2089 | $this->STA_ID = 4; |
2090 | 2090 | $this->CNT_ISO = 'US'; |
2091 | 2091 | $this->zip = '12345'; |
2092 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2092 | + $this->email = get_bloginfo('admin_email'); |
|
2093 | 2093 | $this->phone = ''; |
2094 | 2094 | $this->vat = '123456789'; |
2095 | 2095 | $this->logo_url = ''; |
@@ -2177,46 +2177,46 @@ discard block |
||
2177 | 2177 | * @param string $CNT_ISO |
2178 | 2178 | * @throws \EE_Error |
2179 | 2179 | */ |
2180 | - public function __construct( $CNT_ISO = '' ) { |
|
2180 | + public function __construct($CNT_ISO = '') { |
|
2181 | 2181 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2182 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2182 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2183 | 2183 | // get country code from organization settings or use default |
2184 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2184 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2185 | 2185 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2186 | 2186 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2187 | 2187 | : ''; |
2188 | 2188 | // but override if requested |
2189 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2189 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2190 | 2190 | // 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 |
2191 | 2191 | if ( |
2192 | - ! empty( $CNT_ISO ) |
|
2192 | + ! empty($CNT_ISO) |
|
2193 | 2193 | && EE_Maintenance_Mode::instance()->models_can_query() |
2194 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2194 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2195 | 2195 | ) { |
2196 | 2196 | // retrieve the country settings from the db, just in case they have been customized |
2197 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2198 | - if ( $country instanceof EE_Country ) { |
|
2199 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2200 | - $this->name = $country->currency_name_single(); // Dollar |
|
2201 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2202 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2203 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2204 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2205 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2206 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2197 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2198 | + if ($country instanceof EE_Country) { |
|
2199 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2200 | + $this->name = $country->currency_name_single(); // Dollar |
|
2201 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2202 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2203 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2204 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2205 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2206 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2207 | 2207 | } |
2208 | 2208 | } |
2209 | 2209 | // fallback to hardcoded defaults, in case the above failed |
2210 | - if ( empty( $this->code ) ) { |
|
2210 | + if (empty($this->code)) { |
|
2211 | 2211 | // set default currency settings |
2212 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2213 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2214 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2215 | - $this->sign = '$'; // currency sign: $ |
|
2216 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2217 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2218 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2219 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2212 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2213 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2214 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2215 | + $this->sign = '$'; // currency sign: $ |
|
2216 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2217 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2218 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2219 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2220 | 2220 | } |
2221 | 2221 | } |
2222 | 2222 | } |
@@ -2378,7 +2378,7 @@ discard block |
||
2378 | 2378 | * @since 4.8.8.rc.019 |
2379 | 2379 | */ |
2380 | 2380 | public function do_hooks() { |
2381 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2381 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2382 | 2382 | } |
2383 | 2383 | |
2384 | 2384 | |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | * @return void |
2388 | 2388 | */ |
2389 | 2389 | public function set_default_reg_status_on_EEM_Event() { |
2390 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2390 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | |
@@ -2491,10 +2491,10 @@ discard block |
||
2491 | 2491 | * @param bool $reset |
2492 | 2492 | * @return string |
2493 | 2493 | */ |
2494 | - public function log_file_name( $reset = false ) { |
|
2495 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2496 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2497 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2494 | + public function log_file_name($reset = false) { |
|
2495 | + if (empty($this->log_file_name) || $reset) { |
|
2496 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2497 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2498 | 2498 | } |
2499 | 2499 | return $this->log_file_name; |
2500 | 2500 | } |
@@ -2505,10 +2505,10 @@ discard block |
||
2505 | 2505 | * @param bool $reset |
2506 | 2506 | * @return string |
2507 | 2507 | */ |
2508 | - public function debug_file_name( $reset = false ) { |
|
2509 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2510 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2511 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2508 | + public function debug_file_name($reset = false) { |
|
2509 | + if (empty($this->debug_file_name) || $reset) { |
|
2510 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2511 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2512 | 2512 | } |
2513 | 2513 | return $this->debug_file_name; |
2514 | 2514 | } |
@@ -2519,7 +2519,7 @@ discard block |
||
2519 | 2519 | * @return string |
2520 | 2520 | */ |
2521 | 2521 | public function affiliate_id() { |
2522 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2522 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2523 | 2523 | } |
2524 | 2524 | |
2525 | 2525 | |
@@ -2699,21 +2699,21 @@ discard block |
||
2699 | 2699 | $this->use_google_maps = true; |
2700 | 2700 | $this->google_map_api_key = ''; |
2701 | 2701 | // for event details pages (reg page) |
2702 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2703 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2704 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2705 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2706 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2707 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2708 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2702 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2703 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2704 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2705 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2706 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2707 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2708 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2709 | 2709 | // for event list pages |
2710 | - $this->event_list_map_width = 300; // ee_map_width |
|
2711 | - $this->event_list_map_height = 185; // ee_map_height |
|
2712 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2713 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2714 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2715 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2716 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2710 | + $this->event_list_map_width = 300; // ee_map_width |
|
2711 | + $this->event_list_map_height = 185; // ee_map_height |
|
2712 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2713 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2714 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2715 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2716 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2717 | 2717 | } |
2718 | 2718 | |
2719 | 2719 | } |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | * @return void |
2867 | 2867 | */ |
2868 | 2868 | protected function _set_php_values() { |
2869 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2869 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2870 | 2870 | $this->php->version = phpversion(); |
2871 | 2871 | } |
2872 | 2872 | |
@@ -2885,10 +2885,10 @@ discard block |
||
2885 | 2885 | * @type string $msg Any message to be displayed. |
2886 | 2886 | * } |
2887 | 2887 | */ |
2888 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2889 | - if ( ! empty( $this->php->max_input_vars ) |
|
2890 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2891 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2888 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2889 | + if ( ! empty($this->php->max_input_vars) |
|
2890 | + && ($input_count >= $this->php->max_input_vars) |
|
2891 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2892 | 2892 | ) { |
2893 | 2893 | return sprintf( |
2894 | 2894 | __( |
@@ -2954,7 +2954,7 @@ discard block |
||
2954 | 2954 | */ |
2955 | 2955 | public function __construct() { |
2956 | 2956 | $this->payment_settings = array(); |
2957 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2957 | + $this->active_gateways = array('Invoice' => false); |
|
2958 | 2958 | } |
2959 | 2959 | } |
2960 | 2960 |
@@ -2182,7 +2182,7 @@ discard block |
||
2182 | 2182 | $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
2183 | 2183 | // get country code from organization settings or use default |
2184 | 2184 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2185 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2185 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2186 | 2186 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2187 | 2187 | : ''; |
2188 | 2188 | // but override if requested |
@@ -2887,8 +2887,8 @@ discard block |
||
2887 | 2887 | */ |
2888 | 2888 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2889 | 2889 | if ( ! empty( $this->php->max_input_vars ) |
2890 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2891 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2890 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2891 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2892 | 2892 | ) { |
2893 | 2893 | return sprintf( |
2894 | 2894 | __( |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base{ |
|
9 | +class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base { |
|
10 | 10 | protected $_individual_item_normalization_strategy = array(); |
11 | 11 | /** |
12 | 12 | * |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | * @return array |
24 | 24 | */ |
25 | 25 | public function normalize($value_to_normalize) { |
26 | - if ( is_array( $value_to_normalize )){ |
|
26 | + if (is_array($value_to_normalize)) { |
|
27 | 27 | $items_to_normalize = $value_to_normalize; |
28 | - } else if( $value_to_normalize !== NULL ){ |
|
29 | - $items_to_normalize = array( $value_to_normalize ); |
|
28 | + } else if ($value_to_normalize !== NULL) { |
|
29 | + $items_to_normalize = array($value_to_normalize); |
|
30 | 30 | } else { |
31 | 31 | $items_to_normalize = array(); |
32 | 32 | } |
33 | 33 | $normalized_array_value = array(); |
34 | - foreach( $items_to_normalize as $key => $individual_item ){ |
|
35 | - $normalized_array_value[ $key ] = $this->normalize_one( $individual_item ); |
|
34 | + foreach ($items_to_normalize as $key => $individual_item) { |
|
35 | + $normalized_array_value[$key] = $this->normalize_one($individual_item); |
|
36 | 36 | } |
37 | 37 | return $normalized_array_value; |
38 | 38 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $individual_value_to_normalize but definitely NOT an array |
43 | 43 | * @return mixed |
44 | 44 | */ |
45 | - public function normalize_one( $individual_value_to_normalize ) { |
|
46 | - return $this->_individual_item_normalization_strategy->normalize( $individual_value_to_normalize ); |
|
45 | + public function normalize_one($individual_value_to_normalize) { |
|
46 | + return $this->_individual_item_normalization_strategy->normalize($individual_value_to_normalize); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | * @param array $normalized_values |
52 | 52 | * @return string[] |
53 | 53 | */ |
54 | - public function unnormalize( $normalized_values ) { |
|
55 | - if( $normalized_values === null ) { |
|
54 | + public function unnormalize($normalized_values) { |
|
55 | + if ($normalized_values === null) { |
|
56 | 56 | $normalized_values = array(); |
57 | 57 | } |
58 | - if( ! is_array( $normalized_values ) ){ |
|
59 | - $normalized_values = array( $normalized_values ); |
|
58 | + if ( ! is_array($normalized_values)) { |
|
59 | + $normalized_values = array($normalized_values); |
|
60 | 60 | } |
61 | 61 | $non_normal_values = array(); |
62 | - foreach( $normalized_values as $key => $value ) { |
|
63 | - $non_normal_values[ $key ] = $this->unnormalize_one( $value ); |
|
62 | + foreach ($normalized_values as $key => $value) { |
|
63 | + $non_normal_values[$key] = $this->unnormalize_one($value); |
|
64 | 64 | } |
65 | 65 | return $non_normal_values; |
66 | 66 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @param mixed $individual_value_to_unnormalize but certainly NOT an array |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - public function unnormalize_one( $individual_value_to_unnormalize ) { |
|
74 | - return $this->_individual_item_normalization_strategy->unnormalize( $individual_value_to_unnormalize ); |
|
73 | + public function unnormalize_one($individual_value_to_unnormalize) { |
|
74 | + return $this->_individual_item_normalization_strategy->unnormalize($individual_value_to_unnormalize); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | |
38 | 38 | |
39 | 39 | protected function _init_props() { |
40 | - $this->label = esc_html__( 'Recipient Details Shortcodes', 'event_espresso' ); |
|
41 | - $this->description = esc_html__( 'All shortcodes specific to recipient registration data', 'event_espresso' ); |
|
40 | + $this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso'); |
|
41 | + $this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso'); |
|
42 | 42 | $this->_shortcodes = array( |
43 | - '[RECIPIENT_FNAME]' => esc_html__( 'Parses to the first name of the recipient for the message.', 'event_espresso' ), |
|
44 | - '[RECIPIENT_LNAME]' => esc_html__( 'Parses to the last name of the recipient for the message.', 'event_espresso' ), |
|
45 | - '[RECIPIENT_EMAIL]' => esc_html__( 'Parses to the email address of the recipient for the message.', 'event_espresso' ), |
|
46 | - '[RECIPIENT_REGISTRATION_ID]' => esc_html__( 'Parses to the registration ID of the recipient for the message.', 'event_espresso' ), |
|
47 | - '[RECIPIENT_REGISTRATION_CODE]' => esc_html__( 'Parses to the registration code of the recipient for the message.', 'event_espresso' ), |
|
48 | - '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( 'Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso' ), |
|
49 | - '[RECIPIENT_PHONE_NUMBER]' => esc_html__( 'The Phone Number for the recipient of the message.', 'event_espresso' ), |
|
50 | - '[RECIPIENT_ADDRESS]' => esc_html__( 'The Address for the recipient of the message.', 'event_espresso' ), |
|
51 | - '[RECIPIENT_ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the recipient of the message.', 'event_espresso' ), |
|
52 | - '[RECIPIENT_CITY]' => esc_html__( 'The city for the recipient of the message.', 'event_espresso' ), |
|
53 | - '[RECIPIENT_ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso' ), |
|
54 | - '[RECIPIENT_ADDRESS_STATE]' => esc_html__( 'The state/province for the recipient of the message.', 'event_espresso' ), |
|
55 | - '[RECIPIENT_COUNTRY]' => esc_html__( 'The country for the recipient of the message.', 'event_espresso' ), |
|
56 | - '[RECIPIENT_ANSWER_*]' => esc_html__( 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ), |
|
57 | - '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso' ) |
|
43 | + '[RECIPIENT_FNAME]' => esc_html__('Parses to the first name of the recipient for the message.', 'event_espresso'), |
|
44 | + '[RECIPIENT_LNAME]' => esc_html__('Parses to the last name of the recipient for the message.', 'event_espresso'), |
|
45 | + '[RECIPIENT_EMAIL]' => esc_html__('Parses to the email address of the recipient for the message.', 'event_espresso'), |
|
46 | + '[RECIPIENT_REGISTRATION_ID]' => esc_html__('Parses to the registration ID of the recipient for the message.', 'event_espresso'), |
|
47 | + '[RECIPIENT_REGISTRATION_CODE]' => esc_html__('Parses to the registration code of the recipient for the message.', 'event_espresso'), |
|
48 | + '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__('Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso'), |
|
49 | + '[RECIPIENT_PHONE_NUMBER]' => esc_html__('The Phone Number for the recipient of the message.', 'event_espresso'), |
|
50 | + '[RECIPIENT_ADDRESS]' => esc_html__('The Address for the recipient of the message.', 'event_espresso'), |
|
51 | + '[RECIPIENT_ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'), |
|
52 | + '[RECIPIENT_CITY]' => esc_html__('The city for the recipient of the message.', 'event_espresso'), |
|
53 | + '[RECIPIENT_ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'), |
|
54 | + '[RECIPIENT_ADDRESS_STATE]' => esc_html__('The state/province for the recipient of the message.', 'event_espresso'), |
|
55 | + '[RECIPIENT_COUNTRY]' => esc_html__('The country for the recipient of the message.', 'event_espresso'), |
|
56 | + '[RECIPIENT_ANSWER_*]' => esc_html__('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso'), |
|
57 | + '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__('If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso') |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | |
@@ -65,36 +65,35 @@ discard block |
||
65 | 65 | * @param string $shortcode the shortcode to be parsed. |
66 | 66 | * @return string parsed shortcode |
67 | 67 | */ |
68 | - protected function _parser( $shortcode ) { |
|
68 | + protected function _parser($shortcode) { |
|
69 | 69 | |
70 | 70 | //make sure we end up with a copy of the EE_Messages_Addressee object |
71 | 71 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
72 | 72 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
73 | - && is_array( $this->_data ) |
|
74 | - && isset( $this->_data['data'] ) |
|
73 | + && is_array($this->_data) |
|
74 | + && isset($this->_data['data']) |
|
75 | 75 | && $this->_data['data'] instanceof EE_Messages_Addressee |
76 | - ? $this->_data['data'] : |
|
77 | - $this->_recipient; |
|
76 | + ? $this->_data['data'] : $this->_recipient; |
|
78 | 77 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
79 | - && ! empty( $this->_extra_data['data'] ) |
|
78 | + && ! empty($this->_extra_data['data']) |
|
80 | 79 | && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
81 | 80 | ? $this->_extra_data['data'] |
82 | 81 | : $this->_recipient; |
83 | 82 | |
84 | - if ( ! $this->_recipient instanceof EE_Messages_Addressee ) { |
|
83 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee) { |
|
85 | 84 | return ''; |
86 | 85 | } |
87 | 86 | |
88 | 87 | $attendee = $this->_recipient->att_obj; |
89 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
88 | + if ( ! $attendee instanceof EE_Attendee) { |
|
90 | 89 | return ''; |
91 | 90 | } |
92 | 91 | |
93 | - $this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) |
|
94 | - ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] |
|
92 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) |
|
93 | + ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] |
|
95 | 94 | : array(); |
96 | 95 | |
97 | - switch ( $shortcode ) { |
|
96 | + switch ($shortcode) { |
|
98 | 97 | case '[RECIPIENT_FNAME]' : |
99 | 98 | return $attendee->fname(); |
100 | 99 | break; |
@@ -108,21 +107,21 @@ discard block |
||
108 | 107 | break; |
109 | 108 | |
110 | 109 | case '[RECIPIENT_REGISTRATION_ID]' : |
111 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
110 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
112 | 111 | return ''; |
113 | 112 | } |
114 | 113 | return $this->_get_reg_id(); |
115 | 114 | break; |
116 | 115 | |
117 | 116 | case '[RECIPIENT_REGISTRATION_CODE]' : |
118 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
117 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
119 | 118 | return ''; |
120 | 119 | } |
121 | 120 | return $this->_get_reg_code(); |
122 | 121 | break; |
123 | 122 | |
124 | 123 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]' : |
125 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
124 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
126 | 125 | return ''; |
127 | 126 | } |
128 | 127 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
@@ -164,23 +163,23 @@ discard block |
||
164 | 163 | break; |
165 | 164 | } |
166 | 165 | |
167 | - if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) { |
|
168 | - $shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode ); |
|
169 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
166 | + if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
167 | + $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
168 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
170 | 169 | |
171 | 170 | |
172 | 171 | //now let's figure out what question has this text |
173 | - if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
172 | + if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
174 | 173 | return ''; |
175 | 174 | } |
176 | 175 | |
177 | - foreach ( $this->_recipient->questions as $ansid => $question ) { |
|
176 | + foreach ($this->_recipient->questions as $ansid => $question) { |
|
178 | 177 | if ( |
179 | 178 | $question instanceof EE_Question |
180 | 179 | && $question->display_text() == $shortcode |
181 | - && isset( $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ] ) |
|
180 | + && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]) |
|
182 | 181 | ) { |
183 | - return $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
182 | + return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
184 | 183 | } |
185 | 184 | } |
186 | 185 | } |
@@ -211,53 +210,53 @@ discard block |
||
211 | 210 | protected function _get_reg_code() { |
212 | 211 | |
213 | 212 | //if only one related registration for the recipient then just return that reg code. |
214 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
213 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
215 | 214 | return $this->_recipient->reg_obj->reg_code(); |
216 | 215 | } |
217 | 216 | |
218 | 217 | //k more than one registration so let's see if we can get specific to context |
219 | 218 | //are we parsing event_list? |
220 | - if ( $this->_data instanceof EE_Event ) { |
|
219 | + if ($this->_data instanceof EE_Event) { |
|
221 | 220 | $reg_code = array(); |
222 | 221 | //loop through registrations for recipient and see if there is a match for this event |
223 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
224 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
222 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
223 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
225 | 224 | $reg_code[] = $reg->reg_code(); |
226 | 225 | } |
227 | 226 | } |
228 | - return implode( ', ', $reg_code ); |
|
227 | + return implode(', ', $reg_code); |
|
229 | 228 | } |
230 | 229 | |
231 | 230 | //are we parsing ticket list? |
232 | - if ( $this->_data instanceof EE_Ticket ) { |
|
231 | + if ($this->_data instanceof EE_Ticket) { |
|
233 | 232 | $reg_code = array(); |
234 | 233 | //loop through each registration for recipient and see if there is a match for this ticket |
235 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
236 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
234 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
235 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
237 | 236 | $reg_code = $reg->reg_code(); |
238 | 237 | } |
239 | 238 | } |
240 | - return implode( ', ', $reg_code ); |
|
239 | + return implode(', ', $reg_code); |
|
241 | 240 | } |
242 | 241 | |
243 | 242 | //do we have a specific reg_obj? Let's use it |
244 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
243 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
245 | 244 | return $this->_data->reg_obj->reg_code(); |
246 | 245 | } |
247 | 246 | |
248 | 247 | //do we have a specific reg_obj? Let's use it |
249 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
248 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
250 | 249 | return $this->_data->reg_obj->reg_code(); |
251 | 250 | } |
252 | 251 | |
253 | 252 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
254 | 253 | $reg_code = array(); |
255 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
256 | - if ( $reg instanceof EE_Registration ) { |
|
254 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
255 | + if ($reg instanceof EE_Registration) { |
|
257 | 256 | $reg_code[] = $reg->reg_code(); |
258 | 257 | } |
259 | 258 | } |
260 | - return implode( ', ', $reg_code ); |
|
259 | + return implode(', ', $reg_code); |
|
261 | 260 | } |
262 | 261 | |
263 | 262 | |
@@ -270,48 +269,48 @@ discard block |
||
270 | 269 | protected function _get_reg_id() { |
271 | 270 | |
272 | 271 | //if only one related registration for the recipient then just return that reg code. |
273 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
272 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
274 | 273 | return $this->_recipient->reg_obj->ID(); |
275 | 274 | } |
276 | 275 | |
277 | 276 | //k more than one registration so let's see if we can get specific to context |
278 | 277 | //are we parsing event_list? |
279 | - if ( $this->_data instanceof EE_Event ) { |
|
278 | + if ($this->_data instanceof EE_Event) { |
|
280 | 279 | $registration_ids = array(); |
281 | 280 | //loop through registrations for recipient and see if there is a match for this event |
282 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
283 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
281 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
282 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
284 | 283 | $registration_ids[] = $reg->ID(); |
285 | 284 | } |
286 | 285 | } |
287 | - return implode( ', ', $registration_ids ); |
|
286 | + return implode(', ', $registration_ids); |
|
288 | 287 | } |
289 | 288 | |
290 | 289 | //are we parsing ticket list? |
291 | - if ( $this->_data instanceof EE_Ticket ) { |
|
290 | + if ($this->_data instanceof EE_Ticket) { |
|
292 | 291 | $registration_ids = array(); |
293 | 292 | //loop through each registration for recipient and see if there is a match for this ticket |
294 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
295 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
293 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
294 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
296 | 295 | $registration_ids = $reg->ID(); |
297 | 296 | } |
298 | 297 | } |
299 | - return implode( ', ', $registration_ids ); |
|
298 | + return implode(', ', $registration_ids); |
|
300 | 299 | } |
301 | 300 | |
302 | 301 | //do we have a specific reg_obj? Let's use it |
303 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
302 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
304 | 303 | return $this->_data->reg_obj->ID(); |
305 | 304 | } |
306 | 305 | |
307 | 306 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
308 | 307 | $registration_ids = array(); |
309 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
310 | - if ( $reg instanceof EE_Registration ) { |
|
308 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
309 | + if ($reg instanceof EE_Registration) { |
|
311 | 310 | $registration_ids[] = $reg->ID(); |
312 | 311 | } |
313 | 312 | } |
314 | - return implode( ', ', $registration_ids ); |
|
313 | + return implode(', ', $registration_ids); |
|
315 | 314 | } |
316 | 315 | |
317 | 316 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _init_props() { |
52 | - $this->label = esc_html__( 'Attendee Shortcodes', 'event_espresso' ); |
|
53 | - $this->description = esc_html__( 'All shortcodes specific to attendee related data', 'event_espresso' ); |
|
52 | + $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
53 | + $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
54 | 54 | $this->_shortcodes = array( |
55 | - '[FNAME]' => esc_html__( 'First Name of an attendee.', 'event_espresso' ), |
|
56 | - '[LNAME]' => esc_html__( 'Last Name of an attendee.', 'event_espresso' ), |
|
57 | - '[ATTENDEE_EMAIL]' => esc_html__( 'Email address for the attendee.', 'event_espresso' ), |
|
58 | - '[EDIT_ATTENDEE_LINK]' => esc_html__( 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso' ), |
|
59 | - '[REGISTRATION_ID]' => esc_html__( 'Unique Registration ID for the registration', 'event_espresso' ), |
|
60 | - '[REGISTRATION_CODE]' => esc_html__( 'Unique Registration Code for the registration', 'event_espresso' ), |
|
61 | - '[REGISTRATION_STATUS_ID]' => esc_html__( 'Parses to the registration status for the attendee', 'event_espresso' ), |
|
62 | - '[REGISTRATION_STATUS_LABEL]' => esc_html__( 'Parses to the status label for the registrant', 'event_espresso' ), |
|
63 | - '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( 'Parses to the total amount paid for this registration.', 'event_espresso' ), |
|
64 | - '[FRONTEND_EDIT_REG_LINK]' => esc_html__( 'Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso' ), |
|
65 | - '[PHONE_NUMBER]' => esc_html__( 'The Phone Number for the Registration.', 'event_espresso' ), |
|
66 | - '[ADDRESS]' => esc_html__( 'The Address for the Registration', 'event_espresso' ), |
|
67 | - '[ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the registration.', 'event_espresso' ), |
|
68 | - '[CITY]' => esc_html__( 'The city for the registration.', 'event_espresso' ), |
|
69 | - '[ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the Registration.', 'event_espresso' ), |
|
70 | - '[ADDRESS_STATE]' => esc_html__( 'The state/province for the registration.', 'event_espresso' ), |
|
71 | - '[COUNTRY]' => esc_html__( 'The country for the registration.', 'event_espresso' ) |
|
55 | + '[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'), |
|
56 | + '[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'), |
|
57 | + '[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'), |
|
58 | + '[EDIT_ATTENDEE_LINK]' => esc_html__('Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso'), |
|
59 | + '[REGISTRATION_ID]' => esc_html__('Unique Registration ID for the registration', 'event_espresso'), |
|
60 | + '[REGISTRATION_CODE]' => esc_html__('Unique Registration Code for the registration', 'event_espresso'), |
|
61 | + '[REGISTRATION_STATUS_ID]' => esc_html__('Parses to the registration status for the attendee', 'event_espresso'), |
|
62 | + '[REGISTRATION_STATUS_LABEL]' => esc_html__('Parses to the status label for the registrant', 'event_espresso'), |
|
63 | + '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__('Parses to the total amount paid for this registration.', 'event_espresso'), |
|
64 | + '[FRONTEND_EDIT_REG_LINK]' => esc_html__('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'), |
|
65 | + '[PHONE_NUMBER]' => esc_html__('The Phone Number for the Registration.', 'event_espresso'), |
|
66 | + '[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'), |
|
67 | + '[ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the registration.', 'event_espresso'), |
|
68 | + '[CITY]' => esc_html__('The city for the registration.', 'event_espresso'), |
|
69 | + '[ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the Registration.', 'event_espresso'), |
|
70 | + '[ADDRESS_STATE]' => esc_html__('The state/province for the registration.', 'event_espresso'), |
|
71 | + '[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @return string |
83 | 83 | * @throws \EE_Error |
84 | 84 | */ |
85 | - protected function _parser( $shortcode ) { |
|
85 | + protected function _parser($shortcode) { |
|
86 | 86 | |
87 | 87 | |
88 | - $this->_xtra = ! empty( $this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
88 | + $this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
89 | 89 | ? $this->_extra_data['data'] |
90 | 90 | : null; |
91 | 91 | |
@@ -94,34 +94,34 @@ discard block |
||
94 | 94 | ? null |
95 | 95 | : $this->_data; |
96 | 96 | |
97 | - if ( ! $registration instanceof EE_Registration ) { |
|
97 | + if ( ! $registration instanceof EE_Registration) { |
|
98 | 98 | //let's attempt to get the txn_id for the error message. |
99 | - $txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction |
|
99 | + $txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction |
|
100 | 100 | ? $this->_xtra->txn->ID() |
101 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
102 | - $msg = esc_html__( 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' ); |
|
101 | + : esc_html__('Unknown', 'event_espresso'); |
|
102 | + $msg = esc_html__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso'); |
|
103 | 103 | $dev_msg = sprintf( |
104 | - esc_html__( 'The transaction ID for this request is: %s', 'event_espresso' ), |
|
104 | + esc_html__('The transaction ID for this request is: %s', 'event_espresso'), |
|
105 | 105 | $txn_id |
106 | 106 | ); |
107 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
107 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | //attendee obj for this registration |
111 | - $attendee = isset( $this->_xtra->registrations[ $registration->ID() ]['att_obj'] ) |
|
112 | - ? $this->_xtra->registrations[ $registration->ID() ]['att_obj'] |
|
113 | - : null ; |
|
111 | + $attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) |
|
112 | + ? $this->_xtra->registrations[$registration->ID()]['att_obj'] |
|
113 | + : null; |
|
114 | 114 | |
115 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
116 | - $msg = esc_html__( 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' ); |
|
115 | + if ( ! $attendee instanceof EE_Attendee) { |
|
116 | + $msg = esc_html__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso'); |
|
117 | 117 | $dev_msg = sprintf( |
118 | - esc_html__( 'The registration ID for this request is: %s', 'event_espresso' ), |
|
118 | + esc_html__('The registration ID for this request is: %s', 'event_espresso'), |
|
119 | 119 | $registration->ID() |
120 | 120 | ); |
121 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
121 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
122 | 122 | } |
123 | 123 | |
124 | - switch ( $shortcode ) { |
|
124 | + switch ($shortcode) { |
|
125 | 125 | |
126 | 126 | case '[FNAME]' : |
127 | 127 | return $attendee->fname(); |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | protected static $_event = NULL; |
36 | 36 | |
37 | 37 | /** |
38 | - * array of datetimes and the spaces available for them |
|
39 | - * |
|
40 | - * @access private |
|
41 | - * @var array |
|
42 | - */ |
|
38 | + * array of datetimes and the spaces available for them |
|
39 | + * |
|
40 | + * @access private |
|
41 | + * @var array |
|
42 | + */ |
|
43 | 43 | private static $_available_spaces = array(); |
44 | 44 | |
45 | 45 | /** |
46 | - * max attendees that can register for event at one time |
|
47 | - * |
|
48 | - * @access private |
|
49 | - * @var int |
|
50 | - */ |
|
46 | + * max attendees that can register for event at one time |
|
47 | + * |
|
48 | + * @access private |
|
49 | + * @var int |
|
50 | + */ |
|
51 | 51 | private static $_max_atndz = EE_INF; |
52 | 52 | |
53 | 53 | |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | return $permalink_string; |
217 | 217 | } |
218 | 218 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
219 | - . __( 'Embed', 'event_espresso' ) |
|
220 | - . '</a> '; |
|
219 | + . __( 'Embed', 'event_espresso' ) |
|
220 | + . '</a> '; |
|
221 | 221 | $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
222 | 222 | $iframe_string = esc_html( |
223 | 223 | '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return array|boolean |
528 | 528 | */ |
529 | 529 | public function process_ticket_selections() { |
530 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
530 | + do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
531 | 531 | // check nonce |
532 | 532 | if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
533 | 533 | EE_Error::add_error( |
@@ -921,11 +921,11 @@ discard block |
||
921 | 921 | |
922 | 922 | |
923 | 923 | /** |
924 | - * load js |
|
925 | - * |
|
926 | - * @access public |
|
927 | - * @return void |
|
928 | - */ |
|
924 | + * load js |
|
925 | + * |
|
926 | + * @access public |
|
927 | + * @return void |
|
928 | + */ |
|
929 | 929 | public static function load_tckt_slctr_assets() { |
930 | 930 | // add some style |
931 | 931 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -65,15 +65,15 @@ discard block |
||
65 | 65 | * @return EED_Ticket_Selector |
66 | 66 | */ |
67 | 67 | public static function instance() { |
68 | - return parent::get_instance( __CLASS__ ); |
|
68 | + return parent::get_instance(__CLASS__); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | - protected function set_config(){ |
|
74 | - $this->set_config_section( 'template_settings' ); |
|
75 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
76 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
73 | + protected function set_config() { |
|
74 | + $this->set_config_section('template_settings'); |
|
75 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
76 | + $this->set_config_name('EED_Ticket_Selector'); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public static function set_hooks() { |
90 | 90 | // routing |
91 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
92 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
93 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
91 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
92 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
93 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
94 | 94 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
95 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
95 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
96 | 96 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
97 | 97 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
98 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
98 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | * @return void |
108 | 108 | */ |
109 | 109 | public static function set_hooks_admin() { |
110 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
110 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
111 | 111 | //add button for iframe code to event editor. |
112 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
113 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
112 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
113 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | * @return void |
123 | 123 | */ |
124 | 124 | public static function set_definitions() { |
125 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
126 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
125 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
126 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
127 | 127 | |
128 | 128 | //if config is not set, initialize |
129 | 129 | //If config is not set, set it. |
130 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
130 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
131 | 131 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
132 | 132 | } |
133 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
133 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param object $WP |
142 | 142 | * @return void |
143 | 143 | */ |
144 | - public function run( $WP ) {} |
|
144 | + public function run($WP) {} |
|
145 | 145 | |
146 | 146 | |
147 | 147 | /** |
@@ -153,23 +153,23 @@ discard block |
||
153 | 153 | public function ticket_selector_iframe() { |
154 | 154 | self::$_in_iframe = true; |
155 | 155 | /** @type EEM_Event $EEM_Event */ |
156 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
156 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
157 | 157 | $event = $EEM_Event->get_one_by_ID( |
158 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
158 | + EE_Registry::instance()->REQ->get('event', 0) |
|
159 | 159 | ); |
160 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
161 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
160 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
161 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
162 | 162 | $template_args['css'] = apply_filters( |
163 | 163 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
164 | 164 | array( |
165 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
166 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
167 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
168 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
165 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
166 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
167 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
168 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
169 | 169 | ) |
170 | 170 | ); |
171 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
172 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
171 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
172 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
173 | 173 | $template_args['eei18n'] = apply_filters( |
174 | 174 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
175 | 175 | EE_Registry::localize_i18n_js_strings() |
@@ -177,18 +177,18 @@ discard block |
||
177 | 177 | $template_args['js'] = apply_filters( |
178 | 178 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
179 | 179 | array( |
180 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
181 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
182 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
180 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
181 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
182 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
183 | 183 | ) |
184 | 184 | ); |
185 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
186 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
185 | + $template_args['notices'] = EEH_Template::display_template( |
|
186 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
187 | 187 | array(), |
188 | 188 | true |
189 | 189 | ); |
190 | 190 | EEH_Template::display_template( |
191 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
191 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
192 | 192 | $template_args |
193 | 193 | ); |
194 | 194 | exit; |
@@ -207,25 +207,25 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return string The new html string for the permalink area. |
209 | 209 | */ |
210 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
210 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
211 | 211 | //make sure this is ONLY when editing and the event id has been set. |
212 | - if ( ! empty( $id ) ) { |
|
213 | - $post = get_post( $id ); |
|
212 | + if ( ! empty($id)) { |
|
213 | + $post = get_post($id); |
|
214 | 214 | //if NOT event then let's get out. |
215 | - if ( $post->post_type !== 'espresso_events' ) { |
|
215 | + if ($post->post_type !== 'espresso_events') { |
|
216 | 216 | return $permalink_string; |
217 | 217 | } |
218 | 218 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
219 | - . __( 'Embed', 'event_espresso' ) |
|
219 | + . __('Embed', 'event_espresso') |
|
220 | 220 | . '</a> '; |
221 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
221 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
222 | 222 | $iframe_string = esc_html( |
223 | - '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
|
223 | + '<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>' |
|
224 | 224 | ); |
225 | 225 | $permalink_string .= ' |
226 | 226 | <div id="js-ts-iframe" style="display:none"> |
227 | 227 | <div style="width:100%; height: 500px;"> |
228 | - ' . $iframe_string . ' |
|
228 | + ' . $iframe_string.' |
|
229 | 229 | </div> |
230 | 230 | </div>'; |
231 | 231 | } |
@@ -244,22 +244,22 @@ discard block |
||
244 | 244 | * @param mixed $event |
245 | 245 | * @return bool |
246 | 246 | */ |
247 | - protected static function set_event( $event = null ) { |
|
248 | - if( $event === null ) { |
|
247 | + protected static function set_event($event = null) { |
|
248 | + if ($event === null) { |
|
249 | 249 | global $post; |
250 | 250 | $event = $post; |
251 | 251 | } |
252 | - if ( $event instanceof EE_Event ) { |
|
252 | + if ($event instanceof EE_Event) { |
|
253 | 253 | self::$_event = $event; |
254 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
254 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
255 | 255 | self::$_event = $event->EE_Event; |
256 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
257 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
256 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
257 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
258 | 258 | self::$_event = $event->EE_Event; |
259 | 259 | } else { |
260 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
261 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
262 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
260 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
261 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
262 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | return true; |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | * @param bool $view_details |
279 | 279 | * @return string |
280 | 280 | */ |
281 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
281 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
282 | 282 | // reset filter for displaying submit button |
283 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
283 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
284 | 284 | // poke and prod incoming event till it tells us what it is |
285 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
285 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | && ( |
294 | 294 | ! self::$_event->display_ticket_selector() |
295 | 295 | || $view_details |
296 | - || post_password_required( $event_post ) |
|
296 | + || post_password_required($event_post) |
|
297 | 297 | || ( |
298 | 298 | $_event_active_status != EE_Datetime::active |
299 | 299 | && $_event_active_status != EE_Datetime::upcoming |
@@ -311,34 +311,34 @@ discard block |
||
311 | 311 | $template_args = array(); |
312 | 312 | $template_args['event_status'] = $_event_active_status; |
313 | 313 | |
314 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
315 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
314 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
315 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
316 | 316 | |
317 | 317 | $template_args['EVT_ID'] = self::$_event->ID(); |
318 | 318 | $template_args['event'] = self::$_event; |
319 | 319 | |
320 | 320 | // is the event expired ? |
321 | 321 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
322 | - if ( $template_args['event_is_expired'] ) { |
|
323 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
322 | + if ($template_args['event_is_expired']) { |
|
323 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | $ticket_query_args = array( |
327 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
328 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
327 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
328 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
329 | 329 | ); |
330 | 330 | |
331 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
331 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
332 | 332 | //use the correct applicable time query depending on what version of core is being run. |
333 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
334 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
333 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
334 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // get all tickets for this event ordered by the datetime |
338 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
338 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
339 | 339 | |
340 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
341 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
340 | + if (count($template_args['tickets']) < 1) { |
|
341 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
@@ -347,36 +347,36 @@ discard block |
||
347 | 347 | self::$_event->additional_limit() |
348 | 348 | ); |
349 | 349 | $template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz; |
350 | - if ( $template_args['max_atndz'] < 1 ) { |
|
351 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
352 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
353 | - $sales_closed_msg .= sprintf( |
|
354 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
350 | + if ($template_args['max_atndz'] < 1) { |
|
351 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
352 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
353 | + $sales_closed_msg .= sprintf( |
|
354 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
355 | 355 | '<div class="ee-attention" style="text-align: left;"><b>', |
356 | 356 | '</b><br />', |
357 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
357 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
358 | 358 | '</a></span></div>' |
359 | 359 | ); |
360 | 360 | } |
361 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
361 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
362 | 362 | } |
363 | 363 | |
364 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
365 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
364 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
365 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
366 | 366 | |
367 | 367 | // redirecting to another site for registration ?? |
368 | 368 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
369 | 369 | // set up the form (but not for the admin) |
370 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
370 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
371 | 371 | // if not redirecting to another site for registration |
372 | - if ( ! $external_url ) { |
|
372 | + if ( ! $external_url) { |
|
373 | 373 | // then display the ticket selector |
374 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
374 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
375 | 375 | } else { |
376 | 376 | // if not we still need to trigger the display of the submit button |
377 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
377 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
378 | 378 | //display notice to admin that registration is external |
379 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
379 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
380 | 380 | } |
381 | 381 | // submit button and form close tag |
382 | 382 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -396,25 +396,25 @@ discard block |
||
396 | 396 | * @param string $external_url |
397 | 397 | * @return string |
398 | 398 | */ |
399 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
399 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
400 | 400 | // if redirecting, we don't need any anything else |
401 | - if ( $external_url ) { |
|
402 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
403 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
404 | - foreach ( $query_args as $query_arg => $value ) { |
|
405 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
401 | + if ($external_url) { |
|
402 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
403 | + $query_args = EEH_URL::get_query_string($external_url); |
|
404 | + foreach ($query_args as $query_arg => $value) { |
|
405 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
406 | 406 | } |
407 | 407 | return $html; |
408 | 408 | } |
409 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
410 | - if ( ! $checkout_url ) { |
|
411 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
409 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
410 | + if ( ! $checkout_url) { |
|
411 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
412 | 412 | } |
413 | 413 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
414 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
415 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
414 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
415 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
416 | 416 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
417 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
417 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
418 | 418 | return $html; |
419 | 419 | } |
420 | 420 | |
@@ -429,18 +429,18 @@ discard block |
||
429 | 429 | * @return string |
430 | 430 | */ |
431 | 431 | public static function display_ticket_selector_submit() { |
432 | - if ( ! is_admin() ) { |
|
433 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
432 | + if ( ! is_admin()) { |
|
433 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
434 | 434 | $btn_text = apply_filters( |
435 | 435 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
436 | - __('Register Now', 'event_espresso' ), |
|
436 | + __('Register Now', 'event_espresso'), |
|
437 | 437 | EED_Ticket_Selector::$_event |
438 | 438 | ); |
439 | 439 | $external_url = EED_Ticket_Selector::$_event->external_url(); |
440 | - $html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"'; |
|
440 | + $html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"'; |
|
441 | 441 | $html .= ' class="ticket-selector-submit-btn '; |
442 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
443 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
442 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
443 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
444 | 444 | $html .= apply_filters( |
445 | 445 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
446 | 446 | '', |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | ); |
449 | 449 | $html .= '<div class="clear"><br/></div></form>'; |
450 | 450 | return $html; |
451 | - } else if ( is_archive() ) { |
|
452 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
451 | + } else if (is_archive()) { |
|
452 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
453 | 453 | } else if ( |
454 | 454 | EED_Ticket_Selector::$_event instanceof EE_Event |
455 | 455 | // if $_max_atndz === 1 (ie: a "Dude Where's my Ticket Selector?" type event) |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $html = apply_filters( |
462 | 462 | 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', |
463 | 463 | sprintf( |
464 | - __( '%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso' ), |
|
464 | + __('%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso'), |
|
465 | 465 | '<p class="no-ticket-selector-msg important-notice">', |
466 | 466 | EED_Ticket_Selector::$_event->name(), |
467 | 467 | '</p>' |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | * @return string |
504 | 504 | */ |
505 | 505 | public static function display_view_details_btn() { |
506 | - if ( ! self::$_event->get_permalink() ) { |
|
507 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
506 | + if ( ! self::$_event->get_permalink()) { |
|
507 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
508 | 508 | } |
509 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
510 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
511 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
512 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
509 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
510 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
511 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
512 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
513 | 513 | $view_details_btn .= '<div class="clear"><br/></div>'; |
514 | 514 | $view_details_btn .= '</form>'; |
515 | 515 | return $view_details_btn; |
@@ -527,11 +527,11 @@ discard block |
||
527 | 527 | * @return array|boolean |
528 | 528 | */ |
529 | 529 | public function process_ticket_selections() { |
530 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
530 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
531 | 531 | // check nonce |
532 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
532 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
533 | 533 | EE_Error::add_error( |
534 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
534 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
535 | 535 | __FILE__, __FUNCTION__, __LINE__ |
536 | 536 | ); |
537 | 537 | return FALSE; |
@@ -545,16 +545,16 @@ discard block |
||
545 | 545 | |
546 | 546 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
547 | 547 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
548 | - EE_Registry::instance()->load_core( 'Session' ); |
|
548 | + EE_Registry::instance()->load_core('Session'); |
|
549 | 549 | // unless otherwise requested, clear the session |
550 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
551 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
550 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
551 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
552 | 552 | } |
553 | 553 | //d( EE_Registry::instance()->SSN ); |
554 | 554 | |
555 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
555 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
556 | 556 | // do we have an event id? |
557 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
557 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
558 | 558 | // validate/sanitize data |
559 | 559 | $valid = self::_validate_post_data(); |
560 | 560 | |
@@ -564,41 +564,41 @@ discard block |
||
564 | 564 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
565 | 565 | |
566 | 566 | //check total tickets ordered vs max number of attendees that can register |
567 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
567 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
568 | 568 | |
569 | 569 | // ordering too many tickets !!! |
570 | 570 | $total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso'); |
571 | - $limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] ); |
|
571 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
572 | 572 | // dev only message |
573 | 573 | $max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso'); |
574 | - $limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] ); |
|
575 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
574 | + $limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']); |
|
575 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
576 | 576 | } else { |
577 | 577 | |
578 | 578 | // all data appears to be valid |
579 | 579 | $tckts_slctd = FALSE; |
580 | 580 | $success = TRUE; |
581 | 581 | // load cart |
582 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
582 | + EE_Registry::instance()->load_core('Cart'); |
|
583 | 583 | |
584 | 584 | // cycle thru the number of data rows sent from the event listing |
585 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
585 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
586 | 586 | // does this row actually contain a ticket quantity? |
587 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
587 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
588 | 588 | // YES we have a ticket quantity |
589 | 589 | $tckts_slctd = TRUE; |
590 | 590 | // d( $valid['ticket_obj'][$x] ); |
591 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
591 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
592 | 592 | // then add ticket to cart |
593 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
593 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
594 | 594 | $success = ! $ticket_added ? FALSE : $success; |
595 | - if ( EE_Error::has_error() ) { |
|
595 | + if (EE_Error::has_error()) { |
|
596 | 596 | break; |
597 | 597 | } |
598 | 598 | } else { |
599 | 599 | // nothing added to cart retrieved |
600 | 600 | EE_Error::add_error( |
601 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
601 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
602 | 602 | __FILE__, __FUNCTION__, __LINE__ |
603 | 603 | ); |
604 | 604 | } |
@@ -607,45 +607,45 @@ discard block |
||
607 | 607 | //d( EE_Registry::instance()->CART ); |
608 | 608 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
609 | 609 | |
610 | - if ( $tckts_slctd ) { |
|
611 | - if ( $success ) { |
|
612 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
610 | + if ($tckts_slctd) { |
|
611 | + if ($success) { |
|
612 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
613 | 613 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
614 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
614 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
615 | 615 | EE_Registry::instance()->SSN->update(); |
616 | 616 | //d( EE_Registry::instance()->CART ); |
617 | 617 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
618 | 618 | // just return TRUE for registrations being made from admin |
619 | - if ( is_admin() ) { |
|
619 | + if (is_admin()) { |
|
620 | 620 | return TRUE; |
621 | 621 | } |
622 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
622 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
623 | 623 | exit(); |
624 | 624 | |
625 | 625 | } else { |
626 | - if ( ! EE_Error::has_error() ) { |
|
626 | + if ( ! EE_Error::has_error()) { |
|
627 | 627 | // nothing added to cart |
628 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
628 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | |
632 | 632 | } else { |
633 | 633 | // no ticket quantities were selected |
634 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
634 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
635 | 635 | } |
636 | 636 | } |
637 | 637 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
638 | 638 | // at this point, just return if registration is being made from admin |
639 | - if ( is_admin() ) { |
|
639 | + if (is_admin()) { |
|
640 | 640 | return FALSE; |
641 | 641 | } |
642 | - if ( $valid['return_url'] ) { |
|
643 | - EE_Error::get_notices( FALSE, TRUE ); |
|
644 | - wp_safe_redirect( $valid['return_url'] ); |
|
642 | + if ($valid['return_url']) { |
|
643 | + EE_Error::get_notices(FALSE, TRUE); |
|
644 | + wp_safe_redirect($valid['return_url']); |
|
645 | 645 | exit(); |
646 | - } elseif ( isset( $event_to_add['id'] )) { |
|
647 | - EE_Error::get_notices( FALSE, TRUE ); |
|
648 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
646 | + } elseif (isset($event_to_add['id'])) { |
|
647 | + EE_Error::get_notices(FALSE, TRUE); |
|
648 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
649 | 649 | exit(); |
650 | 650 | } else { |
651 | 651 | echo EE_Error::get_notices(); |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | } else { |
655 | 655 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
656 | 656 | EE_Error::add_error( |
657 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
657 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
658 | 658 | __FILE__, __FUNCTION__, __LINE__ |
659 | 659 | ); |
660 | 660 | } |
@@ -672,18 +672,18 @@ discard block |
||
672 | 672 | * @return array or FALSE |
673 | 673 | */ |
674 | 674 | private static function _validate_post_data() { |
675 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
675 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
676 | 676 | |
677 | 677 | // start with an empty array() |
678 | 678 | $valid_data = array(); |
679 | 679 | // d( $_POST ); |
680 | 680 | //if event id is valid |
681 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
682 | - if ( $id ) { |
|
681 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
682 | + if ($id) { |
|
683 | 683 | // grab valid id |
684 | 684 | $valid_data['id'] = $id; |
685 | 685 | // grab and sanitize return-url |
686 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
686 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
687 | 687 | // array of other form names |
688 | 688 | $inputs_to_clean = array( |
689 | 689 | 'event_id' => 'tkt-slctr-event-id', |
@@ -696,22 +696,22 @@ discard block |
||
696 | 696 | // let's track the total number of tickets ordered.' |
697 | 697 | $valid_data['total_tickets'] = 0; |
698 | 698 | // cycle through $inputs_to_clean array |
699 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
699 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
700 | 700 | // check for POST data |
701 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
701 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
702 | 702 | // grab value |
703 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
703 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
704 | 704 | switch ($what) { |
705 | 705 | |
706 | 706 | // integers |
707 | 707 | case 'event_id': |
708 | - $valid_data[$what] = absint( $input_value ); |
|
708 | + $valid_data[$what] = absint($input_value); |
|
709 | 709 | // get event via the event id we put in the form |
710 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
710 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
711 | 711 | break; |
712 | 712 | case 'rows': |
713 | 713 | case 'max_atndz': |
714 | - $valid_data[$what] = absint( $input_value ); |
|
714 | + $valid_data[$what] = absint($input_value); |
|
715 | 715 | break; |
716 | 716 | |
717 | 717 | // arrays of integers |
@@ -719,27 +719,27 @@ discard block |
||
719 | 719 | // d( $input_value ); |
720 | 720 | $row_qty = $input_value; |
721 | 721 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
722 | - if( ! is_array( $row_qty )) { |
|
722 | + if ( ! is_array($row_qty)) { |
|
723 | 723 | // get number of rows |
724 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
724 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
725 | 725 | // d( $rows ); |
726 | 726 | // explode ints by the dash |
727 | - $row_qty = explode( '-', $row_qty ); |
|
728 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
729 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
730 | - $row_qty = array( $row => $qty ); |
|
727 | + $row_qty = explode('-', $row_qty); |
|
728 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
729 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
730 | + $row_qty = array($row => $qty); |
|
731 | 731 | // d( $row_qty ); |
732 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
733 | - if ( ! isset( $row_qty[$x] )) { |
|
732 | + for ($x = 1; $x <= $rows; $x++) { |
|
733 | + if ( ! isset($row_qty[$x])) { |
|
734 | 734 | $row_qty[$x] = 0; |
735 | 735 | } |
736 | 736 | } |
737 | 737 | } |
738 | - ksort( $row_qty ); |
|
738 | + ksort($row_qty); |
|
739 | 739 | // d( $row_qty ); |
740 | 740 | // cycle thru values |
741 | - foreach ( $row_qty as $qty ) { |
|
742 | - $qty = absint( $qty ); |
|
741 | + foreach ($row_qty as $qty) { |
|
742 | + $qty = absint($qty); |
|
743 | 743 | // sanitize as integers |
744 | 744 | $valid_data[$what][] = $qty; |
745 | 745 | $valid_data['total_tickets'] += $qty; |
@@ -750,19 +750,19 @@ discard block |
||
750 | 750 | case 'ticket_id': |
751 | 751 | $value_array = array(); |
752 | 752 | // cycle thru values |
753 | - foreach ( $input_value as $key=>$value ) { |
|
753 | + foreach ($input_value as $key=>$value) { |
|
754 | 754 | // allow only numbers, letters, spaces, commas and dashes |
755 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
755 | + $value_array[$key] = wp_strip_all_tags($value); |
|
756 | 756 | // get ticket via the ticket id we put in the form |
757 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
758 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
757 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
758 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
759 | 759 | } |
760 | - $valid_data[ $what ] = $value_array; |
|
760 | + $valid_data[$what] = $value_array; |
|
761 | 761 | break; |
762 | 762 | |
763 | 763 | case 'return_url' : |
764 | 764 | // grab and sanitize return-url |
765 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
765 | + $valid_data[$what] = esc_url_raw($input_value); |
|
766 | 766 | break; |
767 | 767 | |
768 | 768 | } // end switch $what |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | } // end foreach $inputs_to_clean |
771 | 771 | |
772 | 772 | } else { |
773 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
773 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
774 | 774 | return FALSE; |
775 | 775 | } |
776 | 776 | |
@@ -788,28 +788,28 @@ discard block |
||
788 | 788 | * @param int $qty |
789 | 789 | * @return TRUE on success, FALSE on fail |
790 | 790 | */ |
791 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
792 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
791 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
792 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
793 | 793 | // get the number of spaces left for this datetime ticket |
794 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
794 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
795 | 795 | // compare available spaces against the number of tickets being purchased |
796 | - if ( $available_spaces >= $qty ) { |
|
796 | + if ($available_spaces >= $qty) { |
|
797 | 797 | // allow addons to prevent a ticket from being added to cart |
798 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
798 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
799 | 799 | return false; |
800 | 800 | } |
801 | 801 | // add event to cart |
802 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
803 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
802 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
803 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
804 | 804 | return true; |
805 | 805 | } else { |
806 | 806 | return false; |
807 | 807 | } |
808 | 808 | } else { |
809 | 809 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
810 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
810 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
811 | 811 | // greedy greedy greedy eh? |
812 | - if ( $available_spaces > 0 ) { |
|
812 | + if ($available_spaces > 0) { |
|
813 | 813 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
814 | 814 | EE_Error::add_error( |
815 | 815 | sprintf( |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | __FILE__, __FUNCTION__, __LINE__ |
826 | 826 | ); |
827 | 827 | } else { |
828 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
828 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
829 | 829 | } |
830 | 830 | return false; |
831 | 831 | } |
@@ -843,22 +843,22 @@ discard block |
||
843 | 843 | * @param bool $get_original_ticket_spaces |
844 | 844 | * @return int |
845 | 845 | */ |
846 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
846 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
847 | 847 | // if the $_available_spaces array has not been set up yet... |
848 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
849 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
848 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
849 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
850 | 850 | } |
851 | 851 | $available_spaces = $ticket->qty() - $ticket->sold(); |
852 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
852 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
853 | 853 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
854 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
854 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
855 | 855 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
856 | - if ( $get_original_ticket_spaces ) { |
|
856 | + if ($get_original_ticket_spaces) { |
|
857 | 857 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
858 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
858 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
859 | 859 | } else { |
860 | 860 | // we want the updated ticket availability as stored in the "datetimes" array |
861 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
861 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | } |
@@ -874,23 +874,23 @@ discard block |
||
874 | 874 | * @param EE_Ticket $ticket |
875 | 875 | * @return int |
876 | 876 | */ |
877 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
877 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
878 | 878 | // first, get all of the datetimes that are available to this ticket |
879 | 879 | $datetimes = $ticket->get_many_related( |
880 | 880 | 'Datetime', |
881 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
881 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
882 | 882 | ); |
883 | - if ( ! empty( $datetimes )) { |
|
883 | + if ( ! empty($datetimes)) { |
|
884 | 884 | // now loop thru all of the datetimes |
885 | - foreach ( $datetimes as $datetime ) { |
|
886 | - if ( $datetime instanceof EE_Datetime ) { |
|
885 | + foreach ($datetimes as $datetime) { |
|
886 | + if ($datetime instanceof EE_Datetime) { |
|
887 | 887 | // the number of spaces available for the datetime without considering individual ticket quantities |
888 | 888 | $spaces_remaining = $datetime->spaces_remaining(); |
889 | 889 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
890 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
890 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
891 | 891 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
892 | 892 | // else just take the datetime spaces remaining, and assign to the datetimes array |
893 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
893 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
894 | 894 | } |
895 | 895 | } |
896 | 896 | } |
@@ -906,12 +906,12 @@ discard block |
||
906 | 906 | * @param int $qty |
907 | 907 | * @return int |
908 | 908 | */ |
909 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
910 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
909 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
910 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
911 | 911 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
912 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
912 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
913 | 913 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
914 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
914 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 | } |
@@ -928,8 +928,8 @@ discard block |
||
928 | 928 | */ |
929 | 929 | public static function load_tckt_slctr_assets() { |
930 | 930 | // add some style |
931 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
932 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
931 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
932 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
933 | 933 | wp_enqueue_style('ticket_selector'); |
934 | 934 | // make it dance |
935 | 935 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -943,9 +943,9 @@ discard block |
||
943 | 943 | |
944 | 944 | public static function load_tckt_slctr_assets_admin() { |
945 | 945 | //iframe button js on admin event editor page |
946 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
947 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
948 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
946 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
947 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
948 | + wp_enqueue_script('ticket_selector_embed'); |
|
949 | 949 | } |
950 | 950 | } |
951 | 951 |
@@ -8,34 +8,34 @@ discard block |
||
8 | 8 | |
9 | 9 | $row = 1; |
10 | 10 | $max = 1; |
11 | -$ticket_count = count( $tickets ); |
|
11 | +$ticket_count = count($tickets); |
|
12 | 12 | |
13 | -if ( ! $ticket_count ) { |
|
13 | +if ( ! $ticket_count) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | $required_ticket_sold_out = FALSE; |
18 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
18 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
19 | 19 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
20 | 20 | : new EE_Ticket_Selector_Config(); |
21 | 21 | |
22 | 22 | ob_start(); |
23 | 23 | |
24 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
25 | - if ( $ticket instanceof EE_Ticket ) { |
|
24 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
25 | + if ($ticket instanceof EE_Ticket) { |
|
26 | 26 | $max = $ticket->max(); |
27 | 27 | $min = 0; |
28 | 28 | $remaining = $ticket->remaining(); |
29 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
29 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
30 | 30 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
31 | - $max = min( $remaining, $max_atndz ); |
|
31 | + $max = min($remaining, $max_atndz); |
|
32 | 32 | // but... we also want to restrict the number of tickets by the ticket max setting, |
33 | 33 | // however, the max still can't be higher than what was just set above |
34 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
34 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
35 | 35 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
36 | 36 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
37 | 37 | // and if the ticket is required, then make sure that min qty is at least 1 |
38 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
38 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
39 | 39 | } else { |
40 | 40 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
41 | 41 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -44,41 +44,41 @@ discard block |
||
44 | 44 | $ticket_price = $ticket->get_ticket_total_with_taxes(); |
45 | 45 | $ticket_bundle = FALSE; |
46 | 46 | // for ticket bundles, set min and max qty the same |
47 | - if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) { |
|
47 | + if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) { |
|
48 | 48 | $ticket_price = $ticket_price * $ticket->min(); |
49 | 49 | $ticket_bundle = TRUE; |
50 | 50 | } |
51 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
51 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
52 | 52 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
53 | 53 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
54 | 54 | $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(); |
55 | 55 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
56 | 56 | // check ticket status |
57 | - switch ( $tkt_status ) { |
|
57 | + switch ($tkt_status) { |
|
58 | 58 | // sold_out |
59 | 59 | case EE_Ticket::sold_out : |
60 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
60 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>'; |
|
61 | 61 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
62 | 62 | break; |
63 | 63 | // expired |
64 | 64 | case EE_Ticket::expired : |
65 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
65 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>'; |
|
66 | 66 | $status_class = 'ticket-sales-expired lt-grey-text'; |
67 | 67 | break; |
68 | 68 | // archived |
69 | 69 | case EE_Ticket::archived : |
70 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
70 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>'; |
|
71 | 71 | $status_class = 'archived-ticket hidden'; |
72 | 72 | break; |
73 | 73 | // pending |
74 | 74 | case EE_Ticket::pending : |
75 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
75 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>'; |
|
76 | 76 | $status_class = 'ticket-pending'; |
77 | 77 | break; |
78 | 78 | // onsale |
79 | 79 | case EE_Ticket::onsale : |
80 | 80 | default : |
81 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
81 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>'; |
|
82 | 82 | $status_class = 'ticket-on-sale'; |
83 | 83 | break; |
84 | 84 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
119 | 119 | ); |
120 | 120 | ?> |
121 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
121 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
122 | 122 | <?php |
123 | 123 | /** |
124 | 124 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @var string|bool |
132 | 132 | */ |
133 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
133 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
134 | 134 | echo $new_row_cells_content; |
135 | 135 | echo '</tr>'; |
136 | 136 | continue; |
137 | 137 | } |
138 | 138 | ?> |
139 | 139 | <td class="tckt-slctr-tbl-td-name"> |
140 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
141 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
142 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
143 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
140 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
141 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
142 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
143 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
144 | 144 | </a> |
145 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
146 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
145 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
146 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
147 | 147 | </a> |
148 | 148 | <?php endif; //end show details check ?> |
149 | - <?php if ( $ticket->required() ) { ?> |
|
150 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
149 | + <?php if ($ticket->required()) { ?> |
|
150 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
151 | 151 | <?php } ?> |
152 | 152 | <?php |
153 | 153 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -161,63 +161,63 @@ discard block |
||
161 | 161 | // echo '<br/><b> $ticket->required() : ' . $ticket->uses() . '</b>'; |
162 | 162 | ?> |
163 | 163 | </td> |
164 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
165 | - <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?> <span class="smaller-text no-bold"><?php |
|
166 | - if ( $ticket_bundle ) { |
|
167 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
164 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
165 | + <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?> <span class="smaller-text no-bold"><?php |
|
166 | + if ($ticket_bundle) { |
|
167 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
168 | 168 | } else { |
169 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
169 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
170 | 170 | }?></span> </td> |
171 | 171 | <?php } ?> |
172 | 172 | <td class="tckt-slctr-tbl-td-qty cntr"> |
173 | 173 | <?php |
174 | 174 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
175 | 175 | // sold out or other status ? |
176 | - if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) { |
|
176 | + if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) { |
|
177 | 177 | ?> |
178 | - <span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold Out', 'event_espresso' ));?></span> |
|
178 | + <span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold Out', 'event_espresso')); ?></span> |
|
179 | 179 | <?php |
180 | - } else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) { |
|
180 | + } else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) { |
|
181 | 181 | echo $ticket_status; |
182 | - } else if ( $tkt_status == EE_Ticket::pending ) { |
|
182 | + } else if ($tkt_status == EE_Ticket::pending) { |
|
183 | 183 | ?> |
184 | 184 | <div class="ticket-pending-pg"> |
185 | - <span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes On Sale', 'event_espresso' )); ?></span><br/> |
|
186 | - <span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span> |
|
185 | + <span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes On Sale', 'event_espresso')); ?></span><br/> |
|
186 | + <span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span> |
|
187 | 187 | </div> |
188 | 188 | <?php |
189 | 189 | // min qty purchasable is less than tickets available |
190 | - } else if ( $ticket->min() > $remaining ) { |
|
190 | + } else if ($ticket->min() > $remaining) { |
|
191 | 191 | ?> |
192 | 192 | <div class="archived-ticket-pg"> |
193 | - <span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/> |
|
193 | + <span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/> |
|
194 | 194 | </div> |
195 | 195 | <?php |
196 | 196 | // if only one attendee is allowed to register at a time |
197 | - } else if ( $max_atndz == 1 ) { |
|
197 | + } else if ($max_atndz == 1) { |
|
198 | 198 | // display submit button since we have tickets available |
199 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
199 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
200 | 200 | ?> |
201 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
201 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
202 | 202 | <?php |
203 | 203 | $hidden_input_qty = FALSE; |
204 | 204 | |
205 | - } else if ( $max_atndz == 0 ) { |
|
206 | - echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>'; |
|
207 | - } elseif ( $max > 0 ) { |
|
205 | + } else if ($max_atndz == 0) { |
|
206 | + echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>'; |
|
207 | + } elseif ($max > 0) { |
|
208 | 208 | // display submit button since we have tickets available |
209 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
209 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
210 | 210 | |
211 | 211 | ?> |
212 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
212 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
213 | 213 | <?php |
214 | 214 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
215 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
215 | + if ( ! $ticket->required() && $min !== 0) { |
|
216 | 216 | ?> |
217 | 217 | <option value="0"> 0 </option> |
218 | 218 | <?php } |
219 | 219 | // offer ticket quantities from the min to the max |
220 | - for ( $i = $min; $i <= $max; $i++) { |
|
220 | + for ($i = $min; $i <= $max; $i++) { |
|
221 | 221 | ?> |
222 | 222 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
223 | 223 | <?php } ?> |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | } |
229 | 229 | // depending on group reg we need to change the format for qty |
230 | - if ( $hidden_input_qty ) { |
|
230 | + if ($hidden_input_qty) { |
|
231 | 231 | ?> |
232 | 232 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
233 | 233 | <?php |
@@ -237,33 +237,33 @@ discard block |
||
237 | 237 | |
238 | 238 | </td> |
239 | 239 | </tr> |
240 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
241 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
240 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
241 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
242 | 242 | <td class="tckt-slctr-tkt-details-td" colspan="3" > |
243 | 243 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
244 | 244 | |
245 | 245 | <section class="tckt-slctr-tkt-details-sctn"> |
246 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
246 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
247 | 247 | <p><?php echo $ticket->description(); ?></p> |
248 | 248 | |
249 | - <?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
249 | + <?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
250 | 250 | <section class="tckt-slctr-tkt-price-sctn"> |
251 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
251 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
252 | 252 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
253 | 253 | <table class="tckt-slctr-tkt-details-tbl"> |
254 | 254 | <thead> |
255 | 255 | <tr> |
256 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
257 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
258 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
256 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
257 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
258 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
259 | 259 | </tr> |
260 | 260 | </thead> |
261 | 261 | <tbody> |
262 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
262 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
263 | 263 | <tr> |
264 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
265 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
266 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
264 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
265 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
266 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
267 | 267 | </tr> |
268 | 268 | <?php |
269 | 269 | $running_total = $ticket->base_price()->amount(); |
@@ -271,44 +271,44 @@ discard block |
||
271 | 271 | $running_total = 0; |
272 | 272 | } |
273 | 273 | // now add price modifiers |
274 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
274 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
275 | 275 | <tr> |
276 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
277 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
278 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
276 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
277 | + <?php if ($price_mod->is_percent()) { ?> |
|
278 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
279 | 279 | <?php |
280 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
280 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
281 | 281 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
282 | 282 | ?> |
283 | 283 | <?php } else { ?> |
284 | 284 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
285 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
285 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
286 | 286 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
287 | 287 | <?php } ?> |
288 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
288 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
289 | 289 | <?php $running_total += $new_sub_total; ?> |
290 | 290 | </tr> |
291 | 291 | <?php } ?> |
292 | - <?php if ( $ticket->taxable() ) { ?> |
|
292 | + <?php if ($ticket->taxable()) { ?> |
|
293 | 293 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
294 | 294 | <tr> |
295 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
296 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
295 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
296 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
297 | 297 | </tr> |
298 | 298 | |
299 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
299 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
300 | 300 | <tr> |
301 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
302 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
303 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
304 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
301 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
302 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
303 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
304 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
305 | 305 | <?php $running_total += $tax_amount; ?> |
306 | 306 | </tr> |
307 | 307 | <?php } ?> |
308 | 308 | <?php } ?> |
309 | 309 | <tr> |
310 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
311 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
310 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
311 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
312 | 312 | </tr> |
313 | 313 | </tbody> |
314 | 314 | </table> |
@@ -318,106 +318,106 @@ discard block |
||
318 | 318 | <?php } ?> |
319 | 319 | |
320 | 320 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
321 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
322 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
323 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
324 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
321 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
322 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
323 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
324 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
325 | 325 | </section> |
326 | 326 | <br/> |
327 | 327 | |
328 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
328 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
329 | 329 | |
330 | - <?php if ( $ticket->min() &&$ticket->max() ) { ?> |
|
330 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
331 | 331 | <section class="tckt-slctr-tkt-quantities-sctn"> |
332 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
333 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
334 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
335 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
332 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
333 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
334 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
335 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
336 | 336 | <?php //$max = min( $max, $max_atndz );?> |
337 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
337 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
338 | 338 | </section> |
339 | 339 | <br/> |
340 | 340 | <?php } ?> |
341 | 341 | |
342 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
342 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
343 | 343 | <section class="tckt-slctr-tkt-uses-sctn"> |
344 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
344 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
345 | 345 | <span class="drk-grey-text small-text no-bold"> - <?php |
346 | 346 | echo apply_filters( |
347 | 347 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
348 | 348 | sprintf( |
349 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
349 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
350 | 350 | '<br/>', |
351 | 351 | '<strong>', |
352 | 352 | '</strong>' |
353 | 353 | ) |
354 | 354 | ); |
355 | 355 | ?></span><br/> |
356 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
356 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
357 | 357 | </section> |
358 | 358 | <?php } ?> |
359 | 359 | |
360 | 360 | <?php |
361 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
361 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
362 | 362 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
363 | - if ( ! empty( $datetimes )) { ?> |
|
363 | + if ( ! empty($datetimes)) { ?> |
|
364 | 364 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
365 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
366 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
365 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
366 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
367 | 367 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
368 | 368 | <table class="tckt-slctr-tkt-details-tbl"> |
369 | 369 | <thead> |
370 | 370 | <tr> |
371 | 371 | <th class="tckt-slctr-tkt-details-date-th"> |
372 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
372 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
373 | 373 | </th> |
374 | 374 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
375 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
375 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
376 | 376 | </th> |
377 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
377 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
378 | 378 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
379 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
379 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
380 | 380 | </th> |
381 | 381 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
382 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
382 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
383 | 383 | </th> |
384 | 384 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
385 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
385 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
386 | 386 | </th> |
387 | 387 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
388 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
388 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
389 | 389 | </th> |
390 | 390 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
391 | 391 | </tr> |
392 | 392 | </thead> |
393 | 393 | <tbody> |
394 | 394 | <?php |
395 | - foreach ( $datetimes as $datetime ) { |
|
396 | - if ( $datetime instanceof EE_Datetime ) { |
|
395 | + foreach ($datetimes as $datetime) { |
|
396 | + if ($datetime instanceof EE_Datetime) { |
|
397 | 397 | ?> |
398 | 398 | |
399 | 399 | <tr> |
400 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
400 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
401 | 401 | <?php $datetime_name = $datetime->name(); ?> |
402 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
403 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
402 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
403 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
404 | 404 | </td> |
405 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
406 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
405 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
406 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
407 | 407 | </td> |
408 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
409 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
408 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
409 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
410 | 410 | <?php echo $ticket->sold(); ?> |
411 | 411 | </td> |
412 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
413 | - <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
412 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
413 | + <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
414 | 414 | </td> |
415 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
415 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
416 | 416 | <?php echo $datetime->sold(); ?> |
417 | 417 | </td> |
418 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
419 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
420 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
418 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
419 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
420 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
421 | 421 | </td> |
422 | 422 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
423 | 423 | </tr> |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | </div> |
436 | 436 | </td> |
437 | 437 | </tr> |
438 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
438 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
439 | 439 | <?php |
440 | 440 | $row++; |
441 | 441 | } |
@@ -444,32 +444,32 @@ discard block |
||
444 | 444 | $ticket_row_html = ob_get_clean(); |
445 | 445 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
446 | 446 | $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false; |
447 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
447 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
448 | 448 | // EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
449 | 449 | // EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ ); |
450 | 450 | // EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ ); |
451 | 451 | //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ ); |
452 | 452 | remove_filter( |
453 | 453 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
454 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
454 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
455 | 455 | ); |
456 | 456 | remove_filter( |
457 | 457 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
458 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
458 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
459 | 459 | ); |
460 | -if ( ! $hide_ticket_selector ) { |
|
460 | +if ( ! $hide_ticket_selector) { |
|
461 | 461 | ?> |
462 | 462 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
463 | 463 | |
464 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
464 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
465 | 465 | |
466 | 466 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
467 | 467 | <thead> |
468 | 468 | <tr> |
469 | 469 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
470 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
470 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
471 | 471 | </th> |
472 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
472 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
473 | 473 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
474 | 474 | <?php |
475 | 475 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @param string 'Price' The translatable text to display in the table header for price |
481 | 481 | * @param int $EVT_ID The Event ID |
482 | 482 | */ |
483 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
483 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
484 | 484 | ?> |
485 | 485 | </th> |
486 | 486 | <?php } ?> |
@@ -494,24 +494,24 @@ discard block |
||
494 | 494 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
495 | 495 | * @param int $EVT_ID The Event ID |
496 | 496 | */ |
497 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
497 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
498 | 498 | ?> |
499 | 499 | </th> |
500 | 500 | </tr> |
501 | 501 | </thead> |
502 | 502 | <tbody> |
503 | - <?php echo $ticket_row_html;?> |
|
503 | + <?php echo $ticket_row_html; ?> |
|
504 | 504 | </tbody> |
505 | 505 | </table> |
506 | 506 | |
507 | 507 | <input type="hidden" name="noheader" value="true" /> |
508 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" /> |
|
508 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" /> |
|
509 | 509 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
510 | 510 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
511 | 511 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
512 | 512 | |
513 | 513 | <?php |
514 | -if ( $max_atndz > 0 && ! $hide_ticket_selector ) { |
|
514 | +if ($max_atndz > 0 && ! $hide_ticket_selector) { |
|
515 | 515 | echo apply_filters( |
516 | 516 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
517 | 517 | '' |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | } |
520 | 520 | ?> |
521 | 521 | |
522 | - <?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?> |
|
522 | + <?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?> |
|
523 | 523 | |
524 | 524 | </div> |
525 | -<?php } else if ( isset( $TKT_ID ) ) { ?> |
|
525 | +<?php } else if (isset($TKT_ID)) { ?> |
|
526 | 526 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
527 | 527 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
528 | 528 | <input type="hidden" name="noheader" value="true"/> |
@@ -531,27 +531,27 @@ discard block |
||
531 | 531 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
532 | 532 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
533 | 533 | <?php |
534 | - if ( $ticket instanceof EE_Ticket ) { |
|
535 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
534 | + if ($ticket instanceof EE_Ticket) { |
|
535 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
536 | 536 | $ticket_description = $ticket->description(); |
537 | 537 | ?> |
538 | 538 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
539 | 539 | <div class="no-tkt-slctr-ticket-content-dv"> |
540 | 540 | <h5><?php echo $ticket->name(); ?></h5> |
541 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
541 | + <?php if ( ! empty($ticket_description)) { ?> |
|
542 | 542 | <p><?php echo $ticket_description; ?></p> |
543 | 543 | <?php } ?> |
544 | 544 | </div> |
545 | 545 | <?php |
546 | 546 | add_filter( |
547 | 547 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
548 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
548 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
549 | 549 | ); |
550 | 550 | add_filter( |
551 | 551 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
552 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
552 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
553 | 553 | ); |
554 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
554 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
555 | 555 | } |
556 | 556 | } |
557 | 557 | ?> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -15,5 +15,5 @@ discard block |
||
15 | 15 | * @author Darren Ethier |
16 | 16 | * @since 4.9.11.rc.001 |
17 | 17 | */ |
18 | -class SendMessageException extends \RuntimeException {} |
|
18 | +class SendMessageException extends \RuntimeException {} |
|
19 | 19 | // End of file SendMessageException.php |
20 | 20 | \ No newline at end of file |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | use EventEspresso\core\domain\entities\RegUrlLink; |
4 | 4 | use EventEspresso\core\domain\services\registration\CreateRegistrationService; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
7 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
7 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class EE_Registration_Processor |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function instance() { |
68 | 68 | // check if class object is instantiated |
69 | - if ( ! self::$_instance instanceof EE_Registration_Processor ) { |
|
69 | + if ( ! self::$_instance instanceof EE_Registration_Processor) { |
|
70 | 70 | self::$_instance = new self(); |
71 | 71 | } |
72 | 72 | return self::$_instance; |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @param int $REG_ID |
87 | 87 | * @return string |
88 | 88 | */ |
89 | - public function old_reg_status( $REG_ID ) { |
|
90 | - return isset( $this->_old_reg_status[ $REG_ID ] ) ? $this->_old_reg_status[ $REG_ID ] : null; |
|
89 | + public function old_reg_status($REG_ID) { |
|
90 | + return isset($this->_old_reg_status[$REG_ID]) ? $this->_old_reg_status[$REG_ID] : null; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | * @param int $REG_ID |
97 | 97 | * @param string $old_reg_status |
98 | 98 | */ |
99 | - public function set_old_reg_status( $REG_ID, $old_reg_status ) { |
|
99 | + public function set_old_reg_status($REG_ID, $old_reg_status) { |
|
100 | 100 | // only set the first time |
101 | - if ( ! isset( $this->_old_reg_status[ $REG_ID ] ) ) { |
|
102 | - $this->_old_reg_status[ $REG_ID ] = $old_reg_status; |
|
101 | + if ( ! isset($this->_old_reg_status[$REG_ID])) { |
|
102 | + $this->_old_reg_status[$REG_ID] = $old_reg_status; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param int $REG_ID |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function new_reg_status( $REG_ID ) { |
|
113 | - return isset( $this->_new_reg_status[ $REG_ID ] ) ? $this->_new_reg_status[ $REG_ID ] : null; |
|
112 | + public function new_reg_status($REG_ID) { |
|
113 | + return isset($this->_new_reg_status[$REG_ID]) ? $this->_new_reg_status[$REG_ID] : null; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param int $REG_ID |
120 | 120 | * @param string $new_reg_status |
121 | 121 | */ |
122 | - public function set_new_reg_status( $REG_ID, $new_reg_status ) { |
|
123 | - $this->_new_reg_status[ $REG_ID ] = $new_reg_status; |
|
122 | + public function set_new_reg_status($REG_ID, $new_reg_status) { |
|
123 | + $this->_new_reg_status[$REG_ID] = $new_reg_status; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param int $REG_ID |
132 | 132 | * @return bool |
133 | 133 | */ |
134 | - public function reg_status_updated( $REG_ID ) { |
|
135 | - return $this->new_reg_status( $REG_ID ) !== $this->old_reg_status( $REG_ID ) ? true : false; |
|
134 | + public function reg_status_updated($REG_ID) { |
|
135 | + return $this->new_reg_status($REG_ID) !== $this->old_reg_status($REG_ID) ? true : false; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | * @param \EE_Registration $registration |
142 | 142 | * @throws \EE_Error |
143 | 143 | */ |
144 | - public function update_registration_status_and_trigger_notifications( \EE_Registration $registration ) { |
|
145 | - $this->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
146 | - $this->toggle_registration_status_for_default_approved_events( $registration, false ); |
|
147 | - $this->toggle_registration_status_if_no_monies_owing( $registration, false ); |
|
144 | + public function update_registration_status_and_trigger_notifications(\EE_Registration $registration) { |
|
145 | + $this->toggle_incomplete_registration_status_to_default($registration, false); |
|
146 | + $this->toggle_registration_status_for_default_approved_events($registration, false); |
|
147 | + $this->toggle_registration_status_if_no_monies_owing($registration, false); |
|
148 | 148 | $registration->save(); |
149 | 149 | // trigger notifications |
150 | - $this->trigger_registration_update_notifications( $registration ); |
|
150 | + $this->trigger_registration_update_notifications($registration); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | * @return boolean |
163 | 163 | * @throws \EE_Error |
164 | 164 | */ |
165 | - public function manually_update_registration_status( EE_Registration $registration, $new_reg_status = '', $save = true ) { |
|
165 | + public function manually_update_registration_status(EE_Registration $registration, $new_reg_status = '', $save = true) { |
|
166 | 166 | // set initial REG_Status |
167 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
167 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
168 | 168 | // set incoming REG_Status |
169 | - $this->set_new_reg_status( $registration->ID(), $new_reg_status ); |
|
169 | + $this->set_new_reg_status($registration->ID(), $new_reg_status); |
|
170 | 170 | // toggle reg status but only if it has changed and the user can do so |
171 | 171 | if ( |
172 | - $this->reg_status_updated( $registration->ID() ) && |
|
173 | - EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registration', 'toggle_registration_status', $registration->ID() ) |
|
172 | + $this->reg_status_updated($registration->ID()) && |
|
173 | + EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'toggle_registration_status', $registration->ID()) |
|
174 | 174 | ) { |
175 | 175 | // change status to new value |
176 | - if ( $registration->set_status( $this->new_reg_status( $registration->ID() ) ) && $save ) { |
|
176 | + if ($registration->set_status($this->new_reg_status($registration->ID())) && $save) { |
|
177 | 177 | $registration->save(); |
178 | 178 | } |
179 | 179 | return TRUE; |
@@ -193,30 +193,30 @@ discard block |
||
193 | 193 | * @return void |
194 | 194 | * @throws \EE_Error |
195 | 195 | */ |
196 | - public function toggle_incomplete_registration_status_to_default( EE_Registration $registration, $save = TRUE ) { |
|
196 | + public function toggle_incomplete_registration_status_to_default(EE_Registration $registration, $save = TRUE) { |
|
197 | 197 | $existing_reg_status = $registration->status_ID(); |
198 | 198 | // set initial REG_Status |
199 | - $this->set_old_reg_status( $registration->ID(), $existing_reg_status ); |
|
199 | + $this->set_old_reg_status($registration->ID(), $existing_reg_status); |
|
200 | 200 | // is the registration currently incomplete ? |
201 | - if ( $registration->status_ID() === EEM_Registration::status_id_incomplete ) { |
|
201 | + if ($registration->status_ID() === EEM_Registration::status_id_incomplete) { |
|
202 | 202 | // grab default reg status for the event, if set |
203 | 203 | $event_default_registration_status = $registration->event()->default_registration_status(); |
204 | 204 | // if no default reg status is set for the event, then use the global value |
205 | - $STS_ID = ! empty( $event_default_registration_status ) |
|
205 | + $STS_ID = ! empty($event_default_registration_status) |
|
206 | 206 | ? $event_default_registration_status |
207 | 207 | : EE_Registry::instance()->CFG->registration->default_STS_ID; |
208 | 208 | // if the event default reg status is approved, then downgrade temporarily to payment pending to ensure that payments are triggered |
209 | 209 | $STS_ID = $STS_ID === EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $STS_ID; |
210 | 210 | // set incoming REG_Status |
211 | - $this->set_new_reg_status( $registration->ID(), $STS_ID ); |
|
212 | - $registration->set_status( $STS_ID ); |
|
213 | - if ( $save ) { |
|
211 | + $this->set_new_reg_status($registration->ID(), $STS_ID); |
|
212 | + $registration->set_status($STS_ID); |
|
213 | + if ($save) { |
|
214 | 214 | $registration->save(); |
215 | 215 | } |
216 | 216 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
217 | - if ( ! EE_Processor_Base::$IPN ) { |
|
217 | + if ( ! EE_Processor_Base::$IPN) { |
|
218 | 218 | // otherwise, send out notifications |
219 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
219 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
220 | 220 | } |
221 | 221 | // DEBUG LOG |
222 | 222 | //$this->log( |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | * @return boolean |
242 | 242 | * @throws \EE_Error |
243 | 243 | */ |
244 | - public function toggle_registration_status_for_default_approved_events( EE_Registration $registration, $save = TRUE ) { |
|
244 | + public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) { |
|
245 | 245 | $reg_status = $registration->status_ID(); |
246 | 246 | // set initial REG_Status |
247 | - $this->set_old_reg_status( $registration->ID(), $reg_status ); |
|
247 | + $this->set_old_reg_status($registration->ID(), $reg_status); |
|
248 | 248 | // if not already, toggle reg status to approved IF the event default reg status is approved |
249 | 249 | // ( as long as the registration wasn't cancelled or declined at some point ) |
250 | 250 | if ( |
@@ -254,16 +254,16 @@ discard block |
||
254 | 254 | $registration->event()->default_registration_status() === EEM_Registration::status_id_approved |
255 | 255 | ) { |
256 | 256 | // set incoming REG_Status |
257 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
257 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
258 | 258 | // toggle status to approved |
259 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
260 | - if ( $save ) { |
|
259 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
260 | + if ($save) { |
|
261 | 261 | $registration->save(); |
262 | 262 | } |
263 | 263 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
264 | - if ( ! EE_Processor_Base::$IPN ) { |
|
264 | + if ( ! EE_Processor_Base::$IPN) { |
|
265 | 265 | // otherwise, send out notifications |
266 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
266 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
267 | 267 | } |
268 | 268 | // DEBUG LOG |
269 | 269 | //$this->log( |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | * @return bool |
292 | 292 | * @throws \EE_Error |
293 | 293 | */ |
294 | - public function toggle_registration_status_if_no_monies_owing( EE_Registration $registration, $save = TRUE, $additional_details = array() ) { |
|
294 | + public function toggle_registration_status_if_no_monies_owing(EE_Registration $registration, $save = TRUE, $additional_details = array()) { |
|
295 | 295 | // set initial REG_Status |
296 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
296 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
297 | 297 | //EEH_Debug_Tools::printr( $additional_details, '$additional_details', __FILE__, __LINE__ ); |
298 | 298 | // was a payment just made ? |
299 | 299 | if ( |
300 | - isset( $additional_details[ 'payment_updates' ], $additional_details[ 'last_payment' ] ) && |
|
301 | - $additional_details[ 'payment_updates' ] && |
|
302 | - $additional_details[ 'last_payment' ] instanceof EE_Payment |
|
300 | + isset($additional_details['payment_updates'], $additional_details['last_payment']) && |
|
301 | + $additional_details['payment_updates'] && |
|
302 | + $additional_details['last_payment'] instanceof EE_Payment |
|
303 | 303 | ) { |
304 | - $payment = $additional_details[ 'last_payment' ]; |
|
304 | + $payment = $additional_details['last_payment']; |
|
305 | 305 | $total_paid = 0; |
306 | - foreach ( self::$_amount_paid as $reg => $amount_paid ) { |
|
306 | + foreach (self::$_amount_paid as $reg => $amount_paid) { |
|
307 | 307 | $total_paid += $amount_paid; |
308 | 308 | } |
309 | 309 | } else { |
@@ -327,30 +327,30 @@ discard block |
||
327 | 327 | $registration->transaction()->is_completed() || |
328 | 328 | $registration->transaction()->is_overpaid() || |
329 | 329 | $registration->transaction()->is_free() || |
330 | - apply_filters( 'FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration ) |
|
330 | + apply_filters('FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration) |
|
331 | 331 | ) || ( |
332 | 332 | $payment instanceof EE_Payment && |
333 | 333 | $payment->is_approved() && |
334 | 334 | // this specific registration has not yet been paid for |
335 | - ! isset( self::$_amount_paid[ $registration->ID() ] ) && |
|
335 | + ! isset(self::$_amount_paid[$registration->ID()]) && |
|
336 | 336 | // payment amount, less what we have already attributed to other registrations, is greater than this reg's final price |
337 | 337 | $payment->amount() - $total_paid >= $registration->final_price() |
338 | 338 | ) |
339 | 339 | ) |
340 | 340 | ) { |
341 | 341 | // mark as paid |
342 | - self::$_amount_paid[ $registration->ID() ] = $registration->final_price(); |
|
342 | + self::$_amount_paid[$registration->ID()] = $registration->final_price(); |
|
343 | 343 | // track new REG_Status |
344 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
344 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
345 | 345 | // toggle status to approved |
346 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
347 | - if ( $save ) { |
|
346 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
347 | + if ($save) { |
|
348 | 348 | $registration->save(); |
349 | 349 | } |
350 | 350 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
351 | - if ( ! EE_Processor_Base::$IPN ) { |
|
351 | + if ( ! EE_Processor_Base::$IPN) { |
|
352 | 352 | // otherwise, send out notifications |
353 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
353 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
354 | 354 | } |
355 | 355 | // DEBUG LOG |
356 | 356 | //$this->log( |
@@ -376,27 +376,27 @@ discard block |
||
376 | 376 | * @param array $additional_details |
377 | 377 | * @return void |
378 | 378 | */ |
379 | - public function trigger_registration_update_notifications( $registration, $additional_details = array() ) { |
|
379 | + public function trigger_registration_update_notifications($registration, $additional_details = array()) { |
|
380 | 380 | try { |
381 | - if ( ! $registration instanceof EE_Registration ) { |
|
382 | - throw new EE_Error( __( 'An invalid registration was received.', 'event_espresso' ) ); |
|
381 | + if ( ! $registration instanceof EE_Registration) { |
|
382 | + throw new EE_Error(__('An invalid registration was received.', 'event_espresso')); |
|
383 | 383 | } |
384 | - EE_Registry::instance()->load_helper( 'Debug_Tools' ); |
|
384 | + EE_Registry::instance()->load_helper('Debug_Tools'); |
|
385 | 385 | EEH_Debug_Tools::log( |
386 | 386 | __CLASS__, |
387 | 387 | __FUNCTION__, |
388 | 388 | __LINE__, |
389 | - array( $registration->transaction(), $additional_details ), |
|
389 | + array($registration->transaction(), $additional_details), |
|
390 | 390 | false, |
391 | - 'EE_Transaction: ' . $registration->transaction()->ID() |
|
391 | + 'EE_Transaction: '.$registration->transaction()->ID() |
|
392 | 392 | ); |
393 | 393 | do_action( |
394 | 394 | 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', |
395 | 395 | $registration, |
396 | 396 | $additional_details |
397 | 397 | ); |
398 | - } catch( Exception $e ) { |
|
399 | - EE_Error::add_error( $e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine() ); |
|
398 | + } catch (Exception $e) { |
|
399 | + EE_Error::add_error($e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine()); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -410,22 +410,22 @@ discard block |
||
410 | 410 | * @return bool |
411 | 411 | * @throws \EE_Error |
412 | 412 | */ |
413 | - public function update_registration_after_checkout_or_payment( EE_Registration $registration, $additional_details = array() ) { |
|
413 | + public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) { |
|
414 | 414 | // set initial REG_Status |
415 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
415 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
416 | 416 | |
417 | 417 | // if the registration status gets updated, then save the registration |
418 | 418 | if ( |
419 | - $this->toggle_registration_status_for_default_approved_events( $registration, false ) |
|
420 | - || $this->toggle_registration_status_if_no_monies_owing( $registration, false, $additional_details ) |
|
419 | + $this->toggle_registration_status_for_default_approved_events($registration, false) |
|
420 | + || $this->toggle_registration_status_if_no_monies_owing($registration, false, $additional_details) |
|
421 | 421 | ) { |
422 | 422 | $registration->save(); |
423 | 423 | } |
424 | 424 | |
425 | 425 | // set new REG_Status |
426 | - $this->set_new_reg_status( $registration->ID(), $registration->status_ID() ); |
|
427 | - return $this->reg_status_updated( $registration->ID() ) |
|
428 | - && $this->new_reg_status( $registration->ID() ) === EEM_Registration::status_id_approved |
|
426 | + $this->set_new_reg_status($registration->ID(), $registration->status_ID()); |
|
427 | + return $this->reg_status_updated($registration->ID()) |
|
428 | + && $this->new_reg_status($registration->ID()) === EEM_Registration::status_id_approved |
|
429 | 429 | ? true |
430 | 430 | : false; |
431 | 431 | } |
@@ -441,20 +441,20 @@ discard block |
||
441 | 441 | * @return void |
442 | 442 | * @throws \EE_Error |
443 | 443 | */ |
444 | - public function update_registration_final_prices( $transaction, $save_regs = true ) { |
|
445 | - $reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() ); |
|
446 | - foreach( $transaction->registrations() as $registration ) { |
|
444 | + public function update_registration_final_prices($transaction, $save_regs = true) { |
|
445 | + $reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item()); |
|
446 | + foreach ($transaction->registrations() as $registration) { |
|
447 | 447 | /** @var EE_Line_Item $line_item */ |
448 | - $line_item = EEM_Line_Item::instance()->get_line_item_for_registration( $registration ); |
|
449 | - if( isset( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ) ) { |
|
450 | - $registration->set_final_price( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ); |
|
451 | - if( $save_regs ) { |
|
448 | + $line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration); |
|
449 | + if (isset($reg_final_price_per_ticket_line_item[$line_item->ID()])) { |
|
450 | + $registration->set_final_price($reg_final_price_per_ticket_line_item[$line_item->ID()]); |
|
451 | + if ($save_regs) { |
|
452 | 452 | $registration->save(); |
453 | 453 | } |
454 | 454 | } |
455 | 455 | } |
456 | 456 | //and make sure there's no rounding problem |
457 | - $this->fix_reg_final_price_rounding_issue( $transaction ); |
|
457 | + $this->fix_reg_final_price_rounding_issue($transaction); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @return boolean success verifying that there is NO difference after this method is done |
475 | 475 | * @throws \EE_Error |
476 | 476 | */ |
477 | - public function fix_reg_final_price_rounding_issue( $transaction ) { |
|
477 | + public function fix_reg_final_price_rounding_issue($transaction) { |
|
478 | 478 | $reg_final_price_sum = EEM_Registration::instance()->sum( |
479 | 479 | array( |
480 | 480 | array( |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | ), |
484 | 484 | 'REG_final_price' |
485 | 485 | ); |
486 | - $diff = $transaction->total() - (float) $reg_final_price_sum; |
|
486 | + $diff = $transaction->total() - (float) $reg_final_price_sum; |
|
487 | 487 | //ok then, just grab one of the registrations |
488 | - if( $diff !== 0 ) { |
|
488 | + if ($diff !== 0) { |
|
489 | 489 | $a_reg = EEM_Registration::instance()->get_one( |
490 | 490 | array( |
491 | 491 | array( |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | )); |
495 | 495 | $success = $a_reg instanceof EE_Registration |
496 | 496 | ? $a_reg->save( |
497 | - array( 'REG_final_price' => $a_reg->final_price() + $diff ) |
|
497 | + array('REG_final_price' => $a_reg->final_price() + $diff) |
|
498 | 498 | ) |
499 | 499 | : false; |
500 | 500 | return $success ? true : false; |
@@ -519,13 +519,13 @@ discard block |
||
519 | 519 | $update_reg = true |
520 | 520 | ) { |
521 | 521 | // these reg statuses should not be considered in any calculations involving monies owing |
522 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses |
|
522 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
523 | 523 | : EEM_Registration::closed_reg_statuses(); |
524 | - if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
524 | + if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
525 | 525 | return false; |
526 | 526 | } |
527 | 527 | $registration->set_final_price(0); |
528 | - if ( $update_reg ) { |
|
528 | + if ($update_reg) { |
|
529 | 529 | $registration->save(); |
530 | 530 | } |
531 | 531 | return true; |
@@ -548,23 +548,23 @@ discard block |
||
548 | 548 | $update_reg = true |
549 | 549 | ) { |
550 | 550 | // these reg statuses should not be considered in any calculations involving monies owing |
551 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses |
|
551 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
552 | 552 | : EEM_Registration::closed_reg_statuses(); |
553 | - if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
553 | + if (in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | $ticket = $registration->ticket(); |
557 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
557 | + if ( ! $ticket instanceof EE_Ticket) { |
|
558 | 558 | throw new EE_Error( |
559 | 559 | sprintf( |
560 | - __( 'The Ticket for Registration %1$d was not found or is invalid.', |
|
561 | - 'event_espresso' ), |
|
560 | + __('The Ticket for Registration %1$d was not found or is invalid.', |
|
561 | + 'event_espresso'), |
|
562 | 562 | $registration->ticket_ID() |
563 | 563 | ) |
564 | 564 | ); |
565 | 565 | } |
566 | - $registration->set_final_price( $ticket->price() ); |
|
567 | - if ( $update_reg ) { |
|
566 | + $registration->set_final_price($ticket->price()); |
|
567 | + if ($update_reg) { |
|
568 | 568 | $registration->save(); |
569 | 569 | } |
570 | 570 | return true; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $total_ticket_count = 1 |
603 | 603 | ) { |
604 | 604 | EE_Error::doing_it_wrong( |
605 | - __CLASS__ . '::' . __FUNCTION__, |
|
605 | + __CLASS__.'::'.__FUNCTION__, |
|
606 | 606 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
607 | 607 | '\EventEspresso\core\domain\services\registration\CreateRegistrationService::create()'), |
608 | 608 | '4.9.1', |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | public function generate_reg_url_link($att_nmbr, $item) |
646 | 646 | { |
647 | 647 | EE_Error::doing_it_wrong( |
648 | - __CLASS__ . '::' . __FUNCTION__, |
|
648 | + __CLASS__.'::'.__FUNCTION__, |
|
649 | 649 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
650 | 650 | 'EventEspresso\core\domain\entities\RegUrlLink'), |
651 | 651 | '4.9.1', |
@@ -665,11 +665,11 @@ discard block |
||
665 | 665 | * @return string |
666 | 666 | * @throws \EE_Error |
667 | 667 | */ |
668 | - public function generate_reg_code( EE_Registration $registration ) { |
|
668 | + public function generate_reg_code(EE_Registration $registration) { |
|
669 | 669 | EE_Error::doing_it_wrong( |
670 | - __CLASS__ . '::' . __FUNCTION__, |
|
670 | + __CLASS__.'::'.__FUNCTION__, |
|
671 | 671 | sprintf( |
672 | - __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), |
|
672 | + __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
673 | 673 | 'EventEspresso\core\domain\entities\RegCode' |
674 | 674 | ), |
675 | 675 | '4.9.1', |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | return apply_filters( |
679 | 679 | 'FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', |
680 | 680 | new RegCode( |
681 | - RegUrlLink::fromRegistration( $registration ), |
|
681 | + RegUrlLink::fromRegistration($registration), |
|
682 | 682 | $registration->transaction(), |
683 | 683 | $registration->ticket() |
684 | 684 | ), |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use \EventEspresso\core\exceptions\SendMessageException; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param \EE_Message_Repository $message_repository |
78 | 78 | */ |
79 | - public function __construct( EE_Message_Repository $message_repository ) { |
|
80 | - $this->_batch_count = apply_filters( 'FHEE__EE_Messages_Queue___batch_count', 50 ); |
|
79 | + public function __construct(EE_Message_Repository $message_repository) { |
|
80 | + $this->_batch_count = apply_filters('FHEE__EE_Messages_Queue___batch_count', 50); |
|
81 | 81 | $this->_rate_limit = $this->get_rate_limit(); |
82 | 82 | $this->_message_repository = $message_repository; |
83 | 83 | } |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | * use the messenger send method but typically is based on preview data. |
97 | 97 | * @return bool Whether the message was successfully added to the repository or not. |
98 | 98 | */ |
99 | - public function add( EE_Message $message, $data = array(), $preview = false, $test_send = false ) { |
|
99 | + public function add(EE_Message $message, $data = array(), $preview = false, $test_send = false) { |
|
100 | 100 | $data['preview'] = $preview; |
101 | 101 | $data['test_send'] = $test_send; |
102 | - return $this->_message_repository->add( $message, $data ); |
|
102 | + return $this->_message_repository->add($message, $data); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | * @param bool $persist This flag indicates whether to attempt to delete the object from the db as well. |
112 | 112 | * @return bool |
113 | 113 | */ |
114 | - public function remove( EE_Message $message, $persist = false ) { |
|
115 | - if ( $persist && $this->_message_repository->current() !== $message ) { |
|
114 | + public function remove(EE_Message $message, $persist = false) { |
|
115 | + if ($persist && $this->_message_repository->current() !== $message) { |
|
116 | 116 | //get pointer on right message |
117 | - if ( $this->_message_repository->has( $message ) ) { |
|
117 | + if ($this->_message_repository->has($message)) { |
|
118 | 118 | $this->_message_repository->rewind(); |
119 | - while( $this->_message_repository->valid() ) { |
|
120 | - if ( $this->_message_repository->current() === $message ) { |
|
119 | + while ($this->_message_repository->valid()) { |
|
120 | + if ($this->_message_repository->current() === $message) { |
|
121 | 121 | break; |
122 | 122 | } |
123 | 123 | $this->_message_repository->next(); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return false; |
127 | 127 | } |
128 | 128 | } |
129 | - return $persist ? $this->_message_repository->delete() : $this->_message_repository->remove( $message ); |
|
129 | + return $persist ? $this->_message_repository->delete() : $this->_message_repository->remove($message); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -166,29 +166,29 @@ discard block |
||
166 | 166 | * @return bool true if successfully retrieved batch, false no batch ready. |
167 | 167 | */ |
168 | 168 | public function get_batch_to_generate() { |
169 | - if ( $this->is_locked( EE_Messages_Queue::action_generating ) ) { |
|
169 | + if ($this->is_locked(EE_Messages_Queue::action_generating)) { |
|
170 | 170 | return false; |
171 | 171 | } |
172 | 172 | |
173 | 173 | //lock batch generation to prevent race conditions. |
174 | - $this->lock_queue( EE_Messages_Queue::action_generating ); |
|
174 | + $this->lock_queue(EE_Messages_Queue::action_generating); |
|
175 | 175 | |
176 | 176 | $query_args = array( |
177 | 177 | // key 0 = where conditions |
178 | - 0 => array( 'STS_ID' => EEM_Message::status_incomplete ), |
|
178 | + 0 => array('STS_ID' => EEM_Message::status_incomplete), |
|
179 | 179 | 'order_by' => $this->_get_priority_orderby(), |
180 | 180 | 'limit' => $this->_batch_count |
181 | 181 | ); |
182 | - $messages = EEM_Message::instance()->get_all( $query_args ); |
|
182 | + $messages = EEM_Message::instance()->get_all($query_args); |
|
183 | 183 | |
184 | - if ( ! $messages ) { |
|
184 | + if ( ! $messages) { |
|
185 | 185 | return false; //nothing to generate |
186 | 186 | } |
187 | 187 | |
188 | - foreach ( $messages as $message ) { |
|
189 | - if ( $message instanceof EE_Message ) { |
|
188 | + foreach ($messages as $message) { |
|
189 | + if ($message instanceof EE_Message) { |
|
190 | 190 | $data = $message->all_extra_meta_array(); |
191 | - $this->add( $message, $data ); |
|
191 | + $this->add($message, $data); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | return true; |
@@ -211,34 +211,34 @@ discard block |
||
211 | 211 | * to assist with notifying user. |
212 | 212 | */ |
213 | 213 | public function get_to_send_batch_and_send() { |
214 | - if ( $this->is_locked( EE_Messages_Queue::action_sending ) || $this->_rate_limit < 1 ) { |
|
214 | + if ($this->is_locked(EE_Messages_Queue::action_sending) || $this->_rate_limit < 1) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | - $this->lock_queue( EE_Messages_Queue::action_sending ); |
|
218 | + $this->lock_queue(EE_Messages_Queue::action_sending); |
|
219 | 219 | |
220 | 220 | $batch = $this->_batch_count < $this->_rate_limit ? $this->_batch_count : $this->_rate_limit; |
221 | 221 | |
222 | 222 | $query_args = array( |
223 | 223 | // key 0 = where conditions |
224 | - 0 => array( 'STS_ID' => array( 'IN', EEM_Message::instance()->stati_indicating_to_send() ) ), |
|
224 | + 0 => array('STS_ID' => array('IN', EEM_Message::instance()->stati_indicating_to_send())), |
|
225 | 225 | 'order_by' => $this->_get_priority_orderby(), |
226 | 226 | 'limit' => $batch |
227 | 227 | ); |
228 | 228 | |
229 | - $messages_to_send = EEM_Message::instance()->get_all( $query_args ); |
|
229 | + $messages_to_send = EEM_Message::instance()->get_all($query_args); |
|
230 | 230 | |
231 | 231 | |
232 | 232 | //any to send? |
233 | - if ( ! $messages_to_send ) { |
|
234 | - $this->unlock_queue( EE_Messages_Queue::action_sending ); |
|
233 | + if ( ! $messages_to_send) { |
|
234 | + $this->unlock_queue(EE_Messages_Queue::action_sending); |
|
235 | 235 | return false; |
236 | 236 | } |
237 | 237 | |
238 | 238 | //add to queue. |
239 | - foreach ( $messages_to_send as $message ) { |
|
240 | - if ( $message instanceof EE_Message ) { |
|
241 | - $this->add( $message ); |
|
239 | + foreach ($messages_to_send as $message) { |
|
240 | + if ($message instanceof EE_Message) { |
|
241 | + $this->add($message); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $this->execute(); |
247 | 247 | |
248 | 248 | //release lock |
249 | - $this->unlock_queue( EE_Messages_Queue::action_sending ); |
|
249 | + $this->unlock_queue(EE_Messages_Queue::action_sending); |
|
250 | 250 | return true; |
251 | 251 | } |
252 | 252 | |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @param string $type The type of queue being locked. |
260 | 260 | */ |
261 | - public function lock_queue( $type = EE_Messages_Queue::action_generating ) { |
|
262 | - set_transient( $this->_get_lock_key( $type ), 1, $this->_get_lock_expiry( $type ) ); |
|
261 | + public function lock_queue($type = EE_Messages_Queue::action_generating) { |
|
262 | + set_transient($this->_get_lock_key($type), 1, $this->_get_lock_expiry($type)); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @param string $type The type of queue being unlocked. |
272 | 272 | */ |
273 | - public function unlock_queue( $type = EE_Messages_Queue::action_generating ) { |
|
274 | - delete_transient( $this->_get_lock_key( $type ) ); |
|
273 | + public function unlock_queue($type = EE_Messages_Queue::action_generating) { |
|
274 | + delete_transient($this->_get_lock_key($type)); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | * @param string $type The type of lock. |
283 | 283 | * @return string |
284 | 284 | */ |
285 | - protected function _get_lock_key( $type = EE_Messages_Queue::action_generating ) { |
|
286 | - return '_ee_lock_' . $type; |
|
285 | + protected function _get_lock_key($type = EE_Messages_Queue::action_generating) { |
|
286 | + return '_ee_lock_'.$type; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -294,8 +294,8 @@ discard block |
||
294 | 294 | * @param string $type The type of lock |
295 | 295 | * @return int time to expiry in seconds. |
296 | 296 | */ |
297 | - protected function _get_lock_expiry( $type = EE_Messages_Queue::action_generating ) { |
|
298 | - return (int) apply_filters( 'FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type ); |
|
297 | + protected function _get_lock_expiry($type = EE_Messages_Queue::action_generating) { |
|
298 | + return (int) apply_filters('FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * @return int |
314 | 314 | */ |
315 | 315 | protected function _get_rate_limit_expiry() { |
316 | - return (int) apply_filters( 'FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS ); |
|
316 | + return (int) apply_filters('FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return int |
325 | 325 | */ |
326 | 326 | protected function _default_rate_limit() { |
327 | - return (int) apply_filters( 'FHEE__EE_Messages_Queue___rate_limit', 200 ); |
|
327 | + return (int) apply_filters('FHEE__EE_Messages_Queue___rate_limit', 200); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | * @param string $type The type of lock being checked for. |
351 | 351 | * @return bool |
352 | 352 | */ |
353 | - public function is_locked( $type = EE_Messages_Queue::action_generating ) { |
|
353 | + public function is_locked($type = EE_Messages_Queue::action_generating) { |
|
354 | 354 | /** |
355 | 355 | * This filters the default is_locked behaviour. |
356 | 356 | */ |
357 | 357 | $is_locked = filter_var( |
358 | 358 | apply_filters( |
359 | 359 | 'FHEE__EE_Messages_Queue__is_locked', |
360 | - get_transient( $this->_get_lock_key( $type ) ), |
|
360 | + get_transient($this->_get_lock_key($type)), |
|
361 | 361 | $this |
362 | 362 | ), |
363 | 363 | FILTER_VALIDATE_BOOLEAN |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * Also implemented here because messages processed on the same request should not have any locks applied. |
369 | 369 | */ |
370 | 370 | if ( |
371 | - apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false ) |
|
371 | + apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false) |
|
372 | 372 | || EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request |
373 | 373 | ) { |
374 | 374 | $is_locked = false; |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | * @return int |
391 | 391 | */ |
392 | 392 | public function get_rate_limit() { |
393 | - if ( ! $rate_limit = get_transient( $this->_get_rate_limit_key() ) ) { |
|
393 | + if ( ! $rate_limit = get_transient($this->_get_rate_limit_key())) { |
|
394 | 394 | $rate_limit = $this->_default_rate_limit(); |
395 | - set_transient( $this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key() ); |
|
395 | + set_transient($this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key()); |
|
396 | 396 | } |
397 | 397 | return $rate_limit; |
398 | 398 | } |
@@ -404,12 +404,12 @@ discard block |
||
404 | 404 | * This updates existing rate limit with the new limit which is the old minus the batch. |
405 | 405 | * @param int $batch_completed This sets the new rate limit based on the given batch that was completed. |
406 | 406 | */ |
407 | - public function set_rate_limit( $batch_completed ) { |
|
407 | + public function set_rate_limit($batch_completed) { |
|
408 | 408 | //first get the most up to date rate limit (in case its expired and reset) |
409 | 409 | $rate_limit = $this->get_rate_limit(); |
410 | 410 | $new_limit = $rate_limit - $batch_completed; |
411 | 411 | //updating the transient option directly to avoid resetting the expiry. |
412 | - update_option( '_transient_' . $this->_get_rate_limit_key(), $new_limit ); |
|
412 | + update_option('_transient_'.$this->_get_rate_limit_key(), $new_limit); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @param string $task This indicates what type of request is going to be initiated. |
423 | 423 | * @param int $priority This indicates the priority that triggers initiating the request. |
424 | 424 | */ |
425 | - public function initiate_request_by_priority( $task = 'generate', $priority = EEM_Message::priority_high ) { |
|
425 | + public function initiate_request_by_priority($task = 'generate', $priority = EEM_Message::priority_high) { |
|
426 | 426 | //determine what status is matched with the priority as part of the trigger conditions. |
427 | 427 | $status = $task == 'generate' |
428 | 428 | ? EEM_Message::status_incomplete |
@@ -442,19 +442,19 @@ discard block |
||
442 | 442 | * the same request. |
443 | 443 | */ |
444 | 444 | if ( |
445 | - apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false ) |
|
445 | + apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false) |
|
446 | 446 | || EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request |
447 | 447 | ) { |
448 | - $messages_processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
449 | - if ( $messages_processor instanceof EE_Messages_Processor ) { |
|
450 | - return $messages_processor->process_immediately_from_queue( $this ); |
|
448 | + $messages_processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
449 | + if ($messages_processor instanceof EE_Messages_Processor) { |
|
450 | + return $messages_processor->process_immediately_from_queue($this); |
|
451 | 451 | } |
452 | 452 | //if we get here then that means the messages processor couldn't be loaded so messages will just remain |
453 | 453 | //queued for manual triggering by end user. |
454 | 454 | } |
455 | 455 | |
456 | - if ( $this->_message_repository->count_by_priority_and_status( $priority, $status ) ) { |
|
457 | - EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( $task ); |
|
456 | + if ($this->_message_repository->count_by_priority_and_status($priority, $status)) { |
|
457 | + EE_Messages_Scheduler::initiate_scheduled_non_blocking_request($task); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
@@ -479,53 +479,53 @@ discard block |
||
479 | 479 | * Also, if the messenger is an request type messenger (or a preview), |
480 | 480 | * its entirely possible that the messenger will exit before |
481 | 481 | */ |
482 | - public function execute( $save = true, $sending_messenger = null, $by_priority = false ) { |
|
482 | + public function execute($save = true, $sending_messenger = null, $by_priority = false) { |
|
483 | 483 | $messages_sent = 0; |
484 | 484 | $this->_did_hook = array(); |
485 | 485 | $this->_message_repository->rewind(); |
486 | 486 | |
487 | - while ( $this->_message_repository->valid() ) { |
|
487 | + while ($this->_message_repository->valid()) { |
|
488 | 488 | $error_messages = array(); |
489 | 489 | /** @type EE_Message $message */ |
490 | 490 | $message = $this->_message_repository->current(); |
491 | 491 | //only process things that are queued for sending |
492 | - if ( ! in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send() ) ) { |
|
492 | + if ( ! in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send())) { |
|
493 | 493 | $this->_message_repository->next(); |
494 | 494 | continue; |
495 | 495 | } |
496 | 496 | //if $by_priority is set and does not match then continue; |
497 | - if ( $by_priority && $by_priority != $message->priority() ) { |
|
497 | + if ($by_priority && $by_priority != $message->priority()) { |
|
498 | 498 | $this->_message_repository->next(); |
499 | 499 | continue; |
500 | 500 | } |
501 | 501 | //error checking |
502 | - if ( ! $message->valid_messenger() ) { |
|
502 | + if ( ! $message->valid_messenger()) { |
|
503 | 503 | $error_messages[] = sprintf( |
504 | - __( 'The %s messenger is not active at time of sending.', 'event_espresso' ), |
|
504 | + __('The %s messenger is not active at time of sending.', 'event_espresso'), |
|
505 | 505 | $message->messenger() |
506 | 506 | ); |
507 | 507 | } |
508 | - if ( ! $message->valid_message_type() ) { |
|
508 | + if ( ! $message->valid_message_type()) { |
|
509 | 509 | $error_messages[] = sprintf( |
510 | - __( 'The %s message type is not active at the time of sending.', 'event_espresso' ), |
|
510 | + __('The %s message type is not active at the time of sending.', 'event_espresso'), |
|
511 | 511 | $message->message_type() |
512 | 512 | ); |
513 | 513 | } |
514 | 514 | // if there was supposed to be a sending messenger for this message, but it was invalid/inactive, |
515 | 515 | // then it will instead be an EE_Error object, so let's check for that |
516 | - if ( $sending_messenger instanceof EE_Error ) { |
|
516 | + if ($sending_messenger instanceof EE_Error) { |
|
517 | 517 | $error_messages[] = $sending_messenger->getMessage(); |
518 | 518 | } |
519 | 519 | // if there are no errors, then let's process the message |
520 | - if ( empty( $error_messages ) && $this->_process_message( $message, $sending_messenger ) ) { |
|
520 | + if (empty($error_messages) && $this->_process_message($message, $sending_messenger)) { |
|
521 | 521 | $messages_sent++; |
522 | 522 | } |
523 | - $this->_set_error_message( $message, $error_messages ); |
|
523 | + $this->_set_error_message($message, $error_messages); |
|
524 | 524 | //add modified time |
525 | - $message->set_modified( time() ); |
|
525 | + $message->set_modified(time()); |
|
526 | 526 | $this->_message_repository->next(); |
527 | 527 | } |
528 | - if ( $save ) { |
|
528 | + if ($save) { |
|
529 | 529 | $this->save(); |
530 | 530 | } |
531 | 531 | return $messages_sent; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * @param mixed $sending_messenger (optional) |
541 | 541 | * @return bool |
542 | 542 | */ |
543 | - protected function _process_message( EE_Message $message, $sending_messenger = null ) { |
|
543 | + protected function _process_message(EE_Message $message, $sending_messenger = null) { |
|
544 | 544 | // these *should* have been validated in the execute() method above |
545 | 545 | $messenger = $message->messenger_object(); |
546 | 546 | $message_type = $message->message_type_object(); |
@@ -550,20 +550,20 @@ discard block |
||
550 | 550 | && $messenger instanceof EE_messenger |
551 | 551 | && $sending_messenger->name != $messenger->name |
552 | 552 | ) { |
553 | - $messenger->do_secondary_messenger_hooks( $sending_messenger->name ); |
|
553 | + $messenger->do_secondary_messenger_hooks($sending_messenger->name); |
|
554 | 554 | $messenger = $sending_messenger; |
555 | 555 | } |
556 | 556 | // send using messenger, but double check objects |
557 | - if ( $messenger instanceof EE_messenger && $message_type instanceof EE_message_type ) { |
|
557 | + if ($messenger instanceof EE_messenger && $message_type instanceof EE_message_type) { |
|
558 | 558 | //set hook for message type (but only if not using another messenger to send). |
559 | - if ( ! isset( $this->_did_hook[ $message_type->name ] ) ) { |
|
560 | - $message_type->do_messenger_hooks( $messenger ); |
|
561 | - $this->_did_hook[ $message_type->name ] = 1; |
|
559 | + if ( ! isset($this->_did_hook[$message_type->name])) { |
|
560 | + $message_type->do_messenger_hooks($messenger); |
|
561 | + $this->_did_hook[$message_type->name] = 1; |
|
562 | 562 | } |
563 | 563 | //if preview then use preview method |
564 | 564 | return $this->_message_repository->is_preview() |
565 | - ? $this->_do_preview( $message, $messenger, $message_type, $this->_message_repository->is_test_send() ) |
|
566 | - : $this->_do_send( $message, $messenger, $message_type ); |
|
565 | + ? $this->_do_preview($message, $messenger, $message_type, $this->_message_repository->is_test_send()) |
|
566 | + : $this->_do_send($message, $messenger, $message_type); |
|
567 | 567 | } |
568 | 568 | return false; |
569 | 569 | } |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | * @param array $status Stati to check for in queue |
582 | 582 | * @return int Count of EE_Message's matching the given status. |
583 | 583 | */ |
584 | - public function count_STS_in_queue( $status ) { |
|
584 | + public function count_STS_in_queue($status) { |
|
585 | 585 | $count = 0; |
586 | - $status = is_array( $status ) ? $status : array( $status ); |
|
586 | + $status = is_array($status) ? $status : array($status); |
|
587 | 587 | $this->_message_repository->rewind(); |
588 | - foreach( $this->_message_repository as $message ) { |
|
589 | - if ( in_array( $message->STS_ID(), $status ) ) { |
|
588 | + foreach ($this->_message_repository as $message) { |
|
589 | + if (in_array($message->STS_ID(), $status)) { |
|
590 | 590 | $count++; |
591 | 591 | } |
592 | 592 | } |
@@ -603,15 +603,15 @@ discard block |
||
603 | 603 | * @param $test_send |
604 | 604 | * @return bool true means all went well, false means, not so much. |
605 | 605 | */ |
606 | - protected function _do_preview( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send ) { |
|
607 | - if ( $preview = $messenger->get_preview( $message, $message_type, $test_send ) ) { |
|
608 | - if ( ! $test_send ) { |
|
609 | - $message->set_content( $preview ); |
|
606 | + protected function _do_preview(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send) { |
|
607 | + if ($preview = $messenger->get_preview($message, $message_type, $test_send)) { |
|
608 | + if ( ! $test_send) { |
|
609 | + $message->set_content($preview); |
|
610 | 610 | } |
611 | - $message->set_STS_ID( EEM_Message::status_sent ); |
|
611 | + $message->set_STS_ID(EEM_Message::status_sent); |
|
612 | 612 | return true; |
613 | 613 | } else { |
614 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
614 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
615 | 615 | return false; |
616 | 616 | } |
617 | 617 | } |
@@ -633,18 +633,18 @@ discard block |
||
633 | 633 | * |
634 | 634 | * @return bool true means all went well, false means, not so much. |
635 | 635 | */ |
636 | - protected function _do_send( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type ) { |
|
636 | + protected function _do_send(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type) { |
|
637 | 637 | try { |
638 | - if ( $messenger->send_message( $message, $message_type ) ) { |
|
639 | - $message->set_STS_ID( EEM_Message::status_sent ); |
|
638 | + if ($messenger->send_message($message, $message_type)) { |
|
639 | + $message->set_STS_ID(EEM_Message::status_sent); |
|
640 | 640 | return true; |
641 | 641 | } else { |
642 | - $message->set_STS_ID( EEM_Message::status_retry ); |
|
642 | + $message->set_STS_ID(EEM_Message::status_retry); |
|
643 | 643 | return false; |
644 | 644 | } |
645 | - } catch( SendMessageException $e ) { |
|
646 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
647 | - $message->set_error_message( $e->getMessage() ); |
|
645 | + } catch (SendMessageException $e) { |
|
646 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
647 | + $message->set_error_message($e->getMessage()); |
|
648 | 648 | return false; |
649 | 649 | } |
650 | 650 | } |
@@ -658,21 +658,21 @@ discard block |
||
658 | 658 | * @param EE_Message $message |
659 | 659 | * @param array $error_messages the response from the messenger. |
660 | 660 | */ |
661 | - protected function _set_error_message( EE_Message $message, $error_messages ) { |
|
661 | + protected function _set_error_message(EE_Message $message, $error_messages) { |
|
662 | 662 | $error_messages = (array) $error_messages; |
663 | - if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending() ) ) { |
|
663 | + if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending())) { |
|
664 | 664 | $notices = EE_Error::has_notices(); |
665 | - $error_messages[] = __( 'Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso' ); |
|
666 | - if ( $notices === 1 ) { |
|
665 | + $error_messages[] = __('Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso'); |
|
666 | + if ($notices === 1) { |
|
667 | 667 | $notices = EE_Error::get_vanilla_notices(); |
668 | - $notices['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : array(); |
|
669 | - $error_messages[] = implode( "\n", $notices['errors'] ); |
|
668 | + $notices['errors'] = isset($notices['errors']) ? $notices['errors'] : array(); |
|
669 | + $error_messages[] = implode("\n", $notices['errors']); |
|
670 | 670 | } |
671 | 671 | } |
672 | - if ( count( $error_messages ) > 0 ) { |
|
673 | - $msg = __( 'Message was not executed successfully.', 'event_espresso' ); |
|
674 | - $msg = $msg . "\n" . implode( "\n", $error_messages ); |
|
675 | - $message->set_error_message( $msg ); |
|
672 | + if (count($error_messages) > 0) { |
|
673 | + $msg = __('Message was not executed successfully.', 'event_espresso'); |
|
674 | + $msg = $msg."\n".implode("\n", $error_messages); |
|
675 | + $message->set_error_message($msg); |
|
676 | 676 | } |
677 | 677 | } |
678 | 678 |