@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @final |
485 | 485 | * @access protected |
486 | - * @return void |
|
486 | + * @return false|null |
|
487 | 487 | */ |
488 | 488 | final protected function _page_setup() { |
489 | 489 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * All this method does is verify the incoming request and make sure that routes exist for it. We do this early so we know if we need to drop out. |
758 | 758 | * |
759 | 759 | * @access protected |
760 | - * @return void |
|
760 | + * @return false|null |
|
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | 763 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | /** |
820 | 820 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
821 | 821 | * @param string $route the route name we're verifying |
822 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
822 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
823 | 823 | */ |
824 | 824 | protected function _verify_route( $route ) { |
825 | 825 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -3411,7 +3411,7 @@ discard block |
||
3411 | 3411 | |
3412 | 3412 | |
3413 | 3413 | /** |
3414 | - * @return mixed |
|
3414 | + * @return string[] |
|
3415 | 3415 | */ |
3416 | 3416 | public function default_espresso_metaboxes() { |
3417 | 3417 | return $this->_default_espresso_metaboxes; |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | |
3430 | 3430 | |
3431 | 3431 | /** |
3432 | - * @return mixed |
|
3432 | + * @return string |
|
3433 | 3433 | */ |
3434 | 3434 | public function wp_page_slug() { |
3435 | 3435 | return $this->_wp_page_slug; |
@@ -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 |
@@ -2907,8 +2907,8 @@ discard block |
||
2907 | 2907 | */ |
2908 | 2908 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2909 | 2909 | if ( ! empty( $this->php->max_input_vars ) |
2910 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2910 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2912 | 2912 | ) { |
2913 | 2913 | return sprintf( |
2914 | 2914 | __( |
@@ -2952,22 +2952,22 @@ discard block |
||
2952 | 2952 | class EE_Tax_Config extends EE_Config_Base |
2953 | 2953 | { |
2954 | 2954 | |
2955 | - /* |
|
2955 | + /* |
|
2956 | 2956 | * flag to indicate whether or not to display ticket prices with the taxes included |
2957 | 2957 | * |
2958 | 2958 | * @var boolean $prices_displayed_including_taxes |
2959 | 2959 | */ |
2960 | - public $prices_displayed_including_taxes; |
|
2960 | + public $prices_displayed_including_taxes; |
|
2961 | 2961 | |
2962 | 2962 | |
2963 | 2963 | |
2964 | - /** |
|
2965 | - * class constructor |
|
2966 | - */ |
|
2967 | - public function __construct() |
|
2968 | - { |
|
2969 | - $this->prices_displayed_including_taxes = true; |
|
2970 | - } |
|
2964 | + /** |
|
2965 | + * class constructor |
|
2966 | + */ |
|
2967 | + public function __construct() |
|
2968 | + { |
|
2969 | + $this->prices_displayed_including_taxes = true; |
|
2970 | + } |
|
2971 | 2971 | } |
2972 | 2972 | |
2973 | 2973 |
@@ -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 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -148,20 +148,20 @@ discard block |
||
148 | 148 | * site was put into maintenance mode) |
149 | 149 | * @return EE_Config |
150 | 150 | */ |
151 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
152 | - if ( $hard_reset ) { |
|
151 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
152 | + if ($hard_reset) { |
|
153 | 153 | self::$_instance->_addon_option_names = array(); |
154 | 154 | self::$_instance->_initialize_config(); |
155 | 155 | self::$_instance->update_espresso_config(); |
156 | 156 | } |
157 | - if ( self::$_instance instanceof EE_Config ) { |
|
157 | + if (self::$_instance instanceof EE_Config) { |
|
158 | 158 | self::$_instance->update_addon_option_names(); |
159 | 159 | } |
160 | 160 | self::$_instance = null; |
161 | 161 | //we don't need to reset the static properties imo because those should |
162 | 162 | //only change when a module is added or removed. Currently we don't |
163 | 163 | //support removing a module during a request when it previously existed |
164 | - if ( $reinstantiate ) { |
|
164 | + if ($reinstantiate) { |
|
165 | 165 | return self::instance(); |
166 | 166 | } else { |
167 | 167 | return null; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @access private |
177 | 177 | */ |
178 | 178 | private function __construct() { |
179 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
179 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
180 | 180 | // setup empty config classes |
181 | 181 | $this->_initialize_config(); |
182 | 182 | // load existing EE site settings |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | // register shortcodes and modules |
187 | 187 | add_action( |
188 | 188 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
189 | - array( $this, 'register_shortcodes_and_modules' ), |
|
189 | + array($this, 'register_shortcodes_and_modules'), |
|
190 | 190 | 999 |
191 | 191 | ); |
192 | 192 | // initialize shortcodes and modules |
193 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
193 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
194 | 194 | // register widgets |
195 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
195 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
196 | 196 | // shutdown |
197 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
197 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
198 | 198 | // construct__end hook |
199 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
199 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
200 | 200 | // hardcoded hack |
201 | 201 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
202 | 202 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string current theme set. |
210 | 210 | */ |
211 | 211 | public static function get_current_theme() { |
212 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
212 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
213 | 213 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
214 | 214 | } |
215 | 215 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | private function _initialize_config() { |
225 | 225 | EE_Config::trim_log(); |
226 | 226 | //set defaults |
227 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
227 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
228 | 228 | $this->addons = new stdClass(); |
229 | 229 | // set _module_route_map |
230 | 230 | EE_Config::$_module_route_map = array(); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | private function _load_core_config() { |
246 | 246 | // load_core_config__start hook |
247 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
247 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
248 | 248 | $espresso_config = $this->get_espresso_config(); |
249 | - foreach ( $espresso_config as $config => $settings ) { |
|
249 | + foreach ($espresso_config as $config => $settings) { |
|
250 | 250 | // load_core_config__start hook |
251 | 251 | $settings = apply_filters( |
252 | 252 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -254,22 +254,22 @@ discard block |
||
254 | 254 | $config, |
255 | 255 | $this |
256 | 256 | ); |
257 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
258 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
257 | + if (is_object($settings) && property_exists($this, $config)) { |
|
258 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
259 | 259 | //call configs populate method to ensure any defaults are set for empty values. |
260 | - if ( method_exists( $settings, 'populate' ) ) { |
|
260 | + if (method_exists($settings, 'populate')) { |
|
261 | 261 | $this->{$config}->populate(); |
262 | 262 | } |
263 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
263 | + if (method_exists($settings, 'do_hooks')) { |
|
264 | 264 | $this->{$config}->do_hooks(); |
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
268 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
268 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
269 | 269 | $this->update_espresso_config(); |
270 | 270 | } |
271 | 271 | // load_core_config__end hook |
272 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
272 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -284,23 +284,23 @@ discard block |
||
284 | 284 | $this->core = $this->core instanceof EE_Core_Config |
285 | 285 | ? $this->core |
286 | 286 | : new EE_Core_Config(); |
287 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
287 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
288 | 288 | $this->organization = $this->organization instanceof EE_Organization_Config |
289 | 289 | ? $this->organization |
290 | 290 | : new EE_Organization_Config(); |
291 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
291 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
292 | 292 | $this->currency = $this->currency instanceof EE_Currency_Config |
293 | 293 | ? $this->currency |
294 | 294 | : new EE_Currency_Config(); |
295 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
295 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
296 | 296 | $this->registration = $this->registration instanceof EE_Registration_Config |
297 | 297 | ? $this->registration |
298 | 298 | : new EE_Registration_Config(); |
299 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
299 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
300 | 300 | $this->admin = $this->admin instanceof EE_Admin_Config |
301 | 301 | ? $this->admin |
302 | 302 | : new EE_Admin_Config(); |
303 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
303 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
304 | 304 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
305 | 305 | ? $this->template_settings |
306 | 306 | : new EE_Template_Config(); |
@@ -311,19 +311,19 @@ discard block |
||
311 | 311 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
312 | 312 | ? $this->map_settings |
313 | 313 | : new EE_Map_Config(); |
314 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
314 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
315 | 315 | $this->environment = $this->environment instanceof EE_Environment_Config |
316 | 316 | ? $this->environment |
317 | 317 | : new EE_Environment_Config(); |
318 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
318 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
319 | 319 | $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
320 | 320 | ? $this->tax_settings |
321 | 321 | : new EE_Tax_Config(); |
322 | - $this->tax_settings = apply_filters( 'FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings ); |
|
322 | + $this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings); |
|
323 | 323 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
324 | 324 | ? $this->gateway |
325 | 325 | : new EE_Gateway_Config(); |
326 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
326 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | // grab espresso configuration |
339 | 339 | return apply_filters( |
340 | 340 | 'FHEE__EE_Config__get_espresso_config__CFG', |
341 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
341 | + get_option(EE_Config::OPTION_NAME, array()) |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @param $old_value |
353 | 353 | * @param $value |
354 | 354 | */ |
355 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
355 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
356 | 356 | // make sure we're checking the ee config |
357 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
357 | + if ($option === EE_Config::OPTION_NAME) { |
|
358 | 358 | // run a loose comparison of the old value against the new value for type and properties, |
359 | 359 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
360 | - if ( $value != $old_value ) { |
|
360 | + if ($value != $old_value) { |
|
361 | 361 | // if they are NOT the same, then remove the hook, |
362 | 362 | // which means the subsequent update results will be based solely on the update query results |
363 | 363 | // the reason we do this is because, as stated above, |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | // the string it sees in the db looks the same as the new one it has been passed!!! |
373 | 373 | // This results in the query returning an "affected rows" value of ZERO, |
374 | 374 | // which gets returned immediately by WP update_option and looks like an error. |
375 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
375 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | } |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | */ |
387 | 387 | protected function _reset_espresso_addon_config() { |
388 | 388 | $this->_addon_option_names = array(); |
389 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
390 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
391 | - $config_class = get_class( $addon_config_obj ); |
|
392 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
393 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
389 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
390 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
391 | + $config_class = get_class($addon_config_obj); |
|
392 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
393 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
394 | 394 | } |
395 | 395 | $this->addons->{$addon_name} = null; |
396 | 396 | } |
@@ -406,22 +406,22 @@ discard block |
||
406 | 406 | * @param bool $add_error |
407 | 407 | * @return bool |
408 | 408 | */ |
409 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
409 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
410 | 410 | // don't allow config updates during WP heartbeats |
411 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
411 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
412 | 412 | return false; |
413 | 413 | } |
414 | 414 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
415 | 415 | //$clone = clone( self::$_instance ); |
416 | 416 | //self::$_instance = NULL; |
417 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
417 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
418 | 418 | $this->_reset_espresso_addon_config(); |
419 | 419 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
420 | 420 | // but BEFORE the actual update occurs |
421 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
421 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
422 | 422 | // now update "ee_config" |
423 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
424 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
423 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
424 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
425 | 425 | // if not saved... check if the hook we just added still exists; |
426 | 426 | // if it does, it means one of two things: |
427 | 427 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | // but just means no update occurred, so don't display an error to the user. |
433 | 433 | // BUT... if update_option returns FALSE, AND the hook is missing, |
434 | 434 | // then it means that something truly went wrong |
435 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
435 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
436 | 436 | // remove our action since we don't want it in the system anymore |
437 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
438 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
437 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
438 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
439 | 439 | //self::$_instance = $clone; |
440 | 440 | //unset( $clone ); |
441 | 441 | // if config remains the same or was updated successfully |
442 | - if ( $saved ) { |
|
443 | - if ( $add_success ) { |
|
442 | + if ($saved) { |
|
443 | + if ($add_success) { |
|
444 | 444 | EE_Error::add_success( |
445 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
445 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
446 | 446 | __FILE__, |
447 | 447 | __FUNCTION__, |
448 | 448 | __LINE__ |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | } |
451 | 451 | return true; |
452 | 452 | } else { |
453 | - if ( $add_error ) { |
|
453 | + if ($add_error) { |
|
454 | 454 | EE_Error::add_error( |
455 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
455 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
456 | 456 | __FILE__, |
457 | 457 | __FUNCTION__, |
458 | 458 | __LINE__ |
@@ -481,16 +481,16 @@ discard block |
||
481 | 481 | $name = '', |
482 | 482 | $config_class = '', |
483 | 483 | $config_obj = null, |
484 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
484 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
485 | 485 | $display_errors = true |
486 | 486 | ) { |
487 | 487 | try { |
488 | - foreach ( $tests_to_run as $test ) { |
|
489 | - switch ( $test ) { |
|
488 | + foreach ($tests_to_run as $test) { |
|
489 | + switch ($test) { |
|
490 | 490 | // TEST #1 : check that section was set |
491 | 491 | case 1 : |
492 | - if ( empty( $section ) ) { |
|
493 | - if ( $display_errors ) { |
|
492 | + if (empty($section)) { |
|
493 | + if ($display_errors) { |
|
494 | 494 | throw new EE_Error( |
495 | 495 | sprintf( |
496 | 496 | __( |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | break; |
507 | 507 | // TEST #2 : check that settings section exists |
508 | 508 | case 2 : |
509 | - if ( ! isset( $this->{$section} ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if ( ! isset($this->{$section} )) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | 512 | sprintf( |
513 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
513 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
514 | 514 | $section |
515 | 515 | ) |
516 | 516 | ); |
@@ -521,9 +521,9 @@ discard block |
||
521 | 521 | // TEST #3 : check that section is the proper format |
522 | 522 | case 3 : |
523 | 523 | if ( |
524 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
524 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
525 | 525 | ) { |
526 | - if ( $display_errors ) { |
|
526 | + if ($display_errors) { |
|
527 | 527 | throw new EE_Error( |
528 | 528 | sprintf( |
529 | 529 | __( |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | break; |
540 | 540 | // TEST #4 : check that config section name has been set |
541 | 541 | case 4 : |
542 | - if ( empty( $name ) ) { |
|
543 | - if ( $display_errors ) { |
|
542 | + if (empty($name)) { |
|
543 | + if ($display_errors) { |
|
544 | 544 | throw new EE_Error( |
545 | 545 | __( |
546 | 546 | 'No name has been provided for the specific configuration section.', |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | break; |
554 | 554 | // TEST #5 : check that a config class name has been set |
555 | 555 | case 5 : |
556 | - if ( empty( $config_class ) ) { |
|
557 | - if ( $display_errors ) { |
|
556 | + if (empty($config_class)) { |
|
557 | + if ($display_errors) { |
|
558 | 558 | throw new EE_Error( |
559 | 559 | __( |
560 | 560 | 'No class name has been provided for the specific configuration section.', |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | break; |
568 | 568 | // TEST #6 : verify config class is accessible |
569 | 569 | case 6 : |
570 | - if ( ! class_exists( $config_class ) ) { |
|
571 | - if ( $display_errors ) { |
|
570 | + if ( ! class_exists($config_class)) { |
|
571 | + if ($display_errors) { |
|
572 | 572 | throw new EE_Error( |
573 | 573 | sprintf( |
574 | 574 | __( |
@@ -584,11 +584,11 @@ discard block |
||
584 | 584 | break; |
585 | 585 | // TEST #7 : check that config has even been set |
586 | 586 | case 7 : |
587 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
588 | - if ( $display_errors ) { |
|
587 | + if ( ! isset($this->{$section}->{$name} )) { |
|
588 | + if ($display_errors) { |
|
589 | 589 | throw new EE_Error( |
590 | 590 | sprintf( |
591 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
591 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
592 | 592 | $section, |
593 | 593 | $name |
594 | 594 | ) |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | return false; |
598 | 598 | } else { |
599 | 599 | // and make sure it's not serialized |
600 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
600 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
601 | 601 | } |
602 | 602 | break; |
603 | 603 | // TEST #8 : check that config is the requested type |
604 | 604 | case 8 : |
605 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
606 | - if ( $display_errors ) { |
|
605 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
606 | + if ($display_errors) { |
|
607 | 607 | throw new EE_Error( |
608 | 608 | sprintf( |
609 | 609 | __( |
@@ -621,12 +621,12 @@ discard block |
||
621 | 621 | break; |
622 | 622 | // TEST #9 : verify config object |
623 | 623 | case 9 : |
624 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
625 | - if ( $display_errors ) { |
|
624 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
625 | + if ($display_errors) { |
|
626 | 626 | throw new EE_Error( |
627 | 627 | sprintf( |
628 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
629 | - print_r( $config_obj, true ) |
|
628 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
629 | + print_r($config_obj, true) |
|
630 | 630 | ) |
631 | 631 | ); |
632 | 632 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | break; |
636 | 636 | } |
637 | 637 | } |
638 | - } catch ( EE_Error $e ) { |
|
638 | + } catch (EE_Error $e) { |
|
639 | 639 | $e->get_error(); |
640 | 640 | } |
641 | 641 | // you have successfully run the gauntlet |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | * @param string $name |
653 | 653 | * @return string |
654 | 654 | */ |
655 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
656 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
655 | + private function _generate_config_option_name($section = '', $name = '') { |
|
656 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,10 +667,10 @@ discard block |
||
667 | 667 | * @param string $name |
668 | 668 | * @return string |
669 | 669 | */ |
670 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
671 | - return ! empty( $config_class ) |
|
670 | + private function _set_config_class($config_class = '', $name = '') { |
|
671 | + return ! empty($config_class) |
|
672 | 672 | ? $config_class |
673 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
673 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | |
@@ -685,36 +685,36 @@ discard block |
||
685 | 685 | * @param EE_Config_Base $config_obj |
686 | 686 | * @return EE_Config_Base |
687 | 687 | */ |
688 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
688 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
689 | 689 | // ensure config class is set to something |
690 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
690 | + $config_class = $this->_set_config_class($config_class, $name); |
|
691 | 691 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
692 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
692 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
693 | 693 | return null; |
694 | 694 | } |
695 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
695 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
696 | 696 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
697 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
698 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
697 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
698 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
699 | 699 | $this->update_addon_option_names(); |
700 | 700 | } |
701 | 701 | // verify the incoming config object but suppress errors |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
703 | 703 | $config_obj = new $config_class(); |
704 | 704 | } |
705 | - if ( get_option( $config_option_name ) ) { |
|
706 | - EE_Config::log( $config_option_name ); |
|
707 | - update_option( $config_option_name, $config_obj ); |
|
705 | + if (get_option($config_option_name)) { |
|
706 | + EE_Config::log($config_option_name); |
|
707 | + update_option($config_option_name, $config_obj); |
|
708 | 708 | $this->{$section}->{$name} = $config_obj; |
709 | 709 | return $this->{$section}->{$name}; |
710 | 710 | } else { |
711 | 711 | // create a wp-option for this config |
712 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
713 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
712 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
713 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
714 | 714 | return $this->{$section}->{$name}; |
715 | 715 | } else { |
716 | 716 | EE_Error::add_error( |
717 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
717 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
718 | 718 | __FILE__, |
719 | 719 | __FUNCTION__, |
720 | 720 | __LINE__ |
@@ -737,46 +737,46 @@ discard block |
||
737 | 737 | * @param bool $throw_errors |
738 | 738 | * @return bool |
739 | 739 | */ |
740 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
740 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
741 | 741 | // don't allow config updates during WP heartbeats |
742 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
742 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
743 | 743 | return false; |
744 | 744 | } |
745 | - $config_obj = maybe_unserialize( $config_obj ); |
|
745 | + $config_obj = maybe_unserialize($config_obj); |
|
746 | 746 | // get class name of the incoming object |
747 | - $config_class = get_class( $config_obj ); |
|
747 | + $config_class = get_class($config_obj); |
|
748 | 748 | // run tests 1-5 and 9 to verify config |
749 | 749 | if ( ! $this->_verify_config_params( |
750 | 750 | $section, |
751 | 751 | $name, |
752 | 752 | $config_class, |
753 | 753 | $config_obj, |
754 | - array( 1, 2, 3, 4, 7, 9 ) |
|
754 | + array(1, 2, 3, 4, 7, 9) |
|
755 | 755 | ) |
756 | 756 | ) { |
757 | 757 | return false; |
758 | 758 | } |
759 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
759 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
760 | 760 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
761 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
761 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
762 | 762 | // save new config to db |
763 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
763 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
764 | 764 | return true; |
765 | 765 | } |
766 | 766 | } else { |
767 | 767 | // first check if the record already exists |
768 | - $existing_config = get_option( $config_option_name ); |
|
769 | - $config_obj = serialize( $config_obj ); |
|
768 | + $existing_config = get_option($config_option_name); |
|
769 | + $config_obj = serialize($config_obj); |
|
770 | 770 | // just return if db record is already up to date (NOT type safe comparison) |
771 | - if ( $existing_config == $config_obj ) { |
|
771 | + if ($existing_config == $config_obj) { |
|
772 | 772 | $this->{$section}->{$name} = $config_obj; |
773 | 773 | return true; |
774 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
775 | - EE_Config::log( $config_option_name ); |
|
774 | + } else if (update_option($config_option_name, $config_obj)) { |
|
775 | + EE_Config::log($config_option_name); |
|
776 | 776 | // update wp-option for this config class |
777 | 777 | $this->{$section}->{$name} = $config_obj; |
778 | 778 | return true; |
779 | - } elseif ( $throw_errors ) { |
|
779 | + } elseif ($throw_errors) { |
|
780 | 780 | EE_Error::add_error( |
781 | 781 | sprintf( |
782 | 782 | __( |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | 'event_espresso' |
785 | 785 | ), |
786 | 786 | $config_class, |
787 | - 'EE_Config->' . $section . '->' . $name |
|
787 | + 'EE_Config->'.$section.'->'.$name |
|
788 | 788 | ), |
789 | 789 | __FILE__, |
790 | 790 | __FUNCTION__, |
@@ -806,34 +806,34 @@ discard block |
||
806 | 806 | * @param string $config_class |
807 | 807 | * @return mixed EE_Config_Base | NULL |
808 | 808 | */ |
809 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
809 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
810 | 810 | // ensure config class is set to something |
811 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
811 | + $config_class = $this->_set_config_class($config_class, $name); |
|
812 | 812 | // run tests 1-4, 6 and 7 to verify that all params have been set |
813 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
813 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
814 | 814 | return null; |
815 | 815 | } |
816 | 816 | // now test if the requested config object exists, but suppress errors |
817 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
817 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
818 | 818 | // config already exists, so pass it back |
819 | 819 | return $this->{$section}->{$name}; |
820 | 820 | } |
821 | 821 | // load config option from db if it exists |
822 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
822 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
823 | 823 | // verify the newly retrieved config object, but suppress errors |
824 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
824 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
825 | 825 | // config is good, so set it and pass it back |
826 | 826 | $this->{$section}->{$name} = $config_obj; |
827 | 827 | return $this->{$section}->{$name}; |
828 | 828 | } |
829 | 829 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
830 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
830 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
831 | 831 | // verify the newly created config object |
832 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
832 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
833 | 833 | return $this->{$section}->{$name}; |
834 | 834 | } else { |
835 | 835 | EE_Error::add_error( |
836 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
836 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
837 | 837 | __FILE__, |
838 | 838 | __FUNCTION__, |
839 | 839 | __LINE__ |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | * @param string $config_option_name |
852 | 852 | * @return mixed EE_Config_Base | FALSE |
853 | 853 | */ |
854 | - public function get_config_option( $config_option_name = '' ) { |
|
854 | + public function get_config_option($config_option_name = '') { |
|
855 | 855 | // retrieve the wp-option for this config class. |
856 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
857 | - if ( empty( $config_option ) ) { |
|
858 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
856 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
857 | + if (empty($config_option)) { |
|
858 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
859 | 859 | } |
860 | 860 | return $config_option; |
861 | 861 | } |
@@ -867,17 +867,17 @@ discard block |
||
867 | 867 | * |
868 | 868 | * @param string $config_option_name |
869 | 869 | */ |
870 | - public static function log( $config_option_name = '' ) { |
|
871 | - if ( ! empty( $config_option_name ) ) { |
|
872 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
870 | + public static function log($config_option_name = '') { |
|
871 | + if ( ! empty($config_option_name)) { |
|
872 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
873 | 873 | //copy incoming $_REQUEST and sanitize it so we can save it |
874 | 874 | $_request = $_REQUEST; |
875 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
876 | - $config_log[ (string) microtime( true ) ] = array( |
|
875 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
876 | + $config_log[(string) microtime(true)] = array( |
|
877 | 877 | 'config_name' => $config_option_name, |
878 | 878 | 'request' => $_request, |
879 | 879 | ); |
880 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
889 | 889 | */ |
890 | 890 | public static function trim_log() { |
891 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
892 | - $log_length = count( $config_log ); |
|
893 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
894 | - ksort( $config_log ); |
|
895 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
896 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
891 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
892 | + $log_length = count($config_log); |
|
893 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
894 | + ksort($config_log); |
|
895 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
896 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -908,14 +908,14 @@ discard block |
||
908 | 908 | * @return string |
909 | 909 | */ |
910 | 910 | public static function get_page_for_posts() { |
911 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
912 | - if ( ! $page_for_posts ) { |
|
911 | + $page_for_posts = get_option('page_for_posts'); |
|
912 | + if ( ! $page_for_posts) { |
|
913 | 913 | return 'posts'; |
914 | 914 | } |
915 | 915 | /** @type WPDB $wpdb */ |
916 | 916 | global $wpdb; |
917 | 917 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
918 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
918 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
@@ -971,17 +971,17 @@ discard block |
||
971 | 971 | ) |
972 | 972 | ) { |
973 | 973 | // grab list of installed widgets |
974 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
974 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
975 | 975 | // filter list of modules to register |
976 | 976 | $widgets_to_register = apply_filters( |
977 | 977 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
978 | 978 | $widgets_to_register |
979 | 979 | ); |
980 | - if ( ! empty( $widgets_to_register ) ) { |
|
980 | + if ( ! empty($widgets_to_register)) { |
|
981 | 981 | // cycle thru widget folders |
982 | - foreach ( $widgets_to_register as $widget_path ) { |
|
982 | + foreach ($widgets_to_register as $widget_path) { |
|
983 | 983 | // add to list of installed widget modules |
984 | - EE_Config::register_ee_widget( $widget_path ); |
|
984 | + EE_Config::register_ee_widget($widget_path); |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 | // filter list of installed modules |
@@ -1001,57 +1001,57 @@ discard block |
||
1001 | 1001 | * @param string $widget_path - full path up to and including widget folder |
1002 | 1002 | * @return void |
1003 | 1003 | */ |
1004 | - public static function register_ee_widget( $widget_path = null ) { |
|
1005 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
1004 | + public static function register_ee_widget($widget_path = null) { |
|
1005 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1006 | 1006 | $widget_ext = '.widget.php'; |
1007 | 1007 | // make all separators match |
1008 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
1008 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
1009 | 1009 | // does the file path INCLUDE the actual file name as part of the path ? |
1010 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
1010 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1011 | 1011 | // grab and shortcode file name from directory name and break apart at dots |
1012 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1012 | + $file_name = explode('.', basename($widget_path)); |
|
1013 | 1013 | // take first segment from file name pieces and remove class prefix if it exists |
1014 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1014 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1015 | 1015 | // sanitize shortcode directory name |
1016 | - $widget = sanitize_key( $widget ); |
|
1016 | + $widget = sanitize_key($widget); |
|
1017 | 1017 | // now we need to rebuild the shortcode path |
1018 | - $widget_path = explode( DS, $widget_path ); |
|
1018 | + $widget_path = explode(DS, $widget_path); |
|
1019 | 1019 | // remove last segment |
1020 | - array_pop( $widget_path ); |
|
1020 | + array_pop($widget_path); |
|
1021 | 1021 | // glue it back together |
1022 | - $widget_path = implode( DS, $widget_path ); |
|
1022 | + $widget_path = implode(DS, $widget_path); |
|
1023 | 1023 | } else { |
1024 | 1024 | // grab and sanitize widget directory name |
1025 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1025 | + $widget = sanitize_key(basename($widget_path)); |
|
1026 | 1026 | } |
1027 | 1027 | // create classname from widget directory name |
1028 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1028 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1029 | 1029 | // add class prefix |
1030 | - $widget_class = 'EEW_' . $widget; |
|
1030 | + $widget_class = 'EEW_'.$widget; |
|
1031 | 1031 | // does the widget exist ? |
1032 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1032 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1033 | 1033 | $msg = sprintf( |
1034 | 1034 | __( |
1035 | 1035 | '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', |
1036 | 1036 | 'event_espresso' |
1037 | 1037 | ), |
1038 | 1038 | $widget_class, |
1039 | - $widget_path . DS . $widget_class . $widget_ext |
|
1039 | + $widget_path.DS.$widget_class.$widget_ext |
|
1040 | 1040 | ); |
1041 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1041 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1042 | 1042 | return; |
1043 | 1043 | } |
1044 | 1044 | // load the widget class file |
1045 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1045 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1046 | 1046 | // verify that class exists |
1047 | - if ( ! class_exists( $widget_class ) ) { |
|
1048 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1049 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1047 | + if ( ! class_exists($widget_class)) { |
|
1048 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1049 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1050 | 1050 | return; |
1051 | 1051 | } |
1052 | - register_widget( $widget_class ); |
|
1052 | + register_widget($widget_class); |
|
1053 | 1053 | // add to array of registered widgets |
1054 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1054 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1064,17 +1064,17 @@ discard block |
||
1064 | 1064 | */ |
1065 | 1065 | private function _register_shortcodes() { |
1066 | 1066 | // grab list of installed shortcodes |
1067 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1067 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1068 | 1068 | // filter list of modules to register |
1069 | 1069 | $shortcodes_to_register = apply_filters( |
1070 | 1070 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1071 | 1071 | $shortcodes_to_register |
1072 | 1072 | ); |
1073 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1073 | + if ( ! empty($shortcodes_to_register)) { |
|
1074 | 1074 | // cycle thru shortcode folders |
1075 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1075 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1076 | 1076 | // add to list of installed shortcode modules |
1077 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1077 | + EE_Config::register_shortcode($shortcode_path); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | // filter list of installed modules |
@@ -1093,64 +1093,64 @@ discard block |
||
1093 | 1093 | * @param string $shortcode_path - full path up to and including shortcode folder |
1094 | 1094 | * @return bool |
1095 | 1095 | */ |
1096 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1097 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1096 | + public static function register_shortcode($shortcode_path = null) { |
|
1097 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1098 | 1098 | $shortcode_ext = '.shortcode.php'; |
1099 | 1099 | // make all separators match |
1100 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1100 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1101 | 1101 | // does the file path INCLUDE the actual file name as part of the path ? |
1102 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1102 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1103 | 1103 | // grab shortcode file name from directory name and break apart at dots |
1104 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1104 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1105 | 1105 | // take first segment from file name pieces and remove class prefix if it exists |
1106 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1107 | - ? substr( $shortcode_file[0], 4 ) |
|
1106 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1107 | + ? substr($shortcode_file[0], 4) |
|
1108 | 1108 | : $shortcode_file[0]; |
1109 | 1109 | // sanitize shortcode directory name |
1110 | - $shortcode = sanitize_key( $shortcode ); |
|
1110 | + $shortcode = sanitize_key($shortcode); |
|
1111 | 1111 | // now we need to rebuild the shortcode path |
1112 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1112 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1113 | 1113 | // remove last segment |
1114 | - array_pop( $shortcode_path ); |
|
1114 | + array_pop($shortcode_path); |
|
1115 | 1115 | // glue it back together |
1116 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1116 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1117 | 1117 | } else { |
1118 | 1118 | // we need to generate the filename based off of the folder name |
1119 | 1119 | // grab and sanitize shortcode directory name |
1120 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1121 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1120 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1121 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1122 | 1122 | } |
1123 | 1123 | // create classname from shortcode directory or file name |
1124 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1124 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1125 | 1125 | // add class prefix |
1126 | - $shortcode_class = 'EES_' . $shortcode; |
|
1126 | + $shortcode_class = 'EES_'.$shortcode; |
|
1127 | 1127 | // does the shortcode exist ? |
1128 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1128 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1129 | 1129 | $msg = sprintf( |
1130 | 1130 | __( |
1131 | 1131 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1132 | 1132 | 'event_espresso' |
1133 | 1133 | ), |
1134 | 1134 | $shortcode_class, |
1135 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1135 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | 1140 | // load the shortcode class file |
1141 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1141 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1142 | 1142 | // verify that class exists |
1143 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1143 | + if ( ! class_exists($shortcode_class)) { |
|
1144 | 1144 | $msg = sprintf( |
1145 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1145 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1146 | 1146 | $shortcode_class |
1147 | 1147 | ); |
1148 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1148 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1149 | 1149 | return false; |
1150 | 1150 | } |
1151 | - $shortcode = strtoupper( $shortcode ); |
|
1151 | + $shortcode = strtoupper($shortcode); |
|
1152 | 1152 | // add to array of registered shortcodes |
1153 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1153 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1154 | 1154 | return true; |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1164,22 +1164,22 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | private function _register_modules() { |
1166 | 1166 | // grab list of installed modules |
1167 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1167 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1168 | 1168 | // filter list of modules to register |
1169 | 1169 | $modules_to_register = apply_filters( |
1170 | 1170 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1171 | 1171 | $modules_to_register |
1172 | 1172 | ); |
1173 | - if ( ! empty( $modules_to_register ) ) { |
|
1173 | + if ( ! empty($modules_to_register)) { |
|
1174 | 1174 | // loop through folders |
1175 | - foreach ( $modules_to_register as $module_path ) { |
|
1175 | + foreach ($modules_to_register as $module_path) { |
|
1176 | 1176 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1177 | 1177 | if ( |
1178 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1179 | - && $module_path !== EE_MODULES . 'gateways' |
|
1178 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1179 | + && $module_path !== EE_MODULES.'gateways' |
|
1180 | 1180 | ) { |
1181 | 1181 | // add to list of installed modules |
1182 | - EE_Config::register_module( $module_path ); |
|
1182 | + EE_Config::register_module($module_path); |
|
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | } |
@@ -1199,39 +1199,39 @@ discard block |
||
1199 | 1199 | * @param string $module_path - full path up to and including module folder |
1200 | 1200 | * @return bool |
1201 | 1201 | */ |
1202 | - public static function register_module( $module_path = null ) { |
|
1203 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1202 | + public static function register_module($module_path = null) { |
|
1203 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1204 | 1204 | $module_ext = '.module.php'; |
1205 | 1205 | // make all separators match |
1206 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1206 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1207 | 1207 | // does the file path INCLUDE the actual file name as part of the path ? |
1208 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1208 | + if (strpos($module_path, $module_ext) !== false) { |
|
1209 | 1209 | // grab and shortcode file name from directory name and break apart at dots |
1210 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1210 | + $module_file = explode('.', basename($module_path)); |
|
1211 | 1211 | // now we need to rebuild the shortcode path |
1212 | - $module_path = explode( DS, $module_path ); |
|
1212 | + $module_path = explode(DS, $module_path); |
|
1213 | 1213 | // remove last segment |
1214 | - array_pop( $module_path ); |
|
1214 | + array_pop($module_path); |
|
1215 | 1215 | // glue it back together |
1216 | - $module_path = implode( DS, $module_path ) . DS; |
|
1216 | + $module_path = implode(DS, $module_path).DS; |
|
1217 | 1217 | // take first segment from file name pieces and sanitize it |
1218 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1218 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1219 | 1219 | // ensure class prefix is added |
1220 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1220 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1221 | 1221 | } else { |
1222 | 1222 | // we need to generate the filename based off of the folder name |
1223 | 1223 | // grab and sanitize module name |
1224 | - $module = strtolower( basename( $module_path ) ); |
|
1225 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1224 | + $module = strtolower(basename($module_path)); |
|
1225 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1226 | 1226 | // like trailingslashit() |
1227 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1227 | + $module_path = rtrim($module_path, DS).DS; |
|
1228 | 1228 | // create classname from module directory name |
1229 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1229 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1230 | 1230 | // add class prefix |
1231 | - $module_class = 'EED_' . $module; |
|
1231 | + $module_class = 'EED_'.$module; |
|
1232 | 1232 | } |
1233 | 1233 | // does the module exist ? |
1234 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1234 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1235 | 1235 | $msg = sprintf( |
1236 | 1236 | __( |
1237 | 1237 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1239,19 +1239,19 @@ discard block |
||
1239 | 1239 | ), |
1240 | 1240 | $module |
1241 | 1241 | ); |
1242 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1242 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1243 | 1243 | return false; |
1244 | 1244 | } |
1245 | 1245 | // load the module class file |
1246 | - require_once( $module_path . $module_class . $module_ext ); |
|
1246 | + require_once($module_path.$module_class.$module_ext); |
|
1247 | 1247 | // verify that class exists |
1248 | - if ( ! class_exists( $module_class ) ) { |
|
1249 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1250 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1248 | + if ( ! class_exists($module_class)) { |
|
1249 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1250 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1251 | 1251 | return false; |
1252 | 1252 | } |
1253 | 1253 | // add to array of registered modules |
1254 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1254 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1255 | 1255 | do_action( |
1256 | 1256 | 'AHEE__EE_Config__register_module__complete', |
1257 | 1257 | $module_class, |
@@ -1271,26 +1271,26 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | private function _initialize_shortcodes() { |
1273 | 1273 | // cycle thru shortcode folders |
1274 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1274 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1275 | 1275 | // add class prefix |
1276 | - $shortcode_class = 'EES_' . $shortcode; |
|
1276 | + $shortcode_class = 'EES_'.$shortcode; |
|
1277 | 1277 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1278 | 1278 | // which set hooks ? |
1279 | - if ( is_admin() ) { |
|
1279 | + if (is_admin()) { |
|
1280 | 1280 | // fire immediately |
1281 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1281 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1282 | 1282 | } else { |
1283 | 1283 | // delay until other systems are online |
1284 | 1284 | add_action( |
1285 | 1285 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1286 | - array( $shortcode_class, 'set_hooks' ) |
|
1286 | + array($shortcode_class, 'set_hooks') |
|
1287 | 1287 | ); |
1288 | 1288 | // convert classname to UPPERCASE and create WP shortcode. |
1289 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1289 | + $shortcode_tag = strtoupper($shortcode); |
|
1290 | 1290 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1291 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1291 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1292 | 1292 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1293 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1293 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1294 | 1294 | } |
1295 | 1295 | } |
1296 | 1296 | } |
@@ -1307,17 +1307,17 @@ discard block |
||
1307 | 1307 | */ |
1308 | 1308 | private function _initialize_modules() { |
1309 | 1309 | // cycle thru shortcode folders |
1310 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1310 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1311 | 1311 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1312 | 1312 | // which set hooks ? |
1313 | - if ( is_admin() ) { |
|
1313 | + if (is_admin()) { |
|
1314 | 1314 | // fire immediately |
1315 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1315 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1316 | 1316 | } else { |
1317 | 1317 | // delay until other systems are online |
1318 | 1318 | add_action( |
1319 | 1319 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1320 | - array( $module_class, 'set_hooks' ) |
|
1320 | + array($module_class, 'set_hooks') |
|
1321 | 1321 | ); |
1322 | 1322 | } |
1323 | 1323 | } |
@@ -1335,29 +1335,29 @@ discard block |
||
1335 | 1335 | * @param string $key - url param key indicating a route is being called |
1336 | 1336 | * @return bool |
1337 | 1337 | */ |
1338 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1339 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1340 | - $module = str_replace( 'EED_', '', $module ); |
|
1341 | - $module_class = 'EED_' . $module; |
|
1342 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1343 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1344 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1339 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1340 | + $module = str_replace('EED_', '', $module); |
|
1341 | + $module_class = 'EED_'.$module; |
|
1342 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1343 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1344 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1345 | 1345 | return false; |
1346 | 1346 | } |
1347 | - if ( empty( $route ) ) { |
|
1348 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1349 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1347 | + if (empty($route)) { |
|
1348 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1349 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1350 | 1350 | return false; |
1351 | 1351 | } |
1352 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1352 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1353 | 1353 | $msg = sprintf( |
1354 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1354 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1355 | 1355 | $route |
1356 | 1356 | ); |
1357 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1357 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1358 | 1358 | return false; |
1359 | 1359 | } |
1360 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1360 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1361 | 1361 | return true; |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1371,11 +1371,11 @@ discard block |
||
1371 | 1371 | * @param string $key - url param key indicating a route is being called |
1372 | 1372 | * @return string |
1373 | 1373 | */ |
1374 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1375 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1376 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1377 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1378 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1374 | + public static function get_route($route = null, $key = 'ee') { |
|
1375 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1376 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1377 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1378 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1379 | 1379 | } |
1380 | 1380 | return null; |
1381 | 1381 | } |
@@ -1405,49 +1405,49 @@ discard block |
||
1405 | 1405 | * @param string $key - url param key indicating a route is being called |
1406 | 1406 | * @return bool |
1407 | 1407 | */ |
1408 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1409 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1410 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1408 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1409 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1410 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1411 | 1411 | $msg = sprintf( |
1412 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1412 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1413 | 1413 | $route |
1414 | 1414 | ); |
1415 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1415 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1416 | 1416 | return false; |
1417 | 1417 | } |
1418 | - if ( empty( $forward ) ) { |
|
1419 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1420 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + if (empty($forward)) { |
|
1419 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1420 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1421 | 1421 | return false; |
1422 | 1422 | } |
1423 | - if ( is_array( $forward ) ) { |
|
1424 | - if ( ! isset( $forward[1] ) ) { |
|
1423 | + if (is_array($forward)) { |
|
1424 | + if ( ! isset($forward[1])) { |
|
1425 | 1425 | $msg = sprintf( |
1426 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1426 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1427 | 1427 | $route |
1428 | 1428 | ); |
1429 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1429 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1430 | 1430 | return false; |
1431 | 1431 | } |
1432 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1432 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1433 | 1433 | $msg = sprintf( |
1434 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1434 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1435 | 1435 | $forward[1], |
1436 | 1436 | $route |
1437 | 1437 | ); |
1438 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1438 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1439 | 1439 | return false; |
1440 | 1440 | } |
1441 | - } else if ( ! function_exists( $forward ) ) { |
|
1441 | + } else if ( ! function_exists($forward)) { |
|
1442 | 1442 | $msg = sprintf( |
1443 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1443 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1444 | 1444 | $forward, |
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 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1450 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1451 | 1451 | return true; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | * @param string $key - url param key indicating a route is being called |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1467 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1468 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1466 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1467 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1468 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1469 | 1469 | return apply_filters( |
1470 | 1470 | 'FHEE__EE_Config__get_forward', |
1471 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1471 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1472 | 1472 | $route, |
1473 | 1473 | $status |
1474 | 1474 | ); |
@@ -1490,17 +1490,17 @@ discard block |
||
1490 | 1490 | * @param string $key - url param key indicating a route is being called |
1491 | 1491 | * @return bool |
1492 | 1492 | */ |
1493 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1494 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1495 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1493 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1494 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1495 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1496 | 1496 | $msg = sprintf( |
1497 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1497 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1498 | 1498 | $route |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - if ( ! is_readable( $view ) ) { |
|
1503 | + if ( ! is_readable($view)) { |
|
1504 | 1504 | $msg = sprintf( |
1505 | 1505 | __( |
1506 | 1506 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1508,10 +1508,10 @@ discard block |
||
1508 | 1508 | ), |
1509 | 1509 | $view |
1510 | 1510 | ); |
1511 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1511 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1512 | 1512 | return false; |
1513 | 1513 | } |
1514 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1514 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1515 | 1515 | return true; |
1516 | 1516 | } |
1517 | 1517 | |
@@ -1527,12 +1527,12 @@ discard block |
||
1527 | 1527 | * @param string $key - url param key indicating a route is being called |
1528 | 1528 | * @return string |
1529 | 1529 | */ |
1530 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1531 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1532 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1530 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1531 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1532 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1533 | 1533 | return apply_filters( |
1534 | 1534 | 'FHEE__EE_Config__get_view', |
1535 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1535 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1536 | 1536 | $route, |
1537 | 1537 | $status |
1538 | 1538 | ); |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | |
1544 | 1544 | |
1545 | 1545 | public function update_addon_option_names() { |
1546 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1546 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | |
@@ -1571,22 +1571,22 @@ discard block |
||
1571 | 1571 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1572 | 1572 | * @throws \EE_Error |
1573 | 1573 | */ |
1574 | - public function get_pretty( $property ) { |
|
1575 | - if ( ! property_exists( $this, $property ) ) { |
|
1574 | + public function get_pretty($property) { |
|
1575 | + if ( ! property_exists($this, $property)) { |
|
1576 | 1576 | throw new EE_Error( |
1577 | 1577 | sprintf( |
1578 | 1578 | __( |
1579 | 1579 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1580 | 1580 | 'event_espresso' |
1581 | 1581 | ), |
1582 | - get_class( $this ), |
|
1582 | + get_class($this), |
|
1583 | 1583 | $property |
1584 | 1584 | ) |
1585 | 1585 | ); |
1586 | 1586 | } |
1587 | 1587 | //just handling escaping of strings for now. |
1588 | - if ( is_string( $this->{$property} ) ) { |
|
1589 | - return stripslashes( $this->{$property} ); |
|
1588 | + if (is_string($this->{$property} )) { |
|
1589 | + return stripslashes($this->{$property} ); |
|
1590 | 1590 | } |
1591 | 1591 | return $this->{$property}; |
1592 | 1592 | } |
@@ -1595,17 +1595,17 @@ discard block |
||
1595 | 1595 | |
1596 | 1596 | public function populate() { |
1597 | 1597 | //grab defaults via a new instance of this class. |
1598 | - $class_name = get_class( $this ); |
|
1598 | + $class_name = get_class($this); |
|
1599 | 1599 | $defaults = new $class_name; |
1600 | 1600 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1601 | 1601 | //default from our $defaults object. |
1602 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1603 | - if ( $this->{$property} === null ) { |
|
1602 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1603 | + if ($this->{$property} === null) { |
|
1604 | 1604 | $this->{$property} = $value; |
1605 | 1605 | } |
1606 | 1606 | } |
1607 | 1607 | //cleanup |
1608 | - unset( $defaults ); |
|
1608 | + unset($defaults); |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | * @param $a |
1622 | 1622 | * @return bool |
1623 | 1623 | */ |
1624 | - public function __isset( $a ) { |
|
1624 | + public function __isset($a) { |
|
1625 | 1625 | return false; |
1626 | 1626 | } |
1627 | 1627 | |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | * @param $a |
1634 | 1634 | * @return bool |
1635 | 1635 | */ |
1636 | - public function __unset( $a ) { |
|
1636 | + public function __unset($a) { |
|
1637 | 1637 | return false; |
1638 | 1638 | } |
1639 | 1639 | |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | $this->current_blog_id = get_current_blog_id(); |
1744 | 1744 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1745 | 1745 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1746 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1746 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1747 | 1747 | $this->post_shortcodes = array(); |
1748 | 1748 | $this->module_route_map = array(); |
1749 | 1749 | $this->module_forward_map = array(); |
@@ -1759,9 +1759,9 @@ discard block |
||
1759 | 1759 | $this->thank_you_page_url = ''; |
1760 | 1760 | $this->cancel_page_url = ''; |
1761 | 1761 | //cpt slugs |
1762 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1762 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1763 | 1763 | //ueip constant check |
1764 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1764 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1765 | 1765 | $this->ee_ueip_optin = false; |
1766 | 1766 | $this->ee_ueip_has_notified = true; |
1767 | 1767 | } |
@@ -1804,11 +1804,11 @@ discard block |
||
1804 | 1804 | * @return string |
1805 | 1805 | */ |
1806 | 1806 | public function reg_page_url() { |
1807 | - if ( ! $this->reg_page_url ) { |
|
1807 | + if ( ! $this->reg_page_url) { |
|
1808 | 1808 | $this->reg_page_url = add_query_arg( |
1809 | - array( 'uts' => time() ), |
|
1810 | - get_permalink( $this->reg_page_id ) |
|
1811 | - ) . '#checkout'; |
|
1809 | + array('uts' => time()), |
|
1810 | + get_permalink($this->reg_page_id) |
|
1811 | + ).'#checkout'; |
|
1812 | 1812 | } |
1813 | 1813 | return $this->reg_page_url; |
1814 | 1814 | } |
@@ -1823,12 +1823,12 @@ discard block |
||
1823 | 1823 | * @access public |
1824 | 1824 | * @return string |
1825 | 1825 | */ |
1826 | - public function txn_page_url( $query_args = array() ) { |
|
1827 | - if ( ! $this->txn_page_url ) { |
|
1828 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1826 | + public function txn_page_url($query_args = array()) { |
|
1827 | + if ( ! $this->txn_page_url) { |
|
1828 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1829 | 1829 | } |
1830 | - if ( $query_args ) { |
|
1831 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1830 | + if ($query_args) { |
|
1831 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1832 | 1832 | } else { |
1833 | 1833 | return $this->txn_page_url; |
1834 | 1834 | } |
@@ -1844,12 +1844,12 @@ discard block |
||
1844 | 1844 | * @access public |
1845 | 1845 | * @return string |
1846 | 1846 | */ |
1847 | - public function thank_you_page_url( $query_args = array() ) { |
|
1848 | - if ( ! $this->thank_you_page_url ) { |
|
1849 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1847 | + public function thank_you_page_url($query_args = array()) { |
|
1848 | + if ( ! $this->thank_you_page_url) { |
|
1849 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1850 | 1850 | } |
1851 | - if ( $query_args ) { |
|
1852 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1851 | + if ($query_args) { |
|
1852 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1853 | 1853 | } else { |
1854 | 1854 | return $this->thank_you_page_url; |
1855 | 1855 | } |
@@ -1864,8 +1864,8 @@ discard block |
||
1864 | 1864 | * @return string |
1865 | 1865 | */ |
1866 | 1866 | public function cancel_page_url() { |
1867 | - if ( ! $this->cancel_page_url ) { |
|
1868 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1867 | + if ( ! $this->cancel_page_url) { |
|
1868 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1869 | 1869 | } |
1870 | 1870 | return $this->cancel_page_url; |
1871 | 1871 | } |
@@ -1894,22 +1894,22 @@ discard block |
||
1894 | 1894 | */ |
1895 | 1895 | protected function _get_main_ee_ueip_optin() { |
1896 | 1896 | //if this is the main site then we can just bypass our direct query. |
1897 | - if ( is_main_site() ) { |
|
1898 | - return get_option( 'ee_ueip_optin', false ); |
|
1897 | + if (is_main_site()) { |
|
1898 | + return get_option('ee_ueip_optin', false); |
|
1899 | 1899 | } |
1900 | 1900 | |
1901 | 1901 | //is this already cached for this request? If so use it. |
1902 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1902 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1903 | 1903 | return EE_Core_Config::$ee_ueip_option; |
1904 | 1904 | } |
1905 | 1905 | |
1906 | 1906 | global $wpdb; |
1907 | 1907 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1908 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1908 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1909 | 1909 | $option = 'ee_ueip_optin'; |
1910 | 1910 | |
1911 | 1911 | //set correct table for query |
1912 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1912 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1913 | 1913 | |
1914 | 1914 | |
1915 | 1915 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1917,20 +1917,20 @@ discard block |
||
1917 | 1917 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1918 | 1918 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1919 | 1919 | //for the purpose of caching. |
1920 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1921 | - if ( false !== $pre ) { |
|
1920 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1921 | + if (false !== $pre) { |
|
1922 | 1922 | EE_Core_Config::$ee_ueip_option = $pre; |
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1927 | - if ( is_object( $row ) ) { |
|
1926 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1927 | + if (is_object($row)) { |
|
1928 | 1928 | $value = $row->option_value; |
1929 | 1929 | } else { //option does not exist so use default. |
1930 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1930 | + return apply_filters('default_option_'.$option, false, $option); |
|
1931 | 1931 | } |
1932 | 1932 | |
1933 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1933 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1934 | 1934 | return EE_Core_Config::$ee_ueip_option; |
1935 | 1935 | } |
1936 | 1936 | |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | //reset all url properties |
1947 | 1947 | $this->_reset_urls(); |
1948 | 1948 | //return what to save to db |
1949 | - return array_keys( get_object_vars( $this ) ); |
|
1949 | + return array_keys(get_object_vars($this)); |
|
1950 | 1950 | } |
1951 | 1951 | |
1952 | 1952 | } |
@@ -2093,14 +2093,14 @@ discard block |
||
2093 | 2093 | */ |
2094 | 2094 | public function __construct() { |
2095 | 2095 | // set default organization settings |
2096 | - $this->name = get_bloginfo( 'name' ); |
|
2096 | + $this->name = get_bloginfo('name'); |
|
2097 | 2097 | $this->address_1 = '123 Onna Road'; |
2098 | 2098 | $this->address_2 = 'PO Box 123'; |
2099 | 2099 | $this->city = 'Inna City'; |
2100 | 2100 | $this->STA_ID = 4; |
2101 | 2101 | $this->CNT_ISO = 'US'; |
2102 | 2102 | $this->zip = '12345'; |
2103 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2103 | + $this->email = get_bloginfo('admin_email'); |
|
2104 | 2104 | $this->phone = ''; |
2105 | 2105 | $this->vat = '123456789'; |
2106 | 2106 | $this->logo_url = ''; |
@@ -2188,46 +2188,46 @@ discard block |
||
2188 | 2188 | * @param string $CNT_ISO |
2189 | 2189 | * @throws \EE_Error |
2190 | 2190 | */ |
2191 | - public function __construct( $CNT_ISO = '' ) { |
|
2191 | + public function __construct($CNT_ISO = '') { |
|
2192 | 2192 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2193 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2193 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2194 | 2194 | // get country code from organization settings or use default |
2195 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2195 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2196 | 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 |
2200 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2200 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2201 | 2201 | // 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 |
2202 | 2202 | if ( |
2203 | - ! empty( $CNT_ISO ) |
|
2203 | + ! empty($CNT_ISO) |
|
2204 | 2204 | && EE_Maintenance_Mode::instance()->models_can_query() |
2205 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2205 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2206 | 2206 | ) { |
2207 | 2207 | // retrieve the country settings from the db, just in case they have been customized |
2208 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2209 | - if ( $country instanceof EE_Country ) { |
|
2210 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | - $this->name = $country->currency_name_single(); // Dollar |
|
2212 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2208 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2209 | + if ($country instanceof EE_Country) { |
|
2210 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | + $this->name = $country->currency_name_single(); // Dollar |
|
2212 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2218 | 2218 | } |
2219 | 2219 | } |
2220 | 2220 | // fallback to hardcoded defaults, in case the above failed |
2221 | - if ( empty( $this->code ) ) { |
|
2221 | + if (empty($this->code)) { |
|
2222 | 2222 | // set default currency settings |
2223 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2225 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2226 | - $this->sign = '$'; // currency sign: $ |
|
2227 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2223 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2225 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2226 | + $this->sign = '$'; // currency sign: $ |
|
2227 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2231 | 2231 | } |
2232 | 2232 | } |
2233 | 2233 | } |
@@ -2389,7 +2389,7 @@ discard block |
||
2389 | 2389 | * @since 4.8.8.rc.019 |
2390 | 2390 | */ |
2391 | 2391 | public function do_hooks() { |
2392 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2392 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2393 | 2393 | } |
2394 | 2394 | |
2395 | 2395 | |
@@ -2398,7 +2398,7 @@ discard block |
||
2398 | 2398 | * @return void |
2399 | 2399 | */ |
2400 | 2400 | public function set_default_reg_status_on_EEM_Event() { |
2401 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2401 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | |
@@ -2502,10 +2502,10 @@ discard block |
||
2502 | 2502 | * @param bool $reset |
2503 | 2503 | * @return string |
2504 | 2504 | */ |
2505 | - public function log_file_name( $reset = false ) { |
|
2506 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2507 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2508 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2505 | + public function log_file_name($reset = false) { |
|
2506 | + if (empty($this->log_file_name) || $reset) { |
|
2507 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2508 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2509 | 2509 | } |
2510 | 2510 | return $this->log_file_name; |
2511 | 2511 | } |
@@ -2516,10 +2516,10 @@ discard block |
||
2516 | 2516 | * @param bool $reset |
2517 | 2517 | * @return string |
2518 | 2518 | */ |
2519 | - public function debug_file_name( $reset = false ) { |
|
2520 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2521 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2522 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2519 | + public function debug_file_name($reset = false) { |
|
2520 | + if (empty($this->debug_file_name) || $reset) { |
|
2521 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2522 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2523 | 2523 | } |
2524 | 2524 | return $this->debug_file_name; |
2525 | 2525 | } |
@@ -2530,7 +2530,7 @@ discard block |
||
2530 | 2530 | * @return string |
2531 | 2531 | */ |
2532 | 2532 | public function affiliate_id() { |
2533 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2533 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2534 | 2534 | } |
2535 | 2535 | |
2536 | 2536 | |
@@ -2710,21 +2710,21 @@ discard block |
||
2710 | 2710 | $this->use_google_maps = true; |
2711 | 2711 | $this->google_map_api_key = ''; |
2712 | 2712 | // for event details pages (reg page) |
2713 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2714 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2715 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2716 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2717 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2718 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2719 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2713 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2714 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2715 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2716 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2717 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2718 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2719 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2720 | 2720 | // for event list pages |
2721 | - $this->event_list_map_width = 300; // ee_map_width |
|
2722 | - $this->event_list_map_height = 185; // ee_map_height |
|
2723 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2724 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2725 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2726 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2727 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2721 | + $this->event_list_map_width = 300; // ee_map_width |
|
2722 | + $this->event_list_map_height = 185; // ee_map_height |
|
2723 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2724 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2725 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2726 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2727 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2728 | 2728 | } |
2729 | 2729 | |
2730 | 2730 | } |
@@ -2886,7 +2886,7 @@ discard block |
||
2886 | 2886 | * @return void |
2887 | 2887 | */ |
2888 | 2888 | protected function _set_php_values() { |
2889 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2889 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2890 | 2890 | $this->php->version = phpversion(); |
2891 | 2891 | } |
2892 | 2892 | |
@@ -2905,10 +2905,10 @@ discard block |
||
2905 | 2905 | * @type string $msg Any message to be displayed. |
2906 | 2906 | * } |
2907 | 2907 | */ |
2908 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2909 | - if ( ! empty( $this->php->max_input_vars ) |
|
2910 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2908 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2909 | + if ( ! empty($this->php->max_input_vars) |
|
2910 | + && ($input_count >= $this->php->max_input_vars) |
|
2911 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2912 | 2912 | ) { |
2913 | 2913 | return sprintf( |
2914 | 2914 | __( |
@@ -3004,7 +3004,7 @@ discard block |
||
3004 | 3004 | */ |
3005 | 3005 | public function __construct() { |
3006 | 3006 | $this->payment_settings = array(); |
3007 | - $this->active_gateways = array( 'Invoice' => false ); |
|
3007 | + $this->active_gateways = array('Invoice' => false); |
|
3008 | 3008 | } |
3009 | 3009 | } |
3010 | 3010 |
@@ -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_Default_Line_Item_Display_Strategy |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Default_Line_Item_Display_Strategy |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class EE_Default_Line_Item_Display_Strategy implements EEI_Line_Item_Display { |
16 | 16 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // quantity td |
165 | 165 | $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | - && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
167 | + && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
168 | 168 | ? 1 + ( $this->_tax_rate / 100 ) |
169 | 169 | : 1; |
170 | 170 | // price td |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param array $options |
58 | 58 | * @return mixed |
59 | 59 | */ |
60 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
60 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
61 | 61 | |
62 | 62 | $html = ''; |
63 | 63 | // set some default options and merge with incoming |
64 | 64 | $default_options = array( |
65 | - 'show_desc' => TRUE, // TRUE FALSE |
|
65 | + 'show_desc' => TRUE, // TRUE FALSE |
|
66 | 66 | 'odd' => FALSE |
67 | 67 | ); |
68 | - $options = array_merge( $default_options, (array)$options ); |
|
68 | + $options = array_merge($default_options, (array) $options); |
|
69 | 69 | |
70 | - switch( $line_item->type() ) { |
|
70 | + switch ($line_item->type()) { |
|
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_line_item: |
73 | 73 | // item row |
74 | - $html .= $this->_item_row( $line_item, $options ); |
|
74 | + $html .= $this->_item_row($line_item, $options); |
|
75 | 75 | // got any kids? |
76 | - foreach ( $line_item->children() as $child_line_item ) { |
|
77 | - $this->display_line_item( $child_line_item, $options ); |
|
76 | + foreach ($line_item->children() as $child_line_item) { |
|
77 | + $this->display_line_item($child_line_item, $options); |
|
78 | 78 | } |
79 | 79 | break; |
80 | 80 | |
81 | 81 | case EEM_Line_Item::type_sub_line_item: |
82 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
82 | + $html .= $this->_sub_item_row($line_item, $options); |
|
83 | 83 | break; |
84 | 84 | |
85 | 85 | case EEM_Line_Item::type_sub_total: |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | break; |
91 | 91 | |
92 | 92 | case EEM_Line_Item::type_tax_sub_total: |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
95 | 95 | // recursively feed children back into this method |
96 | - $this->display_line_item( $child_line_item, $options ); |
|
96 | + $this->display_line_item($child_line_item, $options); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | break; |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | case EEM_Line_Item::type_total: |
102 | 102 | // get all child line items |
103 | 103 | $children = $line_item->children(); |
104 | - if ( $options[ 'set_tax_rate' ] === true ) { |
|
104 | + if ($options['set_tax_rate'] === true) { |
|
105 | 105 | // loop thru tax child line items just to determine tax rate |
106 | - foreach ( $children as $child_line_item ) { |
|
107 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
106 | + foreach ($children as $child_line_item) { |
|
107 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
108 | 108 | // recursively feed children back into this method |
109 | - $this->display_line_item( $child_line_item, $options ); |
|
109 | + $this->display_line_item($child_line_item, $options); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | // now loop thru all non-tax child line items |
114 | - foreach ( $children as $child_line_item ) { |
|
115 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
114 | + foreach ($children as $child_line_item) { |
|
115 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
116 | 116 | // recursively feed children back into this method |
117 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
117 | + $html .= $this->display_line_item($child_line_item, $options); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @param array $options |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
137 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
138 | 138 | // start of row |
139 | 139 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
140 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
140 | + $html = EEH_HTML::tr('', '', $row_class); |
|
141 | 141 | // name && desc |
142 | 142 | $name_and_desc = apply_filters( |
143 | 143 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
@@ -146,33 +146,33 @@ discard block |
||
146 | 146 | ); |
147 | 147 | $name_and_desc .= apply_filters( |
148 | 148 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
149 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
149 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
150 | 150 | $line_item, |
151 | 151 | $options |
152 | 152 | ); |
153 | - if ( $line_item->is_taxable() ) { |
|
153 | + if ($line_item->is_taxable()) { |
|
154 | 154 | $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
155 | - ? __( '* price includes taxes', 'event_espresso' ) |
|
156 | - : __( '* price does not include taxes', 'event_espresso' ); |
|
155 | + ? __('* price includes taxes', 'event_espresso') |
|
156 | + : __('* price does not include taxes', 'event_espresso'); |
|
157 | 157 | $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
158 | 158 | . $ticket_price_includes_taxes |
159 | 159 | . '</span>'; |
160 | 160 | } |
161 | 161 | |
162 | 162 | // name td |
163 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
163 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
164 | 164 | // quantity td |
165 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
165 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | 167 | && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
168 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
168 | + ? 1 + ($this->_tax_rate / 100) |
|
169 | 169 | : 1; |
170 | 170 | // price td |
171 | - $unit_price = EEH_Template::format_currency( $line_item->unit_price() * $tax_rate, false, false ); |
|
172 | - $html .= EEH_HTML::td( $unit_price, '', 'item_c jst-rght' ); |
|
171 | + $unit_price = EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false); |
|
172 | + $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
173 | 173 | // total td |
174 | - $total = EEH_Template::format_currency( $line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false ); |
|
175 | - $html .= EEH_HTML::td( $total, '', 'item_r jst-rght' ); |
|
174 | + $total = EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false); |
|
175 | + $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
176 | 176 | // end of row |
177 | 177 | $html .= EEH_HTML::trx(); |
178 | 178 | |
@@ -188,22 +188,22 @@ discard block |
||
188 | 188 | * @param array $options |
189 | 189 | * @return mixed |
190 | 190 | */ |
191 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
191 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
192 | 192 | // start of row |
193 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
193 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
194 | 194 | // name && desc |
195 | 195 | $name_and_desc = $line_item->name(); |
196 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
196 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
197 | 197 | // name td |
198 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
198 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
199 | 199 | // discount/surcharge td |
200 | - if ( $line_item->is_percent() ) { |
|
201 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
200 | + if ($line_item->is_percent()) { |
|
201 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
202 | 202 | } else { |
203 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
203 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
204 | 204 | } |
205 | 205 | // total td |
206 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
206 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
207 | 207 | // end of row |
208 | 208 | $html .= EEH_HTML::trx(); |
209 | 209 | return $html; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * an array for storing request actions and their corresponding methods |
81 | - * @access private |
|
82 | - * @return void |
|
83 | - */ |
|
81 | + * @access private |
|
82 | + * @return void |
|
83 | + */ |
|
84 | 84 | protected function _set_page_routes() { |
85 | 85 | $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
86 | 86 | $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | 'capability' => 'ee_delete_default_price_type', |
186 | 186 | 'obj_id' => $prt_id |
187 | 187 | ), |
188 | - 'tax_settings' => array( |
|
189 | - 'func' => '_tax_settings', |
|
190 | - 'capability' => 'manage_options' |
|
191 | - ), |
|
192 | - 'update_tax_settings' => array( |
|
193 | - 'func' => '_update_tax_settings', |
|
194 | - 'capability' => 'manage_options', |
|
195 | - 'noheader' => true |
|
196 | - ), |
|
197 | - ); |
|
188 | + 'tax_settings' => array( |
|
189 | + 'func' => '_tax_settings', |
|
190 | + 'capability' => 'manage_options' |
|
191 | + ), |
|
192 | + 'update_tax_settings' => array( |
|
193 | + 'func' => '_update_tax_settings', |
|
194 | + 'capability' => 'manage_options', |
|
195 | + 'noheader' => true |
|
196 | + ), |
|
197 | + ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'order' => 10 |
210 | 210 | ), |
211 | 211 | 'list_table' => 'Prices_List_Table', |
212 | - 'help_tabs' => array( |
|
212 | + 'help_tabs' => array( |
|
213 | 213 | 'pricing_default_pricing_help_tab' => array( |
214 | 214 | 'title' => __('Default Pricing', 'event_espresso'), |
215 | 215 | 'filename' => 'pricing_default_pricing' |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | 'order' => 20, |
233 | 233 | 'persistent' => FALSE |
234 | 234 | ), |
235 | - 'help_tabs' => array( |
|
235 | + 'help_tabs' => array( |
|
236 | 236 | 'add_new_default_price_help_tab' => array( |
237 | 237 | 'title' => __('Add New Default Price', 'event_espresso'), |
238 | 238 | 'filename' => 'pricing_add_new_default_price' |
239 | 239 | ) |
240 | 240 | ), |
241 | - 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
241 | + 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
242 | 242 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | 252 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
253 | - 'help_tabs' => array( |
|
253 | + 'help_tabs' => array( |
|
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'order' => 30 |
266 | 266 | ), |
267 | 267 | 'list_table' => 'Price_Types_List_Table', |
268 | - 'help_tabs' => array( |
|
268 | + 'help_tabs' => array( |
|
269 | 269 | 'pricing_price_types_help_tab' => array( |
270 | 270 | 'title' => __('Price Types', 'event_espresso'), |
271 | 271 | 'filename' => 'pricing_price_types' |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | 'order' => 40, |
290 | 290 | 'persistent' => FALSE |
291 | 291 | ), |
292 | - 'help_tabs' => array( |
|
292 | + 'help_tabs' => array( |
|
293 | 293 | 'add_new_price_type_help_tab' => array( |
294 | 294 | 'title' => __('Add New Price Type', 'event_espresso'), |
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
298 | + 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | 299 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
@@ -305,36 +305,36 @@ discard block |
||
305 | 305 | 'order' => 40, |
306 | 306 | 'persistent' => FALSE |
307 | 307 | ), |
308 | - 'help_tabs' => array( |
|
308 | + 'help_tabs' => array( |
|
309 | 309 | 'edit_price_type_help_tab' => array( |
310 | 310 | 'title' => __('Edit Price Type', 'event_espresso'), |
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
314 | + 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | 315 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
319 | - 'tax_settings' => array( |
|
320 | - 'nav' => array( |
|
321 | - 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | - 'order' => 40 |
|
323 | - ), |
|
324 | - 'labels' => array( |
|
325 | - 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | - ), |
|
327 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | - // 'help_tabs' => array( |
|
329 | - // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | - // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | - // 'filename' => 'registration_form_reg_form_settings' |
|
332 | - // ), |
|
333 | - // ), |
|
334 | - // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | - 'require_nonce' => true |
|
336 | - ) |
|
337 | - ); |
|
319 | + 'tax_settings' => array( |
|
320 | + 'nav' => array( |
|
321 | + 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | + 'order' => 40 |
|
323 | + ), |
|
324 | + 'labels' => array( |
|
325 | + 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | + ), |
|
327 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | + // 'help_tabs' => array( |
|
329 | + // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | + // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | + // 'filename' => 'registration_form_reg_form_settings' |
|
332 | + // ), |
|
333 | + // ), |
|
334 | + // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | + 'require_nonce' => true |
|
336 | + ) |
|
337 | + ); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -460,16 +460,16 @@ discard block |
||
460 | 460 | |
461 | 461 | /** |
462 | 462 | * generates HTML for main Prices Admin page |
463 | - * @access protected |
|
464 | - * @return void |
|
465 | - */ |
|
463 | + * @access protected |
|
464 | + * @return void |
|
465 | + */ |
|
466 | 466 | protected function _price_overview_list_table() { |
467 | 467 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
468 | - 'add_new_price', |
|
469 | - 'add', |
|
470 | - array(), |
|
471 | - 'add-new-h2' |
|
472 | - ); |
|
468 | + 'add_new_price', |
|
469 | + 'add', |
|
470 | + array(), |
|
471 | + 'add-new-h2' |
|
472 | + ); |
|
473 | 473 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
474 | 474 | $this->_search_btn_label = __('Default Prices', 'event_espresso'); |
475 | 475 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | |
482 | 482 | |
483 | 483 | /** |
484 | - * retrieve data for Prices List table |
|
485 | - * @access public |
|
486 | - * @param int $per_page how many prices displayed per page |
|
487 | - * @param boolean $count return the count or objects |
|
488 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | - * @return mixed (int|array) int = count || array of price objects |
|
490 | - */ |
|
484 | + * retrieve data for Prices List table |
|
485 | + * @access public |
|
486 | + * @param int $per_page how many prices displayed per page |
|
487 | + * @param boolean $count return the count or objects |
|
488 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | + * @return mixed (int|array) int = count || array of price objects |
|
490 | + */ |
|
491 | 491 | public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
492 | 492 | |
493 | 493 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -557,9 +557,9 @@ discard block |
||
557 | 557 | |
558 | 558 | /** |
559 | 559 | * _price_details |
560 | - * @access protected |
|
561 | - * @return void |
|
562 | - */ |
|
560 | + * @access protected |
|
561 | + * @return void |
|
562 | + */ |
|
563 | 563 | protected function _edit_price_details() { |
564 | 564 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
565 | 565 | // grab price ID |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | |
629 | 629 | /** |
630 | 630 | * declare price details page metaboxes |
631 | - * @access protected |
|
632 | - * @return void |
|
633 | - */ |
|
631 | + * @access protected |
|
632 | + * @return void |
|
633 | + */ |
|
634 | 634 | protected function _price_details_meta_boxes() { |
635 | 635 | add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
636 | 636 | } |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | |
643 | 643 | /** |
644 | 644 | * _edit_price_details_meta_box |
645 | - * @access public |
|
646 | - * @return void |
|
647 | - */ |
|
645 | + * @access public |
|
646 | + * @return void |
|
647 | + */ |
|
648 | 648 | public function _edit_price_details_meta_box() { |
649 | 649 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
650 | 650 | } |
@@ -655,9 +655,9 @@ discard block |
||
655 | 655 | |
656 | 656 | /** |
657 | 657 | * set_price_column_values |
658 | - * @access protected |
|
659 | - * @return array |
|
660 | - */ |
|
658 | + * @access protected |
|
659 | + * @return array |
|
660 | + */ |
|
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | 663 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | |
685 | 685 | /** |
686 | 686 | * insert_or_update_price |
687 | - * @param boolean $insert - whether to insert or update |
|
688 | - * @access protected |
|
689 | - * @return void |
|
690 | - */ |
|
687 | + * @param boolean $insert - whether to insert or update |
|
688 | + * @access protected |
|
689 | + * @return void |
|
690 | + */ |
|
691 | 691 | protected function _insert_or_update_price( $insert = FALSE ) { |
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | |
761 | 761 | /** |
762 | 762 | * _trash_or_restore_price |
763 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | - * @access protected |
|
765 | - * @return void |
|
766 | - */ |
|
763 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | + * @access protected |
|
765 | + * @return void |
|
766 | + */ |
|
767 | 767 | protected function _trash_or_restore_price( $trash = TRUE ) { |
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | |
844 | 844 | /** |
845 | 845 | * _delete_price |
846 | - * @access protected |
|
847 | - * @return void |
|
848 | - */ |
|
846 | + * @access protected |
|
847 | + * @return void |
|
848 | + */ |
|
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -922,16 +922,16 @@ discard block |
||
922 | 922 | |
923 | 923 | /** |
924 | 924 | * generates HTML for main Prices Admin page |
925 | - * @access protected |
|
926 | - * @return void |
|
927 | - */ |
|
925 | + * @access protected |
|
926 | + * @return void |
|
927 | + */ |
|
928 | 928 | protected function _price_types_overview_list_table() { |
929 | 929 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
930 | - 'add_new_price_type', |
|
931 | - 'add_type', |
|
932 | - array(), |
|
933 | - 'add-new-h2' |
|
934 | - ); |
|
930 | + 'add_new_price_type', |
|
931 | + 'add_type', |
|
932 | + array(), |
|
933 | + 'add-new-h2' |
|
934 | + ); |
|
935 | 935 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
936 | 936 | $this->_search_btn_label = __('Price Types', 'event_espresso'); |
937 | 937 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | |
944 | 944 | |
945 | 945 | /** |
946 | - * retrieve data for Price Types List table |
|
947 | - * @access public |
|
948 | - * @param int $per_page how many prices displayed per page |
|
949 | - * @param boolean $count return the count or objects |
|
950 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | - * @return mixed (int|array) int = count || array of price objects |
|
952 | - */ |
|
946 | + * retrieve data for Price Types List table |
|
947 | + * @access public |
|
948 | + * @param int $per_page how many prices displayed per page |
|
949 | + * @param boolean $count return the count or objects |
|
950 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | + * @return mixed (int|array) int = count || array of price objects |
|
952 | + */ |
|
953 | 953 | public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
954 | 954 | |
955 | 955 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1004,9 +1004,9 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | /** |
1006 | 1006 | * _edit_price_type_details |
1007 | - * @access protected |
|
1008 | - * @return void |
|
1009 | - */ |
|
1007 | + * @access protected |
|
1008 | + * @return void |
|
1009 | + */ |
|
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | 1012 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1070,9 +1070,9 @@ discard block |
||
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * declare price type details page metaboxes |
1073 | - * @access protected |
|
1074 | - * @return void |
|
1075 | - */ |
|
1073 | + * @access protected |
|
1074 | + * @return void |
|
1075 | + */ |
|
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | 1077 | add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
1078 | 1078 | } |
@@ -1083,9 +1083,9 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | /** |
1085 | 1085 | * _edit_price_type_details_meta_box |
1086 | - * @access public |
|
1087 | - * @return void |
|
1088 | - */ |
|
1086 | + * @access public |
|
1087 | + * @return void |
|
1088 | + */ |
|
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | 1090 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
1091 | 1091 | } |
@@ -1095,9 +1095,9 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | /** |
1097 | 1097 | * set_price_type_column_values |
1098 | - * @access protected |
|
1099 | - * @return void |
|
1100 | - */ |
|
1098 | + * @access protected |
|
1099 | + * @return void |
|
1100 | + */ |
|
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | 1103 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1145,10 +1145,10 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | /** |
1147 | 1147 | * _insert_or_update_price_type |
1148 | - * @param boolean $new_price_type - whether to insert or update |
|
1149 | - * @access protected |
|
1150 | - * @return void |
|
1151 | - */ |
|
1148 | + * @param boolean $new_price_type - whether to insert or update |
|
1149 | + * @access protected |
|
1150 | + * @return void |
|
1151 | + */ |
|
1152 | 1152 | protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1189,10 +1189,10 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | /** |
1191 | 1191 | * _trash_or_restore_price_type |
1192 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | - * @access protected |
|
1194 | - * @return void |
|
1195 | - */ |
|
1192 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | + * @access protected |
|
1194 | + * @return void |
|
1195 | + */ |
|
1196 | 1196 | protected function _trash_or_restore_price_type( $trash = TRUE ) { |
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1246,9 +1246,9 @@ discard block |
||
1246 | 1246 | |
1247 | 1247 | /** |
1248 | 1248 | * _delete_price_type |
1249 | - * @access protected |
|
1250 | - * @return void |
|
1251 | - */ |
|
1249 | + * @access protected |
|
1250 | + * @return void |
|
1251 | + */ |
|
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1285,76 +1285,76 @@ discard block |
||
1285 | 1285 | |
1286 | 1286 | /** |
1287 | 1287 | * _learn_more_about_pricing_link |
1288 | - * @access protected |
|
1289 | - * @return string |
|
1290 | - */ |
|
1288 | + * @access protected |
|
1289 | + * @return string |
|
1290 | + */ |
|
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | 1292 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | |
1297 | - protected function _tax_settings() { |
|
1298 | - $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | - $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | - $this->display_admin_page_with_sidebar(); |
|
1302 | - } |
|
1303 | - |
|
1304 | - |
|
1305 | - |
|
1306 | - /** |
|
1307 | - * @return \EE_Form_Section_Proper |
|
1308 | - * @throws \EE_Error |
|
1309 | - */ |
|
1310 | - protected function tax_settings_form() { |
|
1311 | - return new EE_Form_Section_Proper( |
|
1312 | - array( |
|
1313 | - 'name' => 'tax_settings_form', |
|
1314 | - 'html_id' => 'tax_settings_form', |
|
1315 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | - 'subsections' => apply_filters( |
|
1317 | - 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | - array( |
|
1319 | - 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | - array( |
|
1321 | - 'name' => 'tax_settings_tbl', |
|
1322 | - 'html_id' => 'tax_settings_tbl', |
|
1323 | - 'html_class' => 'form-table', |
|
1324 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | - 'subsections' => array( |
|
1326 | - 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | - array( |
|
1328 | - 'html_label_text' => __( |
|
1329 | - "Show Prices With Taxes Included?", |
|
1330 | - 'event_espresso' |
|
1331 | - ), |
|
1332 | - 'html_help_text' => __( |
|
1333 | - 'Indicates whether or not to display prices with the taxes included', |
|
1334 | - 'event_espresso' |
|
1335 | - ), |
|
1336 | - 'default' => isset( |
|
1337 | - EE_Registry::instance() |
|
1338 | - ->CFG |
|
1339 | - ->tax_settings |
|
1340 | - ->prices_displayed_including_taxes |
|
1341 | - ) |
|
1342 | - ? EE_Registry::instance() |
|
1343 | - ->CFG |
|
1344 | - ->tax_settings |
|
1345 | - ->prices_displayed_including_taxes |
|
1346 | - : true, |
|
1347 | - 'display_html_label_text' => false |
|
1348 | - ) |
|
1349 | - ), |
|
1350 | - ) |
|
1351 | - ) |
|
1352 | - ) |
|
1353 | - ) |
|
1354 | - ) |
|
1355 | - ) |
|
1356 | - ); |
|
1357 | - } |
|
1297 | + protected function _tax_settings() { |
|
1298 | + $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | + $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | + $this->display_admin_page_with_sidebar(); |
|
1302 | + } |
|
1303 | + |
|
1304 | + |
|
1305 | + |
|
1306 | + /** |
|
1307 | + * @return \EE_Form_Section_Proper |
|
1308 | + * @throws \EE_Error |
|
1309 | + */ |
|
1310 | + protected function tax_settings_form() { |
|
1311 | + return new EE_Form_Section_Proper( |
|
1312 | + array( |
|
1313 | + 'name' => 'tax_settings_form', |
|
1314 | + 'html_id' => 'tax_settings_form', |
|
1315 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | + 'subsections' => apply_filters( |
|
1317 | + 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | + array( |
|
1319 | + 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | + array( |
|
1321 | + 'name' => 'tax_settings_tbl', |
|
1322 | + 'html_id' => 'tax_settings_tbl', |
|
1323 | + 'html_class' => 'form-table', |
|
1324 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | + 'subsections' => array( |
|
1326 | + 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | + array( |
|
1328 | + 'html_label_text' => __( |
|
1329 | + "Show Prices With Taxes Included?", |
|
1330 | + 'event_espresso' |
|
1331 | + ), |
|
1332 | + 'html_help_text' => __( |
|
1333 | + 'Indicates whether or not to display prices with the taxes included', |
|
1334 | + 'event_espresso' |
|
1335 | + ), |
|
1336 | + 'default' => isset( |
|
1337 | + EE_Registry::instance() |
|
1338 | + ->CFG |
|
1339 | + ->tax_settings |
|
1340 | + ->prices_displayed_including_taxes |
|
1341 | + ) |
|
1342 | + ? EE_Registry::instance() |
|
1343 | + ->CFG |
|
1344 | + ->tax_settings |
|
1345 | + ->prices_displayed_including_taxes |
|
1346 | + : true, |
|
1347 | + 'display_html_label_text' => false |
|
1348 | + ) |
|
1349 | + ), |
|
1350 | + ) |
|
1351 | + ) |
|
1352 | + ) |
|
1353 | + ) |
|
1354 | + ) |
|
1355 | + ) |
|
1356 | + ); |
|
1357 | + } |
|
1358 | 1358 | |
1359 | 1359 | |
1360 | 1360 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
224 | 224 | ) |
225 | 225 | ), |
226 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
226 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
227 | 227 | 'require_nonce' => FALSE |
228 | 228 | ), |
229 | 229 | 'add_new_price' => array( |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | ) |
240 | 240 | ), |
241 | 241 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
242 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
242 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
245 | 245 | 'edit_price' => array( |
246 | 246 | 'nav' => array( |
247 | 247 | 'label' => __('Edit Default Price', 'event_espresso'), |
248 | 248 | 'order' => 20, |
249 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
249 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
252 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
253 | 253 | 'help_tabs' => array( |
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
257 | 257 | ) |
258 | 258 | ), |
259 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
259 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
260 | 260 | 'require_nonce' => FALSE |
261 | 261 | ), |
262 | 262 | 'price_types' => array( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
280 | 280 | ), |
281 | 281 | ), |
282 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
282 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
283 | 283 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
284 | 284 | 'require_nonce' => FALSE |
285 | 285 | ), |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
298 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
299 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
302 | 302 | 'edit_price_type' => array( |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
314 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
315 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | public function load_scripts_styles() { |
368 | 368 | //styles |
369 | 369 | wp_enqueue_style('espresso-ui-theme'); |
370 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
370 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
371 | 371 | wp_enqueue_style('espresso_PRICING'); |
372 | 372 | |
373 | 373 | //scripts |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | //wp_enqueue_script('jquery-ui-dialog'); |
378 | 378 | //wp_enqueue_script('jquery-ui-draggable'); |
379 | 379 | //wp_enqueue_script('jquery-ui-datepicker'); |
380 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
381 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
380 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
381 | + wp_enqueue_script('espresso_PRICING'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | public function load_scripts_styles_default() { |
389 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
389 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | ) |
415 | 415 | ); |
416 | 416 | |
417 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
417 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
418 | 418 | $this->_views['trashed'] = array( |
419 | 419 | 'slug' => 'trashed', |
420 | 420 | 'label' => __('Trash', 'event_espresso'), |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | ) |
445 | 445 | ); |
446 | 446 | |
447 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
447 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
448 | 448 | $this->_views['trashed'] = array( |
449 | 449 | 'slug' => 'trashed', |
450 | 450 | 'label' => __('Trash', 'event_espresso'), |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return void |
465 | 465 | */ |
466 | 466 | protected function _price_overview_list_table() { |
467 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
467 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
468 | 468 | 'add_new_price', |
469 | 469 | 'add', |
470 | 470 | array(), |
@@ -488,18 +488,18 @@ discard block |
||
488 | 488 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
489 | 489 | * @return mixed (int|array) int = count || array of price objects |
490 | 490 | */ |
491 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
491 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
492 | 492 | |
493 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
493 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
494 | 494 | // start with an empty array |
495 | 495 | $event_pricing = array(); |
496 | 496 | |
497 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
498 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
497 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
498 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
499 | 499 | //$PRC = EEM_Price::instance(); |
500 | 500 | |
501 | 501 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
502 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
502 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
503 | 503 | |
504 | 504 | switch ($this->_req_data['orderby']) { |
505 | 505 | case 'name': |
@@ -512,27 +512,27 @@ discard block |
||
512 | 512 | $orderby = array('PRC_amount'=>$order); |
513 | 513 | break; |
514 | 514 | default: |
515 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
515 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
516 | 516 | } |
517 | 517 | |
518 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
519 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
518 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
519 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
520 | 520 | |
521 | 521 | $_where = array( |
522 | 522 | 'PRC_is_default' => 1, |
523 | 523 | 'PRC_deleted' => $trashed |
524 | 524 | ); |
525 | 525 | |
526 | - $offset = ($current_page-1)*$per_page; |
|
527 | - $limit = array( $offset, $per_page ); |
|
526 | + $offset = ($current_page - 1) * $per_page; |
|
527 | + $limit = array($offset, $per_page); |
|
528 | 528 | |
529 | - if ( isset( $this->_req_data['s'] ) ) { |
|
530 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
529 | + if (isset($this->_req_data['s'])) { |
|
530 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
531 | 531 | $_where['OR'] = array( |
532 | - 'PRC_name' => array('LIKE',$sstr ), |
|
533 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
534 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
535 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
532 | + 'PRC_name' => array('LIKE', $sstr), |
|
533 | + 'PRC_desc' => array('LIKE', $sstr), |
|
534 | + 'PRC_amount' => array('LIKE', $sstr), |
|
535 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | 'group_by'=>'PRC_ID' |
544 | 544 | ); |
545 | 545 | |
546 | - if($count){ |
|
547 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | - }else{ |
|
546 | + if ($count) { |
|
547 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | + } else { |
|
549 | 549 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
550 | 550 | } |
551 | 551 | } |
@@ -561,49 +561,49 @@ discard block |
||
561 | 561 | * @return void |
562 | 562 | */ |
563 | 563 | protected function _edit_price_details() { |
564 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
564 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
565 | 565 | // grab price ID |
566 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
566 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
567 | 567 | // change page title based on request action |
568 | - switch( $this->_req_action ) { |
|
568 | + switch ($this->_req_action) { |
|
569 | 569 | case 'add_new_price' : |
570 | - $this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' ); |
|
570 | + $this->_admin_page_title = esc_html__('Add New Price', 'event_espresso'); |
|
571 | 571 | break; |
572 | 572 | case 'edit_price' : |
573 | - $this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' ); |
|
573 | + $this->_admin_page_title = esc_html__('Edit Price', 'event_espresso'); |
|
574 | 574 | break; |
575 | 575 | default : |
576 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
576 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
577 | 577 | } |
578 | 578 | // add PRC_ID to title if editing |
579 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
579 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
580 | 580 | |
581 | 581 | // get prices |
582 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
582 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
583 | 583 | $PRC = EEM_Price::instance(); |
584 | 584 | |
585 | - if ( $PRC_ID ) { |
|
586 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
585 | + if ($PRC_ID) { |
|
586 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
587 | 587 | $additional_hidden_fields = array( |
588 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
588 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
589 | 589 | ); |
590 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
590 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
591 | 591 | } else { |
592 | 592 | $price = $PRC->get_new_price(); |
593 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
593 | + $this->_set_add_edit_form_tags('insert_price'); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | $this->_template_args['PRC_ID'] = $PRC_ID; |
597 | 597 | $this->_template_args['price'] = $price; |
598 | 598 | |
599 | 599 | // get price types |
600 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
600 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
601 | 601 | $PRT = EEM_Price_Type::instance(); |
602 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
602 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
603 | 603 | $price_type_names = array(); |
604 | 604 | if (empty($price_types)) { |
605 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
606 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
605 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
606 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
607 | 607 | exit(); |
608 | 608 | } else { |
609 | 609 | foreach ($price_types as $type) { |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $this->_template_args['price_types'] = $price_type_names; |
617 | 617 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
618 | 618 | |
619 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
619 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
620 | 620 | // the details template wrapper |
621 | 621 | $this->display_admin_page_with_sidebar(); |
622 | 622 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @return void |
633 | 633 | */ |
634 | 634 | protected function _price_details_meta_boxes() { |
635 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
635 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @return void |
647 | 647 | */ |
648 | 648 | public function _edit_price_details_meta_box() { |
649 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
649 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | */ |
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
663 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
664 | 664 | |
665 | 665 | $set_column_values = array( |
666 | 666 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -688,12 +688,12 @@ discard block |
||
688 | 688 | * @access protected |
689 | 689 | * @return void |
690 | 690 | */ |
691 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
691 | + protected function _insert_or_update_price($insert = FALSE) { |
|
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
694 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
694 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
695 | 695 | |
696 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
696 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
697 | 697 | $PRC = EEM_Price::instance(); |
698 | 698 | |
699 | 699 | // why be so pessimistic ??? : ( |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | |
702 | 702 | $set_column_values = $this->set_price_column_values(); |
703 | 703 | // is this a new Price ? |
704 | - if ( $insert ) { |
|
704 | + if ($insert) { |
|
705 | 705 | // run the insert |
706 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
706 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
707 | 707 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
708 | 708 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
709 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
709 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
710 | 710 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
711 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
711 | + $ticket->_add_relation_to($PR, 'Price'); |
|
712 | 712 | $ticket->save(); |
713 | 713 | } |
714 | 714 | $success = 1; |
@@ -718,29 +718,29 @@ discard block |
||
718 | 718 | } |
719 | 719 | $action_desc = 'created'; |
720 | 720 | } else { |
721 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
721 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
722 | 722 | // run the update |
723 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
724 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
723 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
724 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
725 | 725 | $success = 1; |
726 | 726 | } |
727 | 727 | |
728 | 728 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
729 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
729 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
730 | 730 | |
731 | 731 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
732 | - if ( $PRC_ID === 1 ) { |
|
732 | + if ($PRC_ID === 1) { |
|
733 | 733 | $ticket = $PR->get_first_related('Ticket'); |
734 | - if ( $ticket ) { |
|
735 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
736 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
734 | + if ($ticket) { |
|
735 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
736 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
737 | 737 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
738 | 738 | $ticket->save(); |
739 | 739 | } |
740 | 740 | } else { |
741 | 741 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
742 | 742 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
743 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
743 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
744 | 744 | $ticket->save(); |
745 | 745 | } |
746 | 746 | } |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | $action_desc = 'updated'; |
749 | 749 | } |
750 | 750 | |
751 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
751 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
752 | 752 | |
753 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
753 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
754 | 754 | |
755 | 755 | } |
756 | 756 | |
@@ -764,12 +764,12 @@ discard block |
||
764 | 764 | * @access protected |
765 | 765 | * @return void |
766 | 766 | */ |
767 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
767 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
770 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
770 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
771 | 771 | |
772 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
772 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
773 | 773 | $PRC = EEM_Price::instance(); |
774 | 774 | |
775 | 775 | $success = 1; |
@@ -778,18 +778,18 @@ discard block |
||
778 | 778 | //get base ticket for updating |
779 | 779 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
780 | 780 | //Checkboxes |
781 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
781 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
782 | 782 | // if array has more than one element than success message should be plural |
783 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
783 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
784 | 784 | // cycle thru checkboxes |
785 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
786 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
785 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
786 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
787 | 787 | $success = 0; |
788 | 788 | } else { |
789 | 789 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
790 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
790 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
791 | 791 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
792 | - if ( $PRC_deleted ) { |
|
792 | + if ($PRC_deleted) { |
|
793 | 793 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
794 | 794 | } else { |
795 | 795 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -801,14 +801,14 @@ discard block |
||
801 | 801 | |
802 | 802 | } else { |
803 | 803 | // grab single id and delete |
804 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
805 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
804 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
805 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
806 | 806 | $success = 0; |
807 | 807 | } else { |
808 | 808 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
809 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
809 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
810 | 810 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
811 | - if ( $PRC_deleted ) { |
|
811 | + if ($PRC_deleted) { |
|
812 | 812 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
813 | 813 | } else { |
814 | 814 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -822,17 +822,17 @@ discard block |
||
822 | 822 | 'action' => 'default' |
823 | 823 | ); |
824 | 824 | |
825 | - if ( $success ) { |
|
826 | - if ( $trash ) { |
|
825 | + if ($success) { |
|
826 | + if ($trash) { |
|
827 | 827 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
828 | 828 | } else { |
829 | 829 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
830 | 830 | } |
831 | 831 | |
832 | - EE_Error::add_success( $msg ); |
|
832 | + EE_Error::add_success($msg); |
|
833 | 833 | } |
834 | 834 | |
835 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
835 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
836 | 836 | |
837 | 837 | } |
838 | 838 | |
@@ -849,19 +849,19 @@ discard block |
||
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
852 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
852 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
853 | 853 | |
854 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
854 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
855 | 855 | $PRC = EEM_Price::instance(); |
856 | 856 | |
857 | 857 | $success = 1; |
858 | 858 | //Checkboxes |
859 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
859 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
860 | 860 | // if array has more than one element than success message should be plural |
861 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
861 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
862 | 862 | // cycle thru bulk action checkboxes |
863 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
864 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
863 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
864 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
865 | 865 | $success = 0; |
866 | 866 | } |
867 | 867 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | |
876 | 876 | } |
877 | 877 | |
878 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
878 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
879 | 879 | |
880 | 880 | } |
881 | 881 | |
@@ -883,16 +883,16 @@ discard block |
||
883 | 883 | |
884 | 884 | |
885 | 885 | public function update_price_order() { |
886 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
886 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
887 | 887 | |
888 | 888 | // grab our row IDs |
889 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
889 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
890 | 890 | |
891 | - if ( is_array( $row_ids )) { |
|
892 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
891 | + if (is_array($row_ids)) { |
|
892 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
893 | 893 | //Update the prices when re-ordering |
894 | 894 | $id = absint($row_ids[$i]); |
895 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
895 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
896 | 896 | $success = FALSE; |
897 | 897 | } |
898 | 898 | } |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | $success = FALSE; |
901 | 901 | } |
902 | 902 | |
903 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
903 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
904 | 904 | |
905 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
905 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
906 | 906 | die(); |
907 | 907 | } |
908 | 908 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | * @return void |
927 | 927 | */ |
928 | 928 | protected function _price_types_overview_list_table() { |
929 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
929 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
930 | 930 | 'add_new_price_type', |
931 | 931 | 'add_type', |
932 | 932 | array(), |
@@ -950,46 +950,46 @@ discard block |
||
950 | 950 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
951 | 951 | * @return mixed (int|array) int = count || array of price objects |
952 | 952 | */ |
953 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
953 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
954 | 954 | |
955 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
955 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
956 | 956 | // start with an empty array |
957 | 957 | |
958 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
959 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
958 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
959 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
960 | 960 | |
961 | 961 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
962 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
962 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
963 | 963 | switch ($this->_req_data['orderby']) { |
964 | 964 | case 'name': |
965 | - $orderby = array( 'PRT_name' => $order); |
|
965 | + $orderby = array('PRT_name' => $order); |
|
966 | 966 | break; |
967 | 967 | default: |
968 | - $orderby = array( 'PRT_order' => $order); |
|
968 | + $orderby = array('PRT_order' => $order); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | |
972 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
973 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
972 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
973 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
974 | 974 | |
975 | - $offset = ($current_page-1)*$per_page; |
|
976 | - $limit = array( $offset, $per_page ); |
|
975 | + $offset = ($current_page - 1) * $per_page; |
|
976 | + $limit = array($offset, $per_page); |
|
977 | 977 | |
978 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
978 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
979 | 979 | |
980 | - if ( isset( $this->_req_data['s'] ) ) { |
|
981 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
980 | + if (isset($this->_req_data['s'])) { |
|
981 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
982 | 982 | $_where['OR'] = array( |
983 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
983 | + 'PRT_name' => array('LIKE', $sstr) |
|
984 | 984 | ); |
985 | 985 | } |
986 | 986 | $query_params = array( |
987 | 987 | $_where, |
988 | 988 | 'order_by'=>$orderby, |
989 | 989 | 'limit'=>$limit); |
990 | - if($count){ |
|
990 | + if ($count) { |
|
991 | 991 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
992 | - }else{ |
|
992 | + } else { |
|
993 | 993 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
994 | 994 | } |
995 | 995 | |
@@ -1009,34 +1009,34 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1012 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1013 | 1013 | |
1014 | 1014 | |
1015 | 1015 | // grab price type ID |
1016 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
1016 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
1017 | 1017 | // change page title based on request action |
1018 | - switch( $this->_req_action ) { |
|
1018 | + switch ($this->_req_action) { |
|
1019 | 1019 | case 'add_new_price_type' : |
1020 | - $this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' ); |
|
1020 | + $this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso'); |
|
1021 | 1021 | break; |
1022 | 1022 | case 'edit_price_type' : |
1023 | - $this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' ); |
|
1023 | + $this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso'); |
|
1024 | 1024 | break; |
1025 | 1025 | default : |
1026 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
1026 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
1027 | 1027 | } |
1028 | 1028 | // add PRT_ID to title if editing |
1029 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
1029 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
1030 | 1030 | |
1031 | 1031 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
1032 | 1032 | |
1033 | - if ( $PRT_ID ) { |
|
1034 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
1035 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
1036 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
1033 | + if ($PRT_ID) { |
|
1034 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
1035 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
1036 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
1037 | 1037 | } else { |
1038 | 1038 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
1039 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
1039 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -1045,19 +1045,19 @@ discard block |
||
1045 | 1045 | |
1046 | 1046 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
1047 | 1047 | $select_values = array(); |
1048 | - foreach ( $base_types as $ref => $text ) { |
|
1049 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
1048 | + foreach ($base_types as $ref => $text) { |
|
1049 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
1050 | 1050 | //do not allow creation of base_type_base_prices because that's a system only base type. |
1051 | 1051 | continue; |
1052 | 1052 | } |
1053 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
1053 | + $values[] = array('id' => $ref, 'text' => $text); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | |
1057 | 1057 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1058 | 1058 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1059 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1060 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1059 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1060 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1061 | 1061 | // the details template wrapper |
1062 | 1062 | $this->display_admin_page_with_sidebar(); |
1063 | 1063 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | * @return void |
1075 | 1075 | */ |
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1077 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @return void |
1088 | 1088 | */ |
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1090 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | |
@@ -1100,9 +1100,9 @@ discard block |
||
1100 | 1100 | */ |
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1103 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1104 | 1104 | |
1105 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1105 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1106 | 1106 | |
1107 | 1107 | switch ($base_type) { |
1108 | 1108 | |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | * @access protected |
1150 | 1150 | * @return void |
1151 | 1151 | */ |
1152 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1152 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1155 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1155 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1156 | 1156 | |
1157 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1157 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1158 | 1158 | $PRT = EEM_Price_Type::instance(); |
1159 | 1159 | |
1160 | 1160 | // why be so pessimistic ??? : ( |
@@ -1162,24 +1162,24 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | $set_column_values = $this->set_price_type_column_values(); |
1164 | 1164 | // is this a new Price ? |
1165 | - if ( $new_price_type ) { |
|
1165 | + if ($new_price_type) { |
|
1166 | 1166 | // run the insert |
1167 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1167 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1168 | 1168 | $success = 1; |
1169 | 1169 | } |
1170 | 1170 | $action_desc = 'created'; |
1171 | 1171 | } else { |
1172 | 1172 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1173 | 1173 | // run the update |
1174 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1175 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1174 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1175 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1176 | 1176 | $success = 1; |
1177 | 1177 | } |
1178 | 1178 | $action_desc = 'updated'; |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1182 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1181 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1182 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1183 | 1183 | |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1193,49 +1193,49 @@ discard block |
||
1193 | 1193 | * @access protected |
1194 | 1194 | * @return void |
1195 | 1195 | */ |
1196 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1196 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1200 | 1200 | |
1201 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1201 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | $PRT_deleted = $trash ? TRUE : FALSE; |
1206 | 1206 | //Checkboxes |
1207 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1207 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1208 | 1208 | // if array has more than one element than success message should be plural |
1209 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1210 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1209 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1210 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1211 | 1211 | // cycle thru checkboxes |
1212 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1213 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1212 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1213 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1214 | 1214 | $success = 0; |
1215 | 1215 | } |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | } else { |
1219 | 1219 | // grab single id and delete |
1220 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1221 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1220 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1221 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1222 | 1222 | $success = 0; |
1223 | 1223 | } |
1224 | 1224 | $what = 'Price Type'; |
1225 | 1225 | |
1226 | 1226 | } |
1227 | 1227 | |
1228 | - $query_args = array( 'action' => 'price_types' ); |
|
1229 | - if ( $success ) { |
|
1230 | - if ( $trash ) { |
|
1228 | + $query_args = array('action' => 'price_types'); |
|
1229 | + if ($success) { |
|
1230 | + if ($trash) { |
|
1231 | 1231 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1232 | 1232 | } else { |
1233 | 1233 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1234 | 1234 | } |
1235 | - EE_Error::add_success( $msg ); |
|
1235 | + EE_Error::add_success($msg); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1238 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1239 | 1239 | |
1240 | 1240 | } |
1241 | 1241 | |
@@ -1252,19 +1252,19 @@ discard block |
||
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1255 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1255 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1256 | 1256 | |
1257 | 1257 | $PRT = EEM_Price_Type::instance(); |
1258 | 1258 | |
1259 | 1259 | $success = 1; |
1260 | 1260 | //Checkboxes |
1261 | - if (!empty($this->_req_data['checkbox'])) { |
|
1261 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1262 | 1262 | // if array has more than one element than success message should be plural |
1263 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1263 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1264 | 1264 | $what = $PRT->item_name($success); |
1265 | 1265 | // cycle thru bulk action checkboxes |
1266 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1267 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1266 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1267 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1268 | 1268 | $success = 0; |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1272,8 +1272,8 @@ discard block |
||
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | |
1275 | - $query_args = array( 'action'=> 'price_types' ); |
|
1276 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1275 | + $query_args = array('action'=> 'price_types'); |
|
1276 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | * @return string |
1290 | 1290 | */ |
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1292 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
@@ -1365,20 +1365,20 @@ discard block |
||
1365 | 1365 | * @return void |
1366 | 1366 | */ |
1367 | 1367 | public function _update_tax_settings() { |
1368 | - if ( ! isset( EE_Registry::instance()->CFG->tax_settings ) ) { |
|
1368 | + if ( ! isset(EE_Registry::instance()->CFG->tax_settings)) { |
|
1369 | 1369 | EE_Registry::instance()->CFG->tax_settings = new EE_Tax_Config(); |
1370 | 1370 | } |
1371 | 1371 | try { |
1372 | 1372 | $tax_form = $this->tax_settings_form(); |
1373 | 1373 | //check for form submission |
1374 | - if ( $tax_form->was_submitted() ) { |
|
1374 | + if ($tax_form->was_submitted()) { |
|
1375 | 1375 | //capture form data |
1376 | 1376 | $tax_form->receive_form_submission(); |
1377 | 1377 | //validate form data |
1378 | - if ( $tax_form->is_valid() ) { |
|
1378 | + if ($tax_form->is_valid()) { |
|
1379 | 1379 | //grab validated data from form |
1380 | 1380 | $valid_data = $tax_form->valid_data(); |
1381 | - \EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
|
1381 | + \EEH_Debug_Tools::printr($valid_data, '$valid_data', __FILE__, __LINE__); |
|
1382 | 1382 | //set data on config |
1383 | 1383 | EE_Registry::instance() |
1384 | 1384 | ->CFG |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | ->prices_displayed_including_taxes |
1387 | 1387 | = $valid_data['tax_settings']['prices_displayed_including_taxes']; |
1388 | 1388 | } else { |
1389 | - if ( $tax_form->submission_error_message() !== '' ) { |
|
1389 | + if ($tax_form->submission_error_message() !== '') { |
|
1390 | 1390 | EE_Error::add_error( |
1391 | 1391 | $tax_form->submission_error_message(), |
1392 | 1392 | __FILE__, |
@@ -1396,8 +1396,8 @@ discard block |
||
1396 | 1396 | } |
1397 | 1397 | } |
1398 | 1398 | } |
1399 | - } catch ( EE_Error $e ) { |
|
1400 | - EE_Error::add_error( $e->get_error(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1399 | + } catch (EE_Error $e) { |
|
1400 | + EE_Error::add_error($e->get_error(), __FILE__, __FUNCTION__, __LINE__); |
|
1401 | 1401 | } |
1402 | 1402 | |
1403 | 1403 | $what = 'Tax Settings'; |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | __FUNCTION__, |
1409 | 1409 | __LINE__ |
1410 | 1410 | ); |
1411 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'tax_settings' ) ); |
|
1411 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'tax_settings')); |
|
1412 | 1412 | } |
1413 | 1413 | |
1414 | 1414 |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | |
9 | 9 | $row = 1; |
10 | 10 | $max = 1; |
11 | -$ticket_count = count( $tickets ); |
|
11 | +$ticket_count = count($tickets); |
|
12 | 12 | |
13 | -if ( ! $ticket_count ) { |
|
13 | +if ( ! $ticket_count) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | $required_ticket_sold_out = FALSE; |
18 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
18 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
19 | 19 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
20 | 20 | : new EE_Ticket_Selector_Config(); |
21 | 21 | |
22 | -$tax_settings = isset ( EE_Registry::instance()->CFG->tax_settings ) |
|
22 | +$tax_settings = isset (EE_Registry::instance()->CFG->tax_settings) |
|
23 | 23 | ? EE_Registry::instance()->CFG->tax_settings |
24 | 24 | : new EE_Tax_Config(); |
25 | 25 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | |
29 | 29 | ob_start(); |
30 | 30 | |
31 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
32 | - if ( $ticket instanceof EE_Ticket ) { |
|
31 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
32 | + if ($ticket instanceof EE_Ticket) { |
|
33 | 33 | $max = $ticket->max(); |
34 | 34 | $min = 0; |
35 | 35 | $remaining = $ticket->remaining(); |
36 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
36 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
37 | 37 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
38 | - $max = min( $remaining, $max_atndz ); |
|
38 | + $max = min($remaining, $max_atndz); |
|
39 | 39 | // but... we also want to restrict the number of tickets by the ticket max setting, |
40 | 40 | // however, the max still can't be higher than what was just set above |
41 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
41 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
42 | 42 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
43 | 43 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
44 | 44 | // and if the ticket is required, then make sure that min qty is at least 1 |
45 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
45 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
46 | 46 | } else { |
47 | 47 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
48 | 48 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -54,41 +54,41 @@ discard block |
||
54 | 54 | $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets; |
55 | 55 | $ticket_bundle = FALSE; |
56 | 56 | // for ticket bundles, set min and max qty the same |
57 | - if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) { |
|
57 | + if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) { |
|
58 | 58 | $ticket_price = $ticket_price * $ticket->min(); |
59 | 59 | $ticket_bundle = TRUE; |
60 | 60 | } |
61 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
61 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
62 | 62 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
63 | 63 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
64 | 64 | $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(); |
65 | 65 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
66 | 66 | // check ticket status |
67 | - switch ( $tkt_status ) { |
|
67 | + switch ($tkt_status) { |
|
68 | 68 | // sold_out |
69 | 69 | case EE_Ticket::sold_out : |
70 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
70 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>'; |
|
71 | 71 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
72 | 72 | break; |
73 | 73 | // expired |
74 | 74 | case EE_Ticket::expired : |
75 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
75 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>'; |
|
76 | 76 | $status_class = 'ticket-sales-expired lt-grey-text'; |
77 | 77 | break; |
78 | 78 | // archived |
79 | 79 | case EE_Ticket::archived : |
80 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
80 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>'; |
|
81 | 81 | $status_class = 'archived-ticket hidden'; |
82 | 82 | break; |
83 | 83 | // pending |
84 | 84 | case EE_Ticket::pending : |
85 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
85 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>'; |
|
86 | 86 | $status_class = 'ticket-pending'; |
87 | 87 | break; |
88 | 88 | // onsale |
89 | 89 | case EE_Ticket::onsale : |
90 | 90 | default : |
91 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
91 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>'; |
|
92 | 92 | $status_class = 'ticket-on-sale'; |
93 | 93 | break; |
94 | 94 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
129 | 129 | ); |
130 | 130 | ?> |
131 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
131 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
132 | 132 | <?php |
133 | 133 | /** |
134 | 134 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -140,24 +140,24 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @var string|bool |
142 | 142 | */ |
143 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
143 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
144 | 144 | echo $new_row_cells_content; |
145 | 145 | echo '</tr>'; |
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | ?> |
149 | 149 | <td class="tckt-slctr-tbl-td-name"> |
150 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
151 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
152 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
153 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
150 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
151 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
152 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
153 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
154 | 154 | </a> |
155 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
156 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
155 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
156 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
157 | 157 | </a> |
158 | 158 | <?php endif; //end show details check ?> |
159 | - <?php if ( $ticket->required() ) { ?> |
|
160 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
159 | + <?php if ($ticket->required()) { ?> |
|
160 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
161 | 161 | <?php } ?> |
162 | 162 | <?php |
163 | 163 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -171,66 +171,66 @@ discard block |
||
171 | 171 | // echo '<br/><b> $ticket->required() : ' . $ticket->uses() . '</b>'; |
172 | 172 | ?> |
173 | 173 | </td> |
174 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
174 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
175 | 175 | <td class="tckt-slctr-tbl-td-price jst-rght"><?php |
176 | - echo EEH_Template::format_currency( $ticket_price ); |
|
176 | + echo EEH_Template::format_currency($ticket_price); |
|
177 | 177 | echo $ticket->taxable() ? '<span class="taxable-tickets-asterisk grey-text">*</span>' : ''; |
178 | 178 | ?> <span class="smaller-text no-bold"><?php |
179 | - if ( $ticket_bundle ) { |
|
180 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
179 | + if ($ticket_bundle) { |
|
180 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
181 | 181 | } else { |
182 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
182 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
183 | 183 | }?></span> </td> |
184 | 184 | <?php } ?> |
185 | 185 | <td class="tckt-slctr-tbl-td-qty cntr"> |
186 | 186 | <?php |
187 | 187 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
188 | 188 | // sold out or other status ? |
189 | - if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) { |
|
189 | + if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) { |
|
190 | 190 | ?> |
191 | - <span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold Out', 'event_espresso' ));?></span> |
|
191 | + <span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold Out', 'event_espresso')); ?></span> |
|
192 | 192 | <?php |
193 | - } else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) { |
|
193 | + } else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) { |
|
194 | 194 | echo $ticket_status; |
195 | - } else if ( $tkt_status == EE_Ticket::pending ) { |
|
195 | + } else if ($tkt_status == EE_Ticket::pending) { |
|
196 | 196 | ?> |
197 | 197 | <div class="ticket-pending-pg"> |
198 | - <span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes On Sale', 'event_espresso' )); ?></span><br/> |
|
199 | - <span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span> |
|
198 | + <span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes On Sale', 'event_espresso')); ?></span><br/> |
|
199 | + <span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span> |
|
200 | 200 | </div> |
201 | 201 | <?php |
202 | 202 | // min qty purchasable is less than tickets available |
203 | - } else if ( $ticket->min() > $remaining ) { |
|
203 | + } else if ($ticket->min() > $remaining) { |
|
204 | 204 | ?> |
205 | 205 | <div class="archived-ticket-pg"> |
206 | - <span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/> |
|
206 | + <span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/> |
|
207 | 207 | </div> |
208 | 208 | <?php |
209 | 209 | // if only one attendee is allowed to register at a time |
210 | - } else if ( $max_atndz == 1 ) { |
|
210 | + } else if ($max_atndz == 1) { |
|
211 | 211 | // display submit button since we have tickets available |
212 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
212 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
213 | 213 | ?> |
214 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
214 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
215 | 215 | <?php |
216 | 216 | $hidden_input_qty = FALSE; |
217 | 217 | |
218 | - } else if ( $max_atndz == 0 ) { |
|
219 | - echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>'; |
|
220 | - } elseif ( $max > 0 ) { |
|
218 | + } else if ($max_atndz == 0) { |
|
219 | + echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>'; |
|
220 | + } elseif ($max > 0) { |
|
221 | 221 | // display submit button since we have tickets available |
222 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
222 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
223 | 223 | |
224 | 224 | ?> |
225 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
225 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
226 | 226 | <?php |
227 | 227 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
228 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
228 | + if ( ! $ticket->required() && $min !== 0) { |
|
229 | 229 | ?> |
230 | 230 | <option value="0"> 0 </option> |
231 | 231 | <?php } |
232 | 232 | // offer ticket quantities from the min to the max |
233 | - for ( $i = $min; $i <= $max; $i++) { |
|
233 | + for ($i = $min; $i <= $max; $i++) { |
|
234 | 234 | ?> |
235 | 235 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
236 | 236 | <?php } ?> |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | } |
242 | 242 | // depending on group reg we need to change the format for qty |
243 | - if ( $hidden_input_qty ) { |
|
243 | + if ($hidden_input_qty) { |
|
244 | 244 | ?> |
245 | 245 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
246 | 246 | <?php |
@@ -250,33 +250,33 @@ discard block |
||
250 | 250 | |
251 | 251 | </td> |
252 | 252 | </tr> |
253 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
254 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
253 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
254 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
255 | 255 | <td class="tckt-slctr-tkt-details-td" colspan="3" > |
256 | 256 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
257 | 257 | |
258 | 258 | <section class="tckt-slctr-tkt-details-sctn"> |
259 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
259 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
260 | 260 | <p><?php echo $ticket->description(); ?></p> |
261 | 261 | |
262 | - <?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
262 | + <?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
263 | 263 | <section class="tckt-slctr-tkt-price-sctn"> |
264 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
264 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
265 | 265 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
266 | 266 | <table class="tckt-slctr-tkt-details-tbl"> |
267 | 267 | <thead> |
268 | 268 | <tr> |
269 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
270 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
271 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
269 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
270 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
271 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
272 | 272 | </tr> |
273 | 273 | </thead> |
274 | 274 | <tbody> |
275 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
275 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
276 | 276 | <tr> |
277 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
278 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
279 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
277 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
278 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
279 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
280 | 280 | </tr> |
281 | 281 | <?php |
282 | 282 | $running_total = $ticket->base_price()->amount(); |
@@ -284,44 +284,44 @@ discard block |
||
284 | 284 | $running_total = 0; |
285 | 285 | } |
286 | 286 | // now add price modifiers |
287 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
287 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
288 | 288 | <tr> |
289 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
290 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
291 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
289 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
290 | + <?php if ($price_mod->is_percent()) { ?> |
|
291 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
292 | 292 | <?php |
293 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
293 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
294 | 294 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
295 | 295 | ?> |
296 | 296 | <?php } else { ?> |
297 | 297 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
298 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
298 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
299 | 299 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
300 | 300 | <?php } ?> |
301 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
301 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
302 | 302 | <?php $running_total += $new_sub_total; ?> |
303 | 303 | </tr> |
304 | 304 | <?php } ?> |
305 | - <?php if ( $ticket->taxable() ) { ?> |
|
305 | + <?php if ($ticket->taxable()) { ?> |
|
306 | 306 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
307 | 307 | <tr> |
308 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
309 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
308 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
309 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
310 | 310 | </tr> |
311 | 311 | |
312 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
312 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
313 | 313 | <tr> |
314 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
315 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
316 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
317 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
314 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
315 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
316 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
317 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
318 | 318 | <?php $running_total += $tax_amount; ?> |
319 | 319 | </tr> |
320 | 320 | <?php } ?> |
321 | 321 | <?php } ?> |
322 | 322 | <tr> |
323 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
324 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
323 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
324 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
325 | 325 | </tr> |
326 | 326 | </tbody> |
327 | 327 | </table> |
@@ -331,106 +331,106 @@ discard block |
||
331 | 331 | <?php } ?> |
332 | 332 | |
333 | 333 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
334 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
335 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
336 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
337 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
334 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
335 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
336 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
337 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
338 | 338 | </section> |
339 | 339 | <br/> |
340 | 340 | |
341 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
341 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
342 | 342 | |
343 | - <?php if ( $ticket->min() &&$ticket->max() ) { ?> |
|
343 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
344 | 344 | <section class="tckt-slctr-tkt-quantities-sctn"> |
345 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
346 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
347 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
348 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
345 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
346 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
347 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
348 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
349 | 349 | <?php //$max = min( $max, $max_atndz );?> |
350 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
350 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
351 | 351 | </section> |
352 | 352 | <br/> |
353 | 353 | <?php } ?> |
354 | 354 | |
355 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
355 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
356 | 356 | <section class="tckt-slctr-tkt-uses-sctn"> |
357 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
357 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
358 | 358 | <span class="drk-grey-text small-text no-bold"> - <?php |
359 | 359 | echo apply_filters( |
360 | 360 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
361 | 361 | sprintf( |
362 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
362 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
363 | 363 | '<br/>', |
364 | 364 | '<strong>', |
365 | 365 | '</strong>' |
366 | 366 | ) |
367 | 367 | ); |
368 | 368 | ?></span><br/> |
369 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
369 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
370 | 370 | </section> |
371 | 371 | <?php } ?> |
372 | 372 | |
373 | 373 | <?php |
374 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
374 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
375 | 375 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
376 | - if ( ! empty( $datetimes )) { ?> |
|
376 | + if ( ! empty($datetimes)) { ?> |
|
377 | 377 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
378 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
379 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
378 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
379 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
380 | 380 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
381 | 381 | <table class="tckt-slctr-tkt-details-tbl"> |
382 | 382 | <thead> |
383 | 383 | <tr> |
384 | 384 | <th class="tckt-slctr-tkt-details-date-th"> |
385 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
385 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
386 | 386 | </th> |
387 | 387 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
388 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
388 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
389 | 389 | </th> |
390 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
390 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
391 | 391 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
392 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
392 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
393 | 393 | </th> |
394 | 394 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
395 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
395 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
396 | 396 | </th> |
397 | 397 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
398 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
398 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
399 | 399 | </th> |
400 | 400 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
401 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
401 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
402 | 402 | </th> |
403 | 403 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
404 | 404 | </tr> |
405 | 405 | </thead> |
406 | 406 | <tbody> |
407 | 407 | <?php |
408 | - foreach ( $datetimes as $datetime ) { |
|
409 | - if ( $datetime instanceof EE_Datetime ) { |
|
408 | + foreach ($datetimes as $datetime) { |
|
409 | + if ($datetime instanceof EE_Datetime) { |
|
410 | 410 | ?> |
411 | 411 | |
412 | 412 | <tr> |
413 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
413 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
414 | 414 | <?php $datetime_name = $datetime->name(); ?> |
415 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
416 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
415 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
416 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
417 | 417 | </td> |
418 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
419 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
418 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
419 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
420 | 420 | </td> |
421 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
422 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
421 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
422 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
423 | 423 | <?php echo $ticket->sold(); ?> |
424 | 424 | </td> |
425 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
426 | - <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
425 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
426 | + <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
427 | 427 | </td> |
428 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
428 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
429 | 429 | <?php echo $datetime->sold(); ?> |
430 | 430 | </td> |
431 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
432 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
433 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
431 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
432 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
433 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
434 | 434 | </td> |
435 | 435 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
436 | 436 | </tr> |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | </div> |
449 | 449 | </td> |
450 | 450 | </tr> |
451 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
451 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
452 | 452 | <?php |
453 | 453 | $row++; |
454 | 454 | } |
@@ -457,32 +457,32 @@ discard block |
||
457 | 457 | $ticket_row_html = ob_get_clean(); |
458 | 458 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
459 | 459 | $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false; |
460 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
460 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
461 | 461 | // EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
462 | 462 | // EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ ); |
463 | 463 | // EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ ); |
464 | 464 | //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ ); |
465 | 465 | remove_filter( |
466 | 466 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
467 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
467 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
468 | 468 | ); |
469 | 469 | remove_filter( |
470 | 470 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
471 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
471 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
472 | 472 | ); |
473 | -if ( ! $hide_ticket_selector ) { |
|
473 | +if ( ! $hide_ticket_selector) { |
|
474 | 474 | ?> |
475 | 475 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
476 | 476 | |
477 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
477 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
478 | 478 | |
479 | 479 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
480 | 480 | <thead> |
481 | 481 | <tr> |
482 | 482 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
483 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
483 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
484 | 484 | </th> |
485 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
485 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
486 | 486 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
487 | 487 | <?php |
488 | 488 | /** |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @param string 'Price' The translatable text to display in the table header for price |
494 | 494 | * @param int $EVT_ID The Event ID |
495 | 495 | */ |
496 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
496 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
497 | 497 | ?> |
498 | 498 | </th> |
499 | 499 | <?php } ?> |
@@ -507,34 +507,34 @@ discard block |
||
507 | 507 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
508 | 508 | * @param int $EVT_ID The Event ID |
509 | 509 | */ |
510 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
510 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
511 | 511 | ?> |
512 | 512 | </th> |
513 | 513 | </tr> |
514 | 514 | </thead> |
515 | 515 | <tbody> |
516 | - <?php echo $ticket_row_html;?> |
|
516 | + <?php echo $ticket_row_html; ?> |
|
517 | 517 | </tbody> |
518 | 518 | </table> |
519 | 519 | <?php |
520 | - if ( $taxable_tickets && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', true ) ) { |
|
521 | - if ( $tax_settings->prices_displayed_including_taxes ) { |
|
522 | - $ticket_price_includes_taxes = __( '* price includes taxes', 'event_espresso' ); |
|
520 | + if ($taxable_tickets && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
521 | + if ($tax_settings->prices_displayed_including_taxes) { |
|
522 | + $ticket_price_includes_taxes = __('* price includes taxes', 'event_espresso'); |
|
523 | 523 | } else { |
524 | - $ticket_price_includes_taxes = __( '* price does not include taxes', 'event_espresso' ); |
|
524 | + $ticket_price_includes_taxes = __('* price does not include taxes', 'event_espresso'); |
|
525 | 525 | } |
526 | - echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">' . $ticket_price_includes_taxes . '</p>'; |
|
526 | + echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">'.$ticket_price_includes_taxes.'</p>'; |
|
527 | 527 | } |
528 | 528 | ?> |
529 | 529 | |
530 | 530 | <input type="hidden" name="noheader" value="true" /> |
531 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" /> |
|
531 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" /> |
|
532 | 532 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
533 | 533 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
534 | 534 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
535 | 535 | |
536 | 536 | <?php |
537 | -if ( $max_atndz > 0 && ! $hide_ticket_selector ) { |
|
537 | +if ($max_atndz > 0 && ! $hide_ticket_selector) { |
|
538 | 538 | echo apply_filters( |
539 | 539 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
540 | 540 | '' |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | } |
543 | 543 | ?> |
544 | 544 | |
545 | - <?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?> |
|
545 | + <?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?> |
|
546 | 546 | |
547 | 547 | </div> |
548 | -<?php } else if ( isset( $TKT_ID ) ) { ?> |
|
548 | +<?php } else if (isset($TKT_ID)) { ?> |
|
549 | 549 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
550 | 550 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
551 | 551 | <input type="hidden" name="noheader" value="true"/> |
@@ -554,27 +554,27 @@ discard block |
||
554 | 554 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
555 | 555 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
556 | 556 | <?php |
557 | - if ( $ticket instanceof EE_Ticket ) { |
|
558 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
557 | + if ($ticket instanceof EE_Ticket) { |
|
558 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
559 | 559 | $ticket_description = $ticket->description(); |
560 | 560 | ?> |
561 | 561 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
562 | 562 | <div class="no-tkt-slctr-ticket-content-dv"> |
563 | 563 | <h5><?php echo $ticket->name(); ?></h5> |
564 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
564 | + <?php if ( ! empty($ticket_description)) { ?> |
|
565 | 565 | <p><?php echo $ticket_description; ?></p> |
566 | 566 | <?php } ?> |
567 | 567 | </div> |
568 | 568 | <?php |
569 | 569 | add_filter( |
570 | 570 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
571 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
571 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
572 | 572 | ); |
573 | 573 | add_filter( |
574 | 574 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
575 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
575 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
576 | 576 | ); |
577 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
577 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
578 | 578 | } |
579 | 579 | } |
580 | 580 | ?> |