@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
2194 | 2194 | // get country code from organization settings or use default |
2195 | 2195 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2196 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2196 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
@@ -2503,12 +2503,12 @@ discard block |
||
2503 | 2503 | public $help_tour_activation; |
2504 | 2504 | |
2505 | 2505 | /** |
2506 | - * adds extra layer of encoding to session data to prevent serialization errors |
|
2507 | - * but is incompatible with some server configuration errors |
|
2508 | - * if you get "500 internal server errors" during registration, try turning this on |
|
2509 | - * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off |
|
2510 | - * |
|
2511 | - * @var boolean $encode_session_data |
|
2506 | + * adds extra layer of encoding to session data to prevent serialization errors |
|
2507 | + * but is incompatible with some server configuration errors |
|
2508 | + * if you get "500 internal server errors" during registration, try turning this on |
|
2509 | + * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off |
|
2510 | + * |
|
2511 | + * @var boolean $encode_session_data |
|
2512 | 2512 | */ |
2513 | 2513 | private $encode_session_data = false; |
2514 | 2514 | |
@@ -2573,21 +2573,21 @@ discard block |
||
2573 | 2573 | |
2574 | 2574 | |
2575 | 2575 | |
2576 | - /** |
|
2577 | - * @return boolean |
|
2578 | - */ |
|
2579 | - public function encode_session_data() { |
|
2580 | - return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2581 | - } |
|
2576 | + /** |
|
2577 | + * @return boolean |
|
2578 | + */ |
|
2579 | + public function encode_session_data() { |
|
2580 | + return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2581 | + } |
|
2582 | 2582 | |
2583 | 2583 | |
2584 | 2584 | |
2585 | - /** |
|
2586 | - * @param boolean $encode_session_data |
|
2587 | - */ |
|
2588 | - public function set_encode_session_data( $encode_session_data ) { |
|
2589 | - $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2590 | - } |
|
2585 | + /** |
|
2586 | + * @param boolean $encode_session_data |
|
2587 | + */ |
|
2588 | + public function set_encode_session_data( $encode_session_data ) { |
|
2589 | + $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2590 | + } |
|
2591 | 2591 | |
2592 | 2592 | |
2593 | 2593 | |
@@ -2963,8 +2963,8 @@ discard block |
||
2963 | 2963 | */ |
2964 | 2964 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2965 | 2965 | if ( ! empty( $this->php->max_input_vars ) |
2966 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2967 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2966 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2967 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2968 | 2968 | ) { |
2969 | 2969 | return sprintf( |
2970 | 2970 | __( |
@@ -3008,22 +3008,22 @@ discard block |
||
3008 | 3008 | class EE_Tax_Config extends EE_Config_Base |
3009 | 3009 | { |
3010 | 3010 | |
3011 | - /* |
|
3011 | + /* |
|
3012 | 3012 | * flag to indicate whether or not to display ticket prices with the taxes included |
3013 | 3013 | * |
3014 | 3014 | * @var boolean $prices_displayed_including_taxes |
3015 | 3015 | */ |
3016 | - public $prices_displayed_including_taxes; |
|
3016 | + public $prices_displayed_including_taxes; |
|
3017 | 3017 | |
3018 | 3018 | |
3019 | 3019 | |
3020 | - /** |
|
3021 | - * class constructor |
|
3022 | - */ |
|
3023 | - public function __construct() |
|
3024 | - { |
|
3025 | - $this->prices_displayed_including_taxes = true; |
|
3026 | - } |
|
3020 | + /** |
|
3021 | + * class constructor |
|
3022 | + */ |
|
3023 | + public function __construct() |
|
3024 | + { |
|
3025 | + $this->prices_displayed_including_taxes = true; |
|
3026 | + } |
|
3027 | 3027 | } |
3028 | 3028 | |
3029 | 3029 |
@@ -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 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function instance() { |
135 | 135 | // check if class object is instantiated, and instantiated properly |
136 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
136 | + if ( ! self::$_instance instanceof EE_Config) { |
|
137 | 137 | self::$_instance = new self(); |
138 | 138 | } |
139 | 139 | return self::$_instance; |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | * site was put into maintenance mode) |
154 | 154 | * @return EE_Config |
155 | 155 | */ |
156 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
157 | - if ( $hard_reset ) { |
|
156 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
157 | + if ($hard_reset) { |
|
158 | 158 | self::$_instance->_addon_option_names = array(); |
159 | 159 | self::$_instance->_initialize_config(); |
160 | 160 | self::$_instance->update_espresso_config(); |
161 | 161 | } |
162 | - if ( self::$_instance instanceof EE_Config ) { |
|
162 | + if (self::$_instance instanceof EE_Config) { |
|
163 | 163 | self::$_instance->update_addon_option_names(); |
164 | 164 | } |
165 | 165 | self::$_instance = null; |
166 | 166 | //we don't need to reset the static properties imo because those should |
167 | 167 | //only change when a module is added or removed. Currently we don't |
168 | 168 | //support removing a module during a request when it previously existed |
169 | - if ( $reinstantiate ) { |
|
169 | + if ($reinstantiate) { |
|
170 | 170 | return self::instance(); |
171 | 171 | } else { |
172 | 172 | return null; |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @access private |
182 | 182 | */ |
183 | 183 | private function __construct() { |
184 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
185 | - EE_Config::$_logging_enabled = apply_filters( 'FHEE__EE_Config___construct__logging_enabled', false ); |
|
184 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
185 | + EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false); |
|
186 | 186 | // setup empty config classes |
187 | 187 | $this->_initialize_config(); |
188 | 188 | // load existing EE site settings |
@@ -192,17 +192,17 @@ discard block |
||
192 | 192 | // register shortcodes and modules |
193 | 193 | add_action( |
194 | 194 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
195 | - array( $this, 'register_shortcodes_and_modules' ), |
|
195 | + array($this, 'register_shortcodes_and_modules'), |
|
196 | 196 | 999 |
197 | 197 | ); |
198 | 198 | // initialize shortcodes and modules |
199 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
199 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
200 | 200 | // register widgets |
201 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
201 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
202 | 202 | // shutdown |
203 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
203 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
204 | 204 | // construct__end hook |
205 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
205 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
206 | 206 | // hardcoded hack |
207 | 207 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
208 | 208 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @return string current theme set. |
225 | 225 | */ |
226 | 226 | public static function get_current_theme() { |
227 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
227 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
228 | 228 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
229 | 229 | } |
230 | 230 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | private function _initialize_config() { |
240 | 240 | EE_Config::trim_log(); |
241 | 241 | //set defaults |
242 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
242 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
243 | 243 | $this->addons = new stdClass(); |
244 | 244 | // set _module_route_map |
245 | 245 | EE_Config::$_module_route_map = array(); |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | */ |
260 | 260 | private function _load_core_config() { |
261 | 261 | // load_core_config__start hook |
262 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
262 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
263 | 263 | $espresso_config = $this->get_espresso_config(); |
264 | - foreach ( $espresso_config as $config => $settings ) { |
|
264 | + foreach ($espresso_config as $config => $settings) { |
|
265 | 265 | // load_core_config__start hook |
266 | 266 | $settings = apply_filters( |
267 | 267 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -269,22 +269,22 @@ discard block |
||
269 | 269 | $config, |
270 | 270 | $this |
271 | 271 | ); |
272 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
273 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
272 | + if (is_object($settings) && property_exists($this, $config)) { |
|
273 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
274 | 274 | //call configs populate method to ensure any defaults are set for empty values. |
275 | - if ( method_exists( $settings, 'populate' ) ) { |
|
275 | + if (method_exists($settings, 'populate')) { |
|
276 | 276 | $this->{$config}->populate(); |
277 | 277 | } |
278 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
278 | + if (method_exists($settings, 'do_hooks')) { |
|
279 | 279 | $this->{$config}->do_hooks(); |
280 | 280 | } |
281 | 281 | } |
282 | 282 | } |
283 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
283 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
284 | 284 | $this->update_espresso_config(); |
285 | 285 | } |
286 | 286 | // load_core_config__end hook |
287 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
287 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -299,23 +299,23 @@ discard block |
||
299 | 299 | $this->core = $this->core instanceof EE_Core_Config |
300 | 300 | ? $this->core |
301 | 301 | : new EE_Core_Config(); |
302 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
302 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
303 | 303 | $this->organization = $this->organization instanceof EE_Organization_Config |
304 | 304 | ? $this->organization |
305 | 305 | : new EE_Organization_Config(); |
306 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
306 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
307 | 307 | $this->currency = $this->currency instanceof EE_Currency_Config |
308 | 308 | ? $this->currency |
309 | 309 | : new EE_Currency_Config(); |
310 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
310 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
311 | 311 | $this->registration = $this->registration instanceof EE_Registration_Config |
312 | 312 | ? $this->registration |
313 | 313 | : new EE_Registration_Config(); |
314 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
314 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
315 | 315 | $this->admin = $this->admin instanceof EE_Admin_Config |
316 | 316 | ? $this->admin |
317 | 317 | : new EE_Admin_Config(); |
318 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
318 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
319 | 319 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
320 | 320 | ? $this->template_settings |
321 | 321 | : new EE_Template_Config(); |
@@ -326,19 +326,19 @@ discard block |
||
326 | 326 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
327 | 327 | ? $this->map_settings |
328 | 328 | : new EE_Map_Config(); |
329 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
329 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
330 | 330 | $this->environment = $this->environment instanceof EE_Environment_Config |
331 | 331 | ? $this->environment |
332 | 332 | : new EE_Environment_Config(); |
333 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
333 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
334 | 334 | $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
335 | 335 | ? $this->tax_settings |
336 | 336 | : new EE_Tax_Config(); |
337 | - $this->tax_settings = apply_filters( 'FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings ); |
|
337 | + $this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings); |
|
338 | 338 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
339 | 339 | ? $this->gateway |
340 | 340 | : new EE_Gateway_Config(); |
341 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
341 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | // grab espresso configuration |
354 | 354 | return apply_filters( |
355 | 355 | 'FHEE__EE_Config__get_espresso_config__CFG', |
356 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
356 | + get_option(EE_Config::OPTION_NAME, array()) |
|
357 | 357 | ); |
358 | 358 | } |
359 | 359 | |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | * @param $old_value |
368 | 368 | * @param $value |
369 | 369 | */ |
370 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
370 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
371 | 371 | // make sure we're checking the ee config |
372 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
372 | + if ($option === EE_Config::OPTION_NAME) { |
|
373 | 373 | // run a loose comparison of the old value against the new value for type and properties, |
374 | 374 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
375 | - if ( $value != $old_value ) { |
|
375 | + if ($value != $old_value) { |
|
376 | 376 | // if they are NOT the same, then remove the hook, |
377 | 377 | // which means the subsequent update results will be based solely on the update query results |
378 | 378 | // the reason we do this is because, as stated above, |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | // the string it sees in the db looks the same as the new one it has been passed!!! |
388 | 388 | // This results in the query returning an "affected rows" value of ZERO, |
389 | 389 | // which gets returned immediately by WP update_option and looks like an error. |
390 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
390 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | } |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | */ |
402 | 402 | protected function _reset_espresso_addon_config() { |
403 | 403 | $this->_addon_option_names = array(); |
404 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
405 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
406 | - $config_class = get_class( $addon_config_obj ); |
|
407 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
408 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
404 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
405 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
406 | + $config_class = get_class($addon_config_obj); |
|
407 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
408 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
409 | 409 | } |
410 | 410 | $this->addons->{$addon_name} = null; |
411 | 411 | } |
@@ -421,22 +421,22 @@ discard block |
||
421 | 421 | * @param bool $add_error |
422 | 422 | * @return bool |
423 | 423 | */ |
424 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
424 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
425 | 425 | // don't allow config updates during WP heartbeats |
426 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
426 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
427 | 427 | return false; |
428 | 428 | } |
429 | 429 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
430 | 430 | //$clone = clone( self::$_instance ); |
431 | 431 | //self::$_instance = NULL; |
432 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
432 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
433 | 433 | $this->_reset_espresso_addon_config(); |
434 | 434 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
435 | 435 | // but BEFORE the actual update occurs |
436 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
436 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
437 | 437 | // now update "ee_config" |
438 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
439 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
438 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
439 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
440 | 440 | // if not saved... check if the hook we just added still exists; |
441 | 441 | // if it does, it means one of two things: |
442 | 442 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -447,17 +447,17 @@ discard block |
||
447 | 447 | // but just means no update occurred, so don't display an error to the user. |
448 | 448 | // BUT... if update_option returns FALSE, AND the hook is missing, |
449 | 449 | // then it means that something truly went wrong |
450 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
450 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
451 | 451 | // remove our action since we don't want it in the system anymore |
452 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
453 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
452 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
453 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
454 | 454 | //self::$_instance = $clone; |
455 | 455 | //unset( $clone ); |
456 | 456 | // if config remains the same or was updated successfully |
457 | - if ( $saved ) { |
|
458 | - if ( $add_success ) { |
|
457 | + if ($saved) { |
|
458 | + if ($add_success) { |
|
459 | 459 | EE_Error::add_success( |
460 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
460 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
461 | 461 | __FILE__, |
462 | 462 | __FUNCTION__, |
463 | 463 | __LINE__ |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | } |
466 | 466 | return true; |
467 | 467 | } else { |
468 | - if ( $add_error ) { |
|
468 | + if ($add_error) { |
|
469 | 469 | EE_Error::add_error( |
470 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
470 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
471 | 471 | __FILE__, |
472 | 472 | __FUNCTION__, |
473 | 473 | __LINE__ |
@@ -496,16 +496,16 @@ discard block |
||
496 | 496 | $name = '', |
497 | 497 | $config_class = '', |
498 | 498 | $config_obj = null, |
499 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
499 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
500 | 500 | $display_errors = true |
501 | 501 | ) { |
502 | 502 | try { |
503 | - foreach ( $tests_to_run as $test ) { |
|
504 | - switch ( $test ) { |
|
503 | + foreach ($tests_to_run as $test) { |
|
504 | + switch ($test) { |
|
505 | 505 | // TEST #1 : check that section was set |
506 | 506 | case 1 : |
507 | - if ( empty( $section ) ) { |
|
508 | - if ( $display_errors ) { |
|
507 | + if (empty($section)) { |
|
508 | + if ($display_errors) { |
|
509 | 509 | throw new EE_Error( |
510 | 510 | sprintf( |
511 | 511 | __( |
@@ -521,11 +521,11 @@ discard block |
||
521 | 521 | break; |
522 | 522 | // TEST #2 : check that settings section exists |
523 | 523 | case 2 : |
524 | - if ( ! isset( $this->{$section} ) ) { |
|
525 | - if ( $display_errors ) { |
|
524 | + if ( ! isset($this->{$section} )) { |
|
525 | + if ($display_errors) { |
|
526 | 526 | throw new EE_Error( |
527 | 527 | sprintf( |
528 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
528 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
529 | 529 | $section |
530 | 530 | ) |
531 | 531 | ); |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | // TEST #3 : check that section is the proper format |
537 | 537 | case 3 : |
538 | 538 | if ( |
539 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
539 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
540 | 540 | ) { |
541 | - if ( $display_errors ) { |
|
541 | + if ($display_errors) { |
|
542 | 542 | throw new EE_Error( |
543 | 543 | sprintf( |
544 | 544 | __( |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | break; |
555 | 555 | // TEST #4 : check that config section name has been set |
556 | 556 | case 4 : |
557 | - if ( empty( $name ) ) { |
|
558 | - if ( $display_errors ) { |
|
557 | + if (empty($name)) { |
|
558 | + if ($display_errors) { |
|
559 | 559 | throw new EE_Error( |
560 | 560 | __( |
561 | 561 | 'No name has been provided for the specific configuration section.', |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | break; |
569 | 569 | // TEST #5 : check that a config class name has been set |
570 | 570 | case 5 : |
571 | - if ( empty( $config_class ) ) { |
|
572 | - if ( $display_errors ) { |
|
571 | + if (empty($config_class)) { |
|
572 | + if ($display_errors) { |
|
573 | 573 | throw new EE_Error( |
574 | 574 | __( |
575 | 575 | 'No class name has been provided for the specific configuration section.', |
@@ -582,8 +582,8 @@ discard block |
||
582 | 582 | break; |
583 | 583 | // TEST #6 : verify config class is accessible |
584 | 584 | case 6 : |
585 | - if ( ! class_exists( $config_class ) ) { |
|
586 | - if ( $display_errors ) { |
|
585 | + if ( ! class_exists($config_class)) { |
|
586 | + if ($display_errors) { |
|
587 | 587 | throw new EE_Error( |
588 | 588 | sprintf( |
589 | 589 | __( |
@@ -599,11 +599,11 @@ discard block |
||
599 | 599 | break; |
600 | 600 | // TEST #7 : check that config has even been set |
601 | 601 | case 7 : |
602 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
603 | - if ( $display_errors ) { |
|
602 | + if ( ! isset($this->{$section}->{$name} )) { |
|
603 | + if ($display_errors) { |
|
604 | 604 | throw new EE_Error( |
605 | 605 | sprintf( |
606 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
606 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
607 | 607 | $section, |
608 | 608 | $name |
609 | 609 | ) |
@@ -612,13 +612,13 @@ discard block |
||
612 | 612 | return false; |
613 | 613 | } else { |
614 | 614 | // and make sure it's not serialized |
615 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
615 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
616 | 616 | } |
617 | 617 | break; |
618 | 618 | // TEST #8 : check that config is the requested type |
619 | 619 | case 8 : |
620 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
621 | - if ( $display_errors ) { |
|
620 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
621 | + if ($display_errors) { |
|
622 | 622 | throw new EE_Error( |
623 | 623 | sprintf( |
624 | 624 | __( |
@@ -636,12 +636,12 @@ discard block |
||
636 | 636 | break; |
637 | 637 | // TEST #9 : verify config object |
638 | 638 | case 9 : |
639 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
640 | - if ( $display_errors ) { |
|
639 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
640 | + if ($display_errors) { |
|
641 | 641 | throw new EE_Error( |
642 | 642 | sprintf( |
643 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
644 | - print_r( $config_obj, true ) |
|
643 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
644 | + print_r($config_obj, true) |
|
645 | 645 | ) |
646 | 646 | ); |
647 | 647 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | break; |
651 | 651 | } |
652 | 652 | } |
653 | - } catch ( EE_Error $e ) { |
|
653 | + } catch (EE_Error $e) { |
|
654 | 654 | $e->get_error(); |
655 | 655 | } |
656 | 656 | // you have successfully run the gauntlet |
@@ -667,8 +667,8 @@ discard block |
||
667 | 667 | * @param string $name |
668 | 668 | * @return string |
669 | 669 | */ |
670 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
671 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
670 | + private function _generate_config_option_name($section = '', $name = '') { |
|
671 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | |
@@ -682,10 +682,10 @@ discard block |
||
682 | 682 | * @param string $name |
683 | 683 | * @return string |
684 | 684 | */ |
685 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
686 | - return ! empty( $config_class ) |
|
685 | + private function _set_config_class($config_class = '', $name = '') { |
|
686 | + return ! empty($config_class) |
|
687 | 687 | ? $config_class |
688 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
688 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
@@ -700,36 +700,36 @@ discard block |
||
700 | 700 | * @param EE_Config_Base $config_obj |
701 | 701 | * @return EE_Config_Base |
702 | 702 | */ |
703 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
703 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
704 | 704 | // ensure config class is set to something |
705 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
705 | + $config_class = $this->_set_config_class($config_class, $name); |
|
706 | 706 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
707 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
707 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
708 | 708 | return null; |
709 | 709 | } |
710 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
710 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
711 | 711 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
712 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
713 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
712 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
713 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
714 | 714 | $this->update_addon_option_names(); |
715 | 715 | } |
716 | 716 | // verify the incoming config object but suppress errors |
717 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
717 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
718 | 718 | $config_obj = new $config_class(); |
719 | 719 | } |
720 | - if ( get_option( $config_option_name ) ) { |
|
721 | - EE_Config::log( $config_option_name ); |
|
722 | - update_option( $config_option_name, $config_obj ); |
|
720 | + if (get_option($config_option_name)) { |
|
721 | + EE_Config::log($config_option_name); |
|
722 | + update_option($config_option_name, $config_obj); |
|
723 | 723 | $this->{$section}->{$name} = $config_obj; |
724 | 724 | return $this->{$section}->{$name}; |
725 | 725 | } else { |
726 | 726 | // create a wp-option for this config |
727 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
728 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
727 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
728 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
729 | 729 | return $this->{$section}->{$name}; |
730 | 730 | } else { |
731 | 731 | EE_Error::add_error( |
732 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
732 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
733 | 733 | __FILE__, |
734 | 734 | __FUNCTION__, |
735 | 735 | __LINE__ |
@@ -752,46 +752,46 @@ discard block |
||
752 | 752 | * @param bool $throw_errors |
753 | 753 | * @return bool |
754 | 754 | */ |
755 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
755 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
756 | 756 | // don't allow config updates during WP heartbeats |
757 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
757 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
758 | 758 | return false; |
759 | 759 | } |
760 | - $config_obj = maybe_unserialize( $config_obj ); |
|
760 | + $config_obj = maybe_unserialize($config_obj); |
|
761 | 761 | // get class name of the incoming object |
762 | - $config_class = get_class( $config_obj ); |
|
762 | + $config_class = get_class($config_obj); |
|
763 | 763 | // run tests 1-5 and 9 to verify config |
764 | 764 | if ( ! $this->_verify_config_params( |
765 | 765 | $section, |
766 | 766 | $name, |
767 | 767 | $config_class, |
768 | 768 | $config_obj, |
769 | - array( 1, 2, 3, 4, 7, 9 ) |
|
769 | + array(1, 2, 3, 4, 7, 9) |
|
770 | 770 | ) |
771 | 771 | ) { |
772 | 772 | return false; |
773 | 773 | } |
774 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
774 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
775 | 775 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
776 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
776 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
777 | 777 | // save new config to db |
778 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
778 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
779 | 779 | return true; |
780 | 780 | } |
781 | 781 | } else { |
782 | 782 | // first check if the record already exists |
783 | - $existing_config = get_option( $config_option_name ); |
|
784 | - $config_obj = serialize( $config_obj ); |
|
783 | + $existing_config = get_option($config_option_name); |
|
784 | + $config_obj = serialize($config_obj); |
|
785 | 785 | // just return if db record is already up to date (NOT type safe comparison) |
786 | - if ( $existing_config == $config_obj ) { |
|
786 | + if ($existing_config == $config_obj) { |
|
787 | 787 | $this->{$section}->{$name} = $config_obj; |
788 | 788 | return true; |
789 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
790 | - EE_Config::log( $config_option_name ); |
|
789 | + } else if (update_option($config_option_name, $config_obj)) { |
|
790 | + EE_Config::log($config_option_name); |
|
791 | 791 | // update wp-option for this config class |
792 | 792 | $this->{$section}->{$name} = $config_obj; |
793 | 793 | return true; |
794 | - } elseif ( $throw_errors ) { |
|
794 | + } elseif ($throw_errors) { |
|
795 | 795 | EE_Error::add_error( |
796 | 796 | sprintf( |
797 | 797 | __( |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | 'event_espresso' |
800 | 800 | ), |
801 | 801 | $config_class, |
802 | - 'EE_Config->' . $section . '->' . $name |
|
802 | + 'EE_Config->'.$section.'->'.$name |
|
803 | 803 | ), |
804 | 804 | __FILE__, |
805 | 805 | __FUNCTION__, |
@@ -821,34 +821,34 @@ discard block |
||
821 | 821 | * @param string $config_class |
822 | 822 | * @return mixed EE_Config_Base | NULL |
823 | 823 | */ |
824 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
824 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
825 | 825 | // ensure config class is set to something |
826 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
826 | + $config_class = $this->_set_config_class($config_class, $name); |
|
827 | 827 | // run tests 1-4, 6 and 7 to verify that all params have been set |
828 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
828 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
829 | 829 | return null; |
830 | 830 | } |
831 | 831 | // now test if the requested config object exists, but suppress errors |
832 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
832 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
833 | 833 | // config already exists, so pass it back |
834 | 834 | return $this->{$section}->{$name}; |
835 | 835 | } |
836 | 836 | // load config option from db if it exists |
837 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
837 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
838 | 838 | // verify the newly retrieved config object, but suppress errors |
839 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
839 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
840 | 840 | // config is good, so set it and pass it back |
841 | 841 | $this->{$section}->{$name} = $config_obj; |
842 | 842 | return $this->{$section}->{$name}; |
843 | 843 | } |
844 | 844 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
845 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
845 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
846 | 846 | // verify the newly created config object |
847 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
847 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
848 | 848 | return $this->{$section}->{$name}; |
849 | 849 | } else { |
850 | 850 | EE_Error::add_error( |
851 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
851 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
852 | 852 | __FILE__, |
853 | 853 | __FUNCTION__, |
854 | 854 | __LINE__ |
@@ -866,11 +866,11 @@ discard block |
||
866 | 866 | * @param string $config_option_name |
867 | 867 | * @return mixed EE_Config_Base | FALSE |
868 | 868 | */ |
869 | - public function get_config_option( $config_option_name = '' ) { |
|
869 | + public function get_config_option($config_option_name = '') { |
|
870 | 870 | // retrieve the wp-option for this config class. |
871 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
872 | - if ( empty( $config_option ) ) { |
|
873 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
871 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
872 | + if (empty($config_option)) { |
|
873 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
874 | 874 | } |
875 | 875 | return $config_option; |
876 | 876 | } |
@@ -882,17 +882,17 @@ discard block |
||
882 | 882 | * |
883 | 883 | * @param string $config_option_name |
884 | 884 | */ |
885 | - public static function log( $config_option_name = '' ) { |
|
886 | - if ( EE_Config::logging_enabled() && ! empty( $config_option_name ) ) { |
|
887 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
885 | + public static function log($config_option_name = '') { |
|
886 | + if (EE_Config::logging_enabled() && ! empty($config_option_name)) { |
|
887 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
888 | 888 | //copy incoming $_REQUEST and sanitize it so we can save it |
889 | 889 | $_request = $_REQUEST; |
890 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
891 | - $config_log[ (string) microtime( true ) ] = array( |
|
890 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
891 | + $config_log[(string) microtime(true)] = array( |
|
892 | 892 | 'config_name' => $config_option_name, |
893 | 893 | 'request' => $_request, |
894 | 894 | ); |
895 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
895 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
@@ -903,15 +903,15 @@ discard block |
||
903 | 903 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
904 | 904 | */ |
905 | 905 | public static function trim_log() { |
906 | - if ( ! EE_Config::logging_enabled() ) { |
|
906 | + if ( ! EE_Config::logging_enabled()) { |
|
907 | 907 | return; |
908 | 908 | } |
909 | - $config_log = maybe_unserialize( get_option( EE_Config::LOG_NAME, array() ) ); |
|
910 | - $log_length = count( $config_log ); |
|
911 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
912 | - ksort( $config_log ); |
|
913 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
914 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
909 | + $config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array())); |
|
910 | + $log_length = count($config_log); |
|
911 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
912 | + ksort($config_log); |
|
913 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
914 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 | |
@@ -926,14 +926,14 @@ discard block |
||
926 | 926 | * @return string |
927 | 927 | */ |
928 | 928 | public static function get_page_for_posts() { |
929 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
930 | - if ( ! $page_for_posts ) { |
|
929 | + $page_for_posts = get_option('page_for_posts'); |
|
930 | + if ( ! $page_for_posts) { |
|
931 | 931 | return 'posts'; |
932 | 932 | } |
933 | 933 | /** @type WPDB $wpdb */ |
934 | 934 | global $wpdb; |
935 | 935 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
936 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
936 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -989,17 +989,17 @@ discard block |
||
989 | 989 | ) |
990 | 990 | ) { |
991 | 991 | // grab list of installed widgets |
992 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
992 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
993 | 993 | // filter list of modules to register |
994 | 994 | $widgets_to_register = apply_filters( |
995 | 995 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
996 | 996 | $widgets_to_register |
997 | 997 | ); |
998 | - if ( ! empty( $widgets_to_register ) ) { |
|
998 | + if ( ! empty($widgets_to_register)) { |
|
999 | 999 | // cycle thru widget folders |
1000 | - foreach ( $widgets_to_register as $widget_path ) { |
|
1000 | + foreach ($widgets_to_register as $widget_path) { |
|
1001 | 1001 | // add to list of installed widget modules |
1002 | - EE_Config::register_ee_widget( $widget_path ); |
|
1002 | + EE_Config::register_ee_widget($widget_path); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | // filter list of installed modules |
@@ -1019,57 +1019,57 @@ discard block |
||
1019 | 1019 | * @param string $widget_path - full path up to and including widget folder |
1020 | 1020 | * @return void |
1021 | 1021 | */ |
1022 | - public static function register_ee_widget( $widget_path = null ) { |
|
1023 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
1022 | + public static function register_ee_widget($widget_path = null) { |
|
1023 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1024 | 1024 | $widget_ext = '.widget.php'; |
1025 | 1025 | // make all separators match |
1026 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
1026 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
1027 | 1027 | // does the file path INCLUDE the actual file name as part of the path ? |
1028 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
1028 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1029 | 1029 | // grab and shortcode file name from directory name and break apart at dots |
1030 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1030 | + $file_name = explode('.', basename($widget_path)); |
|
1031 | 1031 | // take first segment from file name pieces and remove class prefix if it exists |
1032 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1032 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1033 | 1033 | // sanitize shortcode directory name |
1034 | - $widget = sanitize_key( $widget ); |
|
1034 | + $widget = sanitize_key($widget); |
|
1035 | 1035 | // now we need to rebuild the shortcode path |
1036 | - $widget_path = explode( DS, $widget_path ); |
|
1036 | + $widget_path = explode(DS, $widget_path); |
|
1037 | 1037 | // remove last segment |
1038 | - array_pop( $widget_path ); |
|
1038 | + array_pop($widget_path); |
|
1039 | 1039 | // glue it back together |
1040 | - $widget_path = implode( DS, $widget_path ); |
|
1040 | + $widget_path = implode(DS, $widget_path); |
|
1041 | 1041 | } else { |
1042 | 1042 | // grab and sanitize widget directory name |
1043 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1043 | + $widget = sanitize_key(basename($widget_path)); |
|
1044 | 1044 | } |
1045 | 1045 | // create classname from widget directory name |
1046 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1046 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1047 | 1047 | // add class prefix |
1048 | - $widget_class = 'EEW_' . $widget; |
|
1048 | + $widget_class = 'EEW_'.$widget; |
|
1049 | 1049 | // does the widget exist ? |
1050 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1050 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1051 | 1051 | $msg = sprintf( |
1052 | 1052 | __( |
1053 | 1053 | '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', |
1054 | 1054 | 'event_espresso' |
1055 | 1055 | ), |
1056 | 1056 | $widget_class, |
1057 | - $widget_path . DS . $widget_class . $widget_ext |
|
1057 | + $widget_path.DS.$widget_class.$widget_ext |
|
1058 | 1058 | ); |
1059 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1059 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1060 | 1060 | return; |
1061 | 1061 | } |
1062 | 1062 | // load the widget class file |
1063 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1063 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1064 | 1064 | // verify that class exists |
1065 | - if ( ! class_exists( $widget_class ) ) { |
|
1066 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1067 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1065 | + if ( ! class_exists($widget_class)) { |
|
1066 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1067 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1068 | 1068 | return; |
1069 | 1069 | } |
1070 | - register_widget( $widget_class ); |
|
1070 | + register_widget($widget_class); |
|
1071 | 1071 | // add to array of registered widgets |
1072 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1072 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | |
@@ -1082,17 +1082,17 @@ discard block |
||
1082 | 1082 | */ |
1083 | 1083 | private function _register_shortcodes() { |
1084 | 1084 | // grab list of installed shortcodes |
1085 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1085 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1086 | 1086 | // filter list of modules to register |
1087 | 1087 | $shortcodes_to_register = apply_filters( |
1088 | 1088 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1089 | 1089 | $shortcodes_to_register |
1090 | 1090 | ); |
1091 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1091 | + if ( ! empty($shortcodes_to_register)) { |
|
1092 | 1092 | // cycle thru shortcode folders |
1093 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1093 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1094 | 1094 | // add to list of installed shortcode modules |
1095 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1095 | + EE_Config::register_shortcode($shortcode_path); |
|
1096 | 1096 | } |
1097 | 1097 | } |
1098 | 1098 | // filter list of installed modules |
@@ -1111,64 +1111,64 @@ discard block |
||
1111 | 1111 | * @param string $shortcode_path - full path up to and including shortcode folder |
1112 | 1112 | * @return bool |
1113 | 1113 | */ |
1114 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1115 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1114 | + public static function register_shortcode($shortcode_path = null) { |
|
1115 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1116 | 1116 | $shortcode_ext = '.shortcode.php'; |
1117 | 1117 | // make all separators match |
1118 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1118 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1119 | 1119 | // does the file path INCLUDE the actual file name as part of the path ? |
1120 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1120 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1121 | 1121 | // grab shortcode file name from directory name and break apart at dots |
1122 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1122 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1123 | 1123 | // take first segment from file name pieces and remove class prefix if it exists |
1124 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1125 | - ? substr( $shortcode_file[0], 4 ) |
|
1124 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1125 | + ? substr($shortcode_file[0], 4) |
|
1126 | 1126 | : $shortcode_file[0]; |
1127 | 1127 | // sanitize shortcode directory name |
1128 | - $shortcode = sanitize_key( $shortcode ); |
|
1128 | + $shortcode = sanitize_key($shortcode); |
|
1129 | 1129 | // now we need to rebuild the shortcode path |
1130 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1130 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1131 | 1131 | // remove last segment |
1132 | - array_pop( $shortcode_path ); |
|
1132 | + array_pop($shortcode_path); |
|
1133 | 1133 | // glue it back together |
1134 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1134 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1135 | 1135 | } else { |
1136 | 1136 | // we need to generate the filename based off of the folder name |
1137 | 1137 | // grab and sanitize shortcode directory name |
1138 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1139 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1138 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1139 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1140 | 1140 | } |
1141 | 1141 | // create classname from shortcode directory or file name |
1142 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1142 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1143 | 1143 | // add class prefix |
1144 | - $shortcode_class = 'EES_' . $shortcode; |
|
1144 | + $shortcode_class = 'EES_'.$shortcode; |
|
1145 | 1145 | // does the shortcode exist ? |
1146 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1146 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1147 | 1147 | $msg = sprintf( |
1148 | 1148 | __( |
1149 | 1149 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1150 | 1150 | 'event_espresso' |
1151 | 1151 | ), |
1152 | 1152 | $shortcode_class, |
1153 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1153 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1154 | 1154 | ); |
1155 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1155 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1156 | 1156 | return false; |
1157 | 1157 | } |
1158 | 1158 | // load the shortcode class file |
1159 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1159 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1160 | 1160 | // verify that class exists |
1161 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1161 | + if ( ! class_exists($shortcode_class)) { |
|
1162 | 1162 | $msg = sprintf( |
1163 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1163 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1164 | 1164 | $shortcode_class |
1165 | 1165 | ); |
1166 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1166 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1167 | 1167 | return false; |
1168 | 1168 | } |
1169 | - $shortcode = strtoupper( $shortcode ); |
|
1169 | + $shortcode = strtoupper($shortcode); |
|
1170 | 1170 | // add to array of registered shortcodes |
1171 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1171 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1172 | 1172 | return true; |
1173 | 1173 | } |
1174 | 1174 | |
@@ -1182,22 +1182,22 @@ discard block |
||
1182 | 1182 | */ |
1183 | 1183 | private function _register_modules() { |
1184 | 1184 | // grab list of installed modules |
1185 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1185 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1186 | 1186 | // filter list of modules to register |
1187 | 1187 | $modules_to_register = apply_filters( |
1188 | 1188 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1189 | 1189 | $modules_to_register |
1190 | 1190 | ); |
1191 | - if ( ! empty( $modules_to_register ) ) { |
|
1191 | + if ( ! empty($modules_to_register)) { |
|
1192 | 1192 | // loop through folders |
1193 | - foreach ( $modules_to_register as $module_path ) { |
|
1193 | + foreach ($modules_to_register as $module_path) { |
|
1194 | 1194 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1195 | 1195 | if ( |
1196 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1197 | - && $module_path !== EE_MODULES . 'gateways' |
|
1196 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1197 | + && $module_path !== EE_MODULES.'gateways' |
|
1198 | 1198 | ) { |
1199 | 1199 | // add to list of installed modules |
1200 | - EE_Config::register_module( $module_path ); |
|
1200 | + EE_Config::register_module($module_path); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | } |
@@ -1217,39 +1217,39 @@ discard block |
||
1217 | 1217 | * @param string $module_path - full path up to and including module folder |
1218 | 1218 | * @return bool |
1219 | 1219 | */ |
1220 | - public static function register_module( $module_path = null ) { |
|
1221 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1220 | + public static function register_module($module_path = null) { |
|
1221 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1222 | 1222 | $module_ext = '.module.php'; |
1223 | 1223 | // make all separators match |
1224 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1224 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1225 | 1225 | // does the file path INCLUDE the actual file name as part of the path ? |
1226 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1226 | + if (strpos($module_path, $module_ext) !== false) { |
|
1227 | 1227 | // grab and shortcode file name from directory name and break apart at dots |
1228 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1228 | + $module_file = explode('.', basename($module_path)); |
|
1229 | 1229 | // now we need to rebuild the shortcode path |
1230 | - $module_path = explode( DS, $module_path ); |
|
1230 | + $module_path = explode(DS, $module_path); |
|
1231 | 1231 | // remove last segment |
1232 | - array_pop( $module_path ); |
|
1232 | + array_pop($module_path); |
|
1233 | 1233 | // glue it back together |
1234 | - $module_path = implode( DS, $module_path ) . DS; |
|
1234 | + $module_path = implode(DS, $module_path).DS; |
|
1235 | 1235 | // take first segment from file name pieces and sanitize it |
1236 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1236 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1237 | 1237 | // ensure class prefix is added |
1238 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1238 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1239 | 1239 | } else { |
1240 | 1240 | // we need to generate the filename based off of the folder name |
1241 | 1241 | // grab and sanitize module name |
1242 | - $module = strtolower( basename( $module_path ) ); |
|
1243 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1242 | + $module = strtolower(basename($module_path)); |
|
1243 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1244 | 1244 | // like trailingslashit() |
1245 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1245 | + $module_path = rtrim($module_path, DS).DS; |
|
1246 | 1246 | // create classname from module directory name |
1247 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1247 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1248 | 1248 | // add class prefix |
1249 | - $module_class = 'EED_' . $module; |
|
1249 | + $module_class = 'EED_'.$module; |
|
1250 | 1250 | } |
1251 | 1251 | // does the module exist ? |
1252 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1252 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1253 | 1253 | $msg = sprintf( |
1254 | 1254 | __( |
1255 | 1255 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1257,19 +1257,19 @@ discard block |
||
1257 | 1257 | ), |
1258 | 1258 | $module |
1259 | 1259 | ); |
1260 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1260 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1261 | 1261 | return false; |
1262 | 1262 | } |
1263 | 1263 | // load the module class file |
1264 | - require_once( $module_path . $module_class . $module_ext ); |
|
1264 | + require_once($module_path.$module_class.$module_ext); |
|
1265 | 1265 | // verify that class exists |
1266 | - if ( ! class_exists( $module_class ) ) { |
|
1267 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1268 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1266 | + if ( ! class_exists($module_class)) { |
|
1267 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1268 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1269 | 1269 | return false; |
1270 | 1270 | } |
1271 | 1271 | // add to array of registered modules |
1272 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1272 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1273 | 1273 | do_action( |
1274 | 1274 | 'AHEE__EE_Config__register_module__complete', |
1275 | 1275 | $module_class, |
@@ -1289,26 +1289,26 @@ discard block |
||
1289 | 1289 | */ |
1290 | 1290 | private function _initialize_shortcodes() { |
1291 | 1291 | // cycle thru shortcode folders |
1292 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1292 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1293 | 1293 | // add class prefix |
1294 | - $shortcode_class = 'EES_' . $shortcode; |
|
1294 | + $shortcode_class = 'EES_'.$shortcode; |
|
1295 | 1295 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1296 | 1296 | // which set hooks ? |
1297 | - if ( is_admin() ) { |
|
1297 | + if (is_admin()) { |
|
1298 | 1298 | // fire immediately |
1299 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1299 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1300 | 1300 | } else { |
1301 | 1301 | // delay until other systems are online |
1302 | 1302 | add_action( |
1303 | 1303 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1304 | - array( $shortcode_class, 'set_hooks' ) |
|
1304 | + array($shortcode_class, 'set_hooks') |
|
1305 | 1305 | ); |
1306 | 1306 | // convert classname to UPPERCASE and create WP shortcode. |
1307 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1307 | + $shortcode_tag = strtoupper($shortcode); |
|
1308 | 1308 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1309 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1309 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1310 | 1310 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1311 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1311 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1312 | 1312 | } |
1313 | 1313 | } |
1314 | 1314 | } |
@@ -1325,17 +1325,17 @@ discard block |
||
1325 | 1325 | */ |
1326 | 1326 | private function _initialize_modules() { |
1327 | 1327 | // cycle thru shortcode folders |
1328 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1328 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1329 | 1329 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1330 | 1330 | // which set hooks ? |
1331 | - if ( is_admin() ) { |
|
1331 | + if (is_admin()) { |
|
1332 | 1332 | // fire immediately |
1333 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1333 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1334 | 1334 | } else { |
1335 | 1335 | // delay until other systems are online |
1336 | 1336 | add_action( |
1337 | 1337 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1338 | - array( $module_class, 'set_hooks' ) |
|
1338 | + array($module_class, 'set_hooks') |
|
1339 | 1339 | ); |
1340 | 1340 | } |
1341 | 1341 | } |
@@ -1353,29 +1353,29 @@ discard block |
||
1353 | 1353 | * @param string $key - url param key indicating a route is being called |
1354 | 1354 | * @return bool |
1355 | 1355 | */ |
1356 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1357 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1358 | - $module = str_replace( 'EED_', '', $module ); |
|
1359 | - $module_class = 'EED_' . $module; |
|
1360 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1361 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1362 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1356 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1357 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1358 | + $module = str_replace('EED_', '', $module); |
|
1359 | + $module_class = 'EED_'.$module; |
|
1360 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1361 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1362 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1363 | 1363 | return false; |
1364 | 1364 | } |
1365 | - if ( empty( $route ) ) { |
|
1366 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1367 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1365 | + if (empty($route)) { |
|
1366 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1367 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1368 | 1368 | return false; |
1369 | 1369 | } |
1370 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1370 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1371 | 1371 | $msg = sprintf( |
1372 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1372 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1373 | 1373 | $route |
1374 | 1374 | ); |
1375 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1375 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1376 | 1376 | return false; |
1377 | 1377 | } |
1378 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1378 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1379 | 1379 | return true; |
1380 | 1380 | } |
1381 | 1381 | |
@@ -1389,11 +1389,11 @@ discard block |
||
1389 | 1389 | * @param string $key - url param key indicating a route is being called |
1390 | 1390 | * @return string |
1391 | 1391 | */ |
1392 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1393 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1394 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1395 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1396 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1392 | + public static function get_route($route = null, $key = 'ee') { |
|
1393 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1394 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1395 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1396 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1397 | 1397 | } |
1398 | 1398 | return null; |
1399 | 1399 | } |
@@ -1423,49 +1423,49 @@ discard block |
||
1423 | 1423 | * @param string $key - url param key indicating a route is being called |
1424 | 1424 | * @return bool |
1425 | 1425 | */ |
1426 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1427 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1428 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1426 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1427 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1428 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1429 | 1429 | $msg = sprintf( |
1430 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1430 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1431 | 1431 | $route |
1432 | 1432 | ); |
1433 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1433 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1434 | 1434 | return false; |
1435 | 1435 | } |
1436 | - if ( empty( $forward ) ) { |
|
1437 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1438 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + if (empty($forward)) { |
|
1437 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1438 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1439 | 1439 | return false; |
1440 | 1440 | } |
1441 | - if ( is_array( $forward ) ) { |
|
1442 | - if ( ! isset( $forward[1] ) ) { |
|
1441 | + if (is_array($forward)) { |
|
1442 | + if ( ! isset($forward[1])) { |
|
1443 | 1443 | $msg = sprintf( |
1444 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1444 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1445 | 1445 | $route |
1446 | 1446 | ); |
1447 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1447 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1448 | 1448 | return false; |
1449 | 1449 | } |
1450 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1450 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1451 | 1451 | $msg = sprintf( |
1452 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1452 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1453 | 1453 | $forward[1], |
1454 | 1454 | $route |
1455 | 1455 | ); |
1456 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1456 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1457 | 1457 | return false; |
1458 | 1458 | } |
1459 | - } else if ( ! function_exists( $forward ) ) { |
|
1459 | + } else if ( ! function_exists($forward)) { |
|
1460 | 1460 | $msg = sprintf( |
1461 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1461 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1462 | 1462 | $forward, |
1463 | 1463 | $route |
1464 | 1464 | ); |
1465 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1465 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1466 | 1466 | return false; |
1467 | 1467 | } |
1468 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1468 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1469 | 1469 | return true; |
1470 | 1470 | } |
1471 | 1471 | |
@@ -1481,12 +1481,12 @@ discard block |
||
1481 | 1481 | * @param string $key - url param key indicating a route is being called |
1482 | 1482 | * @return string |
1483 | 1483 | */ |
1484 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1485 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1486 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1484 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1485 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1486 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1487 | 1487 | return apply_filters( |
1488 | 1488 | 'FHEE__EE_Config__get_forward', |
1489 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1489 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1490 | 1490 | $route, |
1491 | 1491 | $status |
1492 | 1492 | ); |
@@ -1508,17 +1508,17 @@ discard block |
||
1508 | 1508 | * @param string $key - url param key indicating a route is being called |
1509 | 1509 | * @return bool |
1510 | 1510 | */ |
1511 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1512 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1513 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1511 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1512 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1513 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1514 | 1514 | $msg = sprintf( |
1515 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1515 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1516 | 1516 | $route |
1517 | 1517 | ); |
1518 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1518 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1519 | 1519 | return false; |
1520 | 1520 | } |
1521 | - if ( ! is_readable( $view ) ) { |
|
1521 | + if ( ! is_readable($view)) { |
|
1522 | 1522 | $msg = sprintf( |
1523 | 1523 | __( |
1524 | 1524 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1526,10 +1526,10 @@ discard block |
||
1526 | 1526 | ), |
1527 | 1527 | $view |
1528 | 1528 | ); |
1529 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1529 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1530 | 1530 | return false; |
1531 | 1531 | } |
1532 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1532 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1533 | 1533 | return true; |
1534 | 1534 | } |
1535 | 1535 | |
@@ -1545,12 +1545,12 @@ discard block |
||
1545 | 1545 | * @param string $key - url param key indicating a route is being called |
1546 | 1546 | * @return string |
1547 | 1547 | */ |
1548 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1549 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1550 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1548 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1549 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1550 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1551 | 1551 | return apply_filters( |
1552 | 1552 | 'FHEE__EE_Config__get_view', |
1553 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1553 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1554 | 1554 | $route, |
1555 | 1555 | $status |
1556 | 1556 | ); |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | |
1562 | 1562 | |
1563 | 1563 | public function update_addon_option_names() { |
1564 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1564 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1565 | 1565 | } |
1566 | 1566 | |
1567 | 1567 | |
@@ -1589,22 +1589,22 @@ discard block |
||
1589 | 1589 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1590 | 1590 | * @throws \EE_Error |
1591 | 1591 | */ |
1592 | - public function get_pretty( $property ) { |
|
1593 | - if ( ! property_exists( $this, $property ) ) { |
|
1592 | + public function get_pretty($property) { |
|
1593 | + if ( ! property_exists($this, $property)) { |
|
1594 | 1594 | throw new EE_Error( |
1595 | 1595 | sprintf( |
1596 | 1596 | __( |
1597 | 1597 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1598 | 1598 | 'event_espresso' |
1599 | 1599 | ), |
1600 | - get_class( $this ), |
|
1600 | + get_class($this), |
|
1601 | 1601 | $property |
1602 | 1602 | ) |
1603 | 1603 | ); |
1604 | 1604 | } |
1605 | 1605 | //just handling escaping of strings for now. |
1606 | - if ( is_string( $this->{$property} ) ) { |
|
1607 | - return stripslashes( $this->{$property} ); |
|
1606 | + if (is_string($this->{$property} )) { |
|
1607 | + return stripslashes($this->{$property} ); |
|
1608 | 1608 | } |
1609 | 1609 | return $this->{$property}; |
1610 | 1610 | } |
@@ -1613,17 +1613,17 @@ discard block |
||
1613 | 1613 | |
1614 | 1614 | public function populate() { |
1615 | 1615 | //grab defaults via a new instance of this class. |
1616 | - $class_name = get_class( $this ); |
|
1616 | + $class_name = get_class($this); |
|
1617 | 1617 | $defaults = new $class_name; |
1618 | 1618 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1619 | 1619 | //default from our $defaults object. |
1620 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1621 | - if ( $this->{$property} === null ) { |
|
1620 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1621 | + if ($this->{$property} === null) { |
|
1622 | 1622 | $this->{$property} = $value; |
1623 | 1623 | } |
1624 | 1624 | } |
1625 | 1625 | //cleanup |
1626 | - unset( $defaults ); |
|
1626 | + unset($defaults); |
|
1627 | 1627 | } |
1628 | 1628 | |
1629 | 1629 | |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | * @param $a |
1640 | 1640 | * @return bool |
1641 | 1641 | */ |
1642 | - public function __isset( $a ) { |
|
1642 | + public function __isset($a) { |
|
1643 | 1643 | return false; |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1651,7 +1651,7 @@ discard block |
||
1651 | 1651 | * @param $a |
1652 | 1652 | * @return bool |
1653 | 1653 | */ |
1654 | - public function __unset( $a ) { |
|
1654 | + public function __unset($a) { |
|
1655 | 1655 | return false; |
1656 | 1656 | } |
1657 | 1657 | |
@@ -1761,7 +1761,7 @@ discard block |
||
1761 | 1761 | $this->current_blog_id = get_current_blog_id(); |
1762 | 1762 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1763 | 1763 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1764 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1764 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1765 | 1765 | $this->post_shortcodes = array(); |
1766 | 1766 | $this->module_route_map = array(); |
1767 | 1767 | $this->module_forward_map = array(); |
@@ -1777,9 +1777,9 @@ discard block |
||
1777 | 1777 | $this->thank_you_page_url = ''; |
1778 | 1778 | $this->cancel_page_url = ''; |
1779 | 1779 | //cpt slugs |
1780 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1780 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1781 | 1781 | //ueip constant check |
1782 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1782 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1783 | 1783 | $this->ee_ueip_optin = false; |
1784 | 1784 | $this->ee_ueip_has_notified = true; |
1785 | 1785 | } |
@@ -1822,11 +1822,11 @@ discard block |
||
1822 | 1822 | * @return string |
1823 | 1823 | */ |
1824 | 1824 | public function reg_page_url() { |
1825 | - if ( ! $this->reg_page_url ) { |
|
1825 | + if ( ! $this->reg_page_url) { |
|
1826 | 1826 | $this->reg_page_url = add_query_arg( |
1827 | - array( 'uts' => time() ), |
|
1828 | - get_permalink( $this->reg_page_id ) |
|
1829 | - ) . '#checkout'; |
|
1827 | + array('uts' => time()), |
|
1828 | + get_permalink($this->reg_page_id) |
|
1829 | + ).'#checkout'; |
|
1830 | 1830 | } |
1831 | 1831 | return $this->reg_page_url; |
1832 | 1832 | } |
@@ -1841,12 +1841,12 @@ discard block |
||
1841 | 1841 | * @access public |
1842 | 1842 | * @return string |
1843 | 1843 | */ |
1844 | - public function txn_page_url( $query_args = array() ) { |
|
1845 | - if ( ! $this->txn_page_url ) { |
|
1846 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1844 | + public function txn_page_url($query_args = array()) { |
|
1845 | + if ( ! $this->txn_page_url) { |
|
1846 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1847 | 1847 | } |
1848 | - if ( $query_args ) { |
|
1849 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1848 | + if ($query_args) { |
|
1849 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1850 | 1850 | } else { |
1851 | 1851 | return $this->txn_page_url; |
1852 | 1852 | } |
@@ -1862,12 +1862,12 @@ discard block |
||
1862 | 1862 | * @access public |
1863 | 1863 | * @return string |
1864 | 1864 | */ |
1865 | - public function thank_you_page_url( $query_args = array() ) { |
|
1866 | - if ( ! $this->thank_you_page_url ) { |
|
1867 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1865 | + public function thank_you_page_url($query_args = array()) { |
|
1866 | + if ( ! $this->thank_you_page_url) { |
|
1867 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1868 | 1868 | } |
1869 | - if ( $query_args ) { |
|
1870 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1869 | + if ($query_args) { |
|
1870 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1871 | 1871 | } else { |
1872 | 1872 | return $this->thank_you_page_url; |
1873 | 1873 | } |
@@ -1882,8 +1882,8 @@ discard block |
||
1882 | 1882 | * @return string |
1883 | 1883 | */ |
1884 | 1884 | public function cancel_page_url() { |
1885 | - if ( ! $this->cancel_page_url ) { |
|
1886 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1885 | + if ( ! $this->cancel_page_url) { |
|
1886 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1887 | 1887 | } |
1888 | 1888 | return $this->cancel_page_url; |
1889 | 1889 | } |
@@ -1912,22 +1912,22 @@ discard block |
||
1912 | 1912 | */ |
1913 | 1913 | protected function _get_main_ee_ueip_optin() { |
1914 | 1914 | //if this is the main site then we can just bypass our direct query. |
1915 | - if ( is_main_site() ) { |
|
1916 | - return get_option( 'ee_ueip_optin', false ); |
|
1915 | + if (is_main_site()) { |
|
1916 | + return get_option('ee_ueip_optin', false); |
|
1917 | 1917 | } |
1918 | 1918 | |
1919 | 1919 | //is this already cached for this request? If so use it. |
1920 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1920 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1921 | 1921 | return EE_Core_Config::$ee_ueip_option; |
1922 | 1922 | } |
1923 | 1923 | |
1924 | 1924 | global $wpdb; |
1925 | 1925 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1926 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1926 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1927 | 1927 | $option = 'ee_ueip_optin'; |
1928 | 1928 | |
1929 | 1929 | //set correct table for query |
1930 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1930 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1931 | 1931 | |
1932 | 1932 | |
1933 | 1933 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1935,20 +1935,20 @@ discard block |
||
1935 | 1935 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1936 | 1936 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1937 | 1937 | //for the purpose of caching. |
1938 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1939 | - if ( false !== $pre ) { |
|
1938 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1939 | + if (false !== $pre) { |
|
1940 | 1940 | EE_Core_Config::$ee_ueip_option = $pre; |
1941 | 1941 | return EE_Core_Config::$ee_ueip_option; |
1942 | 1942 | } |
1943 | 1943 | |
1944 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1945 | - if ( is_object( $row ) ) { |
|
1944 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1945 | + if (is_object($row)) { |
|
1946 | 1946 | $value = $row->option_value; |
1947 | 1947 | } else { //option does not exist so use default. |
1948 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1948 | + return apply_filters('default_option_'.$option, false, $option); |
|
1949 | 1949 | } |
1950 | 1950 | |
1951 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1951 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1952 | 1952 | return EE_Core_Config::$ee_ueip_option; |
1953 | 1953 | } |
1954 | 1954 | |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | //reset all url properties |
1965 | 1965 | $this->_reset_urls(); |
1966 | 1966 | //return what to save to db |
1967 | - return array_keys( get_object_vars( $this ) ); |
|
1967 | + return array_keys(get_object_vars($this)); |
|
1968 | 1968 | } |
1969 | 1969 | |
1970 | 1970 | } |
@@ -2111,14 +2111,14 @@ discard block |
||
2111 | 2111 | */ |
2112 | 2112 | public function __construct() { |
2113 | 2113 | // set default organization settings |
2114 | - $this->name = get_bloginfo( 'name' ); |
|
2114 | + $this->name = get_bloginfo('name'); |
|
2115 | 2115 | $this->address_1 = '123 Onna Road'; |
2116 | 2116 | $this->address_2 = 'PO Box 123'; |
2117 | 2117 | $this->city = 'Inna City'; |
2118 | 2118 | $this->STA_ID = 4; |
2119 | 2119 | $this->CNT_ISO = 'US'; |
2120 | 2120 | $this->zip = '12345'; |
2121 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2121 | + $this->email = get_bloginfo('admin_email'); |
|
2122 | 2122 | $this->phone = ''; |
2123 | 2123 | $this->vat = '123456789'; |
2124 | 2124 | $this->logo_url = ''; |
@@ -2206,46 +2206,46 @@ discard block |
||
2206 | 2206 | * @param string $CNT_ISO |
2207 | 2207 | * @throws \EE_Error |
2208 | 2208 | */ |
2209 | - public function __construct( $CNT_ISO = '' ) { |
|
2209 | + public function __construct($CNT_ISO = '') { |
|
2210 | 2210 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2211 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2211 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2212 | 2212 | // get country code from organization settings or use default |
2213 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2213 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2214 | 2214 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2215 | 2215 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2216 | 2216 | : ''; |
2217 | 2217 | // but override if requested |
2218 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2218 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2219 | 2219 | // 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 |
2220 | 2220 | if ( |
2221 | - ! empty( $CNT_ISO ) |
|
2221 | + ! empty($CNT_ISO) |
|
2222 | 2222 | && EE_Maintenance_Mode::instance()->models_can_query() |
2223 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2223 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2224 | 2224 | ) { |
2225 | 2225 | // retrieve the country settings from the db, just in case they have been customized |
2226 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2227 | - if ( $country instanceof EE_Country ) { |
|
2228 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2229 | - $this->name = $country->currency_name_single(); // Dollar |
|
2230 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2231 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2232 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2233 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2234 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2235 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2226 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2227 | + if ($country instanceof EE_Country) { |
|
2228 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2229 | + $this->name = $country->currency_name_single(); // Dollar |
|
2230 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2231 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2232 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2233 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2234 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2235 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2236 | 2236 | } |
2237 | 2237 | } |
2238 | 2238 | // fallback to hardcoded defaults, in case the above failed |
2239 | - if ( empty( $this->code ) ) { |
|
2239 | + if (empty($this->code)) { |
|
2240 | 2240 | // set default currency settings |
2241 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2242 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2243 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2244 | - $this->sign = '$'; // currency sign: $ |
|
2245 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2246 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2247 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2248 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2241 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2242 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2243 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2244 | + $this->sign = '$'; // currency sign: $ |
|
2245 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2246 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2247 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2248 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2249 | 2249 | } |
2250 | 2250 | } |
2251 | 2251 | } |
@@ -2414,7 +2414,7 @@ discard block |
||
2414 | 2414 | * @since 4.8.8.rc.019 |
2415 | 2415 | */ |
2416 | 2416 | public function do_hooks() { |
2417 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2417 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2418 | 2418 | } |
2419 | 2419 | |
2420 | 2420 | |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | * @return void |
2424 | 2424 | */ |
2425 | 2425 | public function set_default_reg_status_on_EEM_Event() { |
2426 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2426 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2427 | 2427 | } |
2428 | 2428 | |
2429 | 2429 | |
@@ -2440,7 +2440,7 @@ discard block |
||
2440 | 2440 | /** |
2441 | 2441 | * @param boolean $track_invalid_checkout_access |
2442 | 2442 | */ |
2443 | - public function set_track_invalid_checkout_access( $track_invalid_checkout_access ) { |
|
2443 | + public function set_track_invalid_checkout_access($track_invalid_checkout_access) { |
|
2444 | 2444 | $this->track_invalid_checkout_access = filter_var( |
2445 | 2445 | $track_invalid_checkout_access, |
2446 | 2446 | FILTER_VALIDATE_BOOLEAN |
@@ -2558,10 +2558,10 @@ discard block |
||
2558 | 2558 | * @param bool $reset |
2559 | 2559 | * @return string |
2560 | 2560 | */ |
2561 | - public function log_file_name( $reset = false ) { |
|
2562 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2563 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2564 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2561 | + public function log_file_name($reset = false) { |
|
2562 | + if (empty($this->log_file_name) || $reset) { |
|
2563 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2564 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2565 | 2565 | } |
2566 | 2566 | return $this->log_file_name; |
2567 | 2567 | } |
@@ -2572,10 +2572,10 @@ discard block |
||
2572 | 2572 | * @param bool $reset |
2573 | 2573 | * @return string |
2574 | 2574 | */ |
2575 | - public function debug_file_name( $reset = false ) { |
|
2576 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2577 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2578 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2575 | + public function debug_file_name($reset = false) { |
|
2576 | + if (empty($this->debug_file_name) || $reset) { |
|
2577 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2578 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2579 | 2579 | } |
2580 | 2580 | return $this->debug_file_name; |
2581 | 2581 | } |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | * @return string |
2587 | 2587 | */ |
2588 | 2588 | public function affiliate_id() { |
2589 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2589 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2590 | 2590 | } |
2591 | 2591 | |
2592 | 2592 | |
@@ -2595,7 +2595,7 @@ discard block |
||
2595 | 2595 | * @return boolean |
2596 | 2596 | */ |
2597 | 2597 | public function encode_session_data() { |
2598 | - return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2598 | + return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2599 | 2599 | } |
2600 | 2600 | |
2601 | 2601 | |
@@ -2603,8 +2603,8 @@ discard block |
||
2603 | 2603 | /** |
2604 | 2604 | * @param boolean $encode_session_data |
2605 | 2605 | */ |
2606 | - public function set_encode_session_data( $encode_session_data ) { |
|
2607 | - $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2606 | + public function set_encode_session_data($encode_session_data) { |
|
2607 | + $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2608 | 2608 | } |
2609 | 2609 | |
2610 | 2610 | |
@@ -2784,21 +2784,21 @@ discard block |
||
2784 | 2784 | $this->use_google_maps = true; |
2785 | 2785 | $this->google_map_api_key = ''; |
2786 | 2786 | // for event details pages (reg page) |
2787 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2788 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2789 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2790 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2791 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2792 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2793 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2787 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2788 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2789 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2790 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2791 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2792 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2793 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2794 | 2794 | // for event list pages |
2795 | - $this->event_list_map_width = 300; // ee_map_width |
|
2796 | - $this->event_list_map_height = 185; // ee_map_height |
|
2797 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2798 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2799 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2800 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2801 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2795 | + $this->event_list_map_width = 300; // ee_map_width |
|
2796 | + $this->event_list_map_height = 185; // ee_map_height |
|
2797 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2798 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2799 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2800 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2801 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2802 | 2802 | } |
2803 | 2803 | |
2804 | 2804 | } |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | * @return void |
2961 | 2961 | */ |
2962 | 2962 | protected function _set_php_values() { |
2963 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2963 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2964 | 2964 | $this->php->version = phpversion(); |
2965 | 2965 | } |
2966 | 2966 | |
@@ -2979,10 +2979,10 @@ discard block |
||
2979 | 2979 | * @type string $msg Any message to be displayed. |
2980 | 2980 | * } |
2981 | 2981 | */ |
2982 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2983 | - if ( ! empty( $this->php->max_input_vars ) |
|
2984 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2985 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2982 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2983 | + if ( ! empty($this->php->max_input_vars) |
|
2984 | + && ($input_count >= $this->php->max_input_vars) |
|
2985 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2986 | 2986 | ) { |
2987 | 2987 | return sprintf( |
2988 | 2988 | __( |
@@ -3078,7 +3078,7 @@ discard block |
||
3078 | 3078 | */ |
3079 | 3079 | public function __construct() { |
3080 | 3080 | $this->payment_settings = array(); |
3081 | - $this->active_gateways = array( 'Invoice' => false ); |
|
3081 | + $this->active_gateways = array('Invoice' => false); |
|
3082 | 3082 | } |
3083 | 3083 | } |
3084 | 3084 |
@@ -8,8 +8,8 @@ |
||
8 | 8 | foreach( $form_section->subsections() as $subsection ) { |
9 | 9 | if( $subsection instanceof EE_Form_Input_Base ) { |
10 | 10 | if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal |
11 | - || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal |
|
12 | - || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){ |
|
11 | + || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal |
|
12 | + || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){ |
|
13 | 13 | continue; |
14 | 14 | } |
15 | 15 | if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) { |
@@ -1,38 +1,38 @@ |
||
1 | 1 | <div id="admin-side-mbox-billing-info-dv" class="admin-side-mbox-dv"> |
2 | -<?php if ( empty($billing_form) ) : ?> |
|
2 | +<?php if (empty($billing_form)) : ?> |
|
3 | 3 | <div class="clearfix"> |
4 | - <?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/> |
|
4 | + <?php _e('There is no billing info for this transaction.', 'event_espresso'); ?><br/> |
|
5 | 5 | </div> |
6 | 6 | <?php else : |
7 | - function ee_show_billing_info_cleaned( EE_Form_Section_Proper $form_section, $found_cc_data = false ) { |
|
8 | - foreach( $form_section->subsections() as $subsection ) { |
|
9 | - if( $subsection instanceof EE_Form_Input_Base ) { |
|
10 | - if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal |
|
7 | + function ee_show_billing_info_cleaned(EE_Form_Section_Proper $form_section, $found_cc_data = false) { |
|
8 | + foreach ($form_section->subsections() as $subsection) { |
|
9 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
10 | + if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal |
|
11 | 11 | || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal |
12 | - || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){ |
|
12 | + || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy) { |
|
13 | 13 | continue; |
14 | 14 | } |
15 | - if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) { |
|
15 | + if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal) { |
|
16 | 16 | $found_cc_data = true; |
17 | 17 | } |
18 | 18 | ?> |
19 | 19 | <div class="clearfix"> |
20 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label();?></span><?php echo $subsection->pretty_value();?> |
|
20 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label(); ?></span><?php echo $subsection->pretty_value(); ?> |
|
21 | 21 | </div><?php |
22 | - } elseif( $subsection instanceof EE_Form_Section_Proper ) { |
|
23 | - $found_cc_data = ee_show_billing_info_cleaned( $subsection, $found_cc_data); |
|
22 | + } elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
23 | + $found_cc_data = ee_show_billing_info_cleaned($subsection, $found_cc_data); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | return $found_cc_data; |
27 | 27 | } |
28 | - $found_cc_data = ee_show_billing_info_cleaned( $billing_form ); |
|
29 | - if( apply_filters( |
|
28 | + $found_cc_data = ee_show_billing_info_cleaned($billing_form); |
|
29 | + if (apply_filters( |
|
30 | 30 | 'FHEE__txn_admin_details_side_meta_box_billing_info__show_default_note', |
31 | 31 | $found_cc_data, |
32 | - $billing_form ) ) {?> |
|
33 | - <p class="help"><?php _e( 'Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso' );?></p> |
|
32 | + $billing_form )) {?> |
|
33 | + <p class="help"><?php _e('Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso'); ?></p> |
|
34 | 34 | <?php } |
35 | - do_action( 'AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form ); |
|
35 | + do_action('AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form); |
|
36 | 36 | endif; ?> |
37 | 37 | |
38 | 38 | </div> |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
6 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
5 | +if ( ! class_exists('WP_List_Table')) { |
|
6 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table |
208 | 208 | */ |
209 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
209 | + public function __construct(EE_Admin_Page $admin_page) { |
|
210 | 210 | $this->_admin_page = $admin_page; |
211 | 211 | $this->_req_data = $this->_admin_page->get_request_data(); |
212 | 212 | $this->_view = $this->_admin_page->get_view(); |
213 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
213 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
214 | 214 | $this->_current_page = $this->get_pagenum(); |
215 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
216 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
215 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
216 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
217 | 217 | |
218 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
218 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
219 | 219 | |
220 | 220 | $this->_setup_data(); |
221 | 221 | $this->_add_view_counts(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $this->_set_properties(); |
226 | 226 | |
227 | 227 | //set primary column |
228 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
228 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
229 | 229 | |
230 | 230 | //set parent defaults |
231 | 231 | parent::__construct($this->_wp_list_args); |
@@ -301,17 +301,17 @@ discard block |
||
301 | 301 | * @return string |
302 | 302 | */ |
303 | 303 | protected function _get_hidden_fields() { |
304 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
305 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
304 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
305 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
306 | 306 | //if action is STILL empty, then we set it to default |
307 | - $action = empty( $action ) ? 'default' : $action; |
|
308 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
309 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
310 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
307 | + $action = empty($action) ? 'default' : $action; |
|
308 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
309 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
310 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
311 | 311 | |
312 | 312 | $bulk_actions = $this->_get_bulk_actions(); |
313 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
314 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
313 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
314 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $field; |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @var array |
343 | 343 | */ |
344 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
344 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
345 | 345 | |
346 | 346 | $sortable = array(); |
347 | - foreach ( $_sortable as $id => $data ) { |
|
348 | - if ( empty( $data ) ) { |
|
347 | + foreach ($_sortable as $id => $data) { |
|
348 | + if (empty($data)) { |
|
349 | 349 | continue; |
350 | 350 | } |
351 | 351 | //fix for offset errors with WP_List_Table default get_columninfo() |
352 | - if ( is_array($data) ) { |
|
352 | + if (is_array($data)) { |
|
353 | 353 | $_data[0] = key($data); |
354 | 354 | $_data[1] = isset($data[1]) ? $data[1] : false; |
355 | 355 | } else { |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | |
359 | 359 | $data = (array) $data; |
360 | 360 | |
361 | - if ( !isset( $data[1] ) ) { |
|
361 | + if ( ! isset($data[1])) { |
|
362 | 362 | $_data[1] = false; |
363 | 363 | } |
364 | 364 | |
365 | 365 | $sortable[$id] = $_data; |
366 | 366 | } |
367 | 367 | $primary = $this->get_primary_column_name(); |
368 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
368 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @return string |
375 | 375 | */ |
376 | 376 | protected function get_primary_column_name() { |
377 | - foreach( class_parents( $this ) as $parent ) { |
|
378 | - if ( $parent === 'WP_List_Table' && method_exists( $parent, 'get_primary_column_name' ) ) { |
|
377 | + foreach (class_parents($this) as $parent) { |
|
378 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) { |
|
379 | 379 | return parent::get_primary_column_name(); |
380 | 380 | } |
381 | 381 | } |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | * @param string $primary |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
396 | - foreach( class_parents( $this ) as $parent ) { |
|
397 | - if ( $parent === 'WP_List_Table' && method_exists( $parent, 'handle_row_actions' ) ) { |
|
398 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
395 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
396 | + foreach (class_parents($this) as $parent) { |
|
397 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) { |
|
398 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | return ''; |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | protected function _get_bulk_actions() { |
414 | 414 | $actions = array(); |
415 | 415 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
416 | - foreach ( $this->_views as $view => $args) { |
|
417 | - if ( $this->_view === $view && isset( $args['bulk_action']) && is_array($args['bulk_action']) ) { |
|
416 | + foreach ($this->_views as $view => $args) { |
|
417 | + if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) { |
|
418 | 418 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
419 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
420 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
419 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
420 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
421 | 421 | $actions[$route] = $label; |
422 | 422 | } |
423 | 423 | } |
@@ -436,18 +436,18 @@ discard block |
||
436 | 436 | */ |
437 | 437 | private function _filters() { |
438 | 438 | $classname = get_class($this); |
439 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
439 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
440 | 440 | |
441 | - if ( empty( $filters )) { |
|
441 | + if (empty($filters)) { |
|
442 | 442 | return; |
443 | 443 | } |
444 | - foreach ( $filters as $filter ) { |
|
444 | + foreach ($filters as $filter) { |
|
445 | 445 | echo $filter; |
446 | 446 | } |
447 | 447 | //add filter button at end |
448 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
448 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
449 | 449 | //add reset filters button at end |
450 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
450 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | * @param string $column_name |
462 | 462 | * @return string |
463 | 463 | */ |
464 | - public function set_primary_column( $column_name ) { |
|
465 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
464 | + public function set_primary_column($column_name) { |
|
465 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | array( |
483 | 483 | 'total_items' => $total_items, |
484 | 484 | 'per_page' => $this->_per_page, |
485 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
485 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
486 | 486 | ) |
487 | 487 | ); |
488 | 488 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @param string $column_name The column being called. |
497 | 497 | * @return string html content for the column |
498 | 498 | */ |
499 | - public function column_default( $item, $column_name ) { |
|
499 | + public function column_default($item, $column_name) { |
|
500 | 500 | /** |
501 | 501 | * Dynamic hook allowing for adding additional column content in this list table. |
502 | 502 | * Note that $this->screen->id is in the format |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * hook prefix ("event-espresso") will be different. |
507 | 507 | * |
508 | 508 | */ |
509 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
509 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @var array |
534 | 534 | */ |
535 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
535 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
536 | 536 | return $columns; |
537 | 537 | } |
538 | 538 | |
@@ -555,18 +555,18 @@ discard block |
||
555 | 555 | $views = $this->get_views(); |
556 | 556 | $assembled_views = ''; |
557 | 557 | |
558 | - if ( empty( $views )) { |
|
558 | + if (empty($views)) { |
|
559 | 559 | return; |
560 | 560 | } |
561 | 561 | echo "<ul class='subsubsub'>\n"; |
562 | - foreach ( $views as $view ) { |
|
563 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
564 | - if ( isset( $view['slug'], $view['class'], $view['url'], $view['label']) ) { |
|
565 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
562 | + foreach ($views as $view) { |
|
563 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
564 | + if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) { |
|
565 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
569 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
569 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
570 | 570 | echo "</ul>"; |
571 | 571 | } |
572 | 572 | |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | * @access public |
579 | 579 | * @param EE_Base_Class $item The current item |
580 | 580 | */ |
581 | - public function single_row( $item ) { |
|
582 | - $row_class = $this->_get_row_class( $item ); |
|
583 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
584 | - $this->single_row_columns( $item ); |
|
581 | + public function single_row($item) { |
|
582 | + $row_class = $this->_get_row_class($item); |
|
583 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
584 | + $this->single_row_columns($item); |
|
585 | 585 | echo '</tr>'; |
586 | 586 | } |
587 | 587 | |
@@ -593,13 +593,13 @@ discard block |
||
593 | 593 | * @param EE_Base_Class $item the current item |
594 | 594 | * @return string |
595 | 595 | */ |
596 | - protected function _get_row_class( $item ) { |
|
596 | + protected function _get_row_class($item) { |
|
597 | 597 | static $row_class = ''; |
598 | - $row_class = ( $row_class === '' ? 'alternate' : '' ); |
|
598 | + $row_class = ($row_class === '' ? 'alternate' : ''); |
|
599 | 599 | |
600 | 600 | $new_row_class = $row_class; |
601 | 601 | |
602 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
602 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
603 | 603 | $new_row_class .= ' rowsortable'; |
604 | 604 | } |
605 | 605 | |
@@ -631,13 +631,13 @@ discard block |
||
631 | 631 | */ |
632 | 632 | public function get_hidden_columns() { |
633 | 633 | $user_id = get_current_user_id(); |
634 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
635 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
636 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
637 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
634 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
635 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
636 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
637 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
638 | 638 | } |
639 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
640 | - return (array) get_user_option( $ref, $user_id ); |
|
639 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
640 | + return (array) get_user_option($ref, $user_id); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | |
@@ -650,47 +650,47 @@ discard block |
||
650 | 650 | * @since 3.1.0 |
651 | 651 | * @param EE_Base_Class $item The current item |
652 | 652 | */ |
653 | - public function single_row_columns( $item ) { |
|
654 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
653 | + public function single_row_columns($item) { |
|
654 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
655 | 655 | |
656 | 656 | global $wp_version; |
657 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
657 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
658 | 658 | |
659 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
659 | + foreach ($columns as $column_name => $column_display_name) { |
|
660 | 660 | |
661 | 661 | /** |
662 | 662 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
663 | 663 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
664 | 664 | */ |
665 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
666 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
665 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
666 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
667 | 667 | |
668 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
669 | - if ( $primary === $column_name ) { |
|
668 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
669 | + if ($primary === $column_name) { |
|
670 | 670 | $classes .= ' has-row-actions column-primary'; |
671 | 671 | } |
672 | 672 | |
673 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
673 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
674 | 674 | |
675 | 675 | $class = "class='$classes'"; |
676 | 676 | |
677 | 677 | $attributes = "$class$style$data"; |
678 | 678 | |
679 | - if ( $column_name === 'cb' ) { |
|
679 | + if ($column_name === 'cb') { |
|
680 | 680 | echo '<th scope="row" class="check-column">'; |
681 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
681 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
682 | 682 | echo '</th>'; |
683 | 683 | } |
684 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
684 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
685 | 685 | echo "<td $attributes>"; |
686 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
687 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
686 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
687 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
688 | 688 | echo "</td>"; |
689 | 689 | } |
690 | 690 | else { |
691 | 691 | echo "<td $attributes>"; |
692 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
693 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
692 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
693 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
694 | 694 | echo "</td>"; |
695 | 695 | } |
696 | 696 | } |
@@ -705,15 +705,15 @@ discard block |
||
705 | 705 | * @param string $which |
706 | 706 | * @throws \EE_Error |
707 | 707 | */ |
708 | - public function extra_tablenav( $which ) { |
|
709 | - if ( $which === 'top' ) { |
|
708 | + public function extra_tablenav($which) { |
|
709 | + if ($which === 'top') { |
|
710 | 710 | $this->_filters(); |
711 | 711 | echo $this->_get_hidden_fields(); |
712 | 712 | } else { |
713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | - foreach ( $this->_bottom_buttons as $type => $action ){ |
|
715 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
714 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
715 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
717 | 717 | echo $this->_admin_page->get_action_link_or_button( |
718 | 718 | $route, |
719 | 719 | $type, |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | false |
724 | 724 | ); |
725 | 725 | } |
726 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
726 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
727 | 727 | echo '</div>'; |
728 | 728 | } |
729 | 729 | //echo $this->_entries_per_page_dropdown; |
@@ -779,11 +779,11 @@ discard block |
||
779 | 779 | * the actions. |
780 | 780 | * @return string The assembled action elements container. |
781 | 781 | */ |
782 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
782 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
783 | 783 | $content = ''; |
784 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
785 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
786 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
784 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
785 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
786 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
787 | 787 | try { |
788 | 788 | $content .= apply_filters( |
789 | 789 | 'FHEE__EE_Admin_List_Table___action_string__action_items', |
@@ -793,11 +793,11 @@ discard block |
||
793 | 793 | ); |
794 | 794 | } catch (\Exception $e) { |
795 | 795 | if (WP_DEBUG) { |
796 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
796 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 797 | } |
798 | 798 | $content .= $action_items; |
799 | 799 | } |
800 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
|
800 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
801 | 801 | return $content; |
802 | 802 | } |
803 | 803 | } |
@@ -680,14 +680,12 @@ |
||
680 | 680 | echo '<th scope="row" class="check-column">'; |
681 | 681 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
682 | 682 | echo '</th>'; |
683 | - } |
|
684 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
683 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
685 | 684 | echo "<td $attributes>"; |
686 | 685 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
687 | 686 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
688 | 687 | echo "</td>"; |
689 | - } |
|
690 | - else { |
|
688 | + } else { |
|
691 | 689 | echo "<td $attributes>"; |
692 | 690 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
693 | 691 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | abstract class EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -385,12 +385,12 @@ discard block |
||
385 | 385 | |
386 | 386 | |
387 | 387 | |
388 | - /** |
|
389 | - * creates the default hidden inputs section |
|
390 | - * |
|
391 | - * @return EE_Form_Section_Proper |
|
392 | - * @throws \EE_Error |
|
393 | - */ |
|
388 | + /** |
|
389 | + * creates the default hidden inputs section |
|
390 | + * |
|
391 | + * @return EE_Form_Section_Proper |
|
392 | + * @throws \EE_Error |
|
393 | + */ |
|
394 | 394 | public function reg_step_hidden_inputs() { |
395 | 395 | // hidden inputs for admin registrations |
396 | 396 | if ( $this->checkout->admin_request ) { |
@@ -465,10 +465,10 @@ discard block |
||
465 | 465 | |
466 | 466 | |
467 | 467 | |
468 | - /** |
|
469 | - * @return string |
|
470 | - * @throws \EE_Error |
|
471 | - */ |
|
468 | + /** |
|
469 | + * @return string |
|
470 | + * @throws \EE_Error |
|
471 | + */ |
|
472 | 472 | public function display_reg_form() { |
473 | 473 | $html = ''; |
474 | 474 | if ( $this->reg_form instanceof EE_Form_Section_Proper ) { |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | $this->reg_form->localize_validation_rules(); |
478 | 478 | $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
479 | 479 | } |
480 | - $html .= $this->reg_form->get_html(); |
|
481 | - $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : ''; |
|
480 | + $html .= $this->reg_form->get_html(); |
|
481 | + $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : ''; |
|
482 | 482 | $html .= ! $this->checkout->admin_request ? $this->reg_form->form_close() : ''; |
483 | 483 | } |
484 | 484 | return $html; |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | |
487 | 487 | |
488 | 488 | |
489 | - /** |
|
490 | - * div_class - returns nothing for current step, but a css class of "hidden" for others |
|
491 | - * |
|
492 | - * @return string |
|
493 | - * @throws \EE_Error |
|
494 | - */ |
|
489 | + /** |
|
490 | + * div_class - returns nothing for current step, but a css class of "hidden" for others |
|
491 | + * |
|
492 | + * @return string |
|
493 | + * @throws \EE_Error |
|
494 | + */ |
|
495 | 495 | public function reg_step_submit_button() { |
496 | 496 | if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
497 | 497 | return ''; |
@@ -550,12 +550,12 @@ discard block |
||
550 | 550 | |
551 | 551 | |
552 | 552 | |
553 | - /** |
|
554 | - * update_checkout with changes that have been made to the cart |
|
555 | - * |
|
556 | - * @return void |
|
557 | - * @throws \EE_Error |
|
558 | - */ |
|
553 | + /** |
|
554 | + * update_checkout with changes that have been made to the cart |
|
555 | + * |
|
556 | + * @return void |
|
557 | + * @throws \EE_Error |
|
558 | + */ |
|
559 | 559 | public function update_checkout() { |
560 | 560 | // grab the cart grand total and reset TXN total |
561 | 561 | $this->checkout->transaction->set_total( $this->checkout->cart->get_cart_grand_total() ); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function set_completed() { |
154 | 154 | // DEBUG LOG |
155 | 155 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
156 | - $this->_completed = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this ); |
|
156 | + $this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -201,18 +201,18 @@ discard block |
||
201 | 201 | * sets the text that appears on the reg step form submit button |
202 | 202 | * @param string $submit_button_text |
203 | 203 | */ |
204 | - public function set_submit_button_text( $submit_button_text = '' ) { |
|
205 | - if ( ! empty( $submit_button_text )) { |
|
204 | + public function set_submit_button_text($submit_button_text = '') { |
|
205 | + if ( ! empty($submit_button_text)) { |
|
206 | 206 | $this->_submit_button_text = $submit_button_text; |
207 | - } else if ( $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
208 | - if ( $this->checkout->revisit ) { |
|
209 | - $this->_submit_button_text = sprintf( __( 'Update %s', 'event_espresso' ), $this->checkout->current_step->name() ); |
|
207 | + } else if ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
208 | + if ($this->checkout->revisit) { |
|
209 | + $this->_submit_button_text = sprintf(__('Update %s', 'event_espresso'), $this->checkout->current_step->name()); |
|
210 | 210 | } else { |
211 | - $this->_submit_button_text = sprintf( __( 'Proceed to %s', 'event_espresso' ), $this->checkout->next_step->name() ); |
|
211 | + $this->_submit_button_text = sprintf(__('Proceed to %s', 'event_espresso'), $this->checkout->next_step->name()); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | // filters the submit button text |
215 | - $this->_submit_button_text = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout ); |
|
215 | + $this->_submit_button_text = apply_filters('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param boolean $is_current_step |
222 | 222 | */ |
223 | - public function set_is_current_step( $is_current_step ) { |
|
223 | + public function set_is_current_step($is_current_step) { |
|
224 | 224 | $this->_is_current_step = $is_current_step; |
225 | 225 | } |
226 | 226 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * @param int $order |
249 | 249 | */ |
250 | - public function set_order( $order ) { |
|
250 | + public function set_order($order) { |
|
251 | 251 | $this->_order = $order; |
252 | 252 | } |
253 | 253 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * _set_success_message |
286 | 286 | * @param string $success_message |
287 | 287 | */ |
288 | - protected function _set_success_message( $success_message ) { |
|
288 | + protected function _set_success_message($success_message) { |
|
289 | 289 | $this->_success_message = $success_message; |
290 | 290 | } |
291 | 291 | |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | /** |
314 | 314 | * @param string $instructions |
315 | 315 | */ |
316 | - public function set_instructions( $instructions ) { |
|
317 | - $this->_instructions = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this ); |
|
316 | + public function set_instructions($instructions) { |
|
317 | + $this->_instructions = apply_filters('FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * @param array $valid_data |
324 | 324 | */ |
325 | - public function set_valid_data( $valid_data ) { |
|
325 | + public function set_valid_data($valid_data) { |
|
326 | 326 | $this->_valid_data = $valid_data; |
327 | 327 | } |
328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @return array |
333 | 333 | */ |
334 | 334 | public function valid_data() { |
335 | - if ( empty( $this->_valid_data )) { |
|
335 | + if (empty($this->_valid_data)) { |
|
336 | 336 | $this->_valid_data = $this->reg_form->valid_data(); |
337 | 337 | } |
338 | 338 | return $this->_valid_data; |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @return string |
344 | 344 | */ |
345 | 345 | public function reg_form_name() { |
346 | - if ( empty( $this->_reg_form_name )) { |
|
347 | - $this->set_reg_form_name( 'ee-spco-' . $this->slug() . '-reg-step-form' ); |
|
346 | + if (empty($this->_reg_form_name)) { |
|
347 | + $this->set_reg_form_name('ee-spco-'.$this->slug().'-reg-step-form'); |
|
348 | 348 | } |
349 | 349 | return $this->_reg_form_name; |
350 | 350 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | /** |
355 | 355 | * @param string $reg_form_name |
356 | 356 | */ |
357 | - protected function set_reg_form_name( $reg_form_name ) { |
|
357 | + protected function set_reg_form_name($reg_form_name) { |
|
358 | 358 | $this->_reg_form_name = $reg_form_name; |
359 | 359 | } |
360 | 360 | |
@@ -365,22 +365,22 @@ discard block |
||
365 | 365 | * @param string $action |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public function reg_step_url( $action = '' ) { |
|
369 | - $query_args = array( 'step' => $this->slug() ); |
|
370 | - if( ! empty( $action )) { |
|
368 | + public function reg_step_url($action = '') { |
|
369 | + $query_args = array('step' => $this->slug()); |
|
370 | + if ( ! empty($action)) { |
|
371 | 371 | $query_args['action'] = $action; |
372 | 372 | } |
373 | 373 | // final step has no display |
374 | - if ( $this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step' ) { |
|
375 | - $query_args[ 'action' ] = 'process_reg_step'; |
|
374 | + if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action === 'display_spco_reg_step') { |
|
375 | + $query_args['action'] = 'process_reg_step'; |
|
376 | 376 | } |
377 | - if( $this->checkout->revisit ) { |
|
377 | + if ($this->checkout->revisit) { |
|
378 | 378 | $query_args['revisit'] = TRUE; |
379 | 379 | } |
380 | - if( $this->checkout->reg_url_link ) { |
|
380 | + if ($this->checkout->reg_url_link) { |
|
381 | 381 | $query_args['e_reg_url_link'] = $this->checkout->reg_url_link; |
382 | 382 | } |
383 | - return add_query_arg( $query_args, $this->checkout->reg_page_base_url ); |
|
383 | + return add_query_arg($query_args, $this->checkout->reg_page_base_url); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | */ |
394 | 394 | public function reg_step_hidden_inputs() { |
395 | 395 | // hidden inputs for admin registrations |
396 | - if ( $this->checkout->admin_request ) { |
|
396 | + if ($this->checkout->admin_request) { |
|
397 | 397 | return new EE_Form_Section_Proper( |
398 | 398 | array( |
399 | 399 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
400 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
400 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
401 | 401 | 'subsections' => array( |
402 | 402 | 'next_step' => new EE_Fixed_Hidden_Input( |
403 | 403 | array( |
404 | 404 | 'html_name' => 'next_step', |
405 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
405 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
406 | 406 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
407 | 407 | ) |
408 | 408 | ) |
@@ -414,19 +414,19 @@ discard block |
||
414 | 414 | return new EE_Form_Section_Proper( |
415 | 415 | array( |
416 | 416 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
417 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
417 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
418 | 418 | 'subsections' => array( |
419 | 419 | 'action' => new EE_Fixed_Hidden_Input( |
420 | 420 | array( |
421 | 421 | 'html_name' => 'action', |
422 | - 'html_id' => 'spco-' . $this->slug() . '-action', |
|
423 | - 'default' => empty( $this->checkout->reg_url_link ) ? 'process_reg_step' : 'update_reg_step' |
|
422 | + 'html_id' => 'spco-'.$this->slug().'-action', |
|
423 | + 'default' => empty($this->checkout->reg_url_link) ? 'process_reg_step' : 'update_reg_step' |
|
424 | 424 | ) |
425 | 425 | ), |
426 | 426 | 'next_step' => new EE_Fixed_Hidden_Input( |
427 | 427 | array( |
428 | 428 | 'html_name' => 'next_step', |
429 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
429 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
430 | 430 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
431 | 431 | ) |
432 | 432 | ), |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | * @param array $actions |
459 | 459 | * @return void |
460 | 460 | */ |
461 | - public function generate_reg_form_for_actions( $actions = array() ) { |
|
462 | - $actions = array_merge( array( 'generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step' ), $actions ); |
|
463 | - $this->checkout->generate_reg_form = in_array( $this->checkout->action, $actions ) ? TRUE : FALSE; |
|
461 | + public function generate_reg_form_for_actions($actions = array()) { |
|
462 | + $actions = array_merge(array('generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step'), $actions); |
|
463 | + $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions) ? TRUE : FALSE; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | */ |
472 | 472 | public function display_reg_form() { |
473 | 473 | $html = ''; |
474 | - if ( $this->reg_form instanceof EE_Form_Section_Proper ) { |
|
475 | - $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open( $this->reg_step_url() ) : ''; |
|
476 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
474 | + if ($this->reg_form instanceof EE_Form_Section_Proper) { |
|
475 | + $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : ''; |
|
476 | + if (EE_Registry::instance()->REQ->ajax) { |
|
477 | 477 | $this->reg_form->localize_validation_rules(); |
478 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
478 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
479 | 479 | } |
480 | 480 | $html .= $this->reg_form->get_html(); |
481 | 481 | $html .= ! $this->checkout->admin_request ? $this->reg_step_submit_button() : ''; |
@@ -493,25 +493,25 @@ discard block |
||
493 | 493 | * @throws \EE_Error |
494 | 494 | */ |
495 | 495 | public function reg_step_submit_button() { |
496 | - if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
496 | + if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
497 | 497 | return ''; |
498 | 498 | } |
499 | 499 | ob_start(); |
500 | - do_action( 'AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout ); |
|
500 | + do_action('AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout); |
|
501 | 501 | $html = ob_get_clean(); |
502 | 502 | // generate submit button |
503 | - $sbmt_btn = new EE_Submit_Input( array( |
|
504 | - 'html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
505 | - 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
503 | + $sbmt_btn = new EE_Submit_Input(array( |
|
504 | + 'html_name' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
505 | + 'html_id' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
506 | 506 | 'html_class' => 'spco-next-step-btn', |
507 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
507 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
508 | 508 | 'default' => $this->submit_button_text() |
509 | 509 | )); |
510 | - $sbmt_btn->set_button_css_attributes( TRUE, 'large' ); |
|
510 | + $sbmt_btn->set_button_css_attributes(TRUE, 'large'); |
|
511 | 511 | $sbmt_btn_html = $sbmt_btn->get_html_for_input(); |
512 | 512 | $html .= EEH_HTML::div( |
513 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this ), |
|
514 | - 'spco-' . $this->slug() . '-whats-next-buttons-dv', |
|
513 | + apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this), |
|
514 | + 'spco-'.$this->slug().'-whats-next-buttons-dv', |
|
515 | 515 | 'spco-whats-next-buttons' |
516 | 516 | ); |
517 | 517 | return $html; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @return string |
535 | 535 | */ |
536 | 536 | public function edit_lnk_url() { |
537 | - return add_query_arg( array( 'step' => $this->slug() ), $this->checkout->reg_page_base_url ); |
|
537 | + return add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url); |
|
538 | 538 | |
539 | 539 | } |
540 | 540 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | */ |
559 | 559 | public function update_checkout() { |
560 | 560 | // grab the cart grand total and reset TXN total |
561 | - $this->checkout->transaction->set_total( $this->checkout->cart->get_cart_grand_total() ); |
|
561 | + $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total()); |
|
562 | 562 | $this->checkout->stash_transaction_and_checkout(); |
563 | 563 | } |
564 | 564 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | */ |
574 | 574 | public function __sleep() { |
575 | 575 | // remove the reg form and the checkout |
576 | - return array_diff( array_keys( get_object_vars( $this )), array( 'reg_form', 'checkout' )); |
|
576 | + return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout')); |
|
577 | 577 | } |
578 | 578 | } |
579 | 579 |
@@ -1,29 +1,29 @@ |
||
1 | 1 | <div class="padding"> |
2 | 2 | <h3><?php esc_html_e('Need help with Event Espresso?', 'event_espresso'); ?></h3> |
3 | 3 | |
4 | - <h4><?php esc_html_e( 'You may be able to find an answer for your question or concern here:', 'event_espresso' ); ?></h4> |
|
4 | + <h4><?php esc_html_e('You may be able to find an answer for your question or concern here:', 'event_espresso'); ?></h4> |
|
5 | 5 | <ol> |
6 | - <li><strong><em><?php esc_html_e( 'A known issue.', 'event_espresso' ); ?></em></strong> <?php printf( esc_html__( 'Some themes and plugins have %1$sknown conflicts%2$s with Event Espresso. (You can also browse the %3$sEvent Espresso support pages%2$s or %4$sEvent Espresso support forums%2$s to see if other members have experienced and solved the problem.)', 'event_espresso' ), '<a href="https://eventespresso.com/wiki/known-third-party-plugin-theme-conflicts/" target="_blank">','</a>', '<a href="https://eventespresso.com/support/documentation/versioned-docs/?doc_ver=ee4" target="_blank">', '<a href="https://eventespresso.com/support/forums/" target="_blank">' ); ?></li> |
|
7 | - <li><strong><em><?php esc_html_e( 'A plugin conflict.', 'event_espresso' ); ?></em></strong> <?php esc_html_e( 'You can check to see if there is a plugin conflict by temporarily deactivating all plugins except for Event Espresso. If the problem goes away, then reactivate your plugins one by one until the issue returns. This will help you pinpoint the source of the conflict.', 'event_espresso' ); ?></li> |
|
6 | + <li><strong><em><?php esc_html_e('A known issue.', 'event_espresso'); ?></em></strong> <?php printf(esc_html__('Some themes and plugins have %1$sknown conflicts%2$s with Event Espresso. (You can also browse the %3$sEvent Espresso support pages%2$s or %4$sEvent Espresso support forums%2$s to see if other members have experienced and solved the problem.)', 'event_espresso'), '<a href="https://eventespresso.com/wiki/known-third-party-plugin-theme-conflicts/" target="_blank">', '</a>', '<a href="https://eventespresso.com/support/documentation/versioned-docs/?doc_ver=ee4" target="_blank">', '<a href="https://eventespresso.com/support/forums/" target="_blank">'); ?></li> |
|
7 | + <li><strong><em><?php esc_html_e('A plugin conflict.', 'event_espresso'); ?></em></strong> <?php esc_html_e('You can check to see if there is a plugin conflict by temporarily deactivating all plugins except for Event Espresso. If the problem goes away, then reactivate your plugins one by one until the issue returns. This will help you pinpoint the source of the conflict.', 'event_espresso'); ?></li> |
|
8 | 8 | <li> |
9 | - <strong><em><?php esc_html_e( 'A theme conflict.', 'event_espresso' ); ?></em></strong> |
|
9 | + <strong><em><?php esc_html_e('A theme conflict.', 'event_espresso'); ?></em></strong> |
|
10 | 10 | <?php |
11 | - $default_theme = wp_get_theme( WP_DEFAULT_THEME ); |
|
11 | + $default_theme = wp_get_theme(WP_DEFAULT_THEME); |
|
12 | 12 | |
13 | - if ( $default_theme->exists() ) { |
|
14 | - printf( esc_html__( 'If your problem is not a known issue or caused by a plugin, then try activating %s (the default WordPress theme).', 'event_espresso' ), $default_theme->get( 'Name' ) ); |
|
13 | + if ($default_theme->exists()) { |
|
14 | + printf(esc_html__('If your problem is not a known issue or caused by a plugin, then try activating %s (the default WordPress theme).', 'event_espresso'), $default_theme->get('Name')); |
|
15 | 15 | } else { |
16 | - esc_html_e( 'If your problem is not a known issue or caused by a plugin, then try activating the default WordPress theme.', 'event_espresso' ); |
|
16 | + esc_html_e('If your problem is not a known issue or caused by a plugin, then try activating the default WordPress theme.', 'event_espresso'); |
|
17 | 17 | } |
18 | 18 | ?> |
19 | - <?php esc_html_e( 'If this solves the problem for you, then something in your theme is causing this issue. Check to see if an update is available for your WordPress theme or reach out to the theme author.', 'event_espresso' ); ?> |
|
19 | + <?php esc_html_e('If this solves the problem for you, then something in your theme is causing this issue. Check to see if an update is available for your WordPress theme or reach out to the theme author.', 'event_espresso'); ?> |
|
20 | 20 | </li> |
21 | 21 | </ol> |
22 | 22 | |
23 | - <p><?php esc_html_e( 'If none of the suggestions above help you find a solution, then feel free to reach out to the support team at Event Espresso.', 'event_espresso' ); ?></p> |
|
24 | - <p><?php printf( esc_html__( 'Login to your account on EventEspresso.com and %1$screate a support post in our member support forums%2$s. Use a %3$sclear and descriptive title%4$s in your support post, %3$sdescribe the issue to the best of your knowledge%4$s, and %3$snever post any sensitive information such as login details%4$s. Be sure to also include %5$simportant information in the section below%2$s about your WordPress site.', 'event_espresso' ), '<a href="https://eventespresso.com/support/forums/" target="_blank">','</a>','<strong>','</strong>','<a href="#espresso_important_information_settings">' ); ?></p> |
|
23 | + <p><?php esc_html_e('If none of the suggestions above help you find a solution, then feel free to reach out to the support team at Event Espresso.', 'event_espresso'); ?></p> |
|
24 | + <p><?php printf(esc_html__('Login to your account on EventEspresso.com and %1$screate a support post in our member support forums%2$s. Use a %3$sclear and descriptive title%4$s in your support post, %3$sdescribe the issue to the best of your knowledge%4$s, and %3$snever post any sensitive information such as login details%4$s. Be sure to also include %5$simportant information in the section below%2$s about your WordPress site.', 'event_espresso'), '<a href="https://eventespresso.com/support/forums/" target="_blank">', '</a>', '<strong>', '</strong>', '<a href="#espresso_important_information_settings">'); ?></p> |
|
25 | 25 | |
26 | - <h4><?php esc_html_e( 'Have an emergency?', 'event_espresso' ); ?></h4> |
|
26 | + <h4><?php esc_html_e('Have an emergency?', 'event_espresso'); ?></h4> |
|
27 | 27 | |
28 | - <p><?php printf( esc_html__( 'We offer support tokens to members that need help with a time-sensitive issue. A support token will provide you with up to 30 minutes of one-on-one time with a team member at Event Espresso. If you have an emergency and need help quickly, then please %1$spurchase a support token%2$s.', 'event_espresso' ), '<a href="https://eventespresso.com/product/premium-support-token/?utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=help_support_tab&utm_content=support_token" target="_blank">','</a>' ); ?></p> |
|
28 | + <p><?php printf(esc_html__('We offer support tokens to members that need help with a time-sensitive issue. A support token will provide you with up to 30 minutes of one-on-one time with a team member at Event Espresso. If you have an emergency and need help quickly, then please %1$spurchase a support token%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/product/premium-support-token/?utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=help_support_tab&utm_content=support_token" target="_blank">', '</a>'); ?></p> |
|
29 | 29 | </div> |
30 | 30 | \ No newline at end of file |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <div class="padding"> |
2 | - <?php esc_html_e( 'If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', 'event_espresso' ); ?> |
|
3 | - <h2><?php esc_html_e( 'Developer Resources', 'event_espresso' ); ?></h2> |
|
2 | + <?php esc_html_e('If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', 'event_espresso'); ?> |
|
3 | + <h2><?php esc_html_e('Developer Resources', 'event_espresso'); ?></h2> |
|
4 | 4 | <ul> |
5 | - <li><?php printf( esc_html__( '%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank">','</a>' ); ?></li> |
|
6 | - <li><?php printf( esc_html__( '%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso' ), '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
7 | - <li><?php printf( esc_html__( '%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>','<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">' ); ?></li> |
|
5 | + <li><?php printf(esc_html__('%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank">', '</a>'); ?></li> |
|
6 | + <li><?php printf(esc_html__('%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso'), '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
7 | + <li><?php printf(esc_html__('%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso'), '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>', '<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">'); ?></li> |
|
8 | 8 | </ul> |
9 | 9 | |
10 | - <h2><?php esc_html_e( 'Event Espresso 4 Articles for Developers', 'event_espresso' ); ?></h2> |
|
10 | + <h2><?php esc_html_e('Event Espresso 4 Articles for Developers', 'event_espresso'); ?></h2> |
|
11 | 11 | <ul> |
12 | - <li><?php printf( esc_html__( '%1$sCustom Post Types Usage%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
13 | - <li><?php printf( esc_html__( '%1$sTheme Development%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
14 | - <li><?php printf( esc_html__( '%1$sCapability System%2$s', 'event_espresso' ), '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
15 | - <li><?php printf( esc_html__( '%1$sPayment Method Development%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank">','</a>' ); ?></li> |
|
16 | - <li><?php printf( esc_html__( '%1$sMessages System in Event Espresso 4%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
17 | - <li><?php printf( esc_html__( '%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', 'event_espresso' ), '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
12 | + <li><?php printf(esc_html__('%1$sCustom Post Types Usage%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
13 | + <li><?php printf(esc_html__('%1$sTheme Development%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
14 | + <li><?php printf(esc_html__('%1$sCapability System%2$s', 'event_espresso'), '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
15 | + <li><?php printf(esc_html__('%1$sPayment Method Development%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank">', '</a>'); ?></li> |
|
16 | + <li><?php printf(esc_html__('%1$sMessages System in Event Espresso 4%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
17 | + <li><?php printf(esc_html__('%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', 'event_espresso'), '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
18 | 18 | </ul> |
19 | 19 | |
20 | - <h2><?php esc_html_e( 'REST API Resources', 'event_espresso' ); ?></h2> |
|
20 | + <h2><?php esc_html_e('REST API Resources', 'event_espresso'); ?></h2> |
|
21 | 21 | <ul> |
22 | - <li><?php printf( esc_html__( '%1$sREST API: Introduction%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank">','</a>' ); ?></li> |
|
23 | - <li><?php printf( esc_html__( '%1$sREST API: Reading Data%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank">','</a>' ); ?></li> |
|
24 | - <li><?php printf( esc_html__( '%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank">','</a>' ); ?></li> |
|
22 | + <li><?php printf(esc_html__('%1$sREST API: Introduction%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank">', '</a>'); ?></li> |
|
23 | + <li><?php printf(esc_html__('%1$sREST API: Reading Data%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank">', '</a>'); ?></li> |
|
24 | + <li><?php printf(esc_html__('%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank">', '</a>'); ?></li> |
|
25 | 25 | </ul> |
26 | 26 | </div> |
27 | 27 | \ No newline at end of file |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->_columns = array_merge( $columns, $this->_columns ); |
88 | 88 | $this->_primary_column = '_REG_att_checked_in'; |
89 | 89 | if ( ! empty( $evt_id ) |
90 | - && EE_Registry::instance()->CAP->current_user_can( |
|
90 | + && EE_Registry::instance()->CAP->current_user_can( |
|
91 | 91 | 'ee_read_registrations', |
92 | 92 | 'espresso_registrations_registrations_reports', |
93 | 93 | $evt_id |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | if ( count( $this->_dtts_for_event ) > 1 ) { |
190 | 190 | $dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' ); |
191 | 191 | foreach ( $this->_dtts_for_event as $dtt ) { |
192 | - $datetime_string = $dtt->name(); |
|
193 | - $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : ''; |
|
192 | + $datetime_string = $dtt->name(); |
|
193 | + $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : ''; |
|
194 | 194 | $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string; |
195 | 195 | $dtts[ $dtt->ID() ] = $datetime_string; |
196 | 196 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id ); |
285 | 285 | $nonce = wp_create_nonce( 'checkin_nonce' ); |
286 | 286 | $toggle_active = ! empty ( $this->_cur_dtt_id ) |
287 | - && EE_Registry::instance()->CAP->current_user_can( |
|
287 | + && EE_Registry::instance()->CAP->current_user_can( |
|
288 | 288 | 'ee_edit_checkin', |
289 | 289 | 'espresso_registrations_toggle_checkin_status', |
290 | 290 | $item->ID() |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | : ''; |
294 | 294 | $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
295 | 295 | return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"' |
296 | - . ' data-_regid="' . $item->ID() . '"' |
|
297 | - . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
298 | - . ' data-nonce="' . $nonce . '">' |
|
299 | - . '</span>' |
|
300 | - . $mobile_view_content; |
|
296 | + . ' data-_regid="' . $item->ID() . '"' |
|
297 | + . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
298 | + . ' data-nonce="' . $nonce . '">' |
|
299 | + . '</span>' |
|
300 | + . $mobile_view_content; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | 'espresso_registrations_edit_attendee' |
323 | 323 | ) |
324 | 324 | ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' |
325 | - . $item->attendee()->full_name() |
|
326 | - . '</a>' |
|
325 | + . $item->attendee()->full_name() |
|
326 | + . '</a>' |
|
327 | 327 | : $item->attendee()->full_name(); |
328 | 328 | $name_link .= $item->count() === 1 |
329 | 329 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | ? $latest_related_datetime->ID() |
359 | 359 | : $DTT_ID; |
360 | 360 | if ( ! empty( $DTT_ID ) |
361 | - && EE_Registry::instance()->CAP->current_user_can( |
|
361 | + && EE_Registry::instance()->CAP->current_user_can( |
|
362 | 362 | 'ee_read_checkins', |
363 | 363 | 'espresso_registrations_registration_checkins' |
364 | 364 | ) |
@@ -458,15 +458,15 @@ discard block |
||
458 | 458 | ) ? ' |
459 | 459 | <span class="reg-pad-rght"> |
460 | 460 | <a class="status-' |
461 | - . $item->transaction()->status_ID() |
|
462 | - . '" href="' |
|
463 | - . $view_txn_lnk_url |
|
464 | - . '" title="' |
|
465 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
466 | - . '"> |
|
461 | + . $item->transaction()->status_ID() |
|
462 | + . '" href="' |
|
463 | + . $view_txn_lnk_url |
|
464 | + . '" title="' |
|
465 | + . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
466 | + . '"> |
|
467 | 467 | ' |
468 | - . $item->transaction()->pretty_paid() |
|
469 | - . ' |
|
468 | + . $item->transaction()->pretty_paid() |
|
469 | + . ' |
|
470 | 470 | </a> |
471 | 471 | <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
472 | 472 | } |
@@ -499,12 +499,12 @@ discard block |
||
499 | 499 | 'ee_read_transaction', |
500 | 500 | 'espresso_transactions_view_transaction' |
501 | 501 | ) ? '<a href="' |
502 | - . $view_txn_url |
|
503 | - . '" title="' |
|
504 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
505 | - . '"><span class="reg-pad-rght">' |
|
506 | - . $txn_total |
|
507 | - . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
502 | + . $view_txn_url |
|
503 | + . '" title="' |
|
504 | + . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
505 | + . '"><span class="reg-pad-rght">' |
|
506 | + . $txn_total |
|
507 | + . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
508 | 508 | } else { |
509 | 509 | return '<span class="reg-pad-rght"></span>'; |
510 | 510 | } |
@@ -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 | |
@@ -42,51 +42,51 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param \Registrations_Admin_Page $admin_page |
44 | 44 | */ |
45 | - public function __construct( $admin_page ) { |
|
46 | - parent::__construct( $admin_page ); |
|
45 | + public function __construct($admin_page) { |
|
46 | + parent::__construct($admin_page); |
|
47 | 47 | $this->_status = $this->_admin_page->get_registration_status_array(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | 52 | protected function _setup_data() { |
53 | - $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) |
|
54 | - : $this->_admin_page->get_event_attendees( $this->_per_page, false, true ); |
|
53 | + $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) |
|
54 | + : $this->_admin_page->get_event_attendees($this->_per_page, false, true); |
|
55 | 55 | $this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( |
56 | 56 | $this->_per_page, |
57 | 57 | true |
58 | - ) : $this->_admin_page->get_event_attendees( $this->_per_page, true, true ); |
|
58 | + ) : $this->_admin_page->get_event_attendees($this->_per_page, true, true); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | |
63 | 63 | protected function _set_properties() { |
64 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
64 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
65 | 65 | $this->_wp_list_args = array( |
66 | - 'singular' => __( 'registrant', 'event_espresso' ), |
|
67 | - 'plural' => __( 'registrants', 'event_espresso' ), |
|
66 | + 'singular' => __('registrant', 'event_espresso'), |
|
67 | + 'plural' => __('registrants', 'event_espresso'), |
|
68 | 68 | 'ajax' => true, |
69 | 69 | 'screen' => $this->_admin_page->get_current_screen()->id, |
70 | 70 | ); |
71 | 71 | $columns = array(); |
72 | 72 | //$columns['_Reg_Status'] = ''; |
73 | - if ( ! empty( $evt_id ) ) { |
|
73 | + if ( ! empty($evt_id)) { |
|
74 | 74 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
75 | 75 | $this->_has_checkbox_column = true; |
76 | 76 | } |
77 | 77 | $this->_columns = array( |
78 | 78 | '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>', |
79 | - 'ATT_name' => __( 'Registrant', 'event_espresso' ), |
|
80 | - 'ATT_email' => __( 'Email Address', 'event_espresso' ), |
|
81 | - 'Event' => __( 'Event', 'event_espresso' ), |
|
82 | - 'PRC_name' => __( 'TKT Option', 'event_espresso' ), |
|
83 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
84 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
85 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
79 | + 'ATT_name' => __('Registrant', 'event_espresso'), |
|
80 | + 'ATT_email' => __('Email Address', 'event_espresso'), |
|
81 | + 'Event' => __('Event', 'event_espresso'), |
|
82 | + 'PRC_name' => __('TKT Option', 'event_espresso'), |
|
83 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
84 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
85 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
86 | 86 | ); |
87 | - $this->_columns = array_merge( $columns, $this->_columns ); |
|
87 | + $this->_columns = array_merge($columns, $this->_columns); |
|
88 | 88 | $this->_primary_column = '_REG_att_checked_in'; |
89 | - if ( ! empty( $evt_id ) |
|
89 | + if ( ! empty($evt_id) |
|
90 | 90 | && EE_Registry::instance()->CAP->current_user_can( |
91 | 91 | 'ee_read_registrations', |
92 | 92 | 'espresso_registrations_registrations_reports', |
@@ -99,18 +99,18 @@ discard block |
||
99 | 99 | 'extra_request' => |
100 | 100 | array( |
101 | 101 | 'EVT_ID' => $evt_id, |
102 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ), |
|
102 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
103 | 103 | ), |
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | } |
107 | 107 | $this->_sortable_columns = array( |
108 | 108 | //true means its already sorted |
109 | - 'ATT_name' => array( 'ATT_name' => true ), |
|
110 | - 'Event' => array( 'Event.EVT.Name' => false ), |
|
109 | + 'ATT_name' => array('ATT_name' => true), |
|
110 | + 'Event' => array('Event.EVT.Name' => false), |
|
111 | 111 | ); |
112 | 112 | $this->_hidden_columns = array(); |
113 | - $this->_evt = EEM_Event::instance()->get_one_by_ID( $evt_id ); |
|
113 | + $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
|
114 | 114 | $this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array(); |
115 | 115 | } |
116 | 116 | |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | * @param \EE_Registration $item |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - protected function _get_row_class( $item ) { |
|
124 | - $class = parent::_get_row_class( $item ); |
|
123 | + protected function _get_row_class($item) { |
|
124 | + $class = parent::_get_row_class($item); |
|
125 | 125 | //add status class |
126 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
127 | - if ( $this->_has_checkbox_column ) { |
|
126 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
127 | + if ($this->_has_checkbox_column) { |
|
128 | 128 | $class .= ' has-checkbox-column'; |
129 | 129 | } |
130 | 130 | return $class; |
@@ -138,61 +138,61 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function _get_table_filters() { |
140 | 140 | $filters = $where = array(); |
141 | - $current_EVT_ID = isset( $this->_req_data['event_id'] ) ? (int) $this->_req_data['event_id'] : 0; |
|
142 | - if ( empty( $this->_dtts_for_event ) || count( $this->_dtts_for_event ) === 1 ) { |
|
141 | + $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0; |
|
142 | + if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) { |
|
143 | 143 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
144 | 144 | //note possible capability restrictions |
145 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
146 | - $where['status**'] = array( '!=', 'private' ); |
|
145 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
146 | + $where['status**'] = array('!=', 'private'); |
|
147 | 147 | } |
148 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
148 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
149 | 149 | $where['EVT_wp_user'] = get_current_user_id(); |
150 | 150 | } |
151 | 151 | $events = EEM_Event::instance()->get_all( |
152 | 152 | array( |
153 | 153 | $where, |
154 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ), |
|
154 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'), |
|
155 | 155 | ) |
156 | 156 | ); |
157 | 157 | $evts[] = array( |
158 | 158 | 'id' => 0, |
159 | - 'text' => __( 'To toggle Check-in status, select an event', 'event_espresso' ), |
|
159 | + 'text' => __('To toggle Check-in status, select an event', 'event_espresso'), |
|
160 | 160 | ); |
161 | 161 | $checked = 'checked'; |
162 | 162 | /** @var EE_Event $evt */ |
163 | - foreach ( $events as $evt ) { |
|
163 | + foreach ($events as $evt) { |
|
164 | 164 | //any registrations for this event? |
165 | - if ( ! $evt->get_count_of_all_registrations() ) { |
|
165 | + if ( ! $evt->get_count_of_all_registrations()) { |
|
166 | 166 | continue; |
167 | 167 | } |
168 | 168 | $evts[] = array( |
169 | 169 | 'id' => $evt->ID(), |
170 | - 'text' => $evt->get( 'EVT_name' ), |
|
170 | + 'text' => $evt->get('EVT_name'), |
|
171 | 171 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '', |
172 | 172 | ); |
173 | - if ( $evt->ID() === $current_EVT_ID && $evt->is_expired() ) { |
|
173 | + if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) { |
|
174 | 174 | $checked = ''; |
175 | 175 | } |
176 | 176 | } |
177 | 177 | $event_filter = '<div class="ee-event-filter">'; |
178 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts, $current_EVT_ID ); |
|
178 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID); |
|
179 | 179 | $event_filter .= '<span class="ee-event-filter-toggle">'; |
180 | - $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> '; |
|
181 | - $event_filter .= __( 'Hide Expired Events', 'event_espresso' ); |
|
180 | + $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> '; |
|
181 | + $event_filter .= __('Hide Expired Events', 'event_espresso'); |
|
182 | 182 | $event_filter .= '</span>'; |
183 | 183 | $event_filter .= '</div>'; |
184 | 184 | $filters[] = $event_filter; |
185 | 185 | } |
186 | - if ( ! empty( $this->_dtts_for_event ) ) { |
|
186 | + if ( ! empty($this->_dtts_for_event)) { |
|
187 | 187 | //DTT datetimes filter |
188 | - $this->_cur_dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
189 | - if ( count( $this->_dtts_for_event ) > 1 ) { |
|
190 | - $dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' ); |
|
191 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
188 | + $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
189 | + if (count($this->_dtts_for_event) > 1) { |
|
190 | + $dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso'); |
|
191 | + foreach ($this->_dtts_for_event as $dtt) { |
|
192 | 192 | $datetime_string = $dtt->name(); |
193 | - $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : ''; |
|
194 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string; |
|
195 | - $dtts[ $dtt->ID() ] = $datetime_string; |
|
193 | + $datetime_string = ! empty($datetime_string) ? ' ('.$datetime_string.')' : ''; |
|
194 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$datetime_string; |
|
195 | + $dtts[$dtt->ID()] = $datetime_string; |
|
196 | 196 | } |
197 | 197 | $input = new EE_Select_Input( |
198 | 198 | $dtts, |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | ) |
204 | 204 | ); |
205 | 205 | $filters[] = $input->get_html_for_input(); |
206 | - $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">'; |
|
206 | + $filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">'; |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | return $filters; |
@@ -222,22 +222,22 @@ discard block |
||
222 | 222 | * @throws \EE_Error |
223 | 223 | */ |
224 | 224 | protected function _get_total_event_attendees() { |
225 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : false; |
|
225 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
226 | 226 | $DTT_ID = $this->_cur_dtt_id; |
227 | 227 | $query_params = array(); |
228 | - if ( $EVT_ID ) { |
|
228 | + if ($EVT_ID) { |
|
229 | 229 | $query_params[0]['EVT_ID'] = $EVT_ID; |
230 | 230 | } |
231 | 231 | //if DTT is included we only show for that datetime. Otherwise we're showing for all datetimes (the event). |
232 | - if ( $DTT_ID ) { |
|
232 | + if ($DTT_ID) { |
|
233 | 233 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
234 | 234 | } |
235 | 235 | $status_ids_array = apply_filters( |
236 | 236 | 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
237 | - array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) |
|
237 | + array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved) |
|
238 | 238 | ); |
239 | - $query_params[0]['STS_ID'] = array( 'IN', $status_ids_array ); |
|
240 | - return EEM_Registration::instance()->count( $query_params ); |
|
239 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
240 | + return EEM_Registration::instance()->count($query_params); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | * @param \EE_Registration $item |
247 | 247 | * @return string |
248 | 248 | */ |
249 | - public function column__Reg_Status( EE_Registration $item ) { |
|
250 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
249 | + public function column__Reg_Status(EE_Registration $item) { |
|
250 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | * @return string |
258 | 258 | * @throws \EE_Error |
259 | 259 | */ |
260 | - public function column_cb( $item ) { |
|
261 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
260 | + public function column_cb($item) { |
|
261 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -270,20 +270,20 @@ discard block |
||
270 | 270 | * @return string |
271 | 271 | * @throws \EE_Error |
272 | 272 | */ |
273 | - public function column__REG_att_checked_in( EE_Registration $item ) { |
|
273 | + public function column__REG_att_checked_in(EE_Registration $item) { |
|
274 | 274 | $attendee = $item->attendee(); |
275 | 275 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
276 | 276 | |
277 | - if ( $this->_cur_dtt_id === 0 && count( $this->_dtts_for_event ) === 1 ) { |
|
277 | + if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) { |
|
278 | 278 | $latest_related_datetime = $item->get_latest_related_datetime(); |
279 | - if ( $latest_related_datetime instanceof EE_Datetime ) { |
|
279 | + if ($latest_related_datetime instanceof EE_Datetime) { |
|
280 | 280 | $this->_cur_dtt_id = $latest_related_datetime->ID(); |
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
284 | - $checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id ); |
|
285 | - $nonce = wp_create_nonce( 'checkin_nonce' ); |
|
286 | - $toggle_active = ! empty ( $this->_cur_dtt_id ) |
|
284 | + $checkinstatus = $item->check_in_status_for_datetime($this->_cur_dtt_id); |
|
285 | + $nonce = wp_create_nonce('checkin_nonce'); |
|
286 | + $toggle_active = ! empty ($this->_cur_dtt_id) |
|
287 | 287 | && EE_Registry::instance()->CAP->current_user_can( |
288 | 288 | 'ee_edit_checkin', |
289 | 289 | 'espresso_registrations_toggle_checkin_status', |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | ) |
292 | 292 | ? ' clickable trigger-checkin' |
293 | 293 | : ''; |
294 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
295 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"' |
|
296 | - . ' data-_regid="' . $item->ID() . '"' |
|
297 | - . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
298 | - . ' data-nonce="' . $nonce . '">' |
|
294 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
295 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'"' |
|
296 | + . ' data-_regid="'.$item->ID().'"' |
|
297 | + . ' data-dttid="'.$this->_cur_dtt_id.'"' |
|
298 | + . ' data-nonce="'.$nonce.'">' |
|
299 | 299 | . '</span>' |
300 | 300 | . $mobile_view_content; |
301 | 301 | } |
@@ -307,21 +307,21 @@ discard block |
||
307 | 307 | * @return mixed|string|void |
308 | 308 | * @throws \EE_Error |
309 | 309 | */ |
310 | - public function column_ATT_name( EE_Registration $item ) { |
|
310 | + public function column_ATT_name(EE_Registration $item) { |
|
311 | 311 | $attendee = $item->attendee(); |
312 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
313 | - return __( 'No contact record for this registration.', 'event_espresso' ); |
|
312 | + if ( ! $attendee instanceof EE_Attendee) { |
|
313 | + return __('No contact record for this registration.', 'event_espresso'); |
|
314 | 314 | } |
315 | 315 | // edit attendee link |
316 | 316 | $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
317 | - array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), |
|
317 | + array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
318 | 318 | REG_ADMIN_URL |
319 | 319 | ); |
320 | 320 | $name_link = EE_Registry::instance()->CAP->current_user_can( |
321 | 321 | 'ee_edit_contacts', |
322 | 322 | 'espresso_registrations_edit_attendee' |
323 | 323 | ) |
324 | - ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' |
|
324 | + ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">' |
|
325 | 325 | . $item->attendee()->full_name() |
326 | 326 | . '</a>' |
327 | 327 | : $item->attendee()->full_name(); |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' |
330 | 330 | : ''; |
331 | 331 | //add group details |
332 | - $name_link .= ' ' . sprintf( __( '(%s of %s)', 'event_espresso' ), $item->count(), $item->group_size() ); |
|
332 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
333 | 333 | //add regcode |
334 | 334 | $link = EE_Admin_Page::add_query_args_and_nonce( |
335 | - array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), |
|
335 | + array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
336 | 336 | REG_ADMIN_URL |
337 | 337 | ); |
338 | 338 | $name_link .= '<br>'; |
@@ -341,37 +341,37 @@ discard block |
||
341 | 341 | 'view_registration', |
342 | 342 | $item->ID() |
343 | 343 | ) |
344 | - ? '<a href="' . $link . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' |
|
344 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">' |
|
345 | 345 | . $item->reg_code() |
346 | 346 | . '</a>' |
347 | 347 | : $item->reg_code(); |
348 | 348 | //status |
349 | 349 | $name_link .= '<br><span class="ee-status-text-small">'; |
350 | - $name_link .= EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ); |
|
350 | + $name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence'); |
|
351 | 351 | $name_link .= '</span>'; |
352 | 352 | $actions = array(); |
353 | 353 | $DTT_ID = $this->_cur_dtt_id; |
354 | - $latest_related_datetime = empty( $DTT_ID ) && ! empty( $this->_req_data['event_id'] ) && $item instanceof EE_Registration |
|
354 | + $latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration |
|
355 | 355 | ? $item->get_latest_related_datetime() |
356 | 356 | : null; |
357 | 357 | $DTT_ID = $latest_related_datetime instanceof EE_Datetime |
358 | 358 | ? $latest_related_datetime->ID() |
359 | 359 | : $DTT_ID; |
360 | - if ( ! empty( $DTT_ID ) |
|
360 | + if ( ! empty($DTT_ID) |
|
361 | 361 | && EE_Registry::instance()->CAP->current_user_can( |
362 | 362 | 'ee_read_checkins', |
363 | 363 | 'espresso_registrations_registration_checkins' |
364 | 364 | ) |
365 | 365 | ) { |
366 | 366 | $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( |
367 | - array( 'action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID ) |
|
367 | + array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID) |
|
368 | 368 | ); |
369 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__( |
|
369 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__( |
|
370 | 370 | 'View all the check-ins/checkouts for this registrant', |
371 | 371 | 'event_espresso' |
372 | - ) . '">' . __( 'View', 'event_espresso' ) . '</a>'; |
|
372 | + ).'">'.__('View', 'event_espresso').'</a>'; |
|
373 | 373 | } |
374 | - return ! empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions( $actions ) ) : $name_link; |
|
374 | + return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @param \EE_Registration $item |
381 | 381 | * @return string |
382 | 382 | */ |
383 | - public function column_ATT_email( EE_Registration $item ) { |
|
383 | + public function column_ATT_email(EE_Registration $item) { |
|
384 | 384 | $attendee = $item->attendee(); |
385 | 385 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
386 | 386 | } |
@@ -392,22 +392,22 @@ discard block |
||
392 | 392 | * @return bool|string |
393 | 393 | * @throws \EE_Error |
394 | 394 | */ |
395 | - public function column_Event( EE_Registration $item ) { |
|
395 | + public function column_Event(EE_Registration $item) { |
|
396 | 396 | try { |
397 | 397 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
398 | 398 | $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
399 | - array( 'action' => 'event_registrations', 'event_id' => $event->ID() ), |
|
399 | + array('action' => 'event_registrations', 'event_id' => $event->ID()), |
|
400 | 400 | REG_ADMIN_URL |
401 | 401 | ); |
402 | 402 | $event_label = EE_Registry::instance()->CAP->current_user_can( |
403 | 403 | 'ee_read_checkins', |
404 | 404 | 'espresso_registrations_registration_checkins' |
405 | - ) ? '<a href="' . $chkin_lnk_url . '" title="' . esc_attr__( |
|
405 | + ) ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__( |
|
406 | 406 | 'View Checkins for this Event', |
407 | 407 | 'event_espresso' |
408 | - ) . '">' . $event->name() . '</a>' : $event->name(); |
|
409 | - } catch ( \EventEspresso\core\exceptions\EntityNotFoundException $e ) { |
|
410 | - $event_label = esc_html__( 'Unknown', 'event_espresso' ); |
|
408 | + ).'">'.$event->name().'</a>' : $event->name(); |
|
409 | + } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
|
410 | + $event_label = esc_html__('Unknown', 'event_espresso'); |
|
411 | 411 | } |
412 | 412 | return $event_label; |
413 | 413 | } |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | * @param \EE_Registration $item |
419 | 419 | * @return mixed|string|void |
420 | 420 | */ |
421 | - public function column_PRC_name( EE_Registration $item ) { |
|
422 | - return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __( "Unknown", "event_espresso" ); |
|
421 | + public function column_PRC_name(EE_Registration $item) { |
|
422 | + return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | * @param \EE_Registration $item |
431 | 431 | * @return string |
432 | 432 | */ |
433 | - public function column__REG_final_price( EE_Registration $item ) { |
|
434 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
433 | + public function column__REG_final_price(EE_Registration $item) { |
|
434 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | * @return string |
444 | 444 | * @throws \EE_Error |
445 | 445 | */ |
446 | - public function column_TXN_paid( EE_Registration $item ) { |
|
447 | - if ( $item->count() === 1 ) { |
|
448 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
446 | + public function column_TXN_paid(EE_Registration $item) { |
|
447 | + if ($item->count() === 1) { |
|
448 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
449 | 449 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
450 | 450 | } else { |
451 | 451 | $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
452 | - array( 'action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID() ), |
|
452 | + array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()), |
|
453 | 453 | TXN_ADMIN_URL |
454 | 454 | ); |
455 | 455 | return EE_Registry::instance()->CAP->current_user_can( |
@@ -462,13 +462,13 @@ discard block |
||
462 | 462 | . '" href="' |
463 | 463 | . $view_txn_lnk_url |
464 | 464 | . '" title="' |
465 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
465 | + . esc_attr__('View Transaction', 'event_espresso') |
|
466 | 466 | . '"> |
467 | 467 | ' |
468 | 468 | . $item->transaction()->pretty_paid() |
469 | 469 | . ' |
470 | 470 | </a> |
471 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
471 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
472 | 472 | } |
473 | 473 | } else { |
474 | 474 | return '<span class="reg-pad-rght"></span>'; |
@@ -484,13 +484,13 @@ discard block |
||
484 | 484 | * @return string |
485 | 485 | * @throws \EE_Error |
486 | 486 | */ |
487 | - public function column_TXN_total( EE_Registration $item ) { |
|
487 | + public function column_TXN_total(EE_Registration $item) { |
|
488 | 488 | $txn = $item->transaction(); |
489 | - $view_txn_url = add_query_arg( array( 'action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
490 | - if ( $item->get( 'REG_count' ) === 1 ) { |
|
489 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
490 | + if ($item->get('REG_count') === 1) { |
|
491 | 491 | $line_total_obj = $txn->total_line_item(); |
492 | 492 | $txn_total = $line_total_obj instanceof EE_Line_Item |
493 | - ? $line_total_obj->get_pretty( 'LIN_total' ) |
|
493 | + ? $line_total_obj->get_pretty('LIN_total') |
|
494 | 494 | : __( |
495 | 495 | 'View Transaction', |
496 | 496 | 'event_espresso' |
@@ -501,10 +501,10 @@ discard block |
||
501 | 501 | ) ? '<a href="' |
502 | 502 | . $view_txn_url |
503 | 503 | . '" title="' |
504 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
504 | + . esc_attr__('View Transaction', 'event_espresso') |
|
505 | 505 | . '"><span class="reg-pad-rght">' |
506 | 506 | . $txn_total |
507 | - . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
507 | + . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
508 | 508 | } else { |
509 | 509 | return '<span class="reg-pad-rght"></span>'; |
510 | 510 | } |
@@ -186,8 +186,9 @@ discard block |
||
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | 187 | $template_path = locate_template( $templates ); |
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
190 | - return TRUE; |
|
189 | + if ( $check_if_custom && !empty( $template_path ) ) { |
|
190 | + return TRUE; |
|
191 | + } |
|
191 | 192 | |
192 | 193 | // not in the theme |
193 | 194 | if ( empty( $template_path )) { |
@@ -436,11 +437,11 @@ discard block |
||
436 | 437 | if( $mny->sign_b4 ){ |
437 | 438 | if( $amount >= 0 ){ |
438 | 439 | $amount_formatted = $mny->sign . $amount_formatted; |
439 | - }else{ |
|
440 | + } else{ |
|
440 | 441 | $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
441 | 442 | } |
442 | 443 | |
443 | - }else{ |
|
444 | + } else{ |
|
444 | 445 | $amount_formatted = $amount_formatted . $mny->sign; |
445 | 446 | } |
446 | 447 | |
@@ -521,11 +522,13 @@ discard block |
||
521 | 522 | */ |
522 | 523 | public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
523 | 524 | |
524 | - if ( ! $page ) |
|
525 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
525 | + if ( ! $page ) { |
|
526 | + $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
527 | + } |
|
526 | 528 | |
527 | - if ( ! $action ) |
|
528 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
529 | + if ( ! $action ) { |
|
530 | + $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
531 | + } |
|
529 | 532 | |
530 | 533 | $action = empty($action) ? 'default' : $action; |
531 | 534 | |
@@ -599,8 +602,9 @@ discard block |
||
599 | 602 | * @return string html structure for status. |
600 | 603 | */ |
601 | 604 | public static function status_legend( $status_array, $active_status = '' ) { |
602 | - if ( !is_array( $status_array ) ) |
|
603 | - throw new EE_Error( esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
605 | + if ( !is_array( $status_array ) ) { |
|
606 | + throw new EE_Error( esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
607 | + } |
|
604 | 608 | |
605 | 609 | $setup_array = array(); |
606 | 610 | foreach ( $status_array as $item => $status ) { |
@@ -660,8 +664,7 @@ discard block |
||
660 | 664 | </tbody> |
661 | 665 | </table> |
662 | 666 | <?php |
663 | - } |
|
664 | - else { |
|
667 | + } else { |
|
665 | 668 | ?> |
666 | 669 | <ul> |
667 | 670 | <?php |
@@ -671,8 +674,7 @@ discard block |
||
671 | 674 | </ul> |
672 | 675 | <?php |
673 | 676 | } |
674 | - } |
|
675 | - else { |
|
677 | + } else { |
|
676 | 678 | //simple value |
677 | 679 | echo $data; |
678 | 680 | } |
@@ -752,8 +754,9 @@ discard block |
||
752 | 754 | |
753 | 755 | $total_pages = ceil( $total_items / $per_page ); |
754 | 756 | |
755 | - if ( $total_pages <= 1 ) |
|
756 | - return ''; |
|
757 | + if ( $total_pages <= 1 ) { |
|
758 | + return ''; |
|
759 | + } |
|
757 | 760 | |
758 | 761 | $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
759 | 762 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,54 +407,54 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // filter to allow global setting of display_code |
448 | - $display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code ); |
|
448 | + $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code); |
|
449 | 449 | |
450 | 450 | // add currency code ? |
451 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
451 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
452 | 452 | } |
453 | 453 | // filter results |
454 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
454 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
455 | 455 | } |
456 | 456 | // clean up vars |
457 | - unset( $mny ); |
|
457 | + unset($mny); |
|
458 | 458 | // return formatted currency amount |
459 | 459 | return $amount_formatted; |
460 | 460 | } |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
470 | 470 | * @return string The localized label for the status id. |
471 | 471 | */ |
472 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
472 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
473 | 473 | /** @type EEM_Status $EEM_Status */ |
474 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
475 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
476 | - return $status[ $status_id ]; |
|
474 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
475 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
476 | + return $status[$status_id]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -488,21 +488,21 @@ discard block |
||
488 | 488 | * @param string $title |
489 | 489 | * @return string the html output for the button |
490 | 490 | */ |
491 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) { |
|
491 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') { |
|
492 | 492 | $icon_html = ''; |
493 | - if ( ! empty( $icon ) ) { |
|
494 | - $dashicons = preg_split( "(ee-icon |dashicons )", $icon ); |
|
495 | - $dashicons = array_filter( $dashicons ); |
|
496 | - $count = count( $dashicons ); |
|
493 | + if ( ! empty($icon)) { |
|
494 | + $dashicons = preg_split("(ee-icon |dashicons )", $icon); |
|
495 | + $dashicons = array_filter($dashicons); |
|
496 | + $count = count($dashicons); |
|
497 | 497 | $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : ''; |
498 | - foreach ( $dashicons as $dashicon ) { |
|
499 | - $type = strpos( $dashicon, 'ee-icon' ) !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | - $icon_html .= '<span class="' . $type . $dashicon . '"></span>'; |
|
498 | + foreach ($dashicons as $dashicon) { |
|
499 | + $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | + $icon_html .= '<span class="'.$type.$dashicon.'"></span>'; |
|
501 | 501 | } |
502 | 502 | $icon_html .= $count > 1 ? '</span>' : ''; |
503 | 503 | } |
504 | - $label = ! empty( $icon ) ? $icon_html . $label : $label; |
|
505 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>'; |
|
504 | + $label = ! empty($icon) ? $icon_html.$label : $label; |
|
505 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>'; |
|
506 | 506 | return $button; |
507 | 507 | } |
508 | 508 | |
@@ -519,21 +519,21 @@ discard block |
||
519 | 519 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
520 | 520 | * @return string generated link |
521 | 521 | */ |
522 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
522 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
523 | 523 | |
524 | - if ( ! $page ) |
|
525 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
524 | + if ( ! $page) |
|
525 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
526 | 526 | |
527 | - if ( ! $action ) |
|
528 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
527 | + if ( ! $action) |
|
528 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
529 | 529 | |
530 | 530 | $action = empty($action) ? 'default' : $action; |
531 | 531 | |
532 | 532 | |
533 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
534 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | - $help_text = !$help_text ? '' : $help_text; |
|
536 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
533 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
534 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | + $help_text = ! $help_text ? '' : $help_text; |
|
536 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param EE_Help_Tour |
546 | 546 | * @return string html |
547 | 547 | */ |
548 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
548 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
549 | 549 | $id = $tour->get_slug(); |
550 | 550 | $stops = $tour->get_stops(); |
551 | 551 | |
552 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
552 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
553 | 553 | |
554 | - foreach ( $stops as $stop ) { |
|
555 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
556 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
554 | + foreach ($stops as $stop) { |
|
555 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
556 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
557 | 557 | |
558 | 558 | //if container is set to modal then let's make sure we set the options accordingly |
559 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
559 | + if (empty($data_id) && empty($data_class)) { |
|
560 | 560 | $stop['options']['modal'] = true; |
561 | 561 | $stop['options']['expose'] = true; |
562 | 562 | } |
563 | 563 | |
564 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
565 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
564 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
565 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
566 | 566 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
567 | 567 | |
568 | 568 | //options |
569 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
569 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
570 | 570 | $options = ' data-options="'; |
571 | - foreach ( $stop['options'] as $option => $value ) { |
|
572 | - $options .= $option . ':' . $value . ';'; |
|
571 | + foreach ($stop['options'] as $option => $value) { |
|
572 | + $options .= $option.':'.$value.';'; |
|
573 | 573 | } |
574 | 574 | $options .= '"'; |
575 | 575 | } else { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | //let's put all together |
580 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
580 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | $content .= '</ol>'; |
@@ -598,31 +598,31 @@ discard block |
||
598 | 598 | * @throws EE_Error |
599 | 599 | * @return string html structure for status. |
600 | 600 | */ |
601 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
602 | - if ( !is_array( $status_array ) ) |
|
603 | - throw new EE_Error( esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
601 | + public static function status_legend($status_array, $active_status = '') { |
|
602 | + if ( ! is_array($status_array)) |
|
603 | + throw new EE_Error(esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
604 | 604 | |
605 | 605 | $setup_array = array(); |
606 | - foreach ( $status_array as $item => $status ) { |
|
606 | + foreach ($status_array as $item => $status) { |
|
607 | 607 | $setup_array[$item] = array( |
608 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
609 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
608 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
609 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
610 | 610 | 'status' => $status |
611 | 611 | ); |
612 | 612 | } |
613 | 613 | |
614 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
615 | - $content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n"; |
|
616 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
617 | - foreach ( $setup_array as $item => $details ) { |
|
614 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
615 | + $content .= '<h4 class="status-legend-title">'.esc_html__('Status Legend', 'event_espresso').'</h4>'."\n"; |
|
616 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
617 | + foreach ($setup_array as $item => $details) { |
|
618 | 618 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
619 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
620 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
621 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
622 | - $content .= '</dt>' . "\n"; |
|
619 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
620 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
621 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
622 | + $content .= '</dt>'."\n"; |
|
623 | 623 | } |
624 | - $content .= '</dl>' . "\n"; |
|
625 | - $content .= '</div>' . "\n"; |
|
624 | + $content .= '</dl>'."\n"; |
|
625 | + $content .= '</div>'."\n"; |
|
626 | 626 | return $content; |
627 | 627 | } |
628 | 628 | |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * @return string |
636 | 636 | */ |
637 | 637 | public static function layout_array_as_table($data) { |
638 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
639 | - $data = (array)$data; |
|
638 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
639 | + $data = (array) $data; |
|
640 | 640 | } |
641 | 641 | ob_start(); |
642 | 642 | if (is_array($data)) { |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <td> |
652 | - <?php echo $data_key;?> |
|
652 | + <?php echo $data_key; ?> |
|
653 | 653 | </td> |
654 | 654 | <td> |
655 | - <?php echo self::layout_array_as_table($data_values);?> |
|
655 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
656 | 656 | </td> |
657 | 657 | </tr> |
658 | 658 | <?php |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | <ul> |
667 | 667 | <?php |
668 | 668 | foreach ($data as $datum) { |
669 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
669 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
670 | 670 | }?> |
671 | 671 | </ul> |
672 | 672 | <?php |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | } |
675 | 675 | else { |
676 | 676 | //simple value |
677 | - echo esc_html( $data ); |
|
677 | + echo esc_html($data); |
|
678 | 678 | } |
679 | 679 | return ob_get_clean(); |
680 | 680 | } |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
700 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
699 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
700 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * ) |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
724 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
725 | 725 | $page_links = array(); |
726 | 726 | $disable_first = $disable_last = ''; |
727 | 727 | $total_items = (int) $total_items; |
728 | 728 | $per_page = (int) $per_page; |
729 | 729 | $current = (int) $current; |
730 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
730 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
731 | 731 | |
732 | 732 | //filter items_label |
733 | 733 | $items_label = apply_filters( |
@@ -735,68 +735,68 @@ discard block |
||
735 | 735 | $items_label |
736 | 736 | ); |
737 | 737 | |
738 | - if ( empty( $items_label ) |
|
739 | - || ! is_array( $items_label ) |
|
740 | - || ! isset( $items_label['single'] ) |
|
741 | - || ! isset( $items_label['plural'] ) ) { |
|
738 | + if (empty($items_label) |
|
739 | + || ! is_array($items_label) |
|
740 | + || ! isset($items_label['single']) |
|
741 | + || ! isset($items_label['plural'])) { |
|
742 | 742 | $items_label = array( |
743 | - 'single' => __( '1 item', 'event_espresso' ), |
|
744 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
743 | + 'single' => __('1 item', 'event_espresso'), |
|
744 | + 'plural' => __('%s items', 'event_espresso') |
|
745 | 745 | ); |
746 | 746 | } else { |
747 | 747 | $items_label = array( |
748 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
749 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
748 | + 'single' => '1 '.esc_html($items_label['single']), |
|
749 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
750 | 750 | ); |
751 | 751 | } |
752 | 752 | |
753 | - $total_pages = ceil( $total_items / $per_page ); |
|
753 | + $total_pages = ceil($total_items / $per_page); |
|
754 | 754 | |
755 | - if ( $total_pages <= 1 ) |
|
755 | + if ($total_pages <= 1) |
|
756 | 756 | return ''; |
757 | 757 | |
758 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
758 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
759 | 759 | |
760 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
760 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
761 | 761 | |
762 | - if ( $current === 1 ) { |
|
762 | + if ($current === 1) { |
|
763 | 763 | $disable_first = ' disabled'; |
764 | 764 | } |
765 | - if ( $current == $total_pages ) { |
|
765 | + if ($current == $total_pages) { |
|
766 | 766 | $disable_last = ' disabled'; |
767 | 767 | } |
768 | 768 | |
769 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | - 'first-page' . $disable_first, |
|
771 | - esc_attr__( 'Go to the first page' ), |
|
772 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
769 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | + 'first-page'.$disable_first, |
|
771 | + esc_attr__('Go to the first page'), |
|
772 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
773 | 773 | '«' |
774 | 774 | ); |
775 | 775 | |
776 | 776 | $page_links[] = sprintf( |
777 | 777 | '<a class="%s" title="%s" href="%s">%s</a>', |
778 | - 'prev-page' . $disable_first, |
|
779 | - esc_attr__( 'Go to the previous page' ), |
|
780 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
778 | + 'prev-page'.$disable_first, |
|
779 | + esc_attr__('Go to the previous page'), |
|
780 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
781 | 781 | '‹' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( ! $show_num_field ) { |
|
784 | + if ( ! $show_num_field) { |
|
785 | 785 | $html_current_page = $current; |
786 | 786 | } else { |
787 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | - esc_attr__( 'Current page' ), |
|
787 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | + esc_attr__('Current page'), |
|
789 | 789 | $current, |
790 | - strlen( $total_pages ) |
|
790 | + strlen($total_pages) |
|
791 | 791 | ); |
792 | 792 | } |
793 | 793 | |
794 | 794 | $html_total_pages = sprintf( |
795 | 795 | '<span class="total-pages">%s</span>', |
796 | - number_format_i18n( $total_pages ) |
|
796 | + number_format_i18n($total_pages) |
|
797 | 797 | ); |
798 | 798 | $page_links[] = sprintf( |
799 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
799 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
800 | 800 | $html_current_page, |
801 | 801 | $html_total_pages, |
802 | 802 | '<span class="paging-input">', |
@@ -805,29 +805,29 @@ discard block |
||
805 | 805 | |
806 | 806 | $page_links[] = sprintf( |
807 | 807 | '<a class="%s" title="%s" href="%s">%s</a>', |
808 | - 'next-page' . $disable_last, |
|
809 | - esc_attr__( 'Go to the next page' ), |
|
810 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
808 | + 'next-page'.$disable_last, |
|
809 | + esc_attr__('Go to the next page'), |
|
810 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
811 | 811 | '›' |
812 | 812 | ); |
813 | 813 | |
814 | 814 | $page_links[] = sprintf( |
815 | 815 | '<a class="%s" title="%s" href="%s">%s</a>', |
816 | - 'last-page' . $disable_last, |
|
817 | - esc_attr__( 'Go to the last page' ), |
|
818 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
816 | + 'last-page'.$disable_last, |
|
817 | + esc_attr__('Go to the last page'), |
|
818 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
819 | 819 | '»' |
820 | 820 | ); |
821 | 821 | |
822 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
822 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
823 | 823 | // set page class |
824 | - if ( $total_pages ) { |
|
824 | + if ($total_pages) { |
|
825 | 825 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
826 | 826 | } else { |
827 | 827 | $page_class = ' no-pages'; |
828 | 828 | } |
829 | 829 | |
830 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
830 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * @param string $wrap_id |
838 | 838 | * @return string |
839 | 839 | */ |
840 | - public static function powered_by_event_espresso( $wrap_class = '', $wrap_id = '', array $query_args = array() ) { |
|
841 | - $admin = is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
840 | + public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = array()) { |
|
841 | + $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX); |
|
842 | 842 | if ( |
843 | 843 | ! $admin && |
844 | 844 | ! apply_filters( |
@@ -849,9 +849,9 @@ discard block |
||
849 | 849 | return ''; |
850 | 850 | } |
851 | 851 | $tag = $admin ? 'span' : 'div'; |
852 | - $attributes = ! empty( $wrap_id ) ? " id=\"{$wrap_id}\"" : ''; |
|
852 | + $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : ''; |
|
853 | 853 | $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class; |
854 | - $attributes .= ! empty( $wrap_class ) |
|
854 | + $attributes .= ! empty($wrap_class) |
|
855 | 855 | ? " class=\"{$wrap_class} powered-by-event-espresso-credit\"" |
856 | 856 | : ' class="powered-by-event-espresso-credit"'; |
857 | 857 | $query_args = array_merge( |
@@ -863,9 +863,9 @@ discard block |
||
863 | 863 | ), |
864 | 864 | $query_args |
865 | 865 | ); |
866 | - $powered_by = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso' ); |
|
867 | - $url = add_query_arg( $query_args, 'https://eventespresso.com/' ); |
|
868 | - $url = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso__url', $url ); |
|
866 | + $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso'); |
|
867 | + $url = add_query_arg($query_args, 'https://eventespresso.com/'); |
|
868 | + $url = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url); |
|
869 | 869 | return (string) apply_filters( |
870 | 870 | 'FHEE__EEH_Template__powered_by_event_espresso__html', |
871 | 871 | sprintf( |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
898 | 898 | |
899 | 899 | |
900 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
900 | +if ( ! function_exists('espresso_pagination')) { |
|
901 | 901 | /** |
902 | 902 | * espresso_pagination |
903 | 903 | * |
@@ -909,21 +909,21 @@ discard block |
||
909 | 909 | $big = 999999999; // need an unlikely integer |
910 | 910 | $pagination = paginate_links( |
911 | 911 | array( |
912 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
912 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
913 | 913 | 'format' => '?paged=%#%', |
914 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
914 | + 'current' => max(1, get_query_var('paged')), |
|
915 | 915 | 'total' => $wp_query->max_num_pages, |
916 | 916 | 'show_all' => true, |
917 | 917 | 'end_size' => 10, |
918 | 918 | 'mid_size' => 6, |
919 | 919 | 'prev_next' => true, |
920 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
921 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
920 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
921 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
922 | 922 | 'type' => 'plain', |
923 | 923 | 'add_args' => false, |
924 | 924 | 'add_fragment' => '' |
925 | 925 | ) |
926 | 926 | ); |
927 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
927 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | \ No newline at end of file |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | // if plugin_action_slug is NOT set, but an admin page path IS set, |
382 | 382 | // then let's just use the plugin_slug since that will be used for linking to the admin page |
383 | 383 | $addon_settings['plugin_action_slug'] = empty( $addon_settings['plugin_action_slug'] ) |
384 | - && ! empty( $addon_settings['admin_path'] ) |
|
384 | + && ! empty( $addon_settings['admin_path'] ) |
|
385 | 385 | ? $addon_settings['plugin_slug'] |
386 | 386 | : $addon_settings['plugin_action_slug']; |
387 | 387 | // full server path to main file (file loaded directly by WP) |
@@ -766,15 +766,15 @@ discard block |
||
766 | 766 | EE_Register_Widget::deregister( $addon_name ); |
767 | 767 | } |
768 | 768 | if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) |
769 | - || |
|
770 | - ! empty( self::$_settings[ $addon_name ]['class_paths'] ) |
|
769 | + || |
|
770 | + ! empty( self::$_settings[ $addon_name ]['class_paths'] ) |
|
771 | 771 | ) { |
772 | 772 | // add to list of shortcodes to be registered |
773 | 773 | EE_Register_Model::deregister( $addon_name ); |
774 | 774 | } |
775 | 775 | if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) |
776 | - || |
|
777 | - ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] ) |
|
776 | + || |
|
777 | + ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] ) |
|
778 | 778 | ) { |
779 | 779 | // add to list of shortcodes to be registered |
780 | 780 | EE_Register_Model_Extensions::deregister( $addon_name ); |
@@ -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 | |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | * @param string $min_core_version |
61 | 61 | * @return string always like '4.3.0.rc.000' |
62 | 62 | */ |
63 | - protected static function _effective_version( $min_core_version ) { |
|
63 | + protected static function _effective_version($min_core_version) { |
|
64 | 64 | // versions: 4 . 3 . 1 . p . 123 |
65 | 65 | // offsets: 0 . 1 . 2 . 3 . 4 |
66 | - $version_parts = explode( '.', $min_core_version ); |
|
66 | + $version_parts = explode('.', $min_core_version); |
|
67 | 67 | //check they specified the micro version (after 2nd period) |
68 | - if ( ! isset( $version_parts[2] ) ) { |
|
68 | + if ( ! isset($version_parts[2])) { |
|
69 | 69 | $version_parts[2] = '0'; |
70 | 70 | } |
71 | 71 | //if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible |
72 | 72 | //soon we can assume that's 'rc', but this current version is 'alpha' |
73 | - if ( ! isset( $version_parts[3] ) ) { |
|
73 | + if ( ! isset($version_parts[3])) { |
|
74 | 74 | $version_parts[3] = 'dev'; |
75 | 75 | } |
76 | - if ( ! isset( $version_parts[4] ) ) { |
|
76 | + if ( ! isset($version_parts[4])) { |
|
77 | 77 | $version_parts[4] = '000'; |
78 | 78 | } |
79 | - return implode( '.', $version_parts ); |
|
79 | + return implode('.', $version_parts); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | $actual_core_version = EVENT_ESPRESSO_VERSION |
94 | 94 | ) { |
95 | 95 | return version_compare( |
96 | - self::_effective_version( $actual_core_version ), |
|
97 | - self::_effective_version( $min_core_version ), |
|
96 | + self::_effective_version($actual_core_version), |
|
97 | + self::_effective_version($min_core_version), |
|
98 | 98 | '>=' |
99 | 99 | ); |
100 | 100 | } |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | * @throws EE_Error |
217 | 217 | * @return void |
218 | 218 | */ |
219 | - public static function register( $addon_name = '', $setup_args = array() ) { |
|
219 | + public static function register($addon_name = '', $setup_args = array()) { |
|
220 | 220 | // required fields MUST be present, so let's make sure they are. |
221 | - if ( empty( $addon_name ) || ! is_array( $setup_args ) ) { |
|
221 | + if (empty($addon_name) || ! is_array($setup_args)) { |
|
222 | 222 | throw new EE_Error( |
223 | 223 | __( |
224 | 224 | 'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', |
@@ -226,19 +226,19 @@ discard block |
||
226 | 226 | ) |
227 | 227 | ); |
228 | 228 | } |
229 | - if ( ! isset( $setup_args['main_file_path'] ) || empty( $setup_args['main_file_path'] ) ) { |
|
229 | + if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) { |
|
230 | 230 | throw new EE_Error( |
231 | 231 | sprintf( |
232 | 232 | __( |
233 | 233 | 'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', |
234 | 234 | 'event_espresso' |
235 | 235 | ), |
236 | - implode( ",", array_keys( $setup_args ) ) |
|
236 | + implode(",", array_keys($setup_args)) |
|
237 | 237 | ) |
238 | 238 | ); |
239 | 239 | } |
240 | 240 | // check that addon has not already been registered with that name |
241 | - if ( isset( self::$_settings[ $addon_name ] ) && ! did_action( 'activate_plugin' ) ) { |
|
241 | + if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) { |
|
242 | 242 | throw new EE_Error( |
243 | 243 | sprintf( |
244 | 244 | __( |
@@ -250,124 +250,124 @@ discard block |
||
250 | 250 | ); |
251 | 251 | } |
252 | 252 | // no class name for addon? |
253 | - if ( empty( $setup_args['class_name'] ) ) { |
|
253 | + if (empty($setup_args['class_name'])) { |
|
254 | 254 | // generate one by first separating name with spaces |
255 | - $class_name = str_replace( array( '-', '_' ), ' ', trim( $addon_name ) ); |
|
255 | + $class_name = str_replace(array('-', '_'), ' ', trim($addon_name)); |
|
256 | 256 | //capitalize, then replace spaces with underscores |
257 | - $class_name = str_replace( ' ', '_', ucwords( $class_name ) ); |
|
257 | + $class_name = str_replace(' ', '_', ucwords($class_name)); |
|
258 | 258 | } else { |
259 | 259 | $class_name = $setup_args['class_name']; |
260 | 260 | } |
261 | - $class_name = strpos( $class_name, 'EE_' ) === 0 ? $class_name : 'EE_' . $class_name; |
|
261 | + $class_name = strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name; |
|
262 | 262 | //setup $_settings array from incoming values. |
263 | 263 | $addon_settings = array( |
264 | 264 | // generated from the addon name, changes something like "calendar" to "EE_Calendar" |
265 | 265 | 'class_name' => $class_name, |
266 | 266 | // the addon slug for use in URLs, etc |
267 | - 'plugin_slug' => isset( $setup_args['plugin_slug'] ) |
|
267 | + 'plugin_slug' => isset($setup_args['plugin_slug']) |
|
268 | 268 | ? (string) $setup_args['plugin_slug'] |
269 | 269 | : '', |
270 | 270 | // page slug to be used when generating the "Settings" link on the WP plugin page |
271 | - 'plugin_action_slug' => isset( $setup_args['plugin_action_slug'] ) |
|
271 | + 'plugin_action_slug' => isset($setup_args['plugin_action_slug']) |
|
272 | 272 | ? (string) $setup_args['plugin_action_slug'] |
273 | 273 | : '', |
274 | 274 | // the "software" version for the addon |
275 | - 'version' => isset( $setup_args['version'] ) |
|
275 | + 'version' => isset($setup_args['version']) |
|
276 | 276 | ? (string) $setup_args['version'] |
277 | 277 | : '', |
278 | 278 | // the minimum version of EE Core that the addon will work with |
279 | - 'min_core_version' => isset( $setup_args['min_core_version'] ) |
|
279 | + 'min_core_version' => isset($setup_args['min_core_version']) |
|
280 | 280 | ? (string) $setup_args['min_core_version'] |
281 | 281 | : '', |
282 | 282 | // the minimum version of WordPress that the addon will work with |
283 | - 'min_wp_version' => isset( $setup_args['min_wp_version'] ) |
|
283 | + 'min_wp_version' => isset($setup_args['min_wp_version']) |
|
284 | 284 | ? (string) $setup_args['min_wp_version'] |
285 | 285 | : EE_MIN_WP_VER_REQUIRED, |
286 | 286 | // full server path to main file (file loaded directly by WP) |
287 | - 'main_file_path' => isset( $setup_args['main_file_path'] ) |
|
287 | + 'main_file_path' => isset($setup_args['main_file_path']) |
|
288 | 288 | ? (string) $setup_args['main_file_path'] |
289 | 289 | : '', |
290 | 290 | // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages |
291 | - 'admin_path' => isset( $setup_args['admin_path'] ) |
|
291 | + 'admin_path' => isset($setup_args['admin_path']) |
|
292 | 292 | ? (string) $setup_args['admin_path'] : '', |
293 | 293 | // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page |
294 | - 'admin_callback' => isset( $setup_args['admin_callback'] ) |
|
294 | + 'admin_callback' => isset($setup_args['admin_callback']) |
|
295 | 295 | ? (string) $setup_args['admin_callback'] |
296 | 296 | : '', |
297 | 297 | // the section name for this addon's configuration settings section (defaults to "addons") |
298 | - 'config_section' => isset( $setup_args['config_section'] ) |
|
298 | + 'config_section' => isset($setup_args['config_section']) |
|
299 | 299 | ? (string) $setup_args['config_section'] |
300 | 300 | : 'addons', |
301 | 301 | // the class name for this addon's configuration settings object |
302 | - 'config_class' => isset( $setup_args['config_class'] ) |
|
302 | + 'config_class' => isset($setup_args['config_class']) |
|
303 | 303 | ? (string) $setup_args['config_class'] : '', |
304 | 304 | //the name given to the config for this addons' configuration settings object (optional) |
305 | - 'config_name' => isset( $setup_args['config_name'] ) |
|
305 | + 'config_name' => isset($setup_args['config_name']) |
|
306 | 306 | ? (string) $setup_args['config_name'] : '', |
307 | 307 | // an array of "class names" => "full server paths" for any classes that might be invoked by the addon |
308 | - 'autoloader_paths' => isset( $setup_args['autoloader_paths'] ) |
|
308 | + 'autoloader_paths' => isset($setup_args['autoloader_paths']) |
|
309 | 309 | ? (array) $setup_args['autoloader_paths'] |
310 | 310 | : array(), |
311 | 311 | // an array of "full server paths" for any folders containing classes that might be invoked by the addon |
312 | - 'autoloader_folders' => isset( $setup_args['autoloader_folders'] ) |
|
312 | + 'autoloader_folders' => isset($setup_args['autoloader_folders']) |
|
313 | 313 | ? (array) $setup_args['autoloader_folders'] |
314 | 314 | : array(), |
315 | 315 | // array of full server paths to any EE_DMS data migration scripts used by the addon |
316 | - 'dms_paths' => isset( $setup_args['dms_paths'] ) |
|
316 | + 'dms_paths' => isset($setup_args['dms_paths']) |
|
317 | 317 | ? (array) $setup_args['dms_paths'] |
318 | 318 | : array(), |
319 | 319 | // array of full server paths to any EED_Modules used by the addon |
320 | - 'module_paths' => isset( $setup_args['module_paths'] ) |
|
320 | + 'module_paths' => isset($setup_args['module_paths']) |
|
321 | 321 | ? (array) $setup_args['module_paths'] |
322 | 322 | : array(), |
323 | 323 | // array of full server paths to any EES_Shortcodes used by the addon |
324 | - 'shortcode_paths' => isset( $setup_args['shortcode_paths'] ) |
|
324 | + 'shortcode_paths' => isset($setup_args['shortcode_paths']) |
|
325 | 325 | ? (array) $setup_args['shortcode_paths'] |
326 | 326 | : array(), |
327 | 327 | // array of full server paths to any WP_Widgets used by the addon |
328 | - 'widget_paths' => isset( $setup_args['widget_paths'] ) |
|
328 | + 'widget_paths' => isset($setup_args['widget_paths']) |
|
329 | 329 | ? (array) $setup_args['widget_paths'] |
330 | 330 | : array(), |
331 | 331 | // array of PUE options used by the addon |
332 | - 'pue_options' => isset( $setup_args['pue_options'] ) |
|
332 | + 'pue_options' => isset($setup_args['pue_options']) |
|
333 | 333 | ? (array) $setup_args['pue_options'] |
334 | 334 | : array(), |
335 | - 'message_types' => isset( $setup_args['message_types'] ) |
|
335 | + 'message_types' => isset($setup_args['message_types']) |
|
336 | 336 | ? (array) $setup_args['message_types'] |
337 | 337 | : array(), |
338 | - 'capabilities' => isset( $setup_args['capabilities'] ) |
|
338 | + 'capabilities' => isset($setup_args['capabilities']) |
|
339 | 339 | ? (array) $setup_args['capabilities'] |
340 | 340 | : array(), |
341 | - 'capability_maps' => isset( $setup_args['capability_maps'] ) |
|
341 | + 'capability_maps' => isset($setup_args['capability_maps']) |
|
342 | 342 | ? (array) $setup_args['capability_maps'] |
343 | 343 | : array(), |
344 | - 'model_paths' => isset( $setup_args['model_paths'] ) |
|
344 | + 'model_paths' => isset($setup_args['model_paths']) |
|
345 | 345 | ? (array) $setup_args['model_paths'] |
346 | 346 | : array(), |
347 | - 'class_paths' => isset( $setup_args['class_paths'] ) |
|
347 | + 'class_paths' => isset($setup_args['class_paths']) |
|
348 | 348 | ? (array) $setup_args['class_paths'] |
349 | 349 | : array(), |
350 | - 'model_extension_paths' => isset( $setup_args['model_extension_paths'] ) |
|
350 | + 'model_extension_paths' => isset($setup_args['model_extension_paths']) |
|
351 | 351 | ? (array) $setup_args['model_extension_paths'] |
352 | 352 | : array(), |
353 | - 'class_extension_paths' => isset( $setup_args['class_extension_paths'] ) |
|
353 | + 'class_extension_paths' => isset($setup_args['class_extension_paths']) |
|
354 | 354 | ? (array) $setup_args['class_extension_paths'] |
355 | 355 | : array(), |
356 | - 'custom_post_types' => isset( $setup_args['custom_post_types'] ) |
|
356 | + 'custom_post_types' => isset($setup_args['custom_post_types']) |
|
357 | 357 | ? (array) $setup_args['custom_post_types'] |
358 | 358 | : array(), |
359 | - 'custom_taxonomies' => isset( $setup_args['custom_taxonomies'] ) |
|
359 | + 'custom_taxonomies' => isset($setup_args['custom_taxonomies']) |
|
360 | 360 | ? (array) $setup_args['custom_taxonomies'] |
361 | 361 | : array(), |
362 | - 'payment_method_paths' => isset( $setup_args['payment_method_paths'] ) |
|
362 | + 'payment_method_paths' => isset($setup_args['payment_method_paths']) |
|
363 | 363 | ? (array) $setup_args['payment_method_paths'] |
364 | 364 | : array(), |
365 | - 'default_terms' => isset( $setup_args['default_terms'] ) |
|
365 | + 'default_terms' => isset($setup_args['default_terms']) |
|
366 | 366 | ? (array) $setup_args['default_terms'] |
367 | 367 | : array(), |
368 | 368 | // if not empty, inserts a new table row after this plugin's row on the WP Plugins page |
369 | 369 | // that can be used for adding upgrading/marketing info |
370 | - 'plugins_page_row' => isset( $setup_args['plugins_page_row'] ) |
|
370 | + 'plugins_page_row' => isset($setup_args['plugins_page_row']) |
|
371 | 371 | ? $setup_args['plugins_page_row'] |
372 | 372 | : '', |
373 | 373 | 'namespace' => isset( |
@@ -380,19 +380,19 @@ discard block |
||
380 | 380 | ); |
381 | 381 | // if plugin_action_slug is NOT set, but an admin page path IS set, |
382 | 382 | // then let's just use the plugin_slug since that will be used for linking to the admin page |
383 | - $addon_settings['plugin_action_slug'] = empty( $addon_settings['plugin_action_slug'] ) |
|
384 | - && ! empty( $addon_settings['admin_path'] ) |
|
383 | + $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) |
|
384 | + && ! empty($addon_settings['admin_path']) |
|
385 | 385 | ? $addon_settings['plugin_slug'] |
386 | 386 | : $addon_settings['plugin_action_slug']; |
387 | 387 | // full server path to main file (file loaded directly by WP) |
388 | - $addon_settings['plugin_basename'] = plugin_basename( $addon_settings['main_file_path'] ); |
|
388 | + $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']); |
|
389 | 389 | global $wp_version; |
390 | 390 | $incompatibility_message = ''; |
391 | 391 | //check whether this addon version is compatible with EE core |
392 | 392 | if ( |
393 | - isset( EE_Register_Addon::$_incompatible_addons[ $addon_name ] ) |
|
393 | + isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) |
|
394 | 394 | && ! self::_meets_min_core_version_requirement( |
395 | - EE_Register_Addon::$_incompatible_addons[ $addon_name ], |
|
395 | + EE_Register_Addon::$_incompatible_addons[$addon_name], |
|
396 | 396 | $addon_settings['version'] |
397 | 397 | ) |
398 | 398 | ) { |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | ), |
404 | 404 | $addon_name, |
405 | 405 | '<br />', |
406 | - EE_Register_Addon::$_incompatible_addons[ $addon_name ] |
|
406 | + EE_Register_Addon::$_incompatible_addons[$addon_name] |
|
407 | 407 | ); |
408 | 408 | } else if ( |
409 | - ! self::_meets_min_core_version_requirement( $addon_settings['min_core_version'], espresso_version() ) |
|
409 | + ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version()) |
|
410 | 410 | ) { |
411 | 411 | $incompatibility_message = sprintf( |
412 | 412 | __( |
@@ -414,11 +414,11 @@ discard block |
||
414 | 414 | 'event_espresso' |
415 | 415 | ), |
416 | 416 | $addon_name, |
417 | - self::_effective_version( $addon_settings['min_core_version'] ), |
|
418 | - self::_effective_version( espresso_version() ), |
|
417 | + self::_effective_version($addon_settings['min_core_version']), |
|
418 | + self::_effective_version(espresso_version()), |
|
419 | 419 | '<br />' |
420 | 420 | ); |
421 | - } else if ( version_compare( $wp_version, $addon_settings['min_wp_version'], '<' ) ) { |
|
421 | + } else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) { |
|
422 | 422 | $incompatibility_message = sprintf( |
423 | 423 | __( |
424 | 424 | 'The Event Espresso "%1$s" addon could not be activated because it requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.', |
@@ -429,20 +429,20 @@ discard block |
||
429 | 429 | '<br />' |
430 | 430 | ); |
431 | 431 | } |
432 | - if ( ! empty( $incompatibility_message ) ) { |
|
432 | + if ( ! empty($incompatibility_message)) { |
|
433 | 433 | //remove 'activate' from the REQUEST so WP doesn't erroneously tell the user the |
434 | 434 | //plugin activated fine when it didn't |
435 | - if ( isset( $_GET['activate'] ) ) { |
|
436 | - unset( $_GET['activate'] ); |
|
435 | + if (isset($_GET['activate'])) { |
|
436 | + unset($_GET['activate']); |
|
437 | 437 | } |
438 | - if ( isset( $_REQUEST['activate'] ) ) { |
|
439 | - unset( $_REQUEST['activate'] ); |
|
438 | + if (isset($_REQUEST['activate'])) { |
|
439 | + unset($_REQUEST['activate']); |
|
440 | 440 | } |
441 | 441 | //and show an error message indicating the plugin didn't activate properly |
442 | - EE_Error::add_error( $incompatibility_message, __FILE__, __FUNCTION__, __LINE__ ); |
|
443 | - if ( current_user_can( 'activate_plugins' ) ) { |
|
444 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
445 | - deactivate_plugins( plugin_basename( $addon_settings['main_file_path'] ), true ); |
|
442 | + EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__); |
|
443 | + if (current_user_can('activate_plugins')) { |
|
444 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
445 | + deactivate_plugins(plugin_basename($addon_settings['main_file_path']), true); |
|
446 | 446 | } |
447 | 447 | return; |
448 | 448 | } |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | ); |
461 | 461 | } |
462 | 462 | //this is an activation request |
463 | - if ( did_action( 'activate_plugin' ) ) { |
|
463 | + if (did_action('activate_plugin')) { |
|
464 | 464 | //to find if THIS is the addon that was activated, |
465 | 465 | //just check if we have already registered it or not |
466 | 466 | //(as the newly-activated addon wasn't around the first time addons were registered) |
467 | - if ( ! isset( self::$_settings[ $addon_name ] ) ) { |
|
468 | - self::$_settings[ $addon_name ] = $addon_settings; |
|
469 | - $addon = self::_load_and_init_addon_class( $addon_name ); |
|
467 | + if ( ! isset(self::$_settings[$addon_name])) { |
|
468 | + self::$_settings[$addon_name] = $addon_settings; |
|
469 | + $addon = self::_load_and_init_addon_class($addon_name); |
|
470 | 470 | $addon->set_activation_indicator_option(); |
471 | 471 | //dont bother setting up the rest of the addon. |
472 | 472 | //we know it was just activated and the request will end soon |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | } else { |
476 | 476 | // make sure this was called in the right place! |
477 | 477 | if ( |
478 | - ! did_action( 'AHEE__EE_System__load_espresso_addons' ) |
|
479 | - || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' ) |
|
478 | + ! did_action('AHEE__EE_System__load_espresso_addons') |
|
479 | + || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin') |
|
480 | 480 | ) { |
481 | 481 | EE_Error::doing_it_wrong( |
482 | 482 | __METHOD__, |
@@ -490,155 +490,155 @@ discard block |
||
490 | 490 | '4.3.0' |
491 | 491 | ); |
492 | 492 | } |
493 | - self::$_settings[ $addon_name ] = $addon_settings; |
|
493 | + self::$_settings[$addon_name] = $addon_settings; |
|
494 | 494 | } |
495 | 495 | // we need cars |
496 | - if ( ! empty( self::$_settings[ $addon_name ]['autoloader_paths'] ) ) { |
|
496 | + if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) { |
|
497 | 497 | // setup autoloader for single file |
498 | - EEH_Autoloader::instance()->register_autoloader( self::$_settings[ $addon_name ]['autoloader_paths'] ); |
|
498 | + EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']); |
|
499 | 499 | } |
500 | 500 | // setup autoloaders for folders |
501 | - if ( ! empty( self::$_settings[ $addon_name ]['autoloader_folders'] ) ) { |
|
502 | - foreach ( self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder ) { |
|
503 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $autoloader_folder ); |
|
501 | + if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) { |
|
502 | + foreach (self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) { |
|
503 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder); |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | // register new models |
507 | 507 | if ( |
508 | - ! empty( self::$_settings[ $addon_name ]['model_paths'] ) |
|
509 | - || ! empty( self::$_settings[ $addon_name ]['class_paths'] ) |
|
508 | + ! empty(self::$_settings[$addon_name]['model_paths']) |
|
509 | + || ! empty(self::$_settings[$addon_name]['class_paths']) |
|
510 | 510 | ) { |
511 | 511 | EE_Register_Model::register( |
512 | 512 | $addon_name, |
513 | 513 | array( |
514 | - 'model_paths' => self::$_settings[ $addon_name ]['model_paths'], |
|
515 | - 'class_paths' => self::$_settings[ $addon_name ]['class_paths'], |
|
514 | + 'model_paths' => self::$_settings[$addon_name]['model_paths'], |
|
515 | + 'class_paths' => self::$_settings[$addon_name]['class_paths'], |
|
516 | 516 | ) |
517 | 517 | ); |
518 | 518 | } |
519 | 519 | // register model extensions |
520 | 520 | if ( |
521 | - ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) |
|
522 | - || ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] ) |
|
521 | + ! empty(self::$_settings[$addon_name]['model_extension_paths']) |
|
522 | + || ! empty(self::$_settings[$addon_name]['class_extension_paths']) |
|
523 | 523 | ) { |
524 | 524 | EE_Register_Model_Extensions::register( |
525 | 525 | $addon_name, |
526 | 526 | array( |
527 | - 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'], |
|
528 | - 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths'], |
|
527 | + 'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], |
|
528 | + 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'], |
|
529 | 529 | ) |
530 | 530 | ); |
531 | 531 | } |
532 | 532 | // setup DMS |
533 | - if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] ) ) { |
|
533 | + if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) { |
|
534 | 534 | EE_Register_Data_Migration_Scripts::register( |
535 | 535 | $addon_name, |
536 | - array( 'dms_paths' => self::$_settings[ $addon_name ]['dms_paths'] ) |
|
536 | + array('dms_paths' => self::$_settings[$addon_name]['dms_paths']) |
|
537 | 537 | ); |
538 | 538 | } |
539 | 539 | // if config_class is present let's register config. |
540 | - if ( ! empty( self::$_settings[ $addon_name ]['config_class'] ) ) { |
|
540 | + if ( ! empty(self::$_settings[$addon_name]['config_class'])) { |
|
541 | 541 | EE_Register_Config::register( |
542 | - self::$_settings[ $addon_name ]['config_class'], |
|
542 | + self::$_settings[$addon_name]['config_class'], |
|
543 | 543 | array( |
544 | - 'config_section' => self::$_settings[ $addon_name ]['config_section'], |
|
545 | - 'config_name' => self::$_settings[ $addon_name ]['config_name'], |
|
544 | + 'config_section' => self::$_settings[$addon_name]['config_section'], |
|
545 | + 'config_name' => self::$_settings[$addon_name]['config_name'], |
|
546 | 546 | ) |
547 | 547 | ); |
548 | 548 | } |
549 | 549 | // register admin page |
550 | - if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] ) ) { |
|
550 | + if ( ! empty(self::$_settings[$addon_name]['admin_path'])) { |
|
551 | 551 | EE_Register_Admin_Page::register( |
552 | 552 | $addon_name, |
553 | - array( 'page_path' => self::$_settings[ $addon_name ]['admin_path'] ) |
|
553 | + array('page_path' => self::$_settings[$addon_name]['admin_path']) |
|
554 | 554 | ); |
555 | 555 | } |
556 | 556 | // add to list of modules to be registered |
557 | - if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] ) ) { |
|
557 | + if ( ! empty(self::$_settings[$addon_name]['module_paths'])) { |
|
558 | 558 | EE_Register_Module::register( |
559 | 559 | $addon_name, |
560 | - array( 'module_paths' => self::$_settings[ $addon_name ]['module_paths'] ) |
|
560 | + array('module_paths' => self::$_settings[$addon_name]['module_paths']) |
|
561 | 561 | ); |
562 | 562 | } |
563 | 563 | // add to list of shortcodes to be registered |
564 | - if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] ) ) { |
|
564 | + if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) { |
|
565 | 565 | EE_Register_Shortcode::register( |
566 | 566 | $addon_name, |
567 | - array( 'shortcode_paths' => self::$_settings[ $addon_name ]['shortcode_paths'] ) |
|
567 | + array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']) |
|
568 | 568 | ); |
569 | 569 | } |
570 | 570 | // add to list of widgets to be registered |
571 | - if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] ) ) { |
|
571 | + if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) { |
|
572 | 572 | EE_Register_Widget::register( |
573 | 573 | $addon_name, |
574 | - array( 'widget_paths' => self::$_settings[ $addon_name ]['widget_paths'] ) |
|
574 | + array('widget_paths' => self::$_settings[$addon_name]['widget_paths']) |
|
575 | 575 | ); |
576 | 576 | } |
577 | 577 | //register capability related stuff. |
578 | - if ( ! empty( self::$_settings[ $addon_name ]['capabilities'] ) ) { |
|
578 | + if ( ! empty(self::$_settings[$addon_name]['capabilities'])) { |
|
579 | 579 | EE_Register_Capabilities::register( |
580 | 580 | $addon_name, |
581 | 581 | array( |
582 | - 'capabilities' => self::$_settings[ $addon_name ]['capabilities'], |
|
583 | - 'capability_maps' => self::$_settings[ $addon_name ]['capability_maps'], |
|
582 | + 'capabilities' => self::$_settings[$addon_name]['capabilities'], |
|
583 | + 'capability_maps' => self::$_settings[$addon_name]['capability_maps'], |
|
584 | 584 | ) |
585 | 585 | ); |
586 | 586 | } |
587 | 587 | //any message type to register? |
588 | - if ( ! empty( self::$_settings[ $addon_name ]['message_types'] ) ) { |
|
588 | + if ( ! empty(self::$_settings[$addon_name]['message_types'])) { |
|
589 | 589 | add_action( |
590 | 590 | 'EE_Brewing_Regular___messages_caf', |
591 | - array( 'EE_Register_Addon', 'register_message_types' ) |
|
591 | + array('EE_Register_Addon', 'register_message_types') |
|
592 | 592 | ); |
593 | 593 | } |
594 | 594 | // if plugin update engine is being used for auto-updates (not needed if PUE is not being used) |
595 | - if ( ! empty( $setup_args['pue_options'] ) ) { |
|
596 | - self::$_settings[ $addon_name ]['pue_options'] = array( |
|
597 | - 'pue_plugin_slug' => isset( $setup_args['pue_options']['pue_plugin_slug'] ) |
|
595 | + if ( ! empty($setup_args['pue_options'])) { |
|
596 | + self::$_settings[$addon_name]['pue_options'] = array( |
|
597 | + 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug']) |
|
598 | 598 | ? (string) $setup_args['pue_options']['pue_plugin_slug'] |
599 | - : 'espresso_' . strtolower( $class_name ), |
|
600 | - 'plugin_basename' => isset( $setup_args['pue_options']['plugin_basename'] ) |
|
599 | + : 'espresso_'.strtolower($class_name), |
|
600 | + 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) |
|
601 | 601 | ? (string) $setup_args['pue_options']['plugin_basename'] |
602 | - : plugin_basename( self::$_settings[ $addon_name ]['main_file_path'] ), |
|
603 | - 'checkPeriod' => isset( $setup_args['pue_options']['checkPeriod'] ) |
|
602 | + : plugin_basename(self::$_settings[$addon_name]['main_file_path']), |
|
603 | + 'checkPeriod' => isset($setup_args['pue_options']['checkPeriod']) |
|
604 | 604 | ? (string) $setup_args['pue_options']['checkPeriod'] |
605 | 605 | : '24', |
606 | - 'use_wp_update' => isset( $setup_args['pue_options']['use_wp_update'] ) |
|
606 | + 'use_wp_update' => isset($setup_args['pue_options']['use_wp_update']) |
|
607 | 607 | ? (string) $setup_args['pue_options']['use_wp_update'] |
608 | 608 | : false, |
609 | 609 | ); |
610 | 610 | add_action( |
611 | 611 | 'AHEE__EE_System__brew_espresso__after_pue_init', |
612 | - array( 'EE_Register_Addon', 'load_pue_update' ) |
|
612 | + array('EE_Register_Addon', 'load_pue_update') |
|
613 | 613 | ); |
614 | 614 | } |
615 | 615 | //any custom post type/ custom capabilities or default terms to register |
616 | 616 | if ( |
617 | - ! empty( self::$_settings[ $addon_name ]['custom_post_types'] ) |
|
618 | - || ! empty( self::$_settings[ $addon_name ]['custom_taxonomies'] ) |
|
617 | + ! empty(self::$_settings[$addon_name]['custom_post_types']) |
|
618 | + || ! empty(self::$_settings[$addon_name]['custom_taxonomies']) |
|
619 | 619 | ) { |
620 | 620 | EE_Register_CPT::register( |
621 | 621 | $addon_name, |
622 | 622 | array( |
623 | - 'cpts' => self::$_settings[ $addon_name ]['custom_post_types'], |
|
624 | - 'cts' => self::$_settings[ $addon_name ]['custom_taxonomies'], |
|
625 | - 'default_terms' => self::$_settings[ $addon_name ]['default_terms'], |
|
623 | + 'cpts' => self::$_settings[$addon_name]['custom_post_types'], |
|
624 | + 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], |
|
625 | + 'default_terms' => self::$_settings[$addon_name]['default_terms'], |
|
626 | 626 | ) |
627 | 627 | ); |
628 | 628 | } |
629 | - if ( ! empty( self::$_settings[ $addon_name ]['payment_method_paths'] ) ) { |
|
629 | + if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) { |
|
630 | 630 | EE_Register_Payment_Method::register( |
631 | 631 | $addon_name, |
632 | - array( 'payment_method_paths' => self::$_settings[ $addon_name ]['payment_method_paths'] ) |
|
632 | + array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']) |
|
633 | 633 | ); |
634 | 634 | } |
635 | 635 | // load and instantiate main addon class |
636 | - $addon = self::_load_and_init_addon_class( $addon_name ); |
|
636 | + $addon = self::_load_and_init_addon_class($addon_name); |
|
637 | 637 | // call any additional admin_callback functions during load_admin_controller hook |
638 | - if ( ! empty( self::$_settings[ $addon_name ]['admin_callback'] ) ) { |
|
638 | + if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) { |
|
639 | 639 | add_action( |
640 | 640 | 'AHEE__EE_System__load_controllers__load_admin_controllers', |
641 | - array( $addon, self::$_settings[ $addon_name ]['admin_callback'] ) |
|
641 | + array($addon, self::$_settings[$addon_name]['admin_callback']) |
|
642 | 642 | ); |
643 | 643 | } |
644 | 644 | } |
@@ -651,25 +651,25 @@ discard block |
||
651 | 651 | * @param string $addon_name |
652 | 652 | * @return EE_Addon |
653 | 653 | */ |
654 | - private static function _load_and_init_addon_class( $addon_name ) { |
|
654 | + private static function _load_and_init_addon_class($addon_name) { |
|
655 | 655 | $addon = EE_Registry::instance()->load_addon( |
656 | - dirname( self::$_settings[ $addon_name ]['main_file_path'] ), |
|
657 | - self::$_settings[ $addon_name ]['class_name'] |
|
656 | + dirname(self::$_settings[$addon_name]['main_file_path']), |
|
657 | + self::$_settings[$addon_name]['class_name'] |
|
658 | 658 | ); |
659 | - $addon->set_name( $addon_name ); |
|
660 | - $addon->set_plugin_slug( self::$_settings[ $addon_name ]['plugin_slug'] ); |
|
661 | - $addon->set_plugin_basename( self::$_settings[ $addon_name ]['plugin_basename'] ); |
|
662 | - $addon->set_main_plugin_file( self::$_settings[ $addon_name ]['main_file_path'] ); |
|
663 | - $addon->set_plugin_action_slug( self::$_settings[ $addon_name ]['plugin_action_slug'] ); |
|
664 | - $addon->set_plugins_page_row( self::$_settings[ $addon_name ]['plugins_page_row'] ); |
|
665 | - $addon->set_version( self::$_settings[ $addon_name ]['version'] ); |
|
666 | - $addon->set_min_core_version( self::_effective_version( self::$_settings[ $addon_name ]['min_core_version'] ) ); |
|
667 | - $addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] ); |
|
668 | - $addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] ); |
|
669 | - $addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] ); |
|
659 | + $addon->set_name($addon_name); |
|
660 | + $addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']); |
|
661 | + $addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']); |
|
662 | + $addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']); |
|
663 | + $addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']); |
|
664 | + $addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']); |
|
665 | + $addon->set_version(self::$_settings[$addon_name]['version']); |
|
666 | + $addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version'])); |
|
667 | + $addon->set_config_section(self::$_settings[$addon_name]['config_section']); |
|
668 | + $addon->set_config_class(self::$_settings[$addon_name]['config_class']); |
|
669 | + $addon->set_config_name(self::$_settings[$addon_name]['config_name']); |
|
670 | 670 | //unfortunately this can't be hooked in upon construction, because we don't have |
671 | 671 | //the plugin mainfile's path upon construction. |
672 | - register_deactivation_hook( $addon->get_main_plugin_file(), array( $addon, 'deactivation' ) ); |
|
672 | + register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation')); |
|
673 | 673 | return $addon; |
674 | 674 | } |
675 | 675 | |
@@ -682,18 +682,18 @@ discard block |
||
682 | 682 | */ |
683 | 683 | public static function load_pue_update() { |
684 | 684 | // load PUE client |
685 | - require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php'; |
|
685 | + require_once EE_THIRD_PARTY.'pue'.DS.'pue-client.php'; |
|
686 | 686 | // cycle thru settings |
687 | - foreach ( self::$_settings as $settings ) { |
|
688 | - if ( ! empty( $settings['pue_options'] ) ) { |
|
687 | + foreach (self::$_settings as $settings) { |
|
688 | + if ( ! empty($settings['pue_options'])) { |
|
689 | 689 | // initiate the class and start the plugin update engine! |
690 | 690 | new PluginUpdateEngineChecker( |
691 | 691 | // host file URL |
692 | 692 | 'https://eventespresso.com', |
693 | 693 | // plugin slug(s) |
694 | 694 | array( |
695 | - 'premium' => array( 'p' => $settings['pue_options']['pue_plugin_slug'] ), |
|
696 | - 'prerelease' => array( 'beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr' ), |
|
695 | + 'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']), |
|
696 | + 'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr'), |
|
697 | 697 | ), |
698 | 698 | // options |
699 | 699 | array( |
@@ -721,9 +721,9 @@ discard block |
||
721 | 721 | * @throws \EE_Error |
722 | 722 | */ |
723 | 723 | public static function register_message_types() { |
724 | - foreach ( self::$_settings as $settings ) { |
|
725 | - foreach ( $settings['message_types'] as $message_type => $message_type_settings ) { |
|
726 | - EE_Register_Message_Type::register( $message_type, $message_type_settings ); |
|
724 | + foreach (self::$_settings as $settings) { |
|
725 | + foreach ($settings['message_types'] as $message_type => $message_type_settings) { |
|
726 | + EE_Register_Message_Type::register($message_type, $message_type_settings); |
|
727 | 727 | } |
728 | 728 | } |
729 | 729 | } |
@@ -738,73 +738,73 @@ discard block |
||
738 | 738 | * @throws EE_Error |
739 | 739 | * @return void |
740 | 740 | */ |
741 | - public static function deregister( $addon_name = null ) { |
|
742 | - if ( isset( self::$_settings[ $addon_name ] ) ) { |
|
743 | - $class_name = self::$_settings[ $addon_name ]['class_name']; |
|
744 | - if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] ) ) { |
|
741 | + public static function deregister($addon_name = null) { |
|
742 | + if (isset(self::$_settings[$addon_name])) { |
|
743 | + $class_name = self::$_settings[$addon_name]['class_name']; |
|
744 | + if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) { |
|
745 | 745 | // setup DMS |
746 | - EE_Register_Data_Migration_Scripts::deregister( $addon_name ); |
|
746 | + EE_Register_Data_Migration_Scripts::deregister($addon_name); |
|
747 | 747 | } |
748 | - if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] ) ) { |
|
748 | + if ( ! empty(self::$_settings[$addon_name]['admin_path'])) { |
|
749 | 749 | // register admin page |
750 | - EE_Register_Admin_Page::deregister( $addon_name ); |
|
750 | + EE_Register_Admin_Page::deregister($addon_name); |
|
751 | 751 | } |
752 | - if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] ) ) { |
|
752 | + if ( ! empty(self::$_settings[$addon_name]['module_paths'])) { |
|
753 | 753 | // add to list of modules to be registered |
754 | - EE_Register_Module::deregister( $addon_name ); |
|
754 | + EE_Register_Module::deregister($addon_name); |
|
755 | 755 | } |
756 | - if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] ) ) { |
|
756 | + if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) { |
|
757 | 757 | // add to list of shortcodes to be registered |
758 | - EE_Register_Shortcode::deregister( $addon_name ); |
|
758 | + EE_Register_Shortcode::deregister($addon_name); |
|
759 | 759 | } |
760 | - if ( ! empty( self::$_settings[ $addon_name ]['config_class'] ) ) { |
|
760 | + if ( ! empty(self::$_settings[$addon_name]['config_class'])) { |
|
761 | 761 | // if config_class present let's register config. |
762 | - EE_Register_Config::deregister( self::$_settings[ $addon_name ]['config_class'] ); |
|
762 | + EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']); |
|
763 | 763 | } |
764 | - if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] ) ) { |
|
764 | + if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) { |
|
765 | 765 | // add to list of widgets to be registered |
766 | - EE_Register_Widget::deregister( $addon_name ); |
|
766 | + EE_Register_Widget::deregister($addon_name); |
|
767 | 767 | } |
768 | - if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) |
|
768 | + if ( ! empty(self::$_settings[$addon_name]['model_paths']) |
|
769 | 769 | || |
770 | - ! empty( self::$_settings[ $addon_name ]['class_paths'] ) |
|
770 | + ! empty(self::$_settings[$addon_name]['class_paths']) |
|
771 | 771 | ) { |
772 | 772 | // add to list of shortcodes to be registered |
773 | - EE_Register_Model::deregister( $addon_name ); |
|
773 | + EE_Register_Model::deregister($addon_name); |
|
774 | 774 | } |
775 | - if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) |
|
775 | + if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) |
|
776 | 776 | || |
777 | - ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] ) |
|
777 | + ! empty(self::$_settings[$addon_name]['class_extension_paths']) |
|
778 | 778 | ) { |
779 | 779 | // add to list of shortcodes to be registered |
780 | - EE_Register_Model_Extensions::deregister( $addon_name ); |
|
780 | + EE_Register_Model_Extensions::deregister($addon_name); |
|
781 | 781 | } |
782 | - if ( ! empty( self::$_settings[ $addon_name ]['message_types'] ) ) { |
|
783 | - foreach ( self::$_settings[ $addon_name ]['message_types'] as $message_type => $message_type_settings ) |
|
782 | + if ( ! empty(self::$_settings[$addon_name]['message_types'])) { |
|
783 | + foreach (self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) |
|
784 | 784 | { |
785 | - EE_Register_Message_Type::deregister( $message_type ); |
|
785 | + EE_Register_Message_Type::deregister($message_type); |
|
786 | 786 | } |
787 | 787 | } |
788 | 788 | //deregister capabilities for addon |
789 | 789 | if ( |
790 | - ! empty( self::$_settings[ $addon_name ]['capabilities'] ) |
|
791 | - || ! empty( self::$_settings[ $addon_name ]['capability_maps'] ) |
|
790 | + ! empty(self::$_settings[$addon_name]['capabilities']) |
|
791 | + || ! empty(self::$_settings[$addon_name]['capability_maps']) |
|
792 | 792 | ) { |
793 | - EE_Register_Capabilities::deregister( $addon_name ); |
|
793 | + EE_Register_Capabilities::deregister($addon_name); |
|
794 | 794 | } |
795 | 795 | //deregister custom_post_types for addon |
796 | - if ( ! empty( self::$_settings[ $addon_name ]['custom_post_types'] ) ) { |
|
797 | - EE_Register_CPT::deregister( $addon_name ); |
|
796 | + if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) { |
|
797 | + EE_Register_CPT::deregister($addon_name); |
|
798 | 798 | } |
799 | 799 | remove_action( |
800 | - 'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(), |
|
801 | - array( EE_Registry::instance()->addons->{$class_name}, 'deactivation' ) |
|
800 | + 'deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(), |
|
801 | + array(EE_Registry::instance()->addons->{$class_name}, 'deactivation') |
|
802 | 802 | ); |
803 | 803 | remove_action( |
804 | 804 | 'AHEE__EE_System__perform_activations_upgrades_and_migrations', |
805 | - array( EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required' ) |
|
805 | + array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required') |
|
806 | 806 | ); |
807 | - unset( EE_Registry::instance()->addons->{$class_name}, self::$_settings[ $addon_name ] ); |
|
807 | + unset(EE_Registry::instance()->addons->{$class_name}, self::$_settings[$addon_name]); |
|
808 | 808 | } |
809 | 809 | } |
810 | 810 |