@@ -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; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_config_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if( self::$_instance instanceof EE_Config ){ |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->shutdown(); |
156 | 156 | } |
157 | 157 | self::$_instance = NULL; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if( $reinstantiate ){ |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return NULL; |
165 | 165 | } |
166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return \EE_Config |
175 | 175 | */ |
176 | 176 | private function __construct() { |
177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
179 | 179 | // setup empty config classes |
180 | 180 | $this->_initialize_config(); |
181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
184 | 184 | $this->_verify_config(); |
185 | 185 | // register shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
187 | 187 | // initialize shortcodes and modules |
188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
189 | 189 | // register widgets |
190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
191 | 191 | // shutdown |
192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
193 | 193 | // construct__end hook |
194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
195 | 195 | // hardcoded hack |
196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string current theme set. |
205 | 205 | */ |
206 | 206 | public static function get_current_theme() { |
207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
247 | - $this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
247 | + $this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
249 | + if (method_exists($settings, 'populate')) { |
|
250 | 250 | $this->$config->populate(); |
251 | 251 | } |
252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
252 | + if (method_exists($settings, 'do_hooks')) { |
|
253 | 253 | $this->$config->do_hooks(); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
258 | 258 | $this->update_espresso_config(); |
259 | 259 | } |
260 | 260 | // load_core_config__end hook |
261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
272 | 272 | protected function _verify_config() { |
273 | 273 | |
274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
275 | - ? $this->core : new EE_Core_Config(); |
|
276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
275 | + ? $this->core : new EE_Core_Config(); |
|
276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
277 | 277 | |
278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
279 | - ? $this->organization : new EE_Organization_Config(); |
|
280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
279 | + ? $this->organization : new EE_Organization_Config(); |
|
280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
281 | 281 | |
282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
283 | 283 | ? $this->currency : new EE_Currency_Config(); |
284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
285 | 285 | |
286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
287 | 287 | ? $this->registration : new EE_Registration_Config(); |
288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
289 | 289 | |
290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
291 | 291 | ? $this->admin : new EE_Admin_Config(); |
292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
293 | 293 | |
294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
297 | 297 | |
298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
301 | 301 | |
302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
303 | 303 | ? $this->environment : new EE_Environment_Config(); |
304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
305 | 305 | |
306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function get_espresso_config() { |
321 | 321 | // grab espresso configuration |
322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param $old_value |
333 | 333 | * @param $value |
334 | 334 | */ |
335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
336 | 336 | // make sure we're checking the ee config |
337 | - if ( $option == 'ee_config' ) { |
|
337 | + if ($option == 'ee_config') { |
|
338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
339 | 339 | // but NOT exact instance like WP update_option does |
340 | - if ( $value != $old_value ) { |
|
340 | + if ($value != $old_value) { |
|
341 | 341 | // if they are NOT the same, then remove the hook, |
342 | 342 | // which means the subsequent update results will be based solely on the update query results |
343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | */ |
368 | 368 | protected function _reset_espresso_addon_config() { |
369 | 369 | $this->_config_option_names = array(); |
370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
372 | - $config_class = get_class( $addon_config_obj ); |
|
373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
372 | + $config_class = get_class($addon_config_obj); |
|
373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
375 | 375 | } |
376 | 376 | $this->addons->$addon_name = NULL; |
377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | * @param bool $add_error |
388 | 388 | * @return bool |
389 | 389 | */ |
390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
392 | 392 | //$clone = clone( self::$_instance ); |
393 | 393 | //self::$_instance = NULL; |
394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
395 | 395 | $this->_reset_espresso_addon_config(); |
396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
397 | 397 | // but BEFORE the actual update occurs |
398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
399 | 399 | // now update "ee_config" |
400 | - $saved = update_option( 'ee_config', $this ); |
|
400 | + $saved = update_option('ee_config', $this); |
|
401 | 401 | // if not saved... check if the hook we just added still exists; |
402 | 402 | // if it does, it means one of two things: |
403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | // but just means no update occurred, so don't display an error to the user. |
409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
410 | 410 | // then it means that something truly went wrong |
411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
412 | 412 | // remove our action since we don't want it in the system anymore |
413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
415 | 415 | //self::$_instance = $clone; |
416 | 416 | //unset( $clone ); |
417 | 417 | // if config remains the same or was updated successfully |
418 | - if ( $saved ) { |
|
419 | - if ( $add_success ) { |
|
418 | + if ($saved) { |
|
419 | + if ($add_success) { |
|
420 | 420 | EE_Error::add_success( |
421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
423 | 423 | ); |
424 | 424 | } |
425 | 425 | return TRUE; |
426 | 426 | } else { |
427 | - if ( $add_error ) { |
|
427 | + if ($add_error) { |
|
428 | 428 | EE_Error::add_error( |
429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
431 | 431 | ); |
432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | $name = '', |
453 | 453 | $config_class = '', |
454 | 454 | $config_obj = NULL, |
455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
456 | 456 | $display_errors = TRUE |
457 | 457 | ) { |
458 | 458 | try { |
459 | - foreach ( $tests_to_run as $test ) { |
|
460 | - switch ( $test ) { |
|
459 | + foreach ($tests_to_run as $test) { |
|
460 | + switch ($test) { |
|
461 | 461 | |
462 | 462 | // TEST #1 : check that section was set |
463 | 463 | case 1 : |
464 | - if ( empty( $section ) ) { |
|
465 | - if ( $display_errors ) { |
|
464 | + if (empty($section)) { |
|
465 | + if ($display_errors) { |
|
466 | 466 | throw new EE_Error( |
467 | 467 | sprintf( |
468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
469 | 469 | $config_class |
470 | 470 | ) |
471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | // TEST #2 : check that settings section exists |
478 | 478 | case 2 : |
479 | - if ( ! isset( $this->{$section} ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if ( ! isset($this->{$section} )) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
483 | - $section ) |
|
482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
483 | + $section) |
|
484 | 484 | ); |
485 | 485 | } |
486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | // TEST #3 : check that section is the proper format |
491 | 491 | case 3 : |
492 | 492 | if ( |
493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
494 | 494 | ) { |
495 | - if ( $display_errors ) { |
|
495 | + if ($display_errors) { |
|
496 | 496 | throw new EE_Error( |
497 | 497 | sprintf( |
498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
499 | 499 | $section |
500 | 500 | ) |
501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | |
507 | 507 | // TEST #4 : check that config section name has been set |
508 | 508 | case 4 : |
509 | - if ( empty( $name ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if (empty($name)) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
513 | 513 | ); |
514 | 514 | } |
515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | |
519 | 519 | // TEST #5 : check that a config class name has been set |
520 | 520 | case 5 : |
521 | - if ( empty( $config_class ) ) { |
|
522 | - if ( $display_errors ) { |
|
521 | + if (empty($config_class)) { |
|
522 | + if ($display_errors) { |
|
523 | 523 | throw new EE_Error( |
524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
525 | 525 | ); |
526 | 526 | } |
527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | |
531 | 531 | // TEST #6 : verify config class is accessible |
532 | 532 | case 6 : |
533 | - if ( ! class_exists( $config_class ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if ( ! class_exists($config_class)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | sprintf( |
537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
538 | 538 | $config_class |
539 | 539 | ) |
540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | |
546 | 546 | // TEST #7 : check that config has even been set |
547 | 547 | case 7 : |
548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
549 | - if ( $display_errors ) { |
|
548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
549 | + if ($display_errors) { |
|
550 | 550 | throw new EE_Error( |
551 | 551 | sprintf( |
552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
553 | 553 | $section, |
554 | 554 | $name |
555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | return false; |
559 | 559 | } else { |
560 | 560 | // and make sure it's not serialized |
561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
562 | 562 | } |
563 | 563 | break; |
564 | 564 | |
565 | 565 | // TEST #8 : check that config is the requested type |
566 | 566 | case 8 : |
567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
568 | - if ( $display_errors ) { |
|
567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
568 | + if ($display_errors) { |
|
569 | 569 | throw new EE_Error( |
570 | 570 | sprintf( |
571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
572 | 572 | $section, |
573 | 573 | $name, |
574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | |
582 | 582 | // TEST #9 : verify config object |
583 | 583 | case 9 : |
584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
585 | - if ( $display_errors ) { |
|
584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
585 | + if ($display_errors) { |
|
586 | 586 | throw new EE_Error( |
587 | 587 | sprintf( |
588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
589 | - print_r( $config_obj, true ) |
|
588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
589 | + print_r($config_obj, true) |
|
590 | 590 | ) |
591 | 591 | ); |
592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - } catch( EE_Error $e ) { |
|
600 | + } catch (EE_Error $e) { |
|
601 | 601 | $e->get_error(); |
602 | 602 | } |
603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @param string $name |
615 | 615 | * @return string |
616 | 616 | */ |
617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | * @param string $name |
630 | 630 | * @return string |
631 | 631 | */ |
632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
633 | - return ! empty( $config_class ) |
|
632 | + private function _set_config_class($config_class = '', $name = '') { |
|
633 | + return ! empty($config_class) |
|
634 | 634 | ? $config_class |
635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
646 | 646 | * @param EE_Config_Base $config_obj |
647 | 647 | * @return EE_Config_Base |
648 | 648 | */ |
649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
650 | 650 | // ensure config class is set to something |
651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
654 | 654 | return null; |
655 | 655 | } |
656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
660 | 660 | } |
661 | 661 | // verify the incoming config object but suppress errors |
662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
663 | 663 | $config_obj = new $config_class(); |
664 | 664 | } |
665 | - if ( get_option( $config_option_name ) ) { |
|
666 | - update_option( $config_option_name, $config_obj ); |
|
665 | + if (get_option($config_option_name)) { |
|
666 | + update_option($config_option_name, $config_obj); |
|
667 | 667 | $this->{$section}->{$name} = $config_obj; |
668 | 668 | return $this->{$section}->{$name}; |
669 | 669 | } else { |
670 | 670 | // create a wp-option for this config |
671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
673 | 673 | return $this->{$section}->{$name}; |
674 | 674 | } else { |
675 | 675 | EE_Error::add_error( |
676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
678 | 678 | ); |
679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
694 | 694 | * @param bool $throw_errors |
695 | 695 | * @return bool |
696 | 696 | */ |
697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
698 | + $config_obj = maybe_unserialize($config_obj); |
|
699 | 699 | // get class name of the incoming object |
700 | - $config_class = get_class( $config_obj ); |
|
700 | + $config_class = get_class($config_obj); |
|
701 | 701 | // run tests 1-5 and 9 to verify config |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
703 | 703 | return false; |
704 | 704 | } |
705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
708 | 708 | // save new config to db |
709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
710 | 710 | } else { |
711 | 711 | // first check if the record already exists |
712 | - $existing_config = get_option( $config_option_name ); |
|
713 | - $config_obj = serialize( $config_obj ); |
|
712 | + $existing_config = get_option($config_option_name); |
|
713 | + $config_obj = serialize($config_obj); |
|
714 | 714 | // just return if db record is already up to date |
715 | - if ( $existing_config == $config_obj ) { |
|
715 | + if ($existing_config == $config_obj) { |
|
716 | 716 | $this->{$section}->{$name} = $config_obj; |
717 | 717 | return true; |
718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
719 | 719 | // update wp-option for this config class |
720 | 720 | $this->{$section}->{$name} = $config_obj; |
721 | 721 | return true; |
722 | - } elseif ( $throw_errors ) { |
|
722 | + } elseif ($throw_errors) { |
|
723 | 723 | EE_Error::add_error( |
724 | 724 | sprintf( |
725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
726 | 726 | $config_class, |
727 | - 'EE_Config->' . $section . '->' . $name |
|
727 | + 'EE_Config->'.$section.'->'.$name |
|
728 | 728 | ), |
729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param string $config_class |
745 | 745 | * @return mixed EE_Config_Base | NULL |
746 | 746 | */ |
747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
748 | 748 | // ensure config class is set to something |
749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
752 | 752 | return NULL; |
753 | 753 | } |
754 | 754 | // now test if the requested config object exists, but suppress errors |
755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
756 | 756 | // config already exists, so pass it back |
757 | 757 | return $this->{$section}->{$name}; |
758 | 758 | } |
759 | 759 | // load config option from db if it exists |
760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
761 | 761 | // verify the newly retrieved config object, but suppress errors |
762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
763 | 763 | // config is good, so set it and pass it back |
764 | 764 | $this->{$section}->{$name} = $config_obj; |
765 | 765 | return $this->{$section}->{$name}; |
766 | 766 | } |
767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
769 | 769 | // verify the newly created config object |
770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
771 | 771 | return $this->{$section}->{$name}; |
772 | 772 | } else { |
773 | 773 | EE_Error::add_error( |
774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
776 | 776 | ); |
777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param string $config_option_name |
787 | 787 | * @return mixed EE_Config_Base | FALSE |
788 | 788 | */ |
789 | - public function get_config_option( $config_option_name = '' ) { |
|
789 | + public function get_config_option($config_option_name = '') { |
|
790 | 790 | // retrieve the wp-option for this config class. |
791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
791 | + return maybe_unserialize(get_option($config_option_name)); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
801 | 801 | * @param $page_for_posts |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
805 | 805 | // make sure page_for_posts is set |
806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
809 | 809 | // allow others to mess stuff up :D |
810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
811 | 811 | // verify that post_shortcodes is set |
812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
813 | 813 | // cycle thru post_shortcodes |
814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
815 | 815 | // are there any shortcodes to track ? |
816 | - if ( ! empty( $shortcodes )) { |
|
816 | + if ( ! empty($shortcodes)) { |
|
817 | 817 | // loop thru list of tracked shortcodes |
818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
823 | 823 | } |
824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
825 | - if ( $post_name == $page_for_posts ) { |
|
825 | + if ($post_name == $page_for_posts) { |
|
826 | 826 | continue; |
827 | 827 | } |
828 | 828 | // make sure post still exists |
829 | - $post = get_post( $post_id ); |
|
830 | - if ( $post ) { |
|
829 | + $post = get_post($post_id); |
|
830 | + if ($post) { |
|
831 | 831 | // check that the post name matches what we have saved |
832 | - if ( $post->post_name == $post_name ) { |
|
832 | + if ($post->post_name == $post_name) { |
|
833 | 833 | // if so, then break before hitting the unset below |
834 | 834 | continue; |
835 | 835 | } |
836 | 836 | } |
837 | 837 | // we don't like missing posts around here >:( |
838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
838 | + unset($this->core->post_shortcodes[$post_name]); |
|
839 | 839 | } |
840 | 840 | } else { |
841 | 841 | // you got no shortcodes to keep track of ! |
842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
842 | + unset($this->core->post_shortcodes[$post_name]); |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | * @return string |
859 | 859 | */ |
860 | 860 | public static function get_page_for_posts() { |
861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
862 | - if ( ! $page_for_posts ) { |
|
861 | + $page_for_posts = get_option('page_for_posts'); |
|
862 | + if ( ! $page_for_posts) { |
|
863 | 863 | return 'posts'; |
864 | 864 | } |
865 | 865 | /** @type WPDB $wpdb */ |
866 | 866 | global $wpdb; |
867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -881,11 +881,11 @@ discard block |
||
881 | 881 | * @return void |
882 | 882 | */ |
883 | 883 | public function register_shortcodes_and_modules() { |
884 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
884 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
885 | 885 | return; |
886 | 886 | } |
887 | 887 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
888 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
888 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
889 | 889 | // allow modules to set hooks for the rest of the system |
890 | 890 | EE_Registry::instance()->modules = $this->_register_modules(); |
891 | 891 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | * @return void |
900 | 900 | */ |
901 | 901 | public function initialize_shortcodes_and_modules() { |
902 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
902 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
903 | 903 | return; |
904 | 904 | } |
905 | 905 | // allow shortcodes to set hooks for the rest of the system |
@@ -918,26 +918,26 @@ discard block |
||
918 | 918 | * @return void |
919 | 919 | */ |
920 | 920 | public function widgets_init() { |
921 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
921 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
922 | 922 | return; |
923 | 923 | } |
924 | 924 | //only init widgets on admin pages when not in complete maintenance, and |
925 | 925 | //on frontend when not in any maintenance mode |
926 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
926 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
927 | 927 | // grab list of installed widgets |
928 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
928 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
929 | 929 | // filter list of modules to register |
930 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
930 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
931 | 931 | |
932 | - if ( ! empty( $widgets_to_register ) ) { |
|
932 | + if ( ! empty($widgets_to_register)) { |
|
933 | 933 | // cycle thru widget folders |
934 | - foreach ( $widgets_to_register as $widget_path ) { |
|
934 | + foreach ($widgets_to_register as $widget_path) { |
|
935 | 935 | // add to list of installed widget modules |
936 | - EE_Config::register_ee_widget( $widget_path ); |
|
936 | + EE_Config::register_ee_widget($widget_path); |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | // filter list of installed modules |
940 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
940 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
941 | 941 | } |
942 | 942 | } |
943 | 943 | |
@@ -950,54 +950,54 @@ discard block |
||
950 | 950 | * @param string $widget_path - full path up to and including widget folder |
951 | 951 | * @return void |
952 | 952 | */ |
953 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
954 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
953 | + public static function register_ee_widget($widget_path = NULL) { |
|
954 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
955 | 955 | $widget_ext = '.widget.php'; |
956 | 956 | // make all separators match |
957 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
957 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
958 | 958 | // does the file path INCLUDE the actual file name as part of the path ? |
959 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
959 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
960 | 960 | // grab and shortcode file name from directory name and break apart at dots |
961 | - $file_name = explode( '.', basename( $widget_path )); |
|
961 | + $file_name = explode('.', basename($widget_path)); |
|
962 | 962 | // take first segment from file name pieces and remove class prefix if it exists |
963 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
963 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
964 | 964 | // sanitize shortcode directory name |
965 | - $widget = sanitize_key( $widget ); |
|
965 | + $widget = sanitize_key($widget); |
|
966 | 966 | // now we need to rebuild the shortcode path |
967 | - $widget_path = explode( DS, $widget_path ); |
|
967 | + $widget_path = explode(DS, $widget_path); |
|
968 | 968 | // remove last segment |
969 | - array_pop( $widget_path ); |
|
969 | + array_pop($widget_path); |
|
970 | 970 | // glue it back together |
971 | - $widget_path = implode( DS, $widget_path ); |
|
971 | + $widget_path = implode(DS, $widget_path); |
|
972 | 972 | } else { |
973 | 973 | // grab and sanitize widget directory name |
974 | - $widget = sanitize_key( basename( $widget_path )); |
|
974 | + $widget = sanitize_key(basename($widget_path)); |
|
975 | 975 | } |
976 | 976 | // create classname from widget directory name |
977 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
977 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
978 | 978 | // add class prefix |
979 | - $widget_class = 'EEW_' . $widget; |
|
979 | + $widget_class = 'EEW_'.$widget; |
|
980 | 980 | // does the widget exist ? |
981 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
981 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
982 | 982 | $msg = sprintf( |
983 | - __( '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', 'event_espresso' ), |
|
983 | + __('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', 'event_espresso'), |
|
984 | 984 | $widget_class, |
985 | - $widget_path . DS . $widget_class . $widget_ext |
|
985 | + $widget_path.DS.$widget_class.$widget_ext |
|
986 | 986 | ); |
987 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
987 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
988 | 988 | return; |
989 | 989 | } |
990 | 990 | // load the widget class file |
991 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
991 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
992 | 992 | // verify that class exists |
993 | - if ( ! class_exists( $widget_class )) { |
|
994 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
995 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
993 | + if ( ! class_exists($widget_class)) { |
|
994 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
995 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
996 | 996 | return; |
997 | 997 | } |
998 | - register_widget( $widget_class ); |
|
998 | + register_widget($widget_class); |
|
999 | 999 | // add to array of registered widgets |
1000 | - EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext; |
|
1000 | + EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1010,18 +1010,18 @@ discard block |
||
1010 | 1010 | */ |
1011 | 1011 | private function _register_shortcodes() { |
1012 | 1012 | // grab list of installed shortcodes |
1013 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1013 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1014 | 1014 | // filter list of modules to register |
1015 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
1016 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1015 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
1016 | + if ( ! empty($shortcodes_to_register)) { |
|
1017 | 1017 | // cycle thru shortcode folders |
1018 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1018 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1019 | 1019 | // add to list of installed shortcode modules |
1020 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1020 | + EE_Config::register_shortcode($shortcode_path); |
|
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | // filter list of installed modules |
1024 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
1024 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
@@ -1033,56 +1033,56 @@ discard block |
||
1033 | 1033 | * @param string $shortcode_path - full path up to and including shortcode folder |
1034 | 1034 | * @return bool |
1035 | 1035 | */ |
1036 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
1037 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
1036 | + public static function register_shortcode($shortcode_path = NULL) { |
|
1037 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1038 | 1038 | $shortcode_ext = '.shortcode.php'; |
1039 | 1039 | // make all separators match |
1040 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1040 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1041 | 1041 | // does the file path INCLUDE the actual file name as part of the path ? |
1042 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
1042 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
1043 | 1043 | // grab shortcode file name from directory name and break apart at dots |
1044 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
1044 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1045 | 1045 | // take first segment from file name pieces and remove class prefix if it exists |
1046 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
1046 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
1047 | 1047 | // sanitize shortcode directory name |
1048 | - $shortcode = sanitize_key( $shortcode ); |
|
1048 | + $shortcode = sanitize_key($shortcode); |
|
1049 | 1049 | // now we need to rebuild the shortcode path |
1050 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1050 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1051 | 1051 | // remove last segment |
1052 | - array_pop( $shortcode_path ); |
|
1052 | + array_pop($shortcode_path); |
|
1053 | 1053 | // glue it back together |
1054 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1054 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1055 | 1055 | } else { |
1056 | 1056 | // we need to generate the filename based off of the folder name |
1057 | 1057 | // grab and sanitize shortcode directory name |
1058 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
1059 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1058 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1059 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1060 | 1060 | } |
1061 | 1061 | // create classname from shortcode directory or file name |
1062 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
1062 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1063 | 1063 | // add class prefix |
1064 | - $shortcode_class = 'EES_' . $shortcode; |
|
1064 | + $shortcode_class = 'EES_'.$shortcode; |
|
1065 | 1065 | // does the shortcode exist ? |
1066 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
1066 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1067 | 1067 | $msg = sprintf( |
1068 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
1068 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
1069 | 1069 | $shortcode_class, |
1070 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1070 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1071 | 1071 | ); |
1072 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1072 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1073 | 1073 | return FALSE; |
1074 | 1074 | } |
1075 | 1075 | // load the shortcode class file |
1076 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1076 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1077 | 1077 | // verify that class exists |
1078 | - if ( ! class_exists( $shortcode_class )) { |
|
1079 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
1080 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1078 | + if ( ! class_exists($shortcode_class)) { |
|
1079 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
1080 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1081 | 1081 | return FALSE; |
1082 | 1082 | } |
1083 | - $shortcode = strtoupper( $shortcode ); |
|
1083 | + $shortcode = strtoupper($shortcode); |
|
1084 | 1084 | // add to array of registered shortcodes |
1085 | - EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1085 | + EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1086 | 1086 | return TRUE; |
1087 | 1087 | } |
1088 | 1088 | |
@@ -1097,23 +1097,23 @@ discard block |
||
1097 | 1097 | */ |
1098 | 1098 | private function _register_modules() { |
1099 | 1099 | // grab list of installed modules |
1100 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1100 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1101 | 1101 | // filter list of modules to register |
1102 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
1102 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
1103 | 1103 | |
1104 | 1104 | |
1105 | - if ( ! empty( $modules_to_register ) ) { |
|
1105 | + if ( ! empty($modules_to_register)) { |
|
1106 | 1106 | // loop through folders |
1107 | - foreach ( $modules_to_register as $module_path ) { |
|
1107 | + foreach ($modules_to_register as $module_path) { |
|
1108 | 1108 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1109 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
1109 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
1110 | 1110 | // add to list of installed modules |
1111 | - EE_Config::register_module( $module_path ); |
|
1111 | + EE_Config::register_module($module_path); |
|
1112 | 1112 | } |
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | // filter list of installed modules |
1116 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
1116 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
@@ -1126,54 +1126,54 @@ discard block |
||
1126 | 1126 | * @param string $module_path - full path up to and including module folder |
1127 | 1127 | * @return bool |
1128 | 1128 | */ |
1129 | - public static function register_module( $module_path = NULL ) { |
|
1130 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1129 | + public static function register_module($module_path = NULL) { |
|
1130 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1131 | 1131 | $module_ext = '.module.php'; |
1132 | 1132 | // make all separators match |
1133 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1133 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1134 | 1134 | // does the file path INCLUDE the actual file name as part of the path ? |
1135 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1135 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1136 | 1136 | // grab and shortcode file name from directory name and break apart at dots |
1137 | - $module_file = explode( '.', basename( $module_path )); |
|
1137 | + $module_file = explode('.', basename($module_path)); |
|
1138 | 1138 | // now we need to rebuild the shortcode path |
1139 | - $module_path = explode( DS, $module_path ); |
|
1139 | + $module_path = explode(DS, $module_path); |
|
1140 | 1140 | // remove last segment |
1141 | - array_pop( $module_path ); |
|
1141 | + array_pop($module_path); |
|
1142 | 1142 | // glue it back together |
1143 | - $module_path = implode( DS, $module_path ) . DS; |
|
1143 | + $module_path = implode(DS, $module_path).DS; |
|
1144 | 1144 | // take first segment from file name pieces and sanitize it |
1145 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1145 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1146 | 1146 | // ensure class prefix is added |
1147 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1147 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1148 | 1148 | } else { |
1149 | 1149 | // we need to generate the filename based off of the folder name |
1150 | 1150 | // grab and sanitize module name |
1151 | - $module = strtolower( basename( $module_path )); |
|
1152 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1151 | + $module = strtolower(basename($module_path)); |
|
1152 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1153 | 1153 | // like trailingslashit() |
1154 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1154 | + $module_path = rtrim($module_path, DS).DS; |
|
1155 | 1155 | // create classname from module directory name |
1156 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1156 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1157 | 1157 | // add class prefix |
1158 | - $module_class = 'EED_' . $module; |
|
1158 | + $module_class = 'EED_'.$module; |
|
1159 | 1159 | } |
1160 | 1160 | // does the module exist ? |
1161 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1162 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1163 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1161 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1162 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1163 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1164 | 1164 | return FALSE; |
1165 | 1165 | } |
1166 | 1166 | // load the module class file |
1167 | - require_once( $module_path . $module_class . $module_ext ); |
|
1167 | + require_once($module_path.$module_class.$module_ext); |
|
1168 | 1168 | // verify that class exists |
1169 | - if ( ! class_exists( $module_class )) { |
|
1170 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1171 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1169 | + if ( ! class_exists($module_class)) { |
|
1170 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1171 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1172 | 1172 | return FALSE; |
1173 | 1173 | } |
1174 | 1174 | // add to array of registered modules |
1175 | - EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext; |
|
1176 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class ); |
|
1175 | + EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext; |
|
1176 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class); |
|
1177 | 1177 | return TRUE; |
1178 | 1178 | } |
1179 | 1179 | |
@@ -1187,23 +1187,23 @@ discard block |
||
1187 | 1187 | */ |
1188 | 1188 | private function _initialize_shortcodes() { |
1189 | 1189 | // cycle thru shortcode folders |
1190 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1190 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1191 | 1191 | // add class prefix |
1192 | - $shortcode_class = 'EES_' . $shortcode; |
|
1192 | + $shortcode_class = 'EES_'.$shortcode; |
|
1193 | 1193 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1194 | 1194 | // which set hooks ? |
1195 | - if ( is_admin() ) { |
|
1195 | + if (is_admin()) { |
|
1196 | 1196 | // fire immediately |
1197 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1197 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1198 | 1198 | } else { |
1199 | 1199 | // delay until other systems are online |
1200 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1200 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1201 | 1201 | // convert classname to UPPERCASE and create WP shortcode. |
1202 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1202 | + $shortcode_tag = strtoupper($shortcode); |
|
1203 | 1203 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1204 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1204 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1205 | 1205 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1206 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1206 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1207 | 1207 | } |
1208 | 1208 | } |
1209 | 1209 | } |
@@ -1220,15 +1220,15 @@ discard block |
||
1220 | 1220 | */ |
1221 | 1221 | private function _initialize_modules() { |
1222 | 1222 | // cycle thru shortcode folders |
1223 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1223 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1224 | 1224 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1225 | 1225 | // which set hooks ? |
1226 | - if ( is_admin() ) { |
|
1226 | + if (is_admin()) { |
|
1227 | 1227 | // fire immediately |
1228 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1228 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1229 | 1229 | } else { |
1230 | 1230 | // delay until other systems are online |
1231 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1231 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1232 | 1232 | } |
1233 | 1233 | } |
1234 | 1234 | } |
@@ -1246,26 +1246,26 @@ discard block |
||
1246 | 1246 | * @param string $key - url param key indicating a route is being called |
1247 | 1247 | * @return bool |
1248 | 1248 | */ |
1249 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1250 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1251 | - $module = str_replace( 'EED_', '', $module ); |
|
1252 | - $module_class = 'EED_' . $module; |
|
1253 | - if ( ! isset( EE_Registry::instance()->modules->$module_class )) { |
|
1254 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1255 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1249 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1250 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1251 | + $module = str_replace('EED_', '', $module); |
|
1252 | + $module_class = 'EED_'.$module; |
|
1253 | + if ( ! isset(EE_Registry::instance()->modules->$module_class)) { |
|
1254 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1255 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | return FALSE; |
1257 | 1257 | } |
1258 | - if ( empty( $route )) { |
|
1259 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1260 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1258 | + if (empty($route)) { |
|
1259 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1260 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1261 | 1261 | return FALSE; |
1262 | 1262 | } |
1263 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1264 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1265 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1263 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1264 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1265 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1266 | 1266 | return FALSE; |
1267 | 1267 | } |
1268 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1268 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1269 | 1269 | return TRUE; |
1270 | 1270 | } |
1271 | 1271 | |
@@ -1279,11 +1279,11 @@ discard block |
||
1279 | 1279 | * @param string $key - url param key indicating a route is being called |
1280 | 1280 | * @return string |
1281 | 1281 | */ |
1282 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1283 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1284 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1285 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1286 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1282 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1283 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1284 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1285 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1286 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1287 | 1287 | } |
1288 | 1288 | return NULL; |
1289 | 1289 | } |
@@ -1312,35 +1312,35 @@ discard block |
||
1312 | 1312 | * @param string $key - url param key indicating a route is being called |
1313 | 1313 | * @return bool |
1314 | 1314 | */ |
1315 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1316 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1317 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1318 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1319 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1315 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1316 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1317 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1318 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1319 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1320 | 1320 | return FALSE; |
1321 | 1321 | } |
1322 | - if ( empty( $forward )) { |
|
1323 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1324 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1322 | + if (empty($forward)) { |
|
1323 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1324 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1325 | 1325 | return FALSE; |
1326 | 1326 | } |
1327 | - if ( is_array( $forward )) { |
|
1328 | - if ( ! isset( $forward[1] )) { |
|
1329 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1330 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + if (is_array($forward)) { |
|
1328 | + if ( ! isset($forward[1])) { |
|
1329 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1330 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } |
1333 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1334 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1335 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1333 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1334 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1335 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1336 | 1336 | return FALSE; |
1337 | 1337 | } |
1338 | - } else if ( ! function_exists( $forward )) { |
|
1339 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1340 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + } else if ( ! function_exists($forward)) { |
|
1339 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1340 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1341 | 1341 | return FALSE; |
1342 | 1342 | } |
1343 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1343 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1344 | 1344 | return TRUE; |
1345 | 1345 | } |
1346 | 1346 | |
@@ -1355,10 +1355,10 @@ discard block |
||
1355 | 1355 | * @param string $key - url param key indicating a route is being called |
1356 | 1356 | * @return string |
1357 | 1357 | */ |
1358 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1359 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1360 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1361 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1358 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1359 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1360 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1361 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1362 | 1362 | } |
1363 | 1363 | return NULL; |
1364 | 1364 | } |
@@ -1375,19 +1375,19 @@ discard block |
||
1375 | 1375 | * @param string $key - url param key indicating a route is being called |
1376 | 1376 | * @return bool |
1377 | 1377 | */ |
1378 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1379 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1380 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1381 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1382 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1378 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1379 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1380 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1381 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1382 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1383 | 1383 | return FALSE; |
1384 | 1384 | } |
1385 | - if ( ! is_readable( $view )) { |
|
1386 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1387 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1385 | + if ( ! is_readable($view)) { |
|
1386 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1387 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1388 | 1388 | return FALSE; |
1389 | 1389 | } |
1390 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1390 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1391 | 1391 | return TRUE; |
1392 | 1392 | } |
1393 | 1393 | |
@@ -1404,10 +1404,10 @@ discard block |
||
1404 | 1404 | * @param string $key - url param key indicating a route is being called |
1405 | 1405 | * @return string |
1406 | 1406 | */ |
1407 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1408 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1409 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1410 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1407 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1408 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1409 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1410 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1411 | 1411 | } |
1412 | 1412 | return NULL; |
1413 | 1413 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | |
1417 | 1417 | public function shutdown() { |
1418 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1418 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1432 | 1432 | * basically, they should just be well-defined stdClasses |
1433 | 1433 | */ |
1434 | -class EE_Config_Base{ |
|
1434 | +class EE_Config_Base { |
|
1435 | 1435 | |
1436 | 1436 | /** |
1437 | 1437 | * Utility function for escaping the value of a property and returning. |
@@ -1440,13 +1440,13 @@ discard block |
||
1440 | 1440 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1441 | 1441 | * @throws \EE_Error |
1442 | 1442 | */ |
1443 | - public function get_pretty( $property ) { |
|
1444 | - if ( ! property_exists( $this, $property ) ) { |
|
1445 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1443 | + public function get_pretty($property) { |
|
1444 | + if ( ! property_exists($this, $property)) { |
|
1445 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1446 | 1446 | } |
1447 | 1447 | //just handling escaping of strings for now. |
1448 | - if ( is_string( $this->$property ) ) { |
|
1449 | - return stripslashes( $this->$property ); |
|
1448 | + if (is_string($this->$property)) { |
|
1449 | + return stripslashes($this->$property); |
|
1450 | 1450 | } |
1451 | 1451 | return $this->$property; |
1452 | 1452 | } |
@@ -1455,19 +1455,19 @@ discard block |
||
1455 | 1455 | |
1456 | 1456 | public function populate() { |
1457 | 1457 | //grab defaults via a new instance of this class. |
1458 | - $class_name = get_class( $this ); |
|
1458 | + $class_name = get_class($this); |
|
1459 | 1459 | $defaults = new $class_name; |
1460 | 1460 | |
1461 | 1461 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1462 | 1462 | //default from our $defaults object. |
1463 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1464 | - if ( is_null( $this->$property ) ) { |
|
1463 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1464 | + if (is_null($this->$property)) { |
|
1465 | 1465 | $this->$property = $value; |
1466 | 1466 | } |
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | //cleanup |
1470 | - unset( $defaults ); |
|
1470 | + unset($defaults); |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | |
@@ -1559,12 +1559,12 @@ discard block |
||
1559 | 1559 | */ |
1560 | 1560 | public function __construct() { |
1561 | 1561 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1562 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1562 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1563 | 1563 | // set default organization settings |
1564 | 1564 | $this->current_blog_id = get_current_blog_id(); |
1565 | 1565 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1566 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1567 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1566 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1567 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1568 | 1568 | $this->post_shortcodes = array(); |
1569 | 1569 | $this->module_route_map = array(); |
1570 | 1570 | $this->module_forward_map = array(); |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1584 | 1584 | |
1585 | 1585 | //ueip constant check |
1586 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1586 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1587 | 1587 | $this->ee_ueip_optin = FALSE; |
1588 | 1588 | $this->ee_ueip_has_notified = TRUE; |
1589 | 1589 | } |
@@ -1623,8 +1623,8 @@ discard block |
||
1623 | 1623 | * @return string |
1624 | 1624 | */ |
1625 | 1625 | public function reg_page_url() { |
1626 | - if ( ! $this->reg_page_url ) { |
|
1627 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1626 | + if ( ! $this->reg_page_url) { |
|
1627 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1628 | 1628 | } |
1629 | 1629 | return $this->reg_page_url; |
1630 | 1630 | } |
@@ -1637,12 +1637,12 @@ discard block |
||
1637 | 1637 | * @return string |
1638 | 1638 | */ |
1639 | 1639 | public function txn_page_url($query_args = array()) { |
1640 | - if ( ! $this->txn_page_url ) { |
|
1641 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1640 | + if ( ! $this->txn_page_url) { |
|
1641 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1642 | 1642 | } |
1643 | - if($query_args){ |
|
1644 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1645 | - }else{ |
|
1643 | + if ($query_args) { |
|
1644 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1645 | + } else { |
|
1646 | 1646 | return $this->txn_page_url; |
1647 | 1647 | } |
1648 | 1648 | } |
@@ -1654,12 +1654,12 @@ discard block |
||
1654 | 1654 | * @return string |
1655 | 1655 | */ |
1656 | 1656 | public function thank_you_page_url($query_args = array()) { |
1657 | - if ( ! $this->thank_you_page_url ) { |
|
1658 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1657 | + if ( ! $this->thank_you_page_url) { |
|
1658 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1659 | 1659 | } |
1660 | - if($query_args){ |
|
1661 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1662 | - }else{ |
|
1660 | + if ($query_args) { |
|
1661 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1662 | + } else { |
|
1663 | 1663 | return $this->thank_you_page_url; |
1664 | 1664 | } |
1665 | 1665 | } |
@@ -1670,8 +1670,8 @@ discard block |
||
1670 | 1670 | * @return string |
1671 | 1671 | */ |
1672 | 1672 | public function cancel_page_url() { |
1673 | - if ( ! $this->cancel_page_url ) { |
|
1674 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1673 | + if ( ! $this->cancel_page_url) { |
|
1674 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1675 | 1675 | } |
1676 | 1676 | return $this->cancel_page_url; |
1677 | 1677 | } |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | //reset all url properties |
1700 | 1700 | $this->_reset_urls(); |
1701 | 1701 | //return what to save to db |
1702 | - return array_keys( get_object_vars( $this ) ); |
|
1702 | + return array_keys(get_object_vars($this)); |
|
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | } |
@@ -1931,39 +1931,39 @@ discard block |
||
1931 | 1931 | * @param null $CNT_ISO |
1932 | 1932 | * @return \EE_Currency_Config |
1933 | 1933 | */ |
1934 | - public function __construct( $CNT_ISO = NULL ) { |
|
1934 | + public function __construct($CNT_ISO = NULL) { |
|
1935 | 1935 | |
1936 | 1936 | // get country code from organization settings or use default |
1937 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1937 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1938 | 1938 | // but override if requested |
1939 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1940 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
1939 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1940 | + EE_Registry::instance()->load_helper('Activation'); |
|
1941 | 1941 | // 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 |
1942 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1942 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1943 | 1943 | // retrieve the country settings from the db, just in case they have been customized |
1944 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1945 | - if ( $country instanceof EE_Country ) { |
|
1946 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1947 | - $this->name = $country->currency_name_single(); // Dollar |
|
1948 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1949 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1950 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1951 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1952 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1953 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1944 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1945 | + if ($country instanceof EE_Country) { |
|
1946 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1947 | + $this->name = $country->currency_name_single(); // Dollar |
|
1948 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1949 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1950 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1951 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1952 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1953 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1954 | 1954 | } |
1955 | 1955 | } |
1956 | 1956 | // fallback to hardcoded defaults, in case the above failed |
1957 | - if ( empty( $this->code )) { |
|
1957 | + if (empty($this->code)) { |
|
1958 | 1958 | // set default currency settings |
1959 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1960 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1961 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1962 | - $this->sign = '$'; // currency sign: $ |
|
1963 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1964 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1965 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1966 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1959 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1960 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1961 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1962 | + $this->sign = '$'; // currency sign: $ |
|
1963 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1964 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1965 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1966 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1967 | 1967 | } |
1968 | 1968 | } |
1969 | 1969 | } |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | * @since 4.8.8.rc.019 |
2104 | 2104 | */ |
2105 | 2105 | public function do_hooks() { |
2106 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2106 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2107 | 2107 | } |
2108 | 2108 | |
2109 | 2109 | |
@@ -2111,7 +2111,7 @@ discard block |
||
2111 | 2111 | * @return void |
2112 | 2112 | */ |
2113 | 2113 | public function set_default_reg_status_on_EEM_Event() { |
2114 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2114 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | |
@@ -2216,10 +2216,10 @@ discard block |
||
2216 | 2216 | * @param bool $reset |
2217 | 2217 | * @return string |
2218 | 2218 | */ |
2219 | - public function log_file_name( $reset = FALSE ) { |
|
2220 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2221 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2222 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2219 | + public function log_file_name($reset = FALSE) { |
|
2220 | + if (empty($this->log_file_name) || $reset) { |
|
2221 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2222 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2223 | 2223 | } |
2224 | 2224 | return $this->log_file_name; |
2225 | 2225 | } |
@@ -2231,10 +2231,10 @@ discard block |
||
2231 | 2231 | * @param bool $reset |
2232 | 2232 | * @return string |
2233 | 2233 | */ |
2234 | - public function debug_file_name( $reset = FALSE ) { |
|
2235 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2236 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2237 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2234 | + public function debug_file_name($reset = FALSE) { |
|
2235 | + if (empty($this->debug_file_name) || $reset) { |
|
2236 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2237 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2238 | 2238 | } |
2239 | 2239 | return $this->debug_file_name; |
2240 | 2240 | } |
@@ -2407,21 +2407,21 @@ discard block |
||
2407 | 2407 | // set default map settings |
2408 | 2408 | $this->use_google_maps = TRUE; |
2409 | 2409 | // for event details pages (reg page) |
2410 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2411 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2412 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2413 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2414 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2415 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2416 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2410 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2411 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2412 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2413 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2414 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2415 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2416 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2417 | 2417 | // for event list pages |
2418 | - $this->event_list_map_width = 300; // ee_map_width |
|
2419 | - $this->event_list_map_height = 185; // ee_map_height |
|
2420 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2421 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2422 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2423 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2424 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2418 | + $this->event_list_map_width = 300; // ee_map_width |
|
2419 | + $this->event_list_map_height = 185; // ee_map_height |
|
2420 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2421 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2422 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2423 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2424 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2425 | 2425 | } |
2426 | 2426 | |
2427 | 2427 | } |
@@ -2432,7 +2432,7 @@ discard block |
||
2432 | 2432 | /** |
2433 | 2433 | * stores Events_Archive settings |
2434 | 2434 | */ |
2435 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2435 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2436 | 2436 | |
2437 | 2437 | public $display_status_banner; |
2438 | 2438 | public $display_description; |
@@ -2451,7 +2451,7 @@ discard block |
||
2451 | 2451 | /** |
2452 | 2452 | * class constructor |
2453 | 2453 | */ |
2454 | - public function __construct(){ |
|
2454 | + public function __construct() { |
|
2455 | 2455 | $this->display_status_banner = 0; |
2456 | 2456 | $this->display_description = 1; |
2457 | 2457 | $this->display_ticket_selector = 0; |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | /** |
2472 | 2472 | * Stores Event_Single_Config settings |
2473 | 2473 | */ |
2474 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2474 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2475 | 2475 | |
2476 | 2476 | public $display_status_banner_single; |
2477 | 2477 | public $display_venue; |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | /** |
2501 | 2501 | * Stores Ticket_Selector_Config settings |
2502 | 2502 | */ |
2503 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2503 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2504 | 2504 | public $show_ticket_sale_columns; |
2505 | 2505 | public $show_ticket_details; |
2506 | 2506 | public $show_expired_tickets; |
@@ -2554,7 +2554,7 @@ discard block |
||
2554 | 2554 | * @return void |
2555 | 2555 | */ |
2556 | 2556 | protected function _set_php_values() { |
2557 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2557 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2558 | 2558 | $this->php->version = phpversion(); |
2559 | 2559 | } |
2560 | 2560 | |
@@ -2573,8 +2573,8 @@ discard block |
||
2573 | 2573 | * @type string $msg Any message to be displayed. |
2574 | 2574 | * } |
2575 | 2575 | */ |
2576 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2577 | - if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2576 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2577 | + if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2578 | 2578 | return __('The number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso'); |
2579 | 2579 | } else { |
2580 | 2580 | return ''; |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | * stores payment gateway info |
2611 | 2611 | * @deprecated |
2612 | 2612 | */ |
2613 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2613 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2614 | 2614 | |
2615 | 2615 | /** |
2616 | 2616 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2632,9 +2632,9 @@ discard block |
||
2632 | 2632 | * class constructor |
2633 | 2633 | * @deprecated |
2634 | 2634 | */ |
2635 | - public function __construct(){ |
|
2635 | + public function __construct() { |
|
2636 | 2636 | $this->payment_settings = array(); |
2637 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2637 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2638 | 2638 | } |
2639 | 2639 | } |
2640 | 2640 |
@@ -87,6 +87,11 @@ |
||
87 | 87 | public function count_units_to_process() { |
88 | 88 | return \EEM_Attendee::instance()->count(); |
89 | 89 | } |
90 | + |
|
91 | + /** |
|
92 | + * @param integer $offset |
|
93 | + * @param integer $limit |
|
94 | + */ |
|
90 | 95 | public function get_csv_data( $offset, $limit ) { |
91 | 96 | $attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( |
92 | 97 | array( |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use EventEspressoBatchRequest\Helpers\JobParameters; |
19 | 19 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
20 | 20 | |
21 | -if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
21 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
22 | 22 | exit('No direct script access allowed'); |
23 | 23 | } |
24 | 24 | |
@@ -27,83 +27,83 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | public function create_job(JobParameters $job_parameters) { |
30 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) { |
|
30 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) { |
|
31 | 31 | throw new BatchRequestException( |
32 | - __( 'You do not have permission to view contacts', 'event_espresso') |
|
32 | + __('You do not have permission to view contacts', 'event_espresso') |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | $filepath = $this->create_file_from_job_with_name( |
36 | 36 | $job_parameters->job_id(), |
37 | 37 | __('contact-list-report.csv', 'event_espresso') |
38 | 38 | ); |
39 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
40 | - $job_parameters->set_job_size( $this->count_units_to_process() ); |
|
39 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
40 | + $job_parameters->set_job_size($this->count_units_to_process()); |
|
41 | 41 | //we should also set the header columns |
42 | - $csv_data_for_row = $this->get_csv_data( 0, 1 ); |
|
43 | - \EE_Registry::instance()->load_helper( 'Export' ); |
|
44 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
42 | + $csv_data_for_row = $this->get_csv_data(0, 1); |
|
43 | + \EE_Registry::instance()->load_helper('Export'); |
|
44 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
45 | 45 | //if we actually processed a row there, record it |
46 | - if( $job_parameters->job_size() ) { |
|
47 | - $job_parameters->mark_processed( 1 ); |
|
46 | + if ($job_parameters->job_size()) { |
|
47 | + $job_parameters->mark_processed(1); |
|
48 | 48 | } |
49 | 49 | return new JobStepResponse( |
50 | 50 | $job_parameters, |
51 | - __( 'Contacts report started successfully...', 'event_espresso' ) |
|
51 | + __('Contacts report started successfully...', 'event_espresso') |
|
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
57 | - $csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size ); |
|
58 | - \EE_Registry::instance()->load_helper( 'Export' ); |
|
59 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
60 | - $units_processed = count( $csv_data ); |
|
61 | - $job_parameters->mark_processed( $units_processed ); |
|
57 | + $csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size); |
|
58 | + \EE_Registry::instance()->load_helper('Export'); |
|
59 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
60 | + $units_processed = count($csv_data); |
|
61 | + $job_parameters->mark_processed($units_processed); |
|
62 | 62 | $extra_response_data = array( |
63 | 63 | 'file_url' => '' |
64 | 64 | ); |
65 | - if( $units_processed < $batch_size ) { |
|
66 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
67 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
65 | + if ($units_processed < $batch_size) { |
|
66 | + $job_parameters->set_status(JobParameters::status_complete); |
|
67 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
68 | 68 | } |
69 | 69 | return new JobStepResponse( |
70 | 70 | $job_parameters, |
71 | 71 | sprintf( |
72 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
73 | - count( $csv_data ) ), |
|
72 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
73 | + count($csv_data) ), |
|
74 | 74 | $extra_response_data ); |
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function cleanup_job(JobParameters $job_parameters) { |
79 | 79 | $this->_file_helper->delete( |
80 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
80 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
81 | 81 | true, |
82 | 82 | 'd' |
83 | 83 | ); |
84 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
84 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function count_units_to_process() { |
88 | 88 | return \EEM_Attendee::instance()->count(); |
89 | 89 | } |
90 | - public function get_csv_data( $offset, $limit ) { |
|
90 | + public function get_csv_data($offset, $limit) { |
|
91 | 91 | $attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( |
92 | 92 | array( |
93 | - 'limit' => array( $offset, $limit ), |
|
94 | - 'force_join' => array( 'State', 'Country' ) ) ); |
|
93 | + 'limit' => array($offset, $limit), |
|
94 | + 'force_join' => array('State', 'Country') ) ); |
|
95 | 95 | $csv_data = array(); |
96 | - foreach( $attendee_rows as $attendee_row ){ |
|
96 | + foreach ($attendee_rows as $attendee_row) { |
|
97 | 97 | $csv_row = array(); |
98 | - foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){ |
|
99 | - if( $field_name == 'STA_ID' ){ |
|
100 | - $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
|
101 | - $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
|
102 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
103 | - $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
|
104 | - $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
|
105 | - }else{ |
|
106 | - $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
|
98 | + foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) { |
|
99 | + if ($field_name == 'STA_ID') { |
|
100 | + $state_name_field = \EEM_State::instance()->field_settings_for('STA_name'); |
|
101 | + $csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()]; |
|
102 | + }elseif ($field_name == 'CNT_ISO') { |
|
103 | + $country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name'); |
|
104 | + $csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()]; |
|
105 | + } else { |
|
106 | + $csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()]; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | $csv_data[] = $csv_row; |
@@ -99,10 +99,10 @@ |
||
99 | 99 | if( $field_name == 'STA_ID' ){ |
100 | 100 | $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
101 | 101 | $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
102 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
102 | + } elseif( $field_name == 'CNT_ISO' ){ |
|
103 | 103 | $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
104 | 104 | $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
107 | 107 | } |
108 | 108 | } |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * |
|
4 | - * Class {name} |
|
5 | - * |
|
6 | - * Description here |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage |
|
10 | - * @author Mike Nelson |
|
11 | - * @since 4.8.26 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class {name} |
|
5 | + * |
|
6 | + * Description here |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage |
|
10 | + * @author Mike Nelson |
|
11 | + * @since 4.8.26 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | namespace EventEspressoBatchRequest\JobHandlers; |
16 | 16 | use EventEspressoBatchRequest\JobHandlerBaseClasses\JobHandlerFile; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param bool $routing |
43 | 43 | * @return Registrations_Admin_Page |
44 | 44 | */ |
45 | - public function __construct( $routing = TRUE ) { |
|
46 | - parent::__construct( $routing ); |
|
45 | + public function __construct($routing = TRUE) { |
|
46 | + parent::__construct($routing); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | 'trash' => 'post.php' |
76 | 76 | ); |
77 | 77 | |
78 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
78 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
79 | 79 | //add filters so that the comment urls don't take users to a confusing 404 page |
80 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
80 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | - public function clear_comment_link( $link, $comment, $args ) { |
|
84 | + public function clear_comment_link($link, $comment, $args) { |
|
85 | 85 | //gotta make sure this only happens on this route |
86 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
87 | - if ( $post_type == 'espresso_attendees' ) |
|
86 | + $post_type = get_post_type($comment->comment_post_ID); |
|
87 | + if ($post_type == 'espresso_attendees') |
|
88 | 88 | return '#commentsdiv'; |
89 | 89 | return $link; |
90 | 90 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function _ajax_hooks() { |
94 | 94 | //todo: all hooks for registrations ajax goes in here |
95 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
95 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
108 | 108 | 'edit' => __('Edit Contact', 'event_espresso'), |
109 | 109 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
110 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
111 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
110 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
111 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
112 | 112 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
113 | 113 | ), |
114 | 114 | 'publishbox' => array( |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | |
137 | 137 | $this->_get_registration_status_array(); |
138 | 138 | |
139 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
140 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
141 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
139 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
140 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
141 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
142 | 142 | |
143 | 143 | $this->_page_routes = array( |
144 | 144 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | 'edit_registration' => array( |
157 | 157 | 'func' => '_registration_details', |
158 | - 'args' => array( 'edit' ), |
|
158 | + 'args' => array('edit'), |
|
159 | 159 | 'noheader' => TRUE, |
160 | 160 | 'capability' => 'ee_edit_registration', |
161 | 161 | 'obj_id' => $reg_id |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | 'restore_registrations' => array( |
172 | 172 | 'func' => '_trash_or_restore_registrations', |
173 | - 'args' => array( 'trash' => FALSE ), |
|
173 | + 'args' => array('trash' => FALSE), |
|
174 | 174 | 'noheader' => TRUE, |
175 | 175 | 'capability' => 'ee_delete_registrations' |
176 | 176 | ), |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'filename' => 'registrations_overview_other' |
405 | 405 | ) |
406 | 406 | ), |
407 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
407 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
408 | 408 | 'qtips' => array('Registration_List_Table_Tips'), |
409 | 409 | 'list_table' => 'EE_Registrations_List_Table', |
410 | 410 | 'require_nonce' => FALSE |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'nav' => array( |
415 | 415 | 'label' => __('REG Details', 'event_espresso'), |
416 | 416 | 'order' => 15, |
417 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
417 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
418 | 418 | 'persistent' => FALSE |
419 | 419 | ), |
420 | 420 | 'help_tabs' => array( |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | 'filename' => 'registrations_details_registrant_details' |
436 | 436 | ) |
437 | 437 | ), |
438 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
439 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
438 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
439 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
440 | 440 | 'require_nonce' => FALSE |
441 | 441 | ), |
442 | 442 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | 'order' => 15, |
461 | 461 | 'persistent' => FALSE |
462 | 462 | ), |
463 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
463 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
464 | 464 | 'require_nonce' => FALSE |
465 | 465 | ), |
466 | 466 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | 'label' => __('Edit Contact', 'event_espresso'), |
470 | 470 | 'order' => 15, |
471 | 471 | 'persistent' => FALSE, |
472 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
472 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
473 | 473 | ), |
474 | 474 | 'metaboxes' => array('attendee_editor_metaboxes'), |
475 | 475 | 'require_nonce' => FALSE |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'filename' => 'registrations_contact_list_other' |
500 | 500 | ) |
501 | 501 | ), |
502 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
502 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
503 | 503 | 'metaboxes' => array(), |
504 | 504 | 'require_nonce' => FALSE |
505 | 505 | ), |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | protected function _add_screen_options() {} |
519 | 519 | protected function _add_feature_pointers() {} |
520 | 520 | public function admin_init() { |
521 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
521 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
522 | 522 | } |
523 | 523 | public function admin_notices() {} |
524 | 524 | public function admin_footer_scripts() {} |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * @return void |
537 | 537 | */ |
538 | 538 | private function _get_registration_status_array() { |
539 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
539 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | |
@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | public function load_scripts_styles() { |
560 | 560 | //style |
561 | 561 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
562 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
562 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
563 | 563 | wp_enqueue_style('espresso_reg'); |
564 | 564 | |
565 | 565 | //script |
566 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
566 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
567 | 567 | wp_enqueue_script('espresso_reg'); |
568 | 568 | } |
569 | 569 | |
@@ -572,9 +572,9 @@ discard block |
||
572 | 572 | public function load_scripts_styles_edit_attendee() { |
573 | 573 | //stuff to only show up on our attendee edit details page. |
574 | 574 | $attendee_details_translations = array( |
575 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
575 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
576 | 576 | ); |
577 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
577 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
578 | 578 | wp_enqueue_script('jquery-validate'); |
579 | 579 | } |
580 | 580 | |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | |
593 | 593 | public function load_scripts_styles_contact_list() { |
594 | 594 | wp_deregister_style('espresso_reg'); |
595 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
595 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
596 | 596 | wp_enqueue_style('espresso_att'); |
597 | 597 | } |
598 | 598 | |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | |
602 | 602 | |
603 | 603 | public function load_scripts_styles_new_registration() { |
604 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
604 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
605 | 605 | wp_enqueue_script('ee-spco-for-admin'); |
606 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
606 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
607 | 607 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
608 | 608 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
609 | 609 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -642,23 +642,23 @@ discard block |
||
642 | 642 | |
643 | 643 | /** setup reg status bulk actions **/ |
644 | 644 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
645 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
645 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
646 | 646 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
647 | 647 | } |
648 | 648 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
649 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
649 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
650 | 650 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
651 | 651 | } |
652 | 652 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
653 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
653 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
654 | 654 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
655 | 655 | } |
656 | 656 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
657 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
657 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
658 | 658 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
659 | 659 | } |
660 | 660 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
661 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
661 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
662 | 662 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
663 | 663 | } |
664 | 664 | |
@@ -667,29 +667,29 @@ discard block |
||
667 | 667 | 'slug' => 'all', |
668 | 668 | 'label' => __('View All Registrations', 'event_espresso'), |
669 | 669 | 'count' => 0, |
670 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
670 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
671 | 671 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
672 | - ) ) |
|
672 | + )) |
|
673 | 673 | ), |
674 | 674 | 'month' => array( |
675 | 675 | 'slug' => 'month', |
676 | 676 | 'label' => __('This Month', 'event_espresso'), |
677 | 677 | 'count' => 0, |
678 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
678 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
679 | 679 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
680 | 680 | )) |
681 | 681 | ), |
682 | 682 | 'today' => array( |
683 | 683 | 'slug' => 'today', |
684 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
684 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
685 | 685 | 'count' => 0, |
686 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
686 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
687 | 687 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
688 | 688 | )) |
689 | 689 | ) |
690 | 690 | ); |
691 | 691 | |
692 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
692 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
693 | 693 | $this->_views['incomplete'] = array( |
694 | 694 | 'slug' => 'incomplete', |
695 | 695 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | ) |
726 | 726 | ); |
727 | 727 | |
728 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
728 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
729 | 729 | $this->_views['trash'] = array( |
730 | 730 | 'slug' => 'trash', |
731 | 731 | 'label' => __('Trash', 'event_espresso'), |
@@ -764,42 +764,42 @@ discard block |
||
764 | 764 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
765 | 765 | ), |
766 | 766 | ); |
767 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
767 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
768 | 768 | $fc_items['resend_registration'] = array( |
769 | 769 | 'class' => 'dashicons dashicons-email-alt', |
770 | 770 | 'desc' => __('Resend Registration Details', 'event_espresso') |
771 | 771 | ); |
772 | 772 | } else { |
773 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
773 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | $sc_items = array( |
777 | 777 | 'approved_status' => array( |
778 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
779 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
778 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
779 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
780 | 780 | ), |
781 | 781 | 'pending_status' => array( |
782 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
783 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
782 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
783 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
784 | 784 | ), |
785 | 785 | 'incomplete_status' => array( |
786 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
787 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
786 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
787 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
788 | 788 | ), |
789 | 789 | 'not_approved' => array( |
790 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
791 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
790 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
791 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
792 | 792 | ), |
793 | 793 | 'declined_status' => array( |
794 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
795 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
794 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
795 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
796 | 796 | ), |
797 | 797 | 'cancelled_status' => array( |
798 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
799 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
798 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
799 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
800 | 800 | ) |
801 | 801 | ); |
802 | - return array_merge( $fc_items, $sc_items ); |
|
802 | + return array_merge($fc_items, $sc_items); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | |
@@ -812,15 +812,15 @@ discard block |
||
812 | 812 | |
813 | 813 | |
814 | 814 | protected function _registrations_overview_list_table() { |
815 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
816 | - if ( $EVT_ID ) { |
|
817 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
818 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
815 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
816 | + if ($EVT_ID) { |
|
817 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
818 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
819 | 819 | } |
820 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
821 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
820 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
821 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
822 | 822 | } |
823 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
823 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
824 | 824 | $this->display_admin_list_table_page_with_no_sidebar(); |
825 | 825 | } |
826 | 826 | |
@@ -835,19 +835,19 @@ discard block |
||
835 | 835 | */ |
836 | 836 | private function _set_registration_object() { |
837 | 837 | //get out if we've already set the object |
838 | - if ( is_object( $this->_registration )) { |
|
838 | + if (is_object($this->_registration)) { |
|
839 | 839 | return TRUE; |
840 | 840 | } |
841 | 841 | |
842 | 842 | $REG = EEM_Registration::instance(); |
843 | 843 | |
844 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
844 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
845 | 845 | |
846 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
846 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
847 | 847 | return TRUE; |
848 | 848 | else { |
849 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
850 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
849 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
850 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
851 | 851 | $this->_registration = NULL; |
852 | 852 | return FALSE; |
853 | 853 | } |
@@ -866,25 +866,25 @@ discard block |
||
866 | 866 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
867 | 867 | * @return mixed (int|array) int = count || array of registration objects |
868 | 868 | */ |
869 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
870 | - |
|
871 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
872 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
873 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
874 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
875 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
876 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
869 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
870 | + |
|
871 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
872 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
873 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
874 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
875 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
876 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
877 | 877 | $start_date = FALSE; |
878 | 878 | $end_date = FALSE; |
879 | 879 | $_where = array(); |
880 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
881 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
880 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
881 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
882 | 882 | |
883 | 883 | //set orderby |
884 | 884 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
885 | 885 | |
886 | 886 | |
887 | - switch ( $this->_req_data['orderby'] ) { |
|
887 | + switch ($this->_req_data['orderby']) { |
|
888 | 888 | case '_REG_ID': |
889 | 889 | $orderby = 'REG_ID'; |
890 | 890 | break; |
@@ -904,26 +904,26 @@ discard block |
||
904 | 904 | $orderby = 'REG_date'; |
905 | 905 | } |
906 | 906 | |
907 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
908 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
909 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
907 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
908 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
909 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
910 | 910 | |
911 | 911 | |
912 | - $offset = ($current_page-1)*$per_page; |
|
913 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
912 | + $offset = ($current_page - 1) * $per_page; |
|
913 | + $limit = $count ? NULL : array($offset, $per_page); |
|
914 | 914 | |
915 | - if($EVT_ID){ |
|
916 | - $_where['EVT_ID']=$EVT_ID; |
|
915 | + if ($EVT_ID) { |
|
916 | + $_where['EVT_ID'] = $EVT_ID; |
|
917 | 917 | } |
918 | - if($CAT_ID){ |
|
918 | + if ($CAT_ID) { |
|
919 | 919 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
920 | 920 | } |
921 | - if ( $incomplete ) { |
|
921 | + if ($incomplete) { |
|
922 | 922 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
923 | 923 | } else if ( ! $trash) { |
924 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
924 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
925 | 925 | } |
926 | - if($reg_status){ |
|
926 | + if ($reg_status) { |
|
927 | 927 | $_where['STS_ID'] = $reg_status; |
928 | 928 | } |
929 | 929 | |
@@ -935,105 +935,105 @@ discard block |
||
935 | 935 | $time_start = ' 00:00:00'; |
936 | 936 | $time_end = ' 23:59:59'; |
937 | 937 | |
938 | - if($today_a || $today ){ |
|
938 | + if ($today_a || $today) { |
|
939 | 939 | $curdate = date('Y-m-d', current_time('timestamp')); |
940 | - $_where['REG_date']= array('BETWEEN', |
|
940 | + $_where['REG_date'] = array('BETWEEN', |
|
941 | 941 | array( |
942 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
943 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
942 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
943 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
944 | 944 | )); |
945 | - }elseif($this_month_a || $this_month){ |
|
945 | + }elseif ($this_month_a || $this_month) { |
|
946 | 946 | $this_month_r = date('m', current_time('timestamp')); |
947 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
948 | - $_where['REG_date']= array('BETWEEN', |
|
947 | + $days_this_month = date('t', current_time('timestamp')); |
|
948 | + $_where['REG_date'] = array('BETWEEN', |
|
949 | 949 | array( |
950 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
951 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
950 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
951 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
952 | 952 | )); |
953 | - }elseif($month_range){ |
|
953 | + }elseif ($month_range) { |
|
954 | 954 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
955 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
956 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
957 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
958 | - $_where['REG_date']= array('BETWEEN', |
|
959 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
960 | - }elseif($start_date && $end_date){ |
|
955 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
956 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
957 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
958 | + $_where['REG_date'] = array('BETWEEN', |
|
959 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
960 | + }elseif ($start_date && $end_date) { |
|
961 | 961 | throw new EE_Error("not yet supported"); |
962 | - }elseif($start_date){ |
|
962 | + }elseif ($start_date) { |
|
963 | 963 | throw new EE_Error("not yet supported"); |
964 | - }elseif($end_date){ |
|
964 | + }elseif ($end_date) { |
|
965 | 965 | throw new EE_Error("not yet supported"); |
966 | 966 | } |
967 | 967 | |
968 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
969 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
968 | + if ( ! empty($this->_req_data['s'])) { |
|
969 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
970 | 970 | $_where['OR'] = array( |
971 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
972 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
973 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
974 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
975 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
976 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
977 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
978 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
979 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
980 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
981 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
982 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
983 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
984 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
985 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
986 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
987 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
988 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
971 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
972 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
973 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
974 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
975 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
976 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
977 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
978 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
979 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
980 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
981 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
982 | + 'REG_final_price' => array('LIKE', $sstr), |
|
983 | + 'REG_code' => array('LIKE', $sstr), |
|
984 | + 'REG_count' => array('LIKE', $sstr), |
|
985 | + 'REG_group_size' => array('LIKE', $sstr), |
|
986 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
987 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
988 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
989 | 989 | ); |
990 | 990 | } |
991 | 991 | |
992 | 992 | //capability checks |
993 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
993 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
994 | 994 | $_where['AND'] = array( |
995 | 995 | 'Event.EVT_wp_user' => get_current_user_id() |
996 | 996 | ); |
997 | 997 | } |
998 | 998 | |
999 | 999 | |
1000 | - if( $count ){ |
|
1001 | - if ( $trash ) { |
|
1002 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1003 | - } else if ( $incomplete ) { |
|
1004 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1000 | + if ($count) { |
|
1001 | + if ($trash) { |
|
1002 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1003 | + } else if ($incomplete) { |
|
1004 | + return EEM_Registration::instance()->count(array($_where)); |
|
1005 | 1005 | } else { |
1006 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1006 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1007 | 1007 | } |
1008 | 1008 | } else { |
1009 | 1009 | //make sure we remove default where conditions cause all registrations matching query are returned |
1010 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1011 | - if ( $per_page !== -1 ) { |
|
1010 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1011 | + if ($per_page !== -1) { |
|
1012 | 1012 | $query_params['limit'] = $limit; |
1013 | 1013 | } |
1014 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1014 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1015 | 1015 | |
1016 | 1016 | |
1017 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1017 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1018 | 1018 | $first_registration = $registrations[0]; |
1019 | 1019 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1020 | 1020 | $event_name = $first_registration->event_obj()->name(); |
1021 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1021 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1022 | 1022 | // edit event link |
1023 | - if ( $event_name != '' ) { |
|
1024 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1025 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1026 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1023 | + if ($event_name != '') { |
|
1024 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1025 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1026 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1030 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1029 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1030 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1031 | 1031 | |
1032 | 1032 | $this->_template_args['before_admin_page_content'] = ' |
1033 | 1033 | <div id="admin-page-header"> |
1034 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1035 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1036 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1034 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1035 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1036 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1037 | 1037 | </div> |
1038 | 1038 | '; |
1039 | 1039 | |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | $this->_set_registration_object(); |
1073 | 1073 | |
1074 | - if ( is_object( $this->_registration )) { |
|
1074 | + if (is_object($this->_registration)) { |
|
1075 | 1075 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1076 | 1076 | $this->_session = $transaction->session_data(); |
1077 | 1077 | |
@@ -1079,10 +1079,10 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | |
1081 | 1081 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1082 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1082 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1083 | 1083 | |
1084 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1085 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1084 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1085 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1086 | 1086 | |
1087 | 1087 | $this->_template_args['grand_total'] = $transaction->total(); |
1088 | 1088 | |
@@ -1090,19 +1090,19 @@ discard block |
||
1090 | 1090 | // link back to overview |
1091 | 1091 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1092 | 1092 | $this->_template_args['registration'] = $this->_registration; |
1093 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1094 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1095 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1093 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1094 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1095 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1096 | 1096 | |
1097 | 1097 | //next and previous links |
1098 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1099 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1100 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1101 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1098 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1099 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1100 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1101 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1102 | 1102 | |
1103 | 1103 | // grab header |
1104 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1105 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1104 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1105 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1106 | 1106 | |
1107 | 1107 | } else { |
1108 | 1108 | |
@@ -1123,14 +1123,14 @@ discard block |
||
1123 | 1123 | protected function _registration_details_metaboxes() { |
1124 | 1124 | $this->_set_registration_object(); |
1125 | 1125 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1126 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1127 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1128 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1129 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1126 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1127 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1128 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1129 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1130 | 1130 | } |
1131 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1132 | - if ( $this->_registration->group_size() > 1 ) { |
|
1133 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1131 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1132 | + if ($this->_registration->group_size() > 1) { |
|
1133 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1151,23 +1151,23 @@ discard block |
||
1151 | 1151 | |
1152 | 1152 | //let's get an array of all possible buttons that we can just reference |
1153 | 1153 | $status_buttons = $this->_get_reg_status_buttons(); |
1154 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1155 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1154 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1155 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1156 | 1156 | $template_args['attendee'] = $this->_registration->attendee(); |
1157 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1158 | - if ( $this->_set_registration_object() ) { |
|
1157 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1158 | + if ($this->_set_registration_object()) { |
|
1159 | 1159 | $current_status = $this->_registration->status_ID(); |
1160 | - unset( $status_buttons[$current_status] ); |
|
1161 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1162 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1160 | + unset($status_buttons[$current_status]); |
|
1161 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1162 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1163 | 1163 | } |
1164 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1164 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1165 | 1165 | } |
1166 | 1166 | $template_args['form_url'] = REG_ADMIN_URL; |
1167 | 1167 | $template_args['REG_ID'] = $this->_registration->ID(); |
1168 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1168 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1169 | 1169 | |
1170 | - EEH_Template::display_template( $template, $template_args ); |
|
1170 | + EEH_Template::display_template($template, $template_args); |
|
1171 | 1171 | |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1181,11 +1181,11 @@ discard block |
||
1181 | 1181 | private function _get_reg_status_buttons() { |
1182 | 1182 | |
1183 | 1183 | $buttons = array( |
1184 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1185 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1186 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1187 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1188 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1184 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1185 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1186 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1187 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1188 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1189 | 1189 | ); |
1190 | 1190 | return $buttons; |
1191 | 1191 | } |
@@ -1199,13 +1199,13 @@ discard block |
||
1199 | 1199 | * |
1200 | 1200 | * @return array (array with reg_id(s) updated and whether update was successful. |
1201 | 1201 | */ |
1202 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1203 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1202 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1203 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1204 | 1204 | |
1205 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1205 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1206 | 1206 | |
1207 | 1207 | //notify? |
1208 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1208 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1209 | 1209 | $this->_process_resend_registration(); |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1223,19 +1223,19 @@ discard block |
||
1223 | 1223 | * @param bool $status |
1224 | 1224 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1225 | 1225 | */ |
1226 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1226 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1227 | 1227 | $success = true; |
1228 | 1228 | // set default status if none is passed |
1229 | 1229 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1230 | 1230 | |
1231 | 1231 | //typecast and sanitize reg_id |
1232 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1232 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1233 | 1233 | |
1234 | 1234 | //loop through REG_ID's and change status |
1235 | - foreach ( $reg_ids as $r_id ) { |
|
1236 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1237 | - if ( $registration instanceof EE_Registration ) { |
|
1238 | - $registration->set_status( $status ); |
|
1235 | + foreach ($reg_ids as $r_id) { |
|
1236 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1237 | + if ($registration instanceof EE_Registration) { |
|
1238 | + $registration->set_status($status); |
|
1239 | 1239 | $result = $registration->save(); |
1240 | 1240 | |
1241 | 1241 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | $this->_req_data['_REG_ID'] = $reg_ids; |
1248 | 1248 | |
1249 | 1249 | //return $success and processed registrations |
1250 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1250 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | |
@@ -1259,37 +1259,37 @@ discard block |
||
1259 | 1259 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1260 | 1260 | * @return void |
1261 | 1261 | */ |
1262 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1262 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1263 | 1263 | |
1264 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1264 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1265 | 1265 | |
1266 | 1266 | |
1267 | - $success = isset( $result['success'] ) && $result['success']; |
|
1267 | + $success = isset($result['success']) && $result['success']; |
|
1268 | 1268 | |
1269 | 1269 | //setup success message |
1270 | - if ( $success ) { |
|
1271 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1272 | - EE_Error::add_success( $msg ); |
|
1270 | + if ($success) { |
|
1271 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1272 | + EE_Error::add_success($msg); |
|
1273 | 1273 | } else { |
1274 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1274 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1277 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1278 | 1278 | //unset nonces |
1279 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1280 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1281 | - unset( $this->_req_data[$ref] ); |
|
1279 | + foreach ($this->_req_data as $ref => $value) { |
|
1280 | + if (strpos($ref, 'nonce') !== false) { |
|
1281 | + unset($this->_req_data[$ref]); |
|
1282 | 1282 | continue; |
1283 | 1283 | } |
1284 | 1284 | |
1285 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1285 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1286 | 1286 | $this->_req_data[$ref] = $value; |
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | //merge request vars so that the reloaded list table contains any existing filter query params |
1290 | - $route = array_merge( $this->_req_data, $route ); |
|
1290 | + $route = array_merge($this->_req_data, $route); |
|
1291 | 1291 | |
1292 | - $this->_redirect_after_action( $success, '', '', $route, true ); |
|
1292 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
1293 | 1293 | |
1294 | 1294 | } |
1295 | 1295 | |
@@ -1302,29 +1302,29 @@ discard block |
||
1302 | 1302 | protected function _change_reg_status() { |
1303 | 1303 | $this->_req_data['return'] = 'view_registration'; |
1304 | 1304 | //set notify based on whether the send notifications toggle is set or not |
1305 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1306 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1305 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1306 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1307 | 1307 | |
1308 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1309 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1310 | - $this->approve_registration( $notify ); |
|
1308 | + switch ($this->_req_data['_reg_status_id']) { |
|
1309 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1310 | + $this->approve_registration($notify); |
|
1311 | 1311 | break; |
1312 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1313 | - $this->pending_registration( $notify ); |
|
1312 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1313 | + $this->pending_registration($notify); |
|
1314 | 1314 | break; |
1315 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1316 | - $this->not_approve_registration( $notify ); |
|
1315 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1316 | + $this->not_approve_registration($notify); |
|
1317 | 1317 | break; |
1318 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1319 | - $this->decline_registration( $notify ); |
|
1318 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1319 | + $this->decline_registration($notify); |
|
1320 | 1320 | break; |
1321 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1322 | - $this->cancel_registration( $notify ); |
|
1321 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1322 | + $this->cancel_registration($notify); |
|
1323 | 1323 | break; |
1324 | 1324 | default : |
1325 | 1325 | $result['success'] = false; |
1326 | - unset( $this->_req_data['return'] ); |
|
1327 | - $this->_reg_status_change_return( '', false ); |
|
1326 | + unset($this->_req_data['return']); |
|
1327 | + $this->_reg_status_change_return('', false); |
|
1328 | 1328 | break; |
1329 | 1329 | } |
1330 | 1330 | } |
@@ -1337,8 +1337,8 @@ discard block |
||
1337 | 1337 | * @param bool $notify whether or not to notify the registrant about their approval. |
1338 | 1338 | * @return void |
1339 | 1339 | */ |
1340 | - protected function approve_registration( $notify = false ) { |
|
1341 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1340 | + protected function approve_registration($notify = false) { |
|
1341 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | |
@@ -1350,8 +1350,8 @@ discard block |
||
1350 | 1350 | * @param bool $notify whether or not to notify the registrant about their approval. |
1351 | 1351 | * @return void |
1352 | 1352 | */ |
1353 | - protected function decline_registration( $notify = false ) { |
|
1354 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1353 | + protected function decline_registration($notify = false) { |
|
1354 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | |
@@ -1363,8 +1363,8 @@ discard block |
||
1363 | 1363 | * @param bool $notify whether or not to notify the registrant about their approval. |
1364 | 1364 | * @return void |
1365 | 1365 | */ |
1366 | - protected function cancel_registration( $notify = false ) { |
|
1367 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1366 | + protected function cancel_registration($notify = false) { |
|
1367 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | |
@@ -1377,8 +1377,8 @@ discard block |
||
1377 | 1377 | * @param bool $notify whether or not to notify the registrant about their approval. |
1378 | 1378 | * @return void |
1379 | 1379 | */ |
1380 | - protected function not_approve_registration( $notify = false ) { |
|
1381 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1380 | + protected function not_approve_registration($notify = false) { |
|
1381 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | |
@@ -1389,8 +1389,8 @@ discard block |
||
1389 | 1389 | * @param bool $notify whether or not to notify the registrant about their approval. |
1390 | 1390 | * @return void |
1391 | 1391 | */ |
1392 | - protected function pending_registration( $notify = false ) { |
|
1393 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1392 | + protected function pending_registration($notify = false) { |
|
1393 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | |
@@ -1404,75 +1404,75 @@ discard block |
||
1404 | 1404 | public function _reg_details_meta_box() { |
1405 | 1405 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1406 | 1406 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1407 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1407 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1408 | 1408 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1409 | 1409 | $this->_session = $transaction->session_data(); |
1410 | 1410 | |
1411 | 1411 | $filters = new EE_Line_Item_Filter_Collection(); |
1412 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1413 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1414 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1412 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1413 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1414 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1415 | 1415 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1416 | 1416 | |
1417 | 1417 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1418 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1419 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1418 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1419 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1420 | 1420 | |
1421 | 1421 | |
1422 | 1422 | $attendee = $this->_registration->attendee(); |
1423 | 1423 | |
1424 | 1424 | |
1425 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1426 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1425 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1426 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1427 | 1427 | |
1428 | 1428 | |
1429 | 1429 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1430 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1430 | + $payment = $transaction->get_first_related('Payment'); |
|
1431 | 1431 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1432 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1432 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1433 | 1433 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1434 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1434 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1435 | 1435 | $reg_details = array( |
1436 | 1436 | 'payment_method' => $payment_method->name(), |
1437 | 1437 | 'response_msg' => $payment->gateway_response(), |
1438 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1438 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1439 | 1439 | 'registration_session' => $this->_registration->session_ID(), |
1440 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1441 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1440 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1441 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1442 | 1442 | ); |
1443 | 1443 | |
1444 | 1444 | |
1445 | - if ( isset( $reg_details['registration_id'] )) { |
|
1445 | + if (isset($reg_details['registration_id'])) { |
|
1446 | 1446 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1447 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1447 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1448 | 1448 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1449 | 1449 | } |
1450 | 1450 | |
1451 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1451 | + if (isset($reg_details['payment_method'])) { |
|
1452 | 1452 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1453 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1453 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1454 | 1454 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1455 | 1455 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1456 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1456 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1457 | 1457 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1461 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1461 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1462 | 1462 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1463 | 1463 | |
1464 | 1464 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1465 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1465 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1466 | 1466 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1467 | 1467 | |
1468 | 1468 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1469 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1469 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1470 | 1470 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1471 | 1471 | |
1472 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1472 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1473 | 1473 | |
1474 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1475 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1474 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1475 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1476 | 1476 | |
1477 | 1477 | } |
1478 | 1478 | |
@@ -1488,23 +1488,23 @@ discard block |
||
1488 | 1488 | */ |
1489 | 1489 | public function _reg_questions_meta_box() { |
1490 | 1490 | |
1491 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
|
1492 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 ); |
|
1493 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 ); |
|
1494 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 ); |
|
1491 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1); |
|
1492 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1); |
|
1493 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1); |
|
1494 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1); |
|
1495 | 1495 | |
1496 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') ); |
|
1496 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID')); |
|
1497 | 1497 | |
1498 | 1498 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1499 | 1499 | |
1500 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1501 | - $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups ); |
|
1500 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1501 | + $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups); |
|
1502 | 1502 | |
1503 | 1503 | $this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form'; |
1504 | 1504 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1505 | 1505 | |
1506 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1507 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1506 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1507 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1508 | 1508 | |
1509 | 1509 | } |
1510 | 1510 | |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | * @param string $output |
1520 | 1520 | * @return string |
1521 | 1521 | */ |
1522 | - public function form_before_question_group( $output ) { |
|
1522 | + public function form_before_question_group($output) { |
|
1523 | 1523 | return ' |
1524 | 1524 | <table class="form-table ee-width-100"> |
1525 | 1525 | <tbody> |
@@ -1536,13 +1536,13 @@ discard block |
||
1536 | 1536 | * @param string $output |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - public function form_after_question_group( $output ) { |
|
1539 | + public function form_after_question_group($output) { |
|
1540 | 1540 | return ' |
1541 | 1541 | <tr class="hide-if-no-js"> |
1542 | 1542 | <th> </th> |
1543 | 1543 | <td class="reg-admin-edit-attendee-question-td"> |
1544 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1545 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1544 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1545 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1546 | 1546 | <div class="dashicons dashicons-edit"></div> |
1547 | 1547 | </a> |
1548 | 1548 | </td> |
@@ -1562,11 +1562,11 @@ discard block |
||
1562 | 1562 | * @param string $label |
1563 | 1563 | * @return string |
1564 | 1564 | */ |
1565 | - public function form_form_field_label_wrap( $label ) { |
|
1565 | + public function form_form_field_label_wrap($label) { |
|
1566 | 1566 | return ' |
1567 | 1567 | <tr> |
1568 | 1568 | <th> |
1569 | - ' . $label . ' |
|
1569 | + ' . $label.' |
|
1570 | 1570 | </th>'; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1580,10 +1580,10 @@ discard block |
||
1580 | 1580 | * @param string $label |
1581 | 1581 | * @return string |
1582 | 1582 | */ |
1583 | - public function form_form_field_input__wrap( $input ) { |
|
1583 | + public function form_form_field_input__wrap($input) { |
|
1584 | 1584 | return ' |
1585 | 1585 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1586 | - ' . $input . ' |
|
1586 | + ' . $input.' |
|
1587 | 1587 | </td> |
1588 | 1588 | </tr>'; |
1589 | 1589 | } |
@@ -1597,13 +1597,13 @@ discard block |
||
1597 | 1597 | * @return void |
1598 | 1598 | */ |
1599 | 1599 | protected function _update_attendee_registration_form() { |
1600 | - $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
|
1601 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1602 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
1603 | - $success = $this->_save_attendee_registration_form( $REG_ID, $qstns ); |
|
1600 | + $qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE; |
|
1601 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1602 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
1603 | + $success = $this->_save_attendee_registration_form($REG_ID, $qstns); |
|
1604 | 1604 | $what = __('Registration Form', 'event_espresso'); |
1605 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1606 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1605 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1606 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1607 | 1607 | |
1608 | 1608 | } |
1609 | 1609 | |
@@ -1616,26 +1616,26 @@ discard block |
||
1616 | 1616 | * @param bool $qstns |
1617 | 1617 | * @return bool |
1618 | 1618 | */ |
1619 | - private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) { |
|
1619 | + private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) { |
|
1620 | 1620 | |
1621 | - if ( ! $REG_ID || ! $qstns ) { |
|
1622 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1621 | + if ( ! $REG_ID || ! $qstns) { |
|
1622 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1623 | 1623 | } |
1624 | 1624 | $success = TRUE; |
1625 | 1625 | |
1626 | 1626 | // allow others to get in on this awesome fun :D |
1627 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
1627 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
1628 | 1628 | // loop thru questions... FINALLY!!! |
1629 | 1629 | |
1630 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
1630 | + foreach ($qstns as $QST_ID => $qstn) { |
|
1631 | 1631 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
1632 | - if ( !is_array($qstn) ) { |
|
1633 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1632 | + if ( ! is_array($qstn)) { |
|
1633 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1634 | 1634 | continue; |
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | |
1638 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
1638 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
1639 | 1639 | //get answer |
1640 | 1640 | $query_params = array( |
1641 | 1641 | 0 => array( |
@@ -1646,8 +1646,8 @@ discard block |
||
1646 | 1646 | ); |
1647 | 1647 | $answer = EEM_Answer::instance()->get_one($query_params); |
1648 | 1648 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
1649 | - if ( ! $answer instanceof EE_Answer ) { |
|
1650 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1649 | + if ( ! $answer instanceof EE_Answer) { |
|
1650 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1651 | 1651 | continue 2; |
1652 | 1652 | } |
1653 | 1653 | |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | |
1662 | 1662 | |
1663 | 1663 | //TODO: try changing this to use the model directly... not indirectly through creating a default object... |
1664 | - private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { |
|
1664 | + private function _save_new_answer($REG_ID, $QST_ID, $ans) { |
|
1665 | 1665 | $set_values = array( |
1666 | 1666 | 'QST_ID' => $QST_ID, |
1667 | 1667 | 'REG_ID' => $REG_ID, |
@@ -1688,30 +1688,30 @@ discard block |
||
1688 | 1688 | $registrations = $REG->get_all(array( |
1689 | 1689 | array( |
1690 | 1690 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1691 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1691 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1692 | 1692 | ), |
1693 | 1693 | 'force_join'=>array('Attendee'))); |
1694 | 1694 | |
1695 | 1695 | $this->_template_args['attendees'] = array(); |
1696 | 1696 | $this->_template_args['attendee_notice'] = ''; |
1697 | 1697 | EE_Registry::instance()->load_helper('Array'); |
1698 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1699 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1698 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1699 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1700 | 1700 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1701 | 1701 | } else { |
1702 | 1702 | |
1703 | 1703 | $att_nmbr = 1; |
1704 | - foreach ( $registrations as $registration ) { |
|
1704 | + foreach ($registrations as $registration) { |
|
1705 | 1705 | /* @var $registration EE_Registration */ |
1706 | 1706 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1707 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1708 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1709 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1710 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1707 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1708 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1709 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1710 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1711 | 1711 | |
1712 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1712 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1713 | 1713 | |
1714 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1714 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1715 | 1715 | |
1716 | 1716 | $att_nmbr++; |
1717 | 1717 | } |
@@ -1723,8 +1723,8 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1725 | 1725 | } |
1726 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1727 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1726 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1727 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1728 | 1728 | |
1729 | 1729 | } |
1730 | 1730 | |
@@ -1745,11 +1745,11 @@ discard block |
||
1745 | 1745 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1746 | 1746 | |
1747 | 1747 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1748 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1748 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1749 | 1749 | $primary_registration = $this->_registration->get_primary_registration(); |
1750 | 1750 | $primary_attendee = $primary_registration->attendee(); |
1751 | 1751 | |
1752 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1752 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1753 | 1753 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1754 | 1754 | $primary_registration = NULL; |
1755 | 1755 | } |
@@ -1758,28 +1758,28 @@ discard block |
||
1758 | 1758 | } |
1759 | 1759 | |
1760 | 1760 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1761 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1762 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1763 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1761 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1762 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1763 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1764 | 1764 | $this->_template_args['phone'] = $attendee->phone(); |
1765 | 1765 | |
1766 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1767 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1766 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1767 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1768 | 1768 | |
1769 | 1769 | |
1770 | 1770 | //edit link |
1771 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1772 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1771 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1772 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1773 | 1773 | |
1774 | 1774 | //create link |
1775 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1775 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1776 | 1776 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1777 | 1777 | |
1778 | 1778 | $this->_template_args['att_check'] = $att_check; |
1779 | 1779 | |
1780 | 1780 | |
1781 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1782 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1781 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1782 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1783 | 1783 | } |
1784 | 1784 | |
1785 | 1785 | |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | * @access protected |
1793 | 1793 | * @return void |
1794 | 1794 | */ |
1795 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1795 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1796 | 1796 | $REGM = EEM_Registration::instance(); |
1797 | 1797 | |
1798 | 1798 | $success = 1; |
@@ -1802,26 +1802,26 @@ discard block |
||
1802 | 1802 | $dtts = array(); |
1803 | 1803 | |
1804 | 1804 | //if empty _REG_ID then get out because there's nothing to do |
1805 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1805 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1806 | 1806 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1807 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1808 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1807 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1808 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1809 | 1809 | } |
1810 | 1810 | |
1811 | 1811 | //Checkboxes |
1812 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1812 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1813 | 1813 | // if array has more than one element than success message should be plural |
1814 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1814 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1815 | 1815 | // cycle thru checkboxes |
1816 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1816 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1817 | 1817 | |
1818 | 1818 | $REG = $REGM->get_one_by_ID($REG_ID); |
1819 | 1819 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1820 | - if ( $payment_count > 0 ) { |
|
1821 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1820 | + if ($payment_count > 0) { |
|
1821 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1822 | 1822 | $error = 1; |
1823 | 1823 | $success = 0; |
1824 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1824 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1825 | 1825 | continue; //can't trash this registration because it has payments. |
1826 | 1826 | } |
1827 | 1827 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | $dtts = array_merge($dtts, $dtt); |
1831 | 1831 | |
1832 | 1832 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1833 | - if ( !$updated ) { |
|
1833 | + if ( ! $updated) { |
|
1834 | 1834 | $success = 0; |
1835 | 1835 | } else { |
1836 | 1836 | $success = 2; |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | $tickets[$ticket->ID()] = $ticket; |
1846 | 1846 | $dtts = $ticket->get_many_related('Datetime'); |
1847 | 1847 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1848 | - if ( ! $updated ) { |
|
1848 | + if ( ! $updated) { |
|
1849 | 1849 | $success = 0; |
1850 | 1850 | } |
1851 | 1851 | |
@@ -1855,10 +1855,10 @@ discard block |
||
1855 | 1855 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1856 | 1856 | EEM_Datetime::instance()->update_sold($dtts); |
1857 | 1857 | |
1858 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1859 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1858 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1859 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1860 | 1860 | $overwrite_msgs = $error ? TRUE : FALSE; |
1861 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1861 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1862 | 1862 | } |
1863 | 1863 | |
1864 | 1864 | |
@@ -1882,16 +1882,16 @@ discard block |
||
1882 | 1882 | $success = 1; |
1883 | 1883 | |
1884 | 1884 | //Checkboxes |
1885 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1885 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1886 | 1886 | // if array has more than one element than success message should be plural |
1887 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1887 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1888 | 1888 | // cycle thru checkboxes |
1889 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1889 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1890 | 1890 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1891 | - if ( ! $REG instanceof EE_Registration ) |
|
1891 | + if ( ! $REG instanceof EE_Registration) |
|
1892 | 1892 | continue; |
1893 | 1893 | $deleted = $this->_delete_registration($REG); |
1894 | - if ( !$deleted ) { |
|
1894 | + if ( ! $deleted) { |
|
1895 | 1895 | $success = 0; |
1896 | 1896 | } |
1897 | 1897 | } |
@@ -1901,15 +1901,15 @@ discard block |
||
1901 | 1901 | $REG_ID = $this->_req_data['_REG_ID']; |
1902 | 1902 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1903 | 1903 | $deleted = $this->_delete_registration($REG); |
1904 | - if ( ! $deleted ) { |
|
1904 | + if ( ! $deleted) { |
|
1905 | 1905 | $success = 0; |
1906 | 1906 | } |
1907 | 1907 | |
1908 | 1908 | } |
1909 | 1909 | |
1910 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1911 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1912 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1910 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1911 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1912 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | |
@@ -1921,31 +1921,31 @@ discard block |
||
1921 | 1921 | * @param EE_Registration $REG registration to be deleted permenantly |
1922 | 1922 | * @return boolean true = successful deletion, false = fail. |
1923 | 1923 | */ |
1924 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1924 | + protected function _delete_registration(EE_Registration $REG) { |
|
1925 | 1925 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1926 | 1926 | $TXN = $REG->get_first_related('Transaction'); |
1927 | 1927 | $REGS = $TXN->get_many_related('Registration'); |
1928 | 1928 | |
1929 | 1929 | $all_trashed = TRUE; |
1930 | - foreach ( $REGS as $registration ) { |
|
1931 | - if ( ! $registration->get('REG_deleted') ) |
|
1930 | + foreach ($REGS as $registration) { |
|
1931 | + if ( ! $registration->get('REG_deleted')) |
|
1932 | 1932 | $all_trashed = FALSE; |
1933 | 1933 | } |
1934 | 1934 | |
1935 | - if ( ! $all_trashed ) { |
|
1936 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1935 | + if ( ! $all_trashed) { |
|
1936 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1937 | 1937 | return false; |
1938 | 1938 | } |
1939 | 1939 | |
1940 | 1940 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1941 | - foreach ( $REGS as $registration ) { |
|
1941 | + foreach ($REGS as $registration) { |
|
1942 | 1942 | |
1943 | 1943 | //delete related answers |
1944 | 1944 | $registration->delete_related_permanently('Answer'); |
1945 | 1945 | |
1946 | 1946 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1947 | 1947 | $attendee = $registration->get_first_related('Attendee'); |
1948 | - if ( $attendee instanceof EE_Attendee ) { |
|
1948 | + if ($attendee instanceof EE_Attendee) { |
|
1949 | 1949 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1950 | 1950 | } |
1951 | 1951 | |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | //now delete permanently the checkins related to this registration. |
1956 | 1956 | $registration->delete_related_permanently('Checkin'); |
1957 | 1957 | |
1958 | - if ( $registration->ID() === $REG->ID() ) |
|
1958 | + if ($registration->ID() === $REG->ID()) |
|
1959 | 1959 | continue; //we don't want to delete permanently the existing registration just yet. |
1960 | 1960 | |
1961 | 1961 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -1988,34 +1988,34 @@ discard block |
||
1988 | 1988 | * @return void |
1989 | 1989 | */ |
1990 | 1990 | public function new_registration() { |
1991 | - if ( ! $this->_set_reg_event() ) { |
|
1992 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
1991 | + if ( ! $this->_set_reg_event()) { |
|
1992 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
1993 | 1993 | } |
1994 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
1994 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
1995 | 1995 | |
1996 | 1996 | // gotta start with a clean slate if we're not coming here via ajax |
1997 | - if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) { |
|
1998 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
1997 | + if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) { |
|
1998 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
1999 | 1999 | } |
2000 | 2000 | |
2001 | - $this->_template_args['event_name'] = '' ; |
|
2001 | + $this->_template_args['event_name'] = ''; |
|
2002 | 2002 | // event name |
2003 | - if ( $this->_reg_event ) { |
|
2003 | + if ($this->_reg_event) { |
|
2004 | 2004 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2005 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2006 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2007 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2005 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2006 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2007 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2008 | 2008 | } |
2009 | 2009 | |
2010 | 2010 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2011 | 2011 | |
2012 | - if ( defined('DOING_AJAX' ) ) |
|
2012 | + if (defined('DOING_AJAX')) |
|
2013 | 2013 | $this->_return_json(); |
2014 | 2014 | |
2015 | 2015 | |
2016 | 2016 | // grab header |
2017 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2018 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2017 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2018 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2019 | 2019 | |
2020 | 2020 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2021 | 2021 | // the details template wrapper |
@@ -2033,7 +2033,7 @@ discard block |
||
2033 | 2033 | */ |
2034 | 2034 | protected function _get_registration_step_content() { |
2035 | 2035 | |
2036 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php'; |
|
2036 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php'; |
|
2037 | 2037 | $template_args = array( |
2038 | 2038 | 'title' => '', |
2039 | 2039 | 'content' => '', |
@@ -2054,11 +2054,11 @@ discard block |
||
2054 | 2054 | |
2055 | 2055 | //if the cart is empty then we know we're at step one so we'll display ticket selector |
2056 | 2056 | $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
2057 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2058 | - switch ( $step ) { |
|
2057 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2058 | + switch ($step) { |
|
2059 | 2059 | case 'ticket' : |
2060 | 2060 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2061 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2061 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2062 | 2062 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2063 | 2063 | $template_args['show_notification_toggle'] = FALSE; |
2064 | 2064 | break; |
@@ -2071,9 +2071,9 @@ discard block |
||
2071 | 2071 | break; |
2072 | 2072 | } |
2073 | 2073 | |
2074 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2074 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2075 | 2075 | |
2076 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
2076 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
2077 | 2077 | } |
2078 | 2078 | |
2079 | 2079 | |
@@ -2087,11 +2087,11 @@ discard block |
||
2087 | 2087 | * @return boolean |
2088 | 2088 | */ |
2089 | 2089 | private function _set_reg_event() { |
2090 | - if ( is_object( $this->_reg_event )) { |
|
2090 | + if (is_object($this->_reg_event)) { |
|
2091 | 2091 | return TRUE; |
2092 | 2092 | } |
2093 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2094 | - if ( ! $EVT_ID ) { |
|
2093 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2094 | + if ( ! $EVT_ID) { |
|
2095 | 2095 | return FALSE; |
2096 | 2096 | } |
2097 | 2097 | |
@@ -2112,62 +2112,62 @@ discard block |
||
2112 | 2112 | public function process_reg_step() { |
2113 | 2113 | |
2114 | 2114 | $this->_set_reg_event(); |
2115 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2115 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2116 | 2116 | |
2117 | 2117 | //what step are we on? |
2118 | - $cart = EE_Registry::instance()->SSN->get_session_data( 'cart' ); |
|
2119 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2118 | + $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
|
2119 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2120 | 2120 | |
2121 | 2121 | //if doing ajax then we need to verify the nonce |
2122 | - if ( 'DOING_AJAX' ) { |
|
2123 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2124 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2122 | + if ('DOING_AJAX') { |
|
2123 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2124 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2125 | 2125 | } |
2126 | 2126 | |
2127 | - switch ( $step ) { |
|
2127 | + switch ($step) { |
|
2128 | 2128 | case 'ticket' : |
2129 | 2129 | //process ticket selection |
2130 | 2130 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2131 | - if ( $success ) { |
|
2132 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2131 | + if ($success) { |
|
2132 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2133 | 2133 | } else { |
2134 | 2134 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2135 | 2135 | } |
2136 | - if ( defined('DOING_AJAX') ) { |
|
2136 | + if (defined('DOING_AJAX')) { |
|
2137 | 2137 | $this->new_registration(); //display next step |
2138 | 2138 | } else { |
2139 | 2139 | $query_args['action'] = 'new_registration'; |
2140 | 2140 | $query_args['processing_registration'] = true; |
2141 | 2141 | $query_args['event_id'] = $this->_reg_event->ID(); |
2142 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2142 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2143 | 2143 | } |
2144 | 2144 | break; |
2145 | 2145 | case 'questions' : |
2146 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2147 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2146 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2147 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2148 | 2148 | } |
2149 | 2149 | //process registration |
2150 | 2150 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2151 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2151 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2152 | 2152 | $query_args = array( |
2153 | 2153 | 'action' => 'new_registration', |
2154 | 2154 | 'processing_registration' => true, |
2155 | 2155 | 'event_id' => $this->_reg_event->ID() |
2156 | 2156 | ); |
2157 | 2157 | |
2158 | - if ( defined('DOING_AJAX' )) { |
|
2158 | + if (defined('DOING_AJAX')) { |
|
2159 | 2159 | //display registration form again because there are errors (maybe validation?) |
2160 | 2160 | $this->new_registration(); |
2161 | 2161 | return; |
2162 | 2162 | } else { |
2163 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2163 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2164 | 2164 | return; |
2165 | 2165 | } |
2166 | 2166 | } |
2167 | 2167 | /** @type EE_Transaction_Payments $transaction_payments */ |
2168 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2168 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2169 | 2169 | // maybe update status, and make sure to save transaction if not done already |
2170 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2170 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2171 | 2171 | $transaction->save(); |
2172 | 2172 | } |
2173 | 2173 | $query_args = array( |
@@ -2175,8 +2175,8 @@ discard block |
||
2175 | 2175 | 'TXN_ID' => $transaction->ID(), |
2176 | 2176 | 'page' => 'espresso_transactions' |
2177 | 2177 | ); |
2178 | - EE_Error::add_success( __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') ); |
|
2179 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2178 | + EE_Error::add_success(__('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso')); |
|
2179 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2180 | 2180 | break; |
2181 | 2181 | } |
2182 | 2182 | |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | * @return void |
2197 | 2197 | */ |
2198 | 2198 | protected function _attendee_contact_list_table() { |
2199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2200 | 2200 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2201 | 2201 | $this->display_admin_list_table_page_with_no_sidebar(); |
2202 | 2202 | } |
@@ -2211,10 +2211,10 @@ discard block |
||
2211 | 2211 | * @access public |
2212 | 2212 | * @return array |
2213 | 2213 | */ |
2214 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2214 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2215 | 2215 | |
2216 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2217 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2216 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2217 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2218 | 2218 | $ATT_MDL = EEM_Attendee::instance(); |
2219 | 2219 | |
2220 | 2220 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2242,47 +2242,47 @@ discard block |
||
2242 | 2242 | $orderby = 'ATT_lname'; |
2243 | 2243 | } |
2244 | 2244 | |
2245 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2245 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2246 | 2246 | |
2247 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2248 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2249 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2247 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2248 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2249 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2250 | 2250 | |
2251 | 2251 | $_where = array(); |
2252 | 2252 | |
2253 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2254 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2253 | + if (isset($this->_req_data['s'])) { |
|
2254 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2255 | 2255 | $_where['OR'] = array( |
2256 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2257 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2258 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2259 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2260 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2261 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2262 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2263 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2264 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2265 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2266 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2267 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2268 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2269 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2270 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2271 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2272 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2256 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2257 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2258 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2259 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2260 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2261 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2262 | + 'ATT_email' => array('LIKE', $sstr), |
|
2263 | + 'ATT_address' => array('LIKE', $sstr), |
|
2264 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2265 | + 'ATT_city' => array('LIKE', $sstr), |
|
2266 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2267 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2268 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2269 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2270 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2271 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2272 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2273 | 2273 | ); |
2274 | 2274 | } |
2275 | 2275 | |
2276 | 2276 | |
2277 | - $offset = ($current_page-1)*$per_page; |
|
2278 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2277 | + $offset = ($current_page - 1) * $per_page; |
|
2278 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2279 | 2279 | |
2280 | - if ( $trash ) { |
|
2281 | - $_where['status'] = array( '!=', 'publish' ); |
|
2282 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2280 | + if ($trash) { |
|
2281 | + $_where['status'] = array('!=', 'publish'); |
|
2282 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2283 | 2283 | } else { |
2284 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2285 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2284 | + $_where['status'] = array('IN', array('publish')); |
|
2285 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2286 | 2286 | } |
2287 | 2287 | |
2288 | 2288 | return $all_attendees; |
@@ -2299,10 +2299,10 @@ discard block |
||
2299 | 2299 | */ |
2300 | 2300 | protected function _resend_registration() { |
2301 | 2301 | $this->_process_resend_registration(); |
2302 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2302 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2303 | 2303 | 'action' => 'default' |
2304 | 2304 | ); |
2305 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2305 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2306 | 2306 | } |
2307 | 2307 | |
2308 | 2308 | |
@@ -2310,27 +2310,27 @@ discard block |
||
2310 | 2310 | |
2311 | 2311 | |
2312 | 2312 | |
2313 | - public function _registrations_report(){ |
|
2314 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2315 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2313 | + public function _registrations_report() { |
|
2314 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2315 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2316 | 2316 | array( |
2317 | 2317 | 'page' => 'espresso_support', |
2318 | 2318 | 'action' => 'batch_file_create', |
2319 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2320 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2321 | - 'redirect_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2322 | - )) ); |
|
2319 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2320 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2321 | + 'redirect_url' => urlencode($this->_req_data['return_url']), |
|
2322 | + ))); |
|
2323 | 2323 | } else { |
2324 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2324 | + EE_Registry::instance()->load_helper('File'); |
|
2325 | 2325 | $new_request_args = array( |
2326 | 2326 | 'export' => 'report', |
2327 | 2327 | 'action' => 'registrations_report_for_event', |
2328 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2328 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2329 | 2329 | ); |
2330 | 2330 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2331 | 2331 | |
2332 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2333 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2332 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2333 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2334 | 2334 | $EE_Export = EE_Export::instance($this->_req_data); |
2335 | 2335 | $EE_Export->export(); |
2336 | 2336 | } |
@@ -2339,28 +2339,28 @@ discard block |
||
2339 | 2339 | |
2340 | 2340 | |
2341 | 2341 | |
2342 | - public function _contact_list_export(){ |
|
2343 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2344 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2345 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2342 | + public function _contact_list_export() { |
|
2343 | + EE_Registry::instance()->load_helper('File'); |
|
2344 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2345 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2346 | 2346 | $EE_Export = EE_Export::instance($this->_req_data); |
2347 | 2347 | $EE_Export->export_attendees(); |
2348 | 2348 | } |
2349 | 2349 | } |
2350 | 2350 | |
2351 | - public function _contact_list_report(){ |
|
2352 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2353 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2351 | + public function _contact_list_report() { |
|
2352 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2353 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2354 | 2354 | array( |
2355 | 2355 | 'page' => 'espresso_support', |
2356 | 2356 | 'action' => 'batch_file_create', |
2357 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2358 | - 'redirect_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2359 | - )) ); |
|
2357 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2358 | + 'redirect_url' => urlencode($this->_req_data['return_url']), |
|
2359 | + ))); |
|
2360 | 2360 | } else { |
2361 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2362 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2363 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2361 | + EE_Registry::instance()->load_helper('File'); |
|
2362 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2363 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2364 | 2364 | $EE_Export = EE_Export::instance($this->_req_data); |
2365 | 2365 | $EE_Export->report_attendees(); |
2366 | 2366 | } |
@@ -2380,73 +2380,73 @@ discard block |
||
2380 | 2380 | * @return void |
2381 | 2381 | */ |
2382 | 2382 | protected function _duplicate_attendee() { |
2383 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2383 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2384 | 2384 | //verify we have necessary info |
2385 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2386 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2387 | - $query_args = array( 'action' => $action ); |
|
2385 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2386 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2387 | + $query_args = array('action' => $action); |
|
2388 | 2388 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2389 | 2389 | } |
2390 | 2390 | |
2391 | 2391 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2392 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2392 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2393 | 2393 | $attendee = $registration->attendee(); |
2394 | 2394 | |
2395 | 2395 | //remove relation of existing attendee on registration |
2396 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2396 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2397 | 2397 | //new attendee |
2398 | 2398 | $new_attendee = clone $attendee; |
2399 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2399 | + $new_attendee->set('ATT_ID', 0); |
|
2400 | 2400 | $new_attendee->save(); |
2401 | 2401 | |
2402 | 2402 | //add new attendee to reg |
2403 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2403 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2404 | 2404 | |
2405 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2405 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2406 | 2406 | |
2407 | 2407 | //redirect to edit page for attendee |
2408 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2408 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2409 | 2409 | |
2410 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2410 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2411 | 2411 | } |
2412 | 2412 | |
2413 | 2413 | |
2414 | 2414 | //related to cpt routes |
2415 | 2415 | protected function _insert_update_cpt_item($post_id, $post) { |
2416 | 2416 | $success = true; |
2417 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2417 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2418 | 2418 | //for attendee updates |
2419 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2419 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2420 | 2420 | //note we should only be UPDATING attendees at this point. |
2421 | 2421 | $updated_fields = array( |
2422 | 2422 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2423 | 2423 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2424 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2424 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2425 | 2425 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2426 | 2426 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2427 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2428 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2429 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2430 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2431 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2432 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2427 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2428 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2429 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2430 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2431 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2432 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2433 | 2433 | ); |
2434 | - foreach ( $updated_fields as $field => $value ) { |
|
2434 | + foreach ($updated_fields as $field => $value) { |
|
2435 | 2435 | $attendee->set($field, $value); |
2436 | 2436 | } |
2437 | 2437 | |
2438 | 2438 | $success = $attendee->save(); |
2439 | 2439 | |
2440 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2441 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2442 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2443 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2440 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2441 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2442 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2443 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2444 | 2444 | } |
2445 | 2445 | } |
2446 | 2446 | } |
2447 | 2447 | |
2448 | - if ( $success === FALSE ) |
|
2449 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2448 | + if ($success === FALSE) |
|
2449 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2450 | 2450 | |
2451 | 2451 | } |
2452 | 2452 | |
@@ -2466,17 +2466,17 @@ discard block |
||
2466 | 2466 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2467 | 2467 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2468 | 2468 | |
2469 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2470 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2469 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2470 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2471 | 2471 | } |
2472 | 2472 | |
2473 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2473 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2474 | 2474 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2475 | 2475 | } |
2476 | 2476 | |
2477 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2478 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2479 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2477 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2478 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2479 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2480 | 2480 | } |
2481 | 2481 | |
2482 | 2482 | |
@@ -2485,10 +2485,10 @@ discard block |
||
2485 | 2485 | * @param WP_Post $post wp post object |
2486 | 2486 | * @return string attendee contact info ( and form ) |
2487 | 2487 | */ |
2488 | - public function attendee_contact_info( $post ) { |
|
2488 | + public function attendee_contact_info($post) { |
|
2489 | 2489 | //get attendee object ( should already have it ) |
2490 | 2490 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2491 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2491 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2492 | 2492 | EEH_Template::display_template($template, $this->_template_args); |
2493 | 2493 | } |
2494 | 2494 | |
@@ -2504,12 +2504,12 @@ discard block |
||
2504 | 2504 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2505 | 2505 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2506 | 2506 | new EE_Question_Form_Input( |
2507 | - EE_Question::new_instance( array( |
|
2507 | + EE_Question::new_instance(array( |
|
2508 | 2508 | 'QST_ID' => 0, |
2509 | 2509 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2510 | 2510 | 'QST_system' => 'admin-state' |
2511 | 2511 | )), |
2512 | - EE_Answer::new_instance( array( |
|
2512 | + EE_Answer::new_instance(array( |
|
2513 | 2513 | 'ANS_ID' => 0, |
2514 | 2514 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2515 | 2515 | )), |
@@ -2522,12 +2522,12 @@ discard block |
||
2522 | 2522 | )); |
2523 | 2523 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2524 | 2524 | new EE_Question_Form_Input( |
2525 | - EE_Question::new_instance( array( |
|
2525 | + EE_Question::new_instance(array( |
|
2526 | 2526 | 'QST_ID' => 0, |
2527 | 2527 | 'QST_display_text' => __('Country', 'event_espresso'), |
2528 | 2528 | 'QST_system' => 'admin-country' |
2529 | 2529 | )), |
2530 | - EE_Answer::new_instance( array( |
|
2530 | + EE_Answer::new_instance(array( |
|
2531 | 2531 | 'ANS_ID' => 0, |
2532 | 2532 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2533 | 2533 | )), |
@@ -2538,8 +2538,8 @@ discard block |
||
2538 | 2538 | 'append_qstn_id' => FALSE |
2539 | 2539 | ) |
2540 | 2540 | )); |
2541 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2542 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2541 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2542 | + EEH_Template::display_template($template, $this->_template_args); |
|
2543 | 2543 | |
2544 | 2544 | } |
2545 | 2545 | |
@@ -2549,11 +2549,11 @@ discard block |
||
2549 | 2549 | * @access protected |
2550 | 2550 | * @return void |
2551 | 2551 | */ |
2552 | - public function attendee_registrations_meta_box( $post ) { |
|
2552 | + public function attendee_registrations_meta_box($post) { |
|
2553 | 2553 | |
2554 | 2554 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2555 | 2555 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2556 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2556 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2557 | 2557 | EEH_Template::display_template($template, $this->_template_args); |
2558 | 2558 | |
2559 | 2559 | } |
@@ -2567,8 +2567,8 @@ discard block |
||
2567 | 2567 | * @return string html for new form. |
2568 | 2568 | */ |
2569 | 2569 | public function after_title_form_fields($post) { |
2570 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2571 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2570 | + if ($post->post_type == 'espresso_attendees') { |
|
2571 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2572 | 2572 | $template_args['attendee'] = $this->_cpt_model_obj; |
2573 | 2573 | EEH_Template::display_template($template, $template_args); |
2574 | 2574 | } |
@@ -2585,21 +2585,21 @@ discard block |
||
2585 | 2585 | * @access protected |
2586 | 2586 | * @return void |
2587 | 2587 | */ |
2588 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2588 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2589 | 2589 | |
2590 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2590 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2591 | 2591 | |
2592 | 2592 | $ATT_MDL = EEM_Attendee::instance(); |
2593 | 2593 | |
2594 | 2594 | $success = 1; |
2595 | 2595 | //Checkboxes |
2596 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2596 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2597 | 2597 | // if array has more than one element than success message should be plural |
2598 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2598 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2599 | 2599 | // cycle thru checkboxes |
2600 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2601 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2602 | - if ( !$updated ) { |
|
2600 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2601 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2602 | + if ( ! $updated) { |
|
2603 | 2603 | $success = 0; |
2604 | 2604 | } |
2605 | 2605 | } |
@@ -2608,18 +2608,18 @@ discard block |
||
2608 | 2608 | // grab single id and delete |
2609 | 2609 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2610 | 2610 | //get attendee |
2611 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2611 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2612 | 2612 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2613 | 2613 | $updated = $att->save(); |
2614 | - if ( ! $updated ) { |
|
2614 | + if ( ! $updated) { |
|
2615 | 2615 | $success = 0; |
2616 | 2616 | } |
2617 | 2617 | |
2618 | 2618 | } |
2619 | 2619 | |
2620 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2621 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2622 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2620 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2621 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2622 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2623 | 2623 | |
2624 | 2624 | } |
2625 | 2625 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | class Support_Admin_Page extends EE_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | |
48 | 48 | protected function _ajax_hooks() { |
49 | - add_action('wp_ajax_espresso_batch_continue',array($this,'batch_continue')); |
|
50 | - add_action('wp_ajax_espresso_batch_cleanup',array($this,'batch_cleanup')); |
|
49 | + add_action('wp_ajax_espresso_batch_continue', array($this, 'batch_continue')); |
|
50 | + add_action('wp_ajax_espresso_batch_cleanup', array($this, 'batch_cleanup')); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | 'nav' => array( |
96 | 96 | 'label' => __('Shortcodes', 'event_espresso'), |
97 | 97 | 'order' => 30), |
98 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ), |
|
98 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')), |
|
99 | 99 | 'require_nonce' => FALSE |
100 | 100 | ), |
101 | 101 | 'contact_support' => array( |
102 | 102 | 'nav' => array( |
103 | 103 | 'label' => __('Support', 'event_espresso'), |
104 | 104 | 'order' => 40), |
105 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_support_boxes' ) ), |
|
105 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')), |
|
106 | 106 | 'require_nonce' => FALSE |
107 | 107 | ), |
108 | 108 | 'developers' => array( |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | protected function _installation() { |
133 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
134 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
133 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php'; |
|
134 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
135 | 135 | $this->display_admin_page_with_sidebar(); |
136 | 136 | } |
137 | 137 | |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | 'other_resources' => __('Other Resources', 'event_espresso') |
157 | 157 | ); |
158 | 158 | |
159 | - foreach ( $boxes as $box => $label ) { |
|
160 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
159 | + foreach ($boxes as $box => $label) { |
|
160 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
161 | 161 | $callback_args = array('template_path' => $template_path); |
162 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
162 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | 'shortcodes_event_listings' => __('Event Listings', 'event_espresso'), |
181 | 181 | 'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'), |
182 | 182 | 'shortcodes_category' => __('Event Categories', 'event_espresso'), |
183 | - 'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' ) |
|
183 | + 'shortcodes_attendee' => __('Event Attendees', 'event_espresso') |
|
184 | 184 | /*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/ |
185 | 185 | /*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/ |
186 | 186 | ); |
187 | 187 | |
188 | - foreach ( $boxes as $box => $label ) { |
|
189 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
188 | + foreach ($boxes as $box => $label) { |
|
189 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
190 | 190 | $callback_args = array('template_path' => $template_path); |
191 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
191 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -207,32 +207,32 @@ discard block |
||
207 | 207 | 'important_information' => __('Important Information', 'event_espresso') |
208 | 208 | ); |
209 | 209 | |
210 | - foreach ( $boxes as $box => $label ) { |
|
211 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
210 | + foreach ($boxes as $box => $label) { |
|
211 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
212 | 212 | $callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args); |
213 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
213 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | 217 | |
218 | 218 | protected function _developers() { |
219 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php'; |
|
220 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true ); |
|
219 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php'; |
|
220 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true); |
|
221 | 221 | $this->display_admin_page_with_sidebar(); |
222 | 222 | } |
223 | 223 | |
224 | 224 | public function load_scripts_styles_batch_create() { |
225 | - wp_register_script( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js', array( 'jquery' ) ); |
|
225 | + wp_register_script('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.js', array('jquery')); |
|
226 | 226 | |
227 | - wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' )); |
|
228 | - wp_enqueue_script( 'support_batch_runner', EE_SUPPORT_ASSETS_URL . 'support_batch_runner.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION,true); |
|
229 | - wp_enqueue_style( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css' ); |
|
227 | + wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar')); |
|
228 | + wp_enqueue_script('support_batch_runner', EE_SUPPORT_ASSETS_URL.'support_batch_runner.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true); |
|
229 | + wp_enqueue_style('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.css'); |
|
230 | 230 | } |
231 | 231 | public function load_scripts_styles_batch_file_create() { |
232 | - wp_register_script( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js', array( 'jquery' ) ); |
|
233 | - wp_enqueue_style( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION ); |
|
234 | - wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' )); |
|
235 | - wp_enqueue_script( 'support_batch_file_runner', EE_SUPPORT_ASSETS_URL . 'support_batch_file_runner.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION,true); |
|
232 | + wp_register_script('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.js', array('jquery')); |
|
233 | + wp_enqueue_style('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION); |
|
234 | + wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar')); |
|
235 | + wp_enqueue_script('support_batch_file_runner', EE_SUPPORT_ASSETS_URL.'support_batch_file_runner.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true); |
|
236 | 236 | } |
237 | 237 | /** |
238 | 238 | * Invokes the report-generating code |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | //creates a job based on the request variable |
242 | 242 | $request_data = array_diff_key( |
243 | 243 | $this->_req_data, |
244 | - array_flip( array( 'action', 'page' ) ) ); |
|
244 | + array_flip(array('action', 'page')) ); |
|
245 | 245 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
246 | - $job_response = $batch_runner->create_job( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport', $_REQUEST ); |
|
247 | - $success = wp_localize_script( 'support_batch_runner', 'ee_job_response', $job_response->to_array() ); |
|
248 | - echo EEH_Template::locate_template( EE_SUPPORT_ADMIN . 'templates' . DS . 'admin_batch_runner.template.html' ); |
|
246 | + $job_response = $batch_runner->create_job('EventEspressoBatchRequest\JobHandlers\RegistrationsReport', $_REQUEST); |
|
247 | + $success = wp_localize_script('support_batch_runner', 'ee_job_response', $job_response->to_array()); |
|
248 | + echo EEH_Template::locate_template(EE_SUPPORT_ADMIN.'templates'.DS.'admin_batch_runner.template.html'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -254,26 +254,26 @@ discard block |
||
254 | 254 | */ |
255 | 255 | protected function batch_file_create() { |
256 | 256 | //creates a job based on the request variable |
257 | - $job_handler_classname = str_replace( '\\\\', '\\', $this->_req_data[ 'job_handler' ] ); |
|
257 | + $job_handler_classname = str_replace('\\\\', '\\', $this->_req_data['job_handler']); |
|
258 | 258 | $request_data = array_diff_key( |
259 | 259 | $this->_req_data, |
260 | - array_flip( array( 'action', 'page' ) ) ); |
|
260 | + array_flip(array('action', 'page')) ); |
|
261 | 261 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
262 | 262 | //eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' |
263 | - $job_response = $batch_runner->create_job( $job_handler_classname, $request_data ); |
|
264 | - wp_localize_script( 'support_batch_file_runner', 'ee_job_response', $job_response->to_array() ); |
|
265 | - wp_localize_script( 'support_batch_file_runner', 'ee_job_i18n', |
|
263 | + $job_response = $batch_runner->create_job($job_handler_classname, $request_data); |
|
264 | + wp_localize_script('support_batch_file_runner', 'ee_job_response', $job_response->to_array()); |
|
265 | + wp_localize_script('support_batch_file_runner', 'ee_job_i18n', |
|
266 | 266 | array( |
267 | 267 | 'download_and_redirecting' => sprintf( |
268 | 268 | __('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'), |
269 | - '<a href="' . $this->_req_data['redirect_url' ] .'">', |
|
269 | + '<a href="'.$this->_req_data['redirect_url'].'">', |
|
270 | 270 | '</a>' ), |
271 | - 'redirect_url' => $this->_req_data['redirect_url' ], |
|
271 | + 'redirect_url' => $this->_req_data['redirect_url'], |
|
272 | 272 | )); |
273 | 273 | echo EEH_Template::locate_template( |
274 | - EE_SUPPORT_ADMIN . 'templates' . DS . 'admin_batch_file_runner.template.html', |
|
274 | + EE_SUPPORT_ADMIN.'templates'.DS.'admin_batch_file_runner.template.html', |
|
275 | 275 | array( |
276 | - 'filename' => EEH_File::get_filename_from_filepath( $job_response->job_parameters()->extra_datum( 'filepath' ) ) |
|
276 | + 'filename' => EEH_File::get_filename_from_filepath($job_response->job_parameters()->extra_datum('filepath')) |
|
277 | 277 | )); |
278 | 278 | } |
279 | 279 | |
@@ -281,10 +281,10 @@ discard block |
||
281 | 281 | * Receives ajax calls for continuing a job |
282 | 282 | */ |
283 | 283 | public function batch_continue() { |
284 | - $job_id = sanitize_text_field( $this->_req_data[ 'job_id' ] ); |
|
284 | + $job_id = sanitize_text_field($this->_req_data['job_id']); |
|
285 | 285 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
286 | - $responseobj = $batch_runner->continue_job( $job_id); |
|
287 | - $this->_template_args[ 'data' ] = $responseobj->to_array(); |
|
286 | + $responseobj = $batch_runner->continue_job($job_id); |
|
287 | + $this->_template_args['data'] = $responseobj->to_array(); |
|
288 | 288 | $this->_return_json(); |
289 | 289 | } |
290 | 290 | |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | * @return type |
294 | 294 | */ |
295 | 295 | public function batch_cleanup() { |
296 | - $job_id = sanitize_text_field( $this->_req_data[ 'job_id' ] ); |
|
296 | + $job_id = sanitize_text_field($this->_req_data['job_id']); |
|
297 | 297 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
298 | - $response_obj = $batch_runner->cleanup_job( $job_id ); |
|
299 | - $this->_template_args[ 'data' ] = $response_obj->to_array(); |
|
298 | + $response_obj = $batch_runner->cleanup_job($job_id); |
|
299 | + $this->_template_args['data'] = $response_obj->to_array(); |
|
300 | 300 | $this->_return_json(); |
301 | 301 | } |
302 | 302 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | public function __construct() { |
34 | 34 | //define some help/support page related constants |
35 | - define( 'EE_SUPPORT_PG_SLUG', 'espresso_support' ); |
|
36 | - define( 'EE_SUPPORT_ADMIN_URL', admin_url('admin.php?page=' . EE_SUPPORT_PG_SLUG )); |
|
37 | - define( 'EE_SUPPORT_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES . 'support/templates/'); |
|
38 | - define( 'EE_SUPPORT_ADMIN', EE_ADMIN_PAGES . 'support/' ); |
|
39 | - define( 'EE_SUPPORT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'support/assets/' ); |
|
35 | + define('EE_SUPPORT_PG_SLUG', 'espresso_support'); |
|
36 | + define('EE_SUPPORT_ADMIN_URL', admin_url('admin.php?page='.EE_SUPPORT_PG_SLUG)); |
|
37 | + define('EE_SUPPORT_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES.'support/templates/'); |
|
38 | + define('EE_SUPPORT_ADMIN', EE_ADMIN_PAGES.'support/'); |
|
39 | + define('EE_SUPPORT_ASSETS_URL', EE_ADMIN_PAGES_URL.'support/assets/'); |
|
40 | 40 | parent::__construct(); |
41 | 41 | } |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | protected function _set_menu_map() { |
48 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
48 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
49 | 49 | 'menu_group' => 'extras', |
50 | 50 | 'menu_order' => 30, |
51 | 51 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - public function __construct( $admin_page ) { |
|
19 | + public function __construct($admin_page) { |
|
20 | 20 | parent::__construct($admin_page); |
21 | 21 | $this->_status = $this->_admin_page->get_registration_status_array(); |
22 | 22 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | protected function _setup_data() { |
28 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE ); |
|
29 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees( $this->_per_page, TRUE, TRUE); |
|
28 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE); |
|
29 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function _set_properties() { |
36 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
36 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
37 | 37 | |
38 | 38 | $this->_wp_list_args = array( |
39 | 39 | 'singular' => __('registrant', 'event_espresso'), |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $columns = array(); |
46 | 46 | //$columns['_Reg_Status'] = ''; |
47 | - if ( !empty( $evt_id ) ) { |
|
47 | + if ( ! empty($evt_id)) { |
|
48 | 48 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
49 | 49 | $this->_has_checkbox_column = true; |
50 | 50 | } |
@@ -60,43 +60,43 @@ discard block |
||
60 | 60 | 'TXN_total' => __('Total', 'event_espresso') |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_columns = array_merge( $columns, $this->_columns); |
|
63 | + $this->_columns = array_merge($columns, $this->_columns); |
|
64 | 64 | |
65 | 65 | $this->_primary_column = '_REG_att_checked_in'; |
66 | 66 | |
67 | - if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id ) ) { |
|
67 | + if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) { |
|
68 | 68 | $this->_bottom_buttons = array( |
69 | 69 | 'report'=> array( |
70 | 70 | 'route' => 'registrations_report', |
71 | 71 | 'extra_request' => |
72 | 72 | array( |
73 | 73 | 'EVT_ID'=> $evt_id, |
74 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
74 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
75 | 75 | ) |
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->_sortable_columns = array( |
80 | 80 | //true means its already sorted |
81 | - 'ATT_name' => array( 'ATT_name' => TRUE ), |
|
82 | - 'Event' => array( 'Event.EVT.Name' => FALSE ) |
|
81 | + 'ATT_name' => array('ATT_name' => TRUE), |
|
82 | + 'Event' => array('Event.EVT.Name' => FALSE) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | $this->_hidden_columns = array(); |
86 | 86 | |
87 | 87 | $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
88 | - $this->_dtts_for_event = !empty($evt_id) ? $this->_evt->datetimes_ordered() : array(); |
|
88 | + $this->_dtts_for_event = ! empty($evt_id) ? $this->_evt->datetimes_ordered() : array(); |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | - protected function _get_row_class( $item ) { |
|
96 | - $class = parent::_get_row_class( $item ); |
|
95 | + protected function _get_row_class($item) { |
|
96 | + $class = parent::_get_row_class($item); |
|
97 | 97 | //add status class |
98 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
99 | - if ( $this->_has_checkbox_column ) { |
|
98 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
99 | + if ($this->_has_checkbox_column) { |
|
100 | 100 | $class .= ' has-checkbox-column'; |
101 | 101 | } |
102 | 102 | return $class; |
@@ -107,44 +107,44 @@ discard block |
||
107 | 107 | protected function _get_table_filters() { |
108 | 108 | $filters = $where = array(); |
109 | 109 | |
110 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
110 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
111 | 111 | |
112 | - if ( empty( $this->_dtts_for_event ) ) { |
|
112 | + if (empty($this->_dtts_for_event)) { |
|
113 | 113 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
114 | 114 | //note possible capability restrictions |
115 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) { |
|
116 | - $where['status**'] = array( '!=', 'private' ); |
|
115 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
116 | + $where['status**'] = array('!=', 'private'); |
|
117 | 117 | } |
118 | 118 | |
119 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
120 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
119 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
120 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
121 | 121 | } |
122 | 122 | |
123 | - $events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) ); |
|
124 | - $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
|
125 | - foreach ( $events as $evt ) { |
|
123 | + $events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'))); |
|
124 | + $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); |
|
125 | + foreach ($events as $evt) { |
|
126 | 126 | //any registrations for this event? |
127 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
127 | + if ( ! $evt->get_count_of_all_registrations()) |
|
128 | 128 | continue; |
129 | 129 | $evts[] = array( |
130 | 130 | 'id' => $evt->ID(), |
131 | - 'text' => $evt->get( 'EVT_name' ), |
|
131 | + 'text' => $evt->get('EVT_name'), |
|
132 | 132 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '' |
133 | 133 | ); |
134 | 134 | } |
135 | 135 | $event_filter = '<div class="ee-event-filter">'; |
136 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts ); |
|
137 | - $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>'; |
|
136 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts); |
|
137 | + $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>'; |
|
138 | 138 | $event_filter .= '</div>'; |
139 | 139 | $filters[] = $event_filter; |
140 | 140 | |
141 | 141 | } else { |
142 | 142 | //DTT datetimes filter |
143 | - $cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
143 | + $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
144 | 144 | $dtts = array(); |
145 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
146 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time(); |
|
147 | - $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string ); |
|
145 | + foreach ($this->_dtts_for_event as $dtt) { |
|
146 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time(); |
|
147 | + $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); |
|
148 | 148 | } |
149 | 149 | $filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); |
150 | 150 | } |
@@ -165,19 +165,19 @@ discard block |
||
165 | 165 | |
166 | 166 | |
167 | 167 | protected function _get_total_event_attendees() { |
168 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
169 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
168 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
169 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
170 | 170 | $query_params = array(); |
171 | - if ($EVT_ID){ |
|
172 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
171 | + if ($EVT_ID) { |
|
172 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
173 | 173 | } |
174 | 174 | //if DTT is included we do multiple datetimes. Otherwise we just do primary datetime |
175 | - if ( $DTT_ID ) { |
|
175 | + if ($DTT_ID) { |
|
176 | 176 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
177 | 177 | } |
178 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
178 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
179 | 179 | |
180 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
180 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
181 | 181 | |
182 | 182 | return EEM_Registration::instance()->count($query_params); |
183 | 183 | } |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | |
189 | 189 | |
190 | 190 | |
191 | - function column__Reg_Status( EE_Registration $item ) { |
|
192 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
191 | + function column__Reg_Status(EE_Registration $item) { |
|
192 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | |
199 | 199 | function column_cb($item) { |
200 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
200 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -210,18 +210,18 @@ discard block |
||
210 | 210 | /** |
211 | 211 | * column_REG_att_checked_in |
212 | 212 | */ |
213 | - function column__REG_att_checked_in(EE_Registration $item){ |
|
213 | + function column__REG_att_checked_in(EE_Registration $item) { |
|
214 | 214 | $attendee = $item->attendee(); |
215 | 215 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
216 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
216 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
217 | 217 | $checkinstatus = $item->check_in_status_for_datetime($DTT_ID); |
218 | 218 | $nonce = wp_create_nonce('checkin_nonce'); |
219 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
220 | - $toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : ''; |
|
219 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
220 | + $toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : ''; |
|
221 | 221 | |
222 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
222 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
223 | 223 | |
224 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content; |
|
224 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -230,43 +230,43 @@ discard block |
||
230 | 230 | |
231 | 231 | function column_ATT_name(EE_Registration $item) { |
232 | 232 | $attendee = $item->attendee(); |
233 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
233 | + if ( ! $attendee instanceof EE_Attendee) { |
|
234 | 234 | return __('No contact record for this registration.', 'event_espresso'); |
235 | 235 | } |
236 | 236 | |
237 | 237 | // edit attendee link |
238 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
239 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name(); |
|
238 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
239 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name(); |
|
240 | 240 | $name_link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' : ''; |
241 | 241 | |
242 | 242 | //add group details |
243 | - $name_link .= ' ' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size()); |
|
243 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
244 | 244 | |
245 | 245 | //add regcode |
246 | - $link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL ); |
|
246 | + $link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); |
|
247 | 247 | $name_link .= '<br>'; |
248 | - $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() ) |
|
249 | - ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>' |
|
248 | + $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID()) |
|
249 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>' |
|
250 | 250 | : $item->reg_code(); |
251 | 251 | |
252 | 252 | //status |
253 | - $name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
253 | + $name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
254 | 254 | |
255 | 255 | $actions = array(); |
256 | - $DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
257 | - $DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID; |
|
256 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
257 | + $DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID; |
|
258 | 258 | |
259 | - if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) { |
|
260 | - $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
261 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>'; |
|
259 | + if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) { |
|
260 | + $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
261 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
262 | 262 | } |
263 | 263 | |
264 | - return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link; |
|
264 | + return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
268 | 268 | |
269 | - function column_ATT_email( EE_Registration $item ) { |
|
269 | + function column_ATT_email(EE_Registration $item) { |
|
270 | 270 | $attendee = $item->attendee(); |
271 | 271 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
272 | 272 | return $item->get_first_related('Attendee')->email(); |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | |
279 | 279 | function column_Event(EE_Registration $item) { |
280 | 280 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
281 | - $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL ); |
|
282 | - $event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ? '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name(); |
|
281 | + $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL); |
|
282 | + $event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name(); |
|
283 | 283 | return $event_label; |
284 | 284 | } |
285 | 285 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | |
289 | 289 | |
290 | - function column_PRC_name(EE_Registration $item){ |
|
290 | + function column_PRC_name(EE_Registration $item) { |
|
291 | 291 | return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
292 | 292 | } |
293 | 293 | |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | /** |
300 | 300 | * column_REG_final_price |
301 | 301 | */ |
302 | - function column__REG_final_price(EE_Registration $item){ |
|
303 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
302 | + function column__REG_final_price(EE_Registration $item) { |
|
303 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -310,20 +310,20 @@ discard block |
||
310 | 310 | /** |
311 | 311 | * column_TXN_paid |
312 | 312 | */ |
313 | - function column_TXN_paid(EE_Registration $item){ |
|
313 | + function column_TXN_paid(EE_Registration $item) { |
|
314 | 314 | |
315 | - if ( $item->count() == 1 ) { |
|
315 | + if ($item->count() == 1) { |
|
316 | 316 | |
317 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
317 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
318 | 318 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
319 | 319 | } else { |
320 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
321 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
320 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
321 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
322 | 322 | <span class="reg-pad-rght"> |
323 | - <a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '"> |
|
324 | - ' . $item->transaction()->pretty_paid(). ' |
|
323 | + <a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"> |
|
324 | + ' . $item->transaction()->pretty_paid().' |
|
325 | 325 | </a> |
326 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
326 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
327 | 327 | } |
328 | 328 | } else { |
329 | 329 | return '<span class="reg-pad-rght"></span>'; |
@@ -337,13 +337,13 @@ discard block |
||
337 | 337 | /** |
338 | 338 | * column_TXN_total |
339 | 339 | */ |
340 | - function column_TXN_total(EE_Registration $item){ |
|
340 | + function column_TXN_total(EE_Registration $item) { |
|
341 | 341 | $txn = $item->transaction(); |
342 | - $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
343 | - if ( $item->get('REG_count') == 1 ) { |
|
342 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
343 | + if ($item->get('REG_count') == 1) { |
|
344 | 344 | $line_total_obj = $txn->total_line_item(); |
345 | 345 | $txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso'); |
346 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
346 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
347 | 347 | } else { |
348 | 348 | return '<span class="reg-pad-rght"></span>'; |
349 | 349 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'route' => 'contact_list_report', |
37 | 37 | 'extra_request' => |
38 | 38 | array( |
39 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
39 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
40 | 40 | ), |
41 | 41 | // 'contact_list_export'=> array( |
42 | 42 | // 'route' => 'contact_list_export' |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * CSV Import Export class |
|
4 | - * |
|
5 | - * For dealing with CSV files directly. For exports/reports, it would generally |
|
6 | - * be preferred to use EventEspressoBatchRequest\BatchRequestProcessor and |
|
7 | - * EEH_Export to create csv files on the server and then direct the user to download them |
|
8 | - * |
|
9 | - * @package Event Espresso |
|
10 | - * @subpackage includes/functions |
|
11 | - * @author Brent Christensen |
|
12 | - * |
|
13 | - * ------------------------------------------------------------------------ |
|
14 | - */ |
|
3 | + * CSV Import Export class |
|
4 | + * |
|
5 | + * For dealing with CSV files directly. For exports/reports, it would generally |
|
6 | + * be preferred to use EventEspressoBatchRequest\BatchRequestProcessor and |
|
7 | + * EEH_Export to create csv files on the server and then direct the user to download them |
|
8 | + * |
|
9 | + * @package Event Espresso |
|
10 | + * @subpackage includes/functions |
|
11 | + * @author Brent Christensen |
|
12 | + * |
|
13 | + * ------------------------------------------------------------------------ |
|
14 | + */ |
|
15 | 15 | class EE_CSV { |
16 | 16 | |
17 | 17 | // instance of the EE_CSV object |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | // header("Content-Type: application/download"); |
320 | 320 | header('Content-disposition: attachment; filename='.$filename); |
321 | 321 | header("Content-Type: text/csv; charset=utf-8"); |
322 | - do_action( 'AHEE__EE_CSV__begin_sending_csv__headers' ); |
|
322 | + do_action( 'AHEE__EE_CSV__begin_sending_csv__headers' ); |
|
323 | 323 | echo apply_filters('FHEE__EE_CSV__begin_sending_csv__start_writing', "\xEF\xBB\xBF" ); // makes excel open it as UTF-8. UTF-8 BOM, see http://stackoverflow.com/a/4440143/2773835 |
324 | 324 | $fh = fopen('php://output', 'w'); |
325 | 325 | return $fh; |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
3 | 3 | /** |
4 | 4 | * EE_Export class |
5 | 5 | * |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | * @access private |
40 | 40 | * @param array $request_data |
41 | 41 | */ |
42 | - private function __construct( $request_data = array() ) { |
|
42 | + private function __construct($request_data = array()) { |
|
43 | 43 | $this->_req_data = $request_data; |
44 | - $this->today = date("Y-m-d",time()); |
|
45 | - require_once( EE_CLASSES . 'EE_CSV.class.php' ); |
|
46 | - $this->EE_CSV= EE_CSV::instance(); |
|
44 | + $this->today = date("Y-m-d", time()); |
|
45 | + require_once(EE_CLASSES.'EE_CSV.class.php'); |
|
46 | + $this->EE_CSV = EE_CSV::instance(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @param array $request_data |
56 | 56 | * @return \EE_Export |
57 | 57 | */ |
58 | - public static function instance( $request_data = array() ) { |
|
58 | + public static function instance($request_data = array()) { |
|
59 | 59 | // check if class object is instantiated |
60 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Export )) { |
|
61 | - self::$_instance = new self( $request_data ); |
|
60 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Export)) { |
|
61 | + self::$_instance = new self($request_data); |
|
62 | 62 | } |
63 | 63 | return self::$_instance; |
64 | 64 | } |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | public function export() { |
73 | 73 | |
74 | 74 | // in case of bulk exports, the "actual" action will be in action2, but first check regular action for "export" keyword |
75 | - if ( isset( $this->_req_data['action'] ) && strpos( $this->_req_data['action'], 'export' ) === FALSE ) { |
|
75 | + if (isset($this->_req_data['action']) && strpos($this->_req_data['action'], 'export') === FALSE) { |
|
76 | 76 | // check if action2 has export action |
77 | - if ( isset( $this->_req_data['action2'] ) && strpos( $this->_req_data['action2'], 'export' ) !== FALSE ) { |
|
77 | + if (isset($this->_req_data['action2']) && strpos($this->_req_data['action2'], 'export') !== FALSE) { |
|
78 | 78 | // whoop! there it is! |
79 | 79 | $this->_req_data['action'] = $this->_req_data['action2']; |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - $this->_req_data['export'] = isset( $this->_req_data['export'] ) ? $this->_req_data['export'] : ''; |
|
83 | + $this->_req_data['export'] = isset($this->_req_data['export']) ? $this->_req_data['export'] : ''; |
|
84 | 84 | |
85 | 85 | switch ($this->_req_data['export']) { |
86 | 86 | case 'report': |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | break; |
95 | 95 | |
96 | 96 | case 'registrations_report_for_event': |
97 | - $this->report_registrations_for_event( $this->_req_data['EVT_ID'] ); |
|
97 | + $this->report_registrations_for_event($this->_req_data['EVT_ID']); |
|
98 | 98 | break; |
99 | 99 | |
100 | 100 | case 'attendees': |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | break; |
107 | 107 | |
108 | 108 | default: |
109 | - EE_Error::add_error(__('An error occurred! The requested export report could not be found.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ) ; |
|
109 | + EE_Error::add_error(__('An error occurred! The requested export report could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
110 | 110 | return FALSE; |
111 | 111 | break; |
112 | 112 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * Downloads a CSV file with all the columns, but no data. This should be used for importing |
125 | 125 | * @return null kills execution |
126 | 126 | */ |
127 | - function export_sample(){ |
|
127 | + function export_sample() { |
|
128 | 128 | $event = EEM_Event::instance()->get_one(); |
129 | 129 | $this->_req_data['EVT_ID'] = $event->ID(); |
130 | 130 | $this->export_all_event_data(); |
@@ -150,23 +150,23 @@ discard block |
||
150 | 150 | $state_country_query_params = array(); |
151 | 151 | $question_group_query_params = array(); |
152 | 152 | $question_query_params = array(); |
153 | - if ( isset( $this->_req_data['EVT_ID'] )) { |
|
153 | + if (isset($this->_req_data['EVT_ID'])) { |
|
154 | 154 | // do we have an array of IDs ? |
155 | 155 | |
156 | - if ( is_array( $this->_req_data['EVT_ID'] )) { |
|
157 | - $EVT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_ID'] ); |
|
158 | - $value_to_equal = array('IN',$EVT_IDs); |
|
156 | + if (is_array($this->_req_data['EVT_ID'])) { |
|
157 | + $EVT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_ID']); |
|
158 | + $value_to_equal = array('IN', $EVT_IDs); |
|
159 | 159 | $filename = 'events'; |
160 | 160 | } else { |
161 | 161 | // generate regular where = clause |
162 | - $EVT_ID = absint( $this->_req_data['EVT_ID'] ); |
|
162 | + $EVT_ID = absint($this->_req_data['EVT_ID']); |
|
163 | 163 | $value_to_equal = $EVT_ID; |
164 | 164 | $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($EVT_ID); |
165 | 165 | |
166 | - $filename = 'event-' . ( $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ) ); |
|
166 | + $filename = 'event-'.($event instanceof EE_Event ? $event->slug() : __('unknown', 'event_espresso')); |
|
167 | 167 | |
168 | 168 | } |
169 | - $event_query_params[0]['EVT_ID'] =$value_to_equal; |
|
169 | + $event_query_params[0]['EVT_ID'] = $value_to_equal; |
|
170 | 170 | $related_models_query_params[0]['Event.EVT_ID'] = $value_to_equal; |
171 | 171 | $related_through_reg_query_params[0]['Registration.EVT_ID'] = $value_to_equal; |
172 | 172 | $datetime_ticket_query_params[0]['Datetime.EVT_ID'] = $value_to_equal; |
@@ -210,37 +210,37 @@ discard block |
||
210 | 210 | |
211 | 211 | ); |
212 | 212 | |
213 | - $model_data = $this->_get_export_data_for_models( $models_to_export ); |
|
213 | + $model_data = $this->_get_export_data_for_models($models_to_export); |
|
214 | 214 | |
215 | - $filename = $this->generate_filename ( $filename ); |
|
215 | + $filename = $this->generate_filename($filename); |
|
216 | 216 | |
217 | - if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) { |
|
218 | - EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ ); |
|
217 | + if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) { |
|
218 | + EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - function report_attendees(){ |
|
223 | - $attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results( array( 'force_join' => array( 'State', 'Country' ) ) ); |
|
222 | + function report_attendees() { |
|
223 | + $attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results(array('force_join' => array('State', 'Country'))); |
|
224 | 224 | $csv_data = array(); |
225 | - foreach( $attendee_rows as $attendee_row ){ |
|
225 | + foreach ($attendee_rows as $attendee_row) { |
|
226 | 226 | $csv_row = array(); |
227 | - foreach( EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){ |
|
228 | - if( $field_name == 'STA_ID' ){ |
|
229 | - $state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' ); |
|
230 | - $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
|
231 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
232 | - $country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
|
233 | - $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
|
234 | - }else{ |
|
235 | - $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
|
227 | + foreach (EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) { |
|
228 | + if ($field_name == 'STA_ID') { |
|
229 | + $state_name_field = EEM_State::instance()->field_settings_for('STA_name'); |
|
230 | + $csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()]; |
|
231 | + }elseif ($field_name == 'CNT_ISO') { |
|
232 | + $country_name_field = EEM_Country::instance()->field_settings_for('CNT_name'); |
|
233 | + $csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()]; |
|
234 | + } else { |
|
235 | + $csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()]; |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | $csv_data[] = $csv_row; |
239 | 239 | } |
240 | 240 | |
241 | - $filename = $this->generate_filename ( 'contact-list-report' ); |
|
241 | + $filename = $this->generate_filename('contact-list-report'); |
|
242 | 242 | |
243 | - $handle = $this->EE_CSV->begin_sending_csv( $filename); |
|
243 | + $handle = $this->EE_CSV->begin_sending_csv($filename); |
|
244 | 244 | $this->EE_CSV->write_data_array_to_csv($handle, $csv_data); |
245 | 245 | $this->EE_CSV->end_sending_csv($handle); |
246 | 246 | } |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | $countries_that_have_an_attendee = EEM_Country::instance()->get_all(array(0=>array('Attendee.ATT_ID'=>array('IS NOT NULL')))); |
258 | 258 | // $states_to_export_query_params |
259 | 259 | $models_to_export = array( |
260 | - 'Country'=>array(array('CNT_ISO'=>array('IN',array_keys($countries_that_have_an_attendee)))), |
|
261 | - 'State'=>array(array('STA_ID'=>array('IN',array_keys($states_that_have_an_attendee)))), |
|
260 | + 'Country'=>array(array('CNT_ISO'=>array('IN', array_keys($countries_that_have_an_attendee)))), |
|
261 | + 'State'=>array(array('STA_ID'=>array('IN', array_keys($states_that_have_an_attendee)))), |
|
262 | 262 | 'Attendee'=>array(), |
263 | 263 | ); |
264 | 264 | |
265 | 265 | |
266 | 266 | |
267 | - $model_data = $this->_get_export_data_for_models( $models_to_export ); |
|
268 | - $filename = $this->generate_filename ( 'all-attendees' ); |
|
267 | + $model_data = $this->_get_export_data_for_models($models_to_export); |
|
268 | + $filename = $this->generate_filename('all-attendees'); |
|
269 | 269 | |
270 | - if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) { |
|
271 | - EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
270 | + if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) { |
|
271 | + EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -280,19 +280,19 @@ discard block |
||
280 | 280 | * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty |
281 | 281 | * @return string |
282 | 282 | */ |
283 | - protected function _prepare_value_from_db_for_display( $model, $field_name, $raw_db_value, $pretty_schema = true ) { |
|
284 | - $field_obj = $model->field_settings_for( $field_name ); |
|
285 | - $value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value ); |
|
286 | - if( $field_obj instanceof EE_Datetime_Field ) { |
|
287 | - $field_obj->set_date_format( EE_CSV::instance()->get_date_format_for_csv( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema ); |
|
288 | - $field_obj->set_time_format( EE_CSV::instance()->get_time_format_for_csv( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema ); |
|
283 | + protected function _prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true) { |
|
284 | + $field_obj = $model->field_settings_for($field_name); |
|
285 | + $value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value); |
|
286 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
287 | + $field_obj->set_date_format(EE_CSV::instance()->get_date_format_for_csv($field_obj->get_date_format($pretty_schema)), $pretty_schema); |
|
288 | + $field_obj->set_time_format(EE_CSV::instance()->get_time_format_for_csv($field_obj->get_time_format($pretty_schema)), $pretty_schema); |
|
289 | 289 | } |
290 | - if( $pretty_schema === true){ |
|
291 | - return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj ); |
|
292 | - }elseif( is_string( $pretty_schema ) ) { |
|
293 | - return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema ); |
|
294 | - }else{ |
|
295 | - return $field_obj->prepare_for_get( $value_on_model_obj ); |
|
290 | + if ($pretty_schema === true) { |
|
291 | + return $field_obj->prepare_for_pretty_echoing($value_on_model_obj); |
|
292 | + }elseif (is_string($pretty_schema)) { |
|
293 | + return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema); |
|
294 | + } else { |
|
295 | + return $field_obj->prepare_for_get($value_on_model_obj); |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * and the questions associated with the registrations |
302 | 302 | * @param int $event_id |
303 | 303 | */ |
304 | - function report_registrations_for_event( $event_id = NULL ){ |
|
304 | + function report_registrations_for_event($event_id = NULL) { |
|
305 | 305 | $reg_fields_to_include = array( |
306 | 306 | 'TXN_ID', |
307 | 307 | 'ATT_ID', |
@@ -333,125 +333,125 @@ discard block |
||
333 | 333 | array( |
334 | 334 | 'OR' => array( |
335 | 335 | //don't include registrations from failed or abandoned transactions... |
336 | - 'Transaction.STS_ID' => array( 'NOT IN', array( EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code ) ), |
|
336 | + 'Transaction.STS_ID' => array('NOT IN', array(EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code)), |
|
337 | 337 | //unless the registration is approved, in which case include it regardless of transaction status |
338 | 338 | 'STS_ID' => EEM_Registration::status_id_approved |
339 | 339 | ), |
340 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
340 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
341 | 341 | ), |
342 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
343 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ) |
|
342 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
343 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee') |
|
344 | 344 | ), |
345 | 345 | $event_id |
346 | 346 | ); |
347 | - if( $event_id ){ |
|
348 | - $query_params[0]['EVT_ID'] = $event_id; |
|
349 | - }else{ |
|
350 | - $query_params[ 'force_join' ][] = 'Event'; |
|
347 | + if ($event_id) { |
|
348 | + $query_params[0]['EVT_ID'] = $event_id; |
|
349 | + } else { |
|
350 | + $query_params['force_join'][] = 'Event'; |
|
351 | 351 | } |
352 | - $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
|
352 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
353 | 353 | //get all questions which relate to someone in this group |
354 | 354 | $registration_ids = array(); |
355 | - foreach( $registration_rows as $reg_row ) { |
|
356 | - $registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] ); |
|
355 | + foreach ($registration_rows as $reg_row) { |
|
356 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
357 | 357 | } |
358 | 358 | // EEM_Question::instance()->show_next_x_db_queries(); |
359 | - $questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN',$registration_ids)))); |
|
360 | - foreach($registration_rows as $reg_row){ |
|
361 | - if ( is_array( $reg_row ) ) { |
|
359 | + $questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN', $registration_ids)))); |
|
360 | + foreach ($registration_rows as $reg_row) { |
|
361 | + if (is_array($reg_row)) { |
|
362 | 362 | $reg_csv_array = array(); |
363 | - if( ! $event_id ){ |
|
363 | + if ( ! $event_id) { |
|
364 | 364 | //get the event's name and Id |
365 | - $reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), $this->_prepare_value_from_db_for_display( EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] ); |
|
365 | + $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), $this->_prepare_value_from_db_for_display(EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
366 | 366 | } |
367 | - $is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false; |
|
367 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
368 | 368 | /*@var $reg_row EE_Registration */ |
369 | - foreach($reg_fields_to_include as $field_name){ |
|
369 | + foreach ($reg_fields_to_include as $field_name) { |
|
370 | 370 | $field = $reg_model->field_settings_for($field_name); |
371 | - if($field_name == 'REG_final_price'){ |
|
372 | - $value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
|
373 | - }elseif( $field_name == 'REG_count' ){ |
|
374 | - $value = sprintf( __( '%s of %s', 'event_espresso' ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) ); |
|
375 | - }elseif( $field_name == 'REG_date' ) { |
|
376 | - $value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
|
377 | - }else{ |
|
378 | - $value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
|
371 | + if ($field_name == 'REG_final_price') { |
|
372 | + $value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
373 | + }elseif ($field_name == 'REG_count') { |
|
374 | + $value = sprintf(__('%s of %s', 'event_espresso'), $this->_prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), $this->_prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size'])); |
|
375 | + }elseif ($field_name == 'REG_date') { |
|
376 | + $value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html'); |
|
377 | + } else { |
|
378 | + $value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]); |
|
379 | 379 | } |
380 | 380 | $reg_csv_array[$this->_get_column_name_for_field($field)] = $value; |
381 | - if($field_name == 'REG_final_price'){ |
|
381 | + if ($field_name == 'REG_final_price') { |
|
382 | 382 | //add a column named Currency after the final price |
383 | 383 | $reg_csv_array[__("Currency", "event_espresso")] = EE_Config::instance()->currency->code; |
384 | 384 | } |
385 | 385 | } |
386 | 386 | //get pretty status |
387 | - $stati = EEM_Status::instance()->localized_status( array( |
|
388 | - $reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ), |
|
389 | - $reg_row[ 'Transaction.STS_ID' ] => __( 'unknown', 'event_espresso' ) ), |
|
387 | + $stati = EEM_Status::instance()->localized_status(array( |
|
388 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
389 | + $reg_row['Transaction.STS_ID'] => __('unknown', 'event_espresso') ), |
|
390 | 390 | FALSE, |
391 | - 'sentence' ); |
|
392 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ]; |
|
391 | + 'sentence'); |
|
392 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
393 | 393 | //get pretty trnasaction status |
394 | - $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'Transaction.STS_ID' ] ]; |
|
395 | - $reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'Transaction.TXN_total' ], 'localized_float' ) : '0.00'; |
|
396 | - $reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'Transaction.TXN_paid' ], 'localized_float' ) : '0.00'; |
|
394 | + $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['Transaction.STS_ID']]; |
|
395 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_total', $reg_row['Transaction.TXN_total'], 'localized_float') : '0.00'; |
|
396 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_paid', $reg_row['Transaction.TXN_paid'], 'localized_float') : '0.00'; |
|
397 | 397 | $payment_methods = array(); |
398 | 398 | $gateway_txn_ids_etc = array(); |
399 | 399 | $payment_times = array(); |
400 | - if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){ |
|
400 | + if ($is_primary_reg && $reg_row['Transaction.TXN_ID']) { |
|
401 | 401 | $payments_info = EEM_Payment::instance()->get_all_wpdb_results( |
402 | 402 | array( |
403 | 403 | array( |
404 | - 'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ], |
|
404 | + 'TXN_ID' => $reg_row['Transaction.TXN_ID'], |
|
405 | 405 | 'STS_ID' => EEM_Payment::status_id_approved |
406 | 406 | ), |
407 | - 'force_join' => array( 'Payment_Method' ), |
|
407 | + 'force_join' => array('Payment_Method'), |
|
408 | 408 | |
409 | 409 | ), |
410 | 410 | ARRAY_A, |
411 | 411 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
412 | 412 | |
413 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
414 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
415 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
416 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
413 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
414 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
415 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
416 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | } |
420 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
421 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
422 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
420 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
421 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
422 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
423 | 423 | |
424 | 424 | //get whether or not the user has checked in |
425 | - $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' ); |
|
425 | + $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
426 | 426 | //get ticket of registration and its price |
427 | 427 | $ticket_model = EE_Registry::instance()->load_model('Ticket'); |
428 | - if( $reg_row[ 'Ticket.TKT_ID'] ) { |
|
429 | - $ticket_name = $this->_prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] ); |
|
428 | + if ($reg_row['Ticket.TKT_ID']) { |
|
429 | + $ticket_name = $this->_prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']); |
|
430 | 430 | $datetimes_strings = array(); |
431 | - foreach( EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){ |
|
432 | - $datetimes_strings[] = $this->_prepare_value_from_db_for_display( EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] ); |
|
431 | + foreach (EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) { |
|
432 | + $datetimes_strings[] = $this->_prepare_value_from_db_for_display(EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | } else { |
436 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
437 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
436 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
437 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
438 | 438 | } |
439 | 439 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
440 | 440 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
441 | 441 | //get datetime(s) of registration |
442 | 442 | |
443 | 443 | //add attendee columns |
444 | - foreach($att_fields_to_include as $att_field_name){ |
|
444 | + foreach ($att_fields_to_include as $att_field_name) { |
|
445 | 445 | $field_obj = EEM_Attendee::instance()->field_settings_for($att_field_name); |
446 | - if( $reg_row[ 'Attendee_CPT.ID' ]){ |
|
447 | - if($att_field_name == 'STA_ID'){ |
|
448 | - $value = EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
|
449 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
450 | - $value = EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
|
451 | - }else{ |
|
452 | - $value = $this->_prepare_value_from_db_for_display( EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
|
446 | + if ($reg_row['Attendee_CPT.ID']) { |
|
447 | + if ($att_field_name == 'STA_ID') { |
|
448 | + $value = EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name'); |
|
449 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
450 | + $value = EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name'); |
|
451 | + } else { |
|
452 | + $value = $this->_prepare_value_from_db_for_display(EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
453 | 453 | } |
454 | - }else{ |
|
454 | + } else { |
|
455 | 455 | $value = ''; |
456 | 456 | } |
457 | 457 | |
@@ -459,56 +459,56 @@ discard block |
||
459 | 459 | } |
460 | 460 | |
461 | 461 | //make sure each registration has the same questions in the same order |
462 | - foreach($questions_for_these_regs_rows as $question_row){ |
|
463 | - if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){ |
|
464 | - $reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null; |
|
462 | + foreach ($questions_for_these_regs_rows as $question_row) { |
|
463 | + if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) { |
|
464 | + $reg_csv_array[$question_row['Question.QST_admin_label']] = null; |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | //now fill out the questions THEY answered |
468 | - foreach( EEM_Answer::instance()->get_all_wpdb_results( array( array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), 'force_join' => array( 'Question' ) ) ) as $answer_row){ |
|
468 | + foreach (EEM_Answer::instance()->get_all_wpdb_results(array(array('REG_ID' => $reg_row['Registration.REG_ID']), 'force_join' => array('Question'))) as $answer_row) { |
|
469 | 469 | /* @var $answer EE_Answer */ |
470 | - if( $answer_row[ 'Question.QST_ID' ] ){ |
|
471 | - $question_label = $this->_prepare_value_from_db_for_display( EEM_Question::instance(), 'QST_admin_label', $answer_row[ 'Question.QST_admin_label' ] ); |
|
472 | - }else{ |
|
473 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] ); |
|
470 | + if ($answer_row['Question.QST_ID']) { |
|
471 | + $question_label = $this->_prepare_value_from_db_for_display(EEM_Question::instance(), 'QST_admin_label', $answer_row['Question.QST_admin_label']); |
|
472 | + } else { |
|
473 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
474 | 474 | } |
475 | - if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) { |
|
476 | - $reg_csv_array[ $question_label ] = EEM_State::instance()->get_state_name_by_ID( $answer_row[ 'Answer.ANS_value' ] ); |
|
475 | + if (isset($answer_row['Question.QST_type']) && $answer_row['Question.QST_type'] == EEM_Question::QST_type_state) { |
|
476 | + $reg_csv_array[$question_label] = EEM_State::instance()->get_state_name_by_ID($answer_row['Answer.ANS_value']); |
|
477 | 477 | } else { |
478 | - $reg_csv_array[ $question_label ] = $this->_prepare_value_from_db_for_display( EEM_Answer::instance(), 'ANS_value', $answer_row[ 'Answer.ANS_value' ] ); |
|
478 | + $reg_csv_array[$question_label] = $this->_prepare_value_from_db_for_display(EEM_Answer::instance(), 'ANS_value', $answer_row['Answer.ANS_value']); |
|
479 | 479 | } |
480 | 480 | } |
481 | - $registrations_csv_ready_array[] = apply_filters( 'FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row ); |
|
481 | + $registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
485 | 485 | //if we couldn't export anything, we want to at least show the column headers |
486 | - if(empty($registrations_csv_ready_array)){ |
|
486 | + if (empty($registrations_csv_ready_array)) { |
|
487 | 487 | $reg_csv_array = array(); |
488 | 488 | $model_and_fields_to_include = array( |
489 | 489 | 'Registration' => $reg_fields_to_include, |
490 | 490 | 'Attendee' => $att_fields_to_include |
491 | 491 | ); |
492 | - foreach($model_and_fields_to_include as $model_name => $field_list){ |
|
492 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
493 | 493 | $model = EE_Registry::instance()->load_model($model_name); |
494 | - foreach($field_list as $field_name){ |
|
494 | + foreach ($field_list as $field_name) { |
|
495 | 495 | $field = $model->field_settings_for($field_name); |
496 | - $reg_csv_array[$this->_get_column_name_for_field($field)] = null;//$registration->get($field->get_name()); |
|
496 | + $reg_csv_array[$this->_get_column_name_for_field($field)] = null; //$registration->get($field->get_name()); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | $registrations_csv_ready_array [] = $reg_csv_array; |
500 | 500 | } |
501 | - if( $event_id ){ |
|
502 | - $event_slug = EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' ); |
|
503 | - if( ! $event_slug ) { |
|
504 | - $event_slug = __( 'unknown', 'event_espresso' ); |
|
501 | + if ($event_id) { |
|
502 | + $event_slug = EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug'); |
|
503 | + if ( ! $event_slug) { |
|
504 | + $event_slug = __('unknown', 'event_espresso'); |
|
505 | 505 | } |
506 | - }else{ |
|
507 | - $event_slug = __( 'all', 'event_espresso' ); |
|
506 | + } else { |
|
507 | + $event_slug = __('all', 'event_espresso'); |
|
508 | 508 | } |
509 | - $filename = sprintf( "registrations-for-%s", $event_slug ); |
|
509 | + $filename = sprintf("registrations-for-%s", $event_slug); |
|
510 | 510 | |
511 | - $handle = $this->EE_CSV->begin_sending_csv( $filename); |
|
511 | + $handle = $this->EE_CSV->begin_sending_csv($filename); |
|
512 | 512 | $this->EE_CSV->write_data_array_to_csv($handle, $registrations_csv_ready_array); |
513 | 513 | $this->EE_CSV->end_sending_csv($handle); |
514 | 514 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * @param EE_Model_Field_Base $field |
519 | 519 | * @return string |
520 | 520 | */ |
521 | - protected function _get_column_name_for_field(EE_Model_Field_Base $field){ |
|
521 | + protected function _get_column_name_for_field(EE_Model_Field_Base $field) { |
|
522 | 522 | return $field->get_nicename()."[".$field->get_name()."]"; |
523 | 523 | } |
524 | 524 | |
@@ -531,17 +531,17 @@ discard block |
||
531 | 531 | function export_categories() { |
532 | 532 | // are any Event IDs set? |
533 | 533 | $query_params = array(); |
534 | - if ( isset( $this->_req_data['EVT_CAT_ID'] )) { |
|
534 | + if (isset($this->_req_data['EVT_CAT_ID'])) { |
|
535 | 535 | // do we have an array of IDs ? |
536 | - if ( is_array( $this->_req_data['EVT_CAT_ID'] )) { |
|
536 | + if (is_array($this->_req_data['EVT_CAT_ID'])) { |
|
537 | 537 | // generate an "IN (CSV)" where clause |
538 | - $EVT_CAT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_CAT_ID'] ); |
|
538 | + $EVT_CAT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_CAT_ID']); |
|
539 | 539 | $filename = 'event-categories'; |
540 | - $query_params[0]['term_taxonomy_id'] = array('IN',$EVT_CAT_IDs); |
|
540 | + $query_params[0]['term_taxonomy_id'] = array('IN', $EVT_CAT_IDs); |
|
541 | 541 | } else { |
542 | 542 | // generate regular where = clause |
543 | - $EVT_CAT_ID = absint( $this->_req_data['EVT_CAT_ID'] ); |
|
544 | - $filename = 'event-category#' . $EVT_CAT_ID; |
|
543 | + $EVT_CAT_ID = absint($this->_req_data['EVT_CAT_ID']); |
|
544 | + $filename = 'event-category#'.$EVT_CAT_ID; |
|
545 | 545 | $query_params[0]['term_taxonomy_id'] = $EVT_CAT_ID; |
546 | 546 | } |
547 | 547 | } else { |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | 'Term_Taxonomy' => $query_params |
554 | 554 | ); |
555 | 555 | |
556 | - $table_data = $this->_get_export_data_for_models( $tables_to_export ); |
|
557 | - $filename = $this->generate_filename ( $filename ); |
|
556 | + $table_data = $this->_get_export_data_for_models($tables_to_export); |
|
557 | + $filename = $this->generate_filename($filename); |
|
558 | 558 | |
559 | - if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $table_data )) { |
|
560 | - EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
559 | + if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) { |
|
560 | + EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | * @param string - export_name |
569 | 569 | * @return string on success, FALSE on fail |
570 | 570 | */ |
571 | - private function generate_filename ( $export_name = '' ) { |
|
572 | - if ( $export_name != '' ) { |
|
573 | - $filename = get_bloginfo('name') . '-' . $export_name; |
|
574 | - $filename = sanitize_key( $filename ) . '-' . $this->today; |
|
571 | + private function generate_filename($export_name = '') { |
|
572 | + if ($export_name != '') { |
|
573 | + $filename = get_bloginfo('name').'-'.$export_name; |
|
574 | + $filename = sanitize_key($filename).'-'.$this->today; |
|
575 | 575 | return $filename; |
576 | - } else { |
|
577 | - EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ ); |
|
576 | + } else { |
|
577 | + EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
578 | 578 | } |
579 | 579 | return false; |
580 | 580 | } |
@@ -587,12 +587,12 @@ discard block |
||
587 | 587 | * @param array $models_to_export keys are model names (eg 'Event', 'Attendee', etc.) and values are arrays of query params like on EEM_Base::get_all |
588 | 588 | * @return array on success, FALSE on fail |
589 | 589 | */ |
590 | - private function _get_export_data_for_models( $models_to_export = array() ) { |
|
590 | + private function _get_export_data_for_models($models_to_export = array()) { |
|
591 | 591 | $table_data = FALSE; |
592 | - if ( is_array( $models_to_export ) ) { |
|
593 | - foreach ( $models_to_export as $model_name => $query_params ) { |
|
592 | + if (is_array($models_to_export)) { |
|
593 | + foreach ($models_to_export as $model_name => $query_params) { |
|
594 | 594 | //check for a numerically-indexed array. in that case, $model_name is the value!! |
595 | - if(is_int($model_name)){ |
|
595 | + if (is_int($model_name)) { |
|
596 | 596 | $model_name = $query_params; |
597 | 597 | $query_params = array(); |
598 | 598 | } |
@@ -600,17 +600,17 @@ discard block |
||
600 | 600 | $model_objects = $model->get_all($query_params); |
601 | 601 | |
602 | 602 | $table_data[$model_name] = array(); |
603 | - foreach($model_objects as $model_object){ |
|
603 | + foreach ($model_objects as $model_object) { |
|
604 | 604 | $model_data_array = array(); |
605 | 605 | $fields = $model->field_settings(); |
606 | - foreach($fields as $field){ |
|
606 | + foreach ($fields as $field) { |
|
607 | 607 | $column_name = $field->get_nicename()."[".$field->get_name()."]"; |
608 | - if($field instanceof EE_Datetime_Field){ |
|
608 | + if ($field instanceof EE_Datetime_Field) { |
|
609 | 609 | // $field->set_date_format('Y-m-d'); |
610 | 610 | // $field->set_time_format('H:i:s'); |
611 | - $model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s'); |
|
611 | + $model_data_array[$column_name] = $model_object->get_datetime($field->get_name(), 'Y-m-d', 'H:i:s'); |
|
612 | 612 | } |
613 | - else{ |
|
613 | + else { |
|
614 | 614 | $model_data_array[$column_name] = $model_object->get($field->get_name()); |
615 | 615 | } |
616 | 616 | } |